diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/io/trygvis/test/DbUtil.java | 13 | ||||
-rw-r--r-- | src/test/java/io/trygvis/test/PlainJavaExample.java | 5 | ||||
-rwxr-xr-x | src/test/resources/logback.xml | 2 |
3 files changed, 18 insertions, 2 deletions
diff --git a/src/test/java/io/trygvis/test/DbUtil.java b/src/test/java/io/trygvis/test/DbUtil.java index a2c41d3..46459b0 100644 --- a/src/test/java/io/trygvis/test/DbUtil.java +++ b/src/test/java/io/trygvis/test/DbUtil.java @@ -6,7 +6,10 @@ import org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy; import javax.sql.DataSource; import java.io.PrintWriter; +import java.sql.Connection; +import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Statement; import static java.lang.System.getProperty; @@ -48,4 +51,14 @@ public class DbUtil { public static DataSource springifyDataSource(DataSource ds) { return new TransactionAwareDataSourceProxy(new LazyConnectionDataSourceProxy(ds)); } + + public static int getPid(Connection c) throws SQLException { + int pid; + try (Statement statement = c.createStatement()) { + ResultSet rs = statement.executeQuery("SELECT pg_backend_pid()"); + rs.next(); + pid = rs.getInt(1); + } + return pid; + } } diff --git a/src/test/java/io/trygvis/test/PlainJavaExample.java b/src/test/java/io/trygvis/test/PlainJavaExample.java index 488ee35..788d8a0 100644 --- a/src/test/java/io/trygvis/test/PlainJavaExample.java +++ b/src/test/java/io/trygvis/test/PlainJavaExample.java @@ -4,6 +4,7 @@ import io.trygvis.async.SqlEffect; import io.trygvis.async.SqlEffectExecutor; import io.trygvis.queue.JdbcQueueService; import io.trygvis.queue.Queue; +import io.trygvis.queue.QueueService; import io.trygvis.queue.QueueSystem; import io.trygvis.queue.Task; import io.trygvis.queue.TaskEffect; @@ -51,7 +52,9 @@ public class PlainJavaExample { final Queue input = queues[0]; final Queue output = queues[1]; - queueService.consumeAll(input, new TaskEffect() { + QueueService.TaskExecutionRequest req = new QueueService.TaskExecutionRequest(false); + + queueService.consumeAll(input, req, new TaskEffect() { public List<Task> apply(Task task) throws Exception { System.out.println("PlainJavaExample$Consumer.consumeAll: arguments = " + task.arguments); Long a = Long.valueOf(task.arguments.get(0)); diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml index a9e4a25..65b37a6 100755 --- a/src/test/resources/logback.xml +++ b/src/test/resources/logback.xml @@ -13,7 +13,7 @@ <logger name="org.hibernate" level="INFO"/> <logger name="org.hibernate.SQL" level="INFO"/> - <logger name="com.jolbox" level="INFO"/> + <logger name="com.jolbox" level="DEBUG"/> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> |