Repository: qpid-jms Updated Branches: refs/heads/master 199cc7351 -> 123990d4d
QPIDJMS-46: make tests more aggressive and fix up used discovery provider options Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/0a7e1480 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/0a7e1480 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/0a7e1480 Branch: refs/heads/master Commit: 0a7e1480c256bc74c132c139e281f35e1f0bf6b6 Parents: 199cc73 Author: Robert Gemmell <[email protected]> Authored: Tue May 12 12:50:29 2015 +0100 Committer: Robert Gemmell <[email protected]> Committed: Tue May 12 13:30:50 2015 +0100 ---------------------------------------------------------------------- .../jms/discovery/JmsAmqpDiscoveryTest.java | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/0a7e1480/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/discovery/JmsAmqpDiscoveryTest.java ---------------------------------------------------------------------- diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/discovery/JmsAmqpDiscoveryTest.java b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/discovery/JmsAmqpDiscoveryTest.java index f3a76cb..ce6e468 100644 --- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/discovery/JmsAmqpDiscoveryTest.java +++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/discovery/JmsAmqpDiscoveryTest.java @@ -28,6 +28,7 @@ import org.apache.qpid.jms.JmsConnection; import org.apache.qpid.jms.JmsConnectionFactory; import org.apache.qpid.jms.JmsConnectionListener; import org.apache.qpid.jms.message.JmsInboundMessageDispatch; +import org.apache.qpid.jms.provider.discovery.DiscoveryProviderFactory; import org.apache.qpid.jms.support.AmqpTestSupport; import org.apache.qpid.jms.support.Wait; import org.junit.Before; @@ -57,7 +58,7 @@ public class JmsAmqpDiscoveryTest extends AmqpTestSupport implements JmsConnecti restored = new CountDownLatch(1); } - @Test(timeout=60000) + @Test(timeout=30000) public void testRunningBrokerIsDiscovered() throws Exception { connection = createConnection(); connection.start(); @@ -71,7 +72,7 @@ public class JmsAmqpDiscoveryTest extends AmqpTestSupport implements JmsConnecti })); } - @Test(timeout=60000) + @Test(timeout=30000) public void testConnectionFailsWhenBrokerGoesDown() throws Exception { connection = createConnection(); connection.start(); @@ -87,10 +88,10 @@ public class JmsAmqpDiscoveryTest extends AmqpTestSupport implements JmsConnecti LOG.info("Connection established, stopping broker."); stopPrimaryBroker(); - assertTrue("Interrupted event never fired", interrupted.await(30, TimeUnit.SECONDS)); + assertTrue("Interrupted event never fired", interrupted.await(10, TimeUnit.SECONDS)); } - @Test(timeout=60000) + @Test(timeout=30000) public void testConnectionRestoresAfterBrokerRestarted() throws Exception { connection = createConnection(); connection.start(); @@ -104,12 +105,12 @@ public class JmsAmqpDiscoveryTest extends AmqpTestSupport implements JmsConnecti })); stopPrimaryBroker(); - assertTrue(interrupted.await(20, TimeUnit.SECONDS)); + assertTrue(interrupted.await(10, TimeUnit.SECONDS)); startPrimaryBroker(); - assertTrue(restored.await(20, TimeUnit.SECONDS)); + assertTrue(restored.await(10, TimeUnit.SECONDS)); } - @Test(timeout=60000) + @Test(timeout=30000) public void testDiscoversAndReconnectsToSecondaryBroker() throws Exception { connection = createConnection(); @@ -126,8 +127,8 @@ public class JmsAmqpDiscoveryTest extends AmqpTestSupport implements JmsConnecti startNewBroker(); stopPrimaryBroker(); - assertTrue(interrupted.await(20, TimeUnit.SECONDS)); - assertTrue(restored.await(20, TimeUnit.SECONDS)); + assertTrue(interrupted.await(10, TimeUnit.SECONDS)); + assertTrue(restored.await(10, TimeUnit.SECONDS)); } @Override @@ -136,8 +137,9 @@ public class JmsAmqpDiscoveryTest extends AmqpTestSupport implements JmsConnecti } protected Connection createConnection() throws Exception { + String discoveryPrefix = DiscoveryProviderFactory.DISCOVERY_OPTION_PREFIX; JmsConnectionFactory factory = new JmsConnectionFactory( - "discovery:(multicast://default)?maxReconnectDelay=500"); + "discovery:(multicast://default)?" + discoveryPrefix + "startupMaxReconnectAttempts=25" + "&" + discoveryPrefix +"maxReconnectDelay=500"); connection = factory.createConnection(); jmsConnection = (JmsConnection) connection; jmsConnection.addConnectionListener(this); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
