diff options
Diffstat (limited to 'src/test/java/io/trygvis/test/spring')
-rw-r--r-- | src/test/java/io/trygvis/test/spring/PlainSpringTest.java | 10 | ||||
-rwxr-xr-x | src/test/java/io/trygvis/test/spring/TestConfig.java | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/test/java/io/trygvis/test/spring/PlainSpringTest.java b/src/test/java/io/trygvis/test/spring/PlainSpringTest.java index 9a7a436..07e67fb 100644 --- a/src/test/java/io/trygvis/test/spring/PlainSpringTest.java +++ b/src/test/java/io/trygvis/test/spring/PlainSpringTest.java @@ -2,6 +2,7 @@ package io.trygvis.test.spring; import io.trygvis.async.AsyncService; import io.trygvis.queue.Queue; +import io.trygvis.queue.QueueService; import io.trygvis.spring.DefaultConfig; import org.junit.Test; import org.junit.runner.RunWith; @@ -15,6 +16,7 @@ import java.util.concurrent.atomic.AtomicReference; import static java.lang.System.getProperty; import static java.lang.System.setProperty; +import static java.util.Arrays.asList; import static org.fest.assertions.Assertions.assertThat; import static org.junit.Assert.assertNotNull; @@ -25,6 +27,9 @@ public class PlainSpringTest { @Autowired private AsyncService asyncService; + @Autowired + private QueueService queueService; + static { String username = getProperty("user.name"); setProperty("database.url", getProperty("jdbc.url", "jdbc:postgresql://localhost/" + username)); @@ -34,8 +39,9 @@ public class PlainSpringTest { @Test public void testBasic() throws SQLException, InterruptedException { + Queue test = queueService.getQueue("test", 10, true); final AtomicReference<List<String>> ref = new AtomicReference<>(); - Queue test = asyncService.registerQueue("test", 10, new AsyncService.AsyncCallable() { + asyncService.registerQueue(test, new AsyncService.AsyncCallable() { public void run(List<String> arguments) throws Exception { System.out.println("PlainSpringTest.run"); ref.set(arguments); @@ -47,7 +53,7 @@ public class PlainSpringTest { synchronized (ref) { System.out.println("Scheduling task"); - asyncService.schedule(test, "hello", "world"); + asyncService.schedule(test, asList("hello", "world")); System.out.println("Waiting"); ref.wait(1000); } diff --git a/src/test/java/io/trygvis/test/spring/TestConfig.java b/src/test/java/io/trygvis/test/spring/TestConfig.java index 7853cb5..a1d95c0 100755 --- a/src/test/java/io/trygvis/test/spring/TestConfig.java +++ b/src/test/java/io/trygvis/test/spring/TestConfig.java @@ -100,6 +100,7 @@ public class TestConfig { ds.setUsername(username); ds.setPassword(password); + ds.setDefaultAutoCommit(false); ds.setIdleConnectionTestPeriodInSeconds(60); ds.setIdleMaxAgeInSeconds(240); ds.setMaxConnectionsPerPartition(40); |