Improve JMS Test

Loop sleeping 100ms for up to 10s instead of a hard sleep of 1s.

Stop the gateway in a finally block.
This commit is contained in:
Gary Russell
2014-01-06 09:03:05 -05:00
parent b5bb4a6fc5
commit cca630e882

View File

@@ -140,8 +140,16 @@ public class JmsOutboundGatewayTests {
gateway.setBeanFactory(beanFactory);
gateway.afterPropertiesSet();
gateway.start();
Thread.sleep(1000);
assertTrue(count.get() > 4);
assertEquals(0, errors.size());
try {
int n = 0;
while (n++ < 100 && count.get() < 5) {
Thread.sleep(100);
}
assertTrue(count.get() > 4);
assertEquals(0, errors.size());
}
finally {
gateway.stop();
}
}
}