diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/SmokeTests.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/SmokeTests.java index bb5d10281..1ac30d931 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/SmokeTests.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/SmokeTests.java @@ -17,7 +17,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) -@MessageEndpoint public class SmokeTests { @Autowired @@ -26,18 +25,7 @@ public class SmokeTests { @Autowired private PollableChannel smokeout; - // This has to be static because Spring Integration registers the handler - // more than once (every time a test instance is created), but only one of - // them will get the message. - private volatile static int count = 0; - - @ServiceActivator(inputChannel = "smokein", outputChannel = "smokeout") - public String process(String message) { - count++; - String result = message + ": " + count; - return result; - } - + @Test public void testDummyWithSimpleAssert() throws Exception { assertTrue(true); @@ -50,7 +38,24 @@ public class SmokeTests { Message message = (Message) smokeout.receive(100); String result = message == null ? null : message.getPayload(); assertEquals("foo: 1", result); - assertEquals(1, count); + assertEquals(1, AnnotatedEndpoint.count); + } + + @MessageEndpoint + static class AnnotatedEndpoint { + + // This has to be static because Spring Integration registers the handler + // more than once (every time a test instance is created), but only one of + // them will get the message. + private volatile static int count = 0; + + @ServiceActivator(inputChannel = "smokein", outputChannel = "smokeout") + public String process(String message) { + count++; + String result = message + ": " + count; + return result; + } + } } diff --git a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/SmokeTests-context.xml b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/SmokeTests-context.xml index 292a06ab3..543ae485b 100644 --- a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/SmokeTests-context.xml +++ b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/SmokeTests-context.xml @@ -12,6 +12,7 @@ http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> +