diff options
| author | Robert Greig <rgreig@apache.org> | 2006-12-09 18:11:46 +0000 |
|---|---|---|
| committer | Robert Greig <rgreig@apache.org> | 2006-12-09 18:11:46 +0000 |
| commit | 7be98d6d3dd5e08c47c2d41c0e9cfddf4b75638c (patch) | |
| tree | c7d544baa50c38545215735e23510f4c3e835d4e /qpid/java/client/src/test | |
| parent | d1410d2a5448c07724018d610f170dbdcda39f56 (diff) | |
| download | qpid-python-7be98d6d3dd5e08c47c2d41c0e9cfddf4b75638c.tar.gz | |
QPID-163 - attempting to change the client id results in an exception being thrown.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@485020 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/src/test')
| -rw-r--r-- | qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java index d7862d047f..0da4147351 100644 --- a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java +++ b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java @@ -22,12 +22,10 @@ package org.apache.qpid.test.unit.client.connection; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQAuthenticationException; -import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException; import org.apache.qpid.client.transport.TransportConnection; import org.apache.qpid.AMQException; import org.apache.qpid.AMQConnectionException; import org.apache.qpid.AMQUnresolvedAddressException; -import org.apache.qpid.test.VMBrokerSetup; import javax.jms.Connection; @@ -40,6 +38,18 @@ public class ConnectionTest extends TestCase String _broker_NotRunning = "vm://:2"; String _broker_BadDNS = "tcp://hg3sgaaw4lgihjs"; + + protected void setUp() throws Exception + { + super.setUp(); + TransportConnection.createVMBroker(1); + } + + protected void tearDown() throws Exception + { + TransportConnection.killAllVMBrokers(); + } + public void testSimpleConnection() { try @@ -102,8 +112,30 @@ public class ConnectionTest extends TestCase } } + public void testClientIdCannotBeChanged() throws Exception + { + Connection connection = new AMQConnection(_broker, "guest", "guest", + "fred", "/test"); + try + { + connection.setClientID("someClientId"); + fail("No IllegalStateException thrown when resetting clientid"); + } + catch (javax.jms.IllegalStateException e) + { + // PASS + } + } + + public void testClientIdIsPopulatedAutomatically() throws Exception + { + Connection connection = new AMQConnection(_broker, "guest", "guest", + null, "/test"); + assertNotNull(connection.getClientID()); + } + public static junit.framework.Test suite() { - return new VMBrokerSetup(new junit.framework.TestSuite(ConnectionTest.class)); + return new junit.framework.TestSuite(ConnectionTest.class); } } |
