Repository: qpid-jms Updated Branches: refs/heads/master db615570d -> cfb65ee61
QPIDJMS-56: move test alongside the matching 'no-hint' test Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/cfb65ee6 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/cfb65ee6 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/cfb65ee6 Branch: refs/heads/master Commit: cfb65ee616ef4f4d3e0ce36c93c5d4dd8800940c Parents: db61557 Author: Robert Gemmell <[email protected]> Authored: Fri May 29 15:38:55 2015 +0100 Committer: Robert Gemmell <[email protected]> Committed: Fri May 29 15:38:55 2015 +0100 ---------------------------------------------------------------------- .../integration/ConnectionIntegrationTest.java | 24 ---------------- .../FailedConnectionsIntegrationTest.java | 29 +++++++++++++++++++- 2 files changed, 28 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/cfb65ee6/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java index 9e2e998..15f761e 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java @@ -150,30 +150,6 @@ public class ConnectionIntegrationTest extends QpidJmsTestCase { } } - @Test(timeout = 5000) - public void testConnectionThrowsInvalidClientIdExceptionWhenInvalidContainerHintPresent() throws Exception { - try (TestAmqpPeer testPeer = new TestAmqpPeer();) { - final String remoteURI = "amqp://localhost:" + testPeer.getServerPort(); - - Map<Symbol, Object> errorInfo = new HashMap<Symbol, Object>(); - errorInfo.put(AmqpSupport.INVALID_FIELD, AmqpSupport.CONTAINER_ID); - - testPeer.rejectConnect(AmqpError.INVALID_FIELD, "Client ID already in use", errorInfo); - - try { - ConnectionFactory factory = new JmsConnectionFactory(remoteURI); - Connection connection = factory.createConnection(); - connection.setClientID("in-use-client-id"); - - fail("Should have thrown InvalidClientIDException"); - } catch (InvalidClientIDException e) { - // Expected - } - - testPeer.waitForAllHandlersToComplete(1000); - } - } - @Test(timeout = 10000) public void testRemotelyEndConnectionWithRedirect() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/cfb65ee6/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/FailedConnectionsIntegrationTest.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/FailedConnectionsIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/FailedConnectionsIntegrationTest.java index bf91902..9e9ea80 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/FailedConnectionsIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/FailedConnectionsIntegrationTest.java @@ -29,10 +29,12 @@ import java.util.Map; import javax.jms.Connection; import javax.jms.ConnectionFactory; +import javax.jms.InvalidClientIDException; import javax.jms.JMSException; import org.apache.qpid.jms.JmsConnectionFactory; import org.apache.qpid.jms.provider.ProviderRedirectedException; +import org.apache.qpid.jms.provider.amqp.AmqpSupport; import org.apache.qpid.jms.test.QpidJmsTestCase; import org.apache.qpid.jms.test.testpeer.TestAmqpPeer; import org.apache.qpid.jms.test.testpeer.basictypes.AmqpError; @@ -47,13 +49,14 @@ import org.junit.Test; public class FailedConnectionsIntegrationTest extends QpidJmsTestCase { @Test(timeout = 5000) - public void testConnectWithInvalidClientId() throws Exception { + public void testConnectWithInvalidClientIdThrowsJMSEWhenInvalidContainerHintNotPresent() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { testPeer.rejectConnect(AmqpError.INVALID_FIELD, "Client ID already in use", null); try { establishAnonymousConnecton(testPeer, true); fail("Should have thrown JMSException"); } catch (JMSException jmsEx) { + // Expected } catch (Exception ex) { fail("Should have thrown JMSException: " + ex); } @@ -63,6 +66,30 @@ public class FailedConnectionsIntegrationTest extends QpidJmsTestCase { } @Test(timeout = 5000) + public void testConnectWithInvalidClientIdThrowsICIDEWhenInvalidContainerHintPresent() throws Exception { + try (TestAmqpPeer testPeer = new TestAmqpPeer();) { + final String remoteURI = "amqp://localhost:" + testPeer.getServerPort(); + + Map<Symbol, Object> errorInfo = new HashMap<Symbol, Object>(); + errorInfo.put(AmqpSupport.INVALID_FIELD, AmqpSupport.CONTAINER_ID); + + testPeer.rejectConnect(AmqpError.INVALID_FIELD, "Client ID already in use", errorInfo); + + try { + ConnectionFactory factory = new JmsConnectionFactory(remoteURI); + Connection connection = factory.createConnection(); + connection.setClientID("in-use-client-id"); + + fail("Should have thrown InvalidClientIDException"); + } catch (InvalidClientIDException e) { + // Expected + } + + testPeer.waitForAllHandlersToComplete(1000); + } + } + + @Test(timeout = 5000) public void testConnectSecurityViolation() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { testPeer.rejectConnect(AmqpError.UNAUTHORIZED_ACCESS, "Anonymous connections not allowed", null); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
