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