Add waitFor to check that once the async processing kicks in the pool

clears the bad connection and a new one is returned from the pool.
This commit is contained in:
Timothy Bish 2016-05-09 15:15:30 -04:00
parent 7bdcca1bda
commit 100c5e0b59
1 changed files with 11 additions and 2 deletions

View File

@ -106,8 +106,8 @@ public class PooledConnectionSecurityExceptionTest {
}
@Test
public void testFailureGetsNewConnectionOnRetry() throws JMSException {
Connection connection1 = pooledConnFact.createConnection("invalid", "credentials");
public void testFailureGetsNewConnectionOnRetry() throws Exception {
final Connection connection1 = pooledConnFact.createConnection("invalid", "credentials");
try {
connection1.start();
@ -116,6 +116,15 @@ public class PooledConnectionSecurityExceptionTest {
LOG.info("Caught expected security error");
}
// The pool should process the async error
assertTrue("Should get new connection", Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
return connection1 != pooledConnFact.createConnection("invalid", "credentials");
}
}));
Connection connection2 = pooledConnFact.createConnection("invalid", "credentials");
try {
connection2.start();