mirror of https://github.com/apache/activemq.git
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:
parent
7bdcca1bda
commit
100c5e0b59
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue