INT-1884 Fix Sporadically Failing Jdbc Test

This commit is contained in:
Gary Russell
2011-06-10 09:37:25 -04:00
parent 59f6cd99d7
commit c305d667a0

View File

@@ -100,7 +100,7 @@ public class JdbcMessageStoreChannelIntegrationTests {
});
}
@Test @Ignore
@Test
@Repeat(10)
public void testTransactionalSendAndReceive() throws Exception {
@@ -130,8 +130,7 @@ public class JdbcMessageStoreChannelIntegrationTests {
assertTrue("Could not send message", result);
// So no activation
assertEquals(0, Service.messages.size());
waitForMessage();
StopWatch stopWatch = new StopWatch();
try {
@@ -147,6 +146,18 @@ public class JdbcMessageStoreChannelIntegrationTests {
}
protected void waitForMessage() throws InterruptedException {
int n = 0;
while (Service.messages.size() == 0) {
if (n++ > 200) {
fail("Message not received by Service");
}
Thread.sleep(50);
}
assertEquals(1, Service.messages.size());
}
@Test
public void testSameTransactionSendAndReceive() throws Exception {