Merge pull request #648 from olegz/INT-2280

This commit is contained in:
Gary Russell
2012-10-11 21:03:35 -04:00
2 changed files with 13 additions and 8 deletions

View File

@@ -32,7 +32,7 @@
<service-activator id="service-activator" input-channel="input" output-channel="output" xmlns="http://www.springframework.org/schema/integration"> <service-activator id="service-activator" input-channel="input" output-channel="output" xmlns="http://www.springframework.org/schema/integration">
<beans:bean class="org.springframework.integration.jdbc.JdbcMessageStoreChannelTests$Service" /> <beans:bean class="org.springframework.integration.jdbc.JdbcMessageStoreChannelTests$Service" />
<poller fixed-rate="200"> <poller fixed-rate="2000">
<transactional /> <transactional />
</poller> </poller>
</service-activator> </service-activator>

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2011 the original author or authors. * Copyright 2002-2012 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -92,10 +92,12 @@ public class JdbcMessageStoreChannelTests {
public static class Service { public static class Service {
private static boolean fail = false; private static boolean fail = false;
private static boolean alreadyFailed = false;
private static List<String> messages = new CopyOnWriteArrayList<String>(); private static List<String> messages = new CopyOnWriteArrayList<String>();
private static CountDownLatch latch = new CountDownLatch(0); private static CountDownLatch latch = new CountDownLatch(0);
public static void reset(int count) { public static void reset(int count) {
fail = false; fail = false;
alreadyFailed = false;
messages.clear(); messages.clear();
latch = new CountDownLatch(count); latch = new CountDownLatch(count);
} }
@@ -105,9 +107,12 @@ public class JdbcMessageStoreChannelTests {
} }
} }
public String echo(String input) { public String echo(String input) {
messages.add(input); if (!alreadyFailed) {
latch.countDown(); messages.add(input);
latch.countDown();
}
if (fail) { if (fail) {
alreadyFailed = true;
throw new RuntimeException("Planned failure"); throw new RuntimeException("Planned failure");
} }
return input; return input;