Added timeout in teardown because of intermittent test failures

This commit is contained in:
Kevin Earls 2014-01-03 10:37:48 +01:00
parent 7db0fe6a38
commit 96bdda716a
1 changed files with 4 additions and 9 deletions

View File

@ -52,7 +52,7 @@ public class MBeanOperationTimeoutTest {
protected int messageCount = 50000; protected int messageCount = 50000;
@Test @Test(expected = TimeoutException.class)
public void testLongOperationTimesOut() throws Exception { public void testLongOperationTimesOut() throws Exception {
sendMessages(messageCount); sendMessages(messageCount);
@ -68,13 +68,8 @@ public class MBeanOperationTimeoutTest {
long count = proxy.getQueueSize(); long count = proxy.getQueueSize();
assertEquals("Queue size", count, messageCount); assertEquals("Queue size", count, messageCount);
try { LOG.info("Attempting to move one message, TimeoutException expected");
LOG.info("Attempting to move one message."); proxy.moveMatchingMessagesTo(null, moveToDestinationName);
proxy.moveMatchingMessagesTo(null, moveToDestinationName);
fail("Queue purge should have timed out.");
} catch (TimeoutException e) {
LOG.info("Queue message move Timed out as expected.");
}
} }
private void sendMessages(int count) throws Exception { private void sendMessages(int count) throws Exception {
@ -106,7 +101,6 @@ public class MBeanOperationTimeoutTest {
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
broker = createBroker(); broker = createBroker();
broker.start(); broker.start();
broker.waitUntilStarted(); broker.waitUntilStarted();
@ -118,6 +112,7 @@ public class MBeanOperationTimeoutTest {
@After @After
public void tearDown() throws Exception { public void tearDown() throws Exception {
Thread.sleep(500);
if (broker != null) { if (broker != null) {
broker.stop(); broker.stop();
broker.waitUntilStopped(); broker.waitUntilStopped();