Fix JMX MonitorTests

MessagingTemplate had no timeout and could hang the build.

OnlyOneTrigger could fire before the message is sent; increase
the poller receive timeout so the poller thread blocks until the message is sent.
This commit is contained in:
Gary Russell
2015-11-16 16:45:28 -05:00
parent dd8b5c2e72
commit 1fe50138f0
2 changed files with 4 additions and 2 deletions

View File

@@ -20,7 +20,7 @@
<bean id="testTrigger" class="org.springframework.integration.test.util.OnlyOnceTrigger"/>
<int:bridge input-channel="input" output-channel="next">
<int:poller trigger="testTrigger" />
<int:poller trigger="testTrigger" receive-timeout="10000" />
</int:bridge>
<int:service-activator input-channel="next">

View File

@@ -104,7 +104,9 @@ public class MonitorTests {
new DirectFieldAccessor(this.handler).setPropertyValue("handlerMetrics", handlerMetrics);
Integer active = new MessagingTemplate(this.input).convertSendAndReceive("foo", Integer.class);
MessagingTemplate messagingTemplate = new MessagingTemplate(this.input);
messagingTemplate.setReceiveTimeout(10000);
Integer active = messagingTemplate.convertSendAndReceive("foo", Integer.class);
assertEquals(1, active.intValue());
assertTrue(afterHandleLatch.await(10, TimeUnit.SECONDS));
assertEquals(0, this.handler.getActiveCount());