summaryrefslogtreecommitdiff
path: root/java/client/src/test/java/org/apache/qpid/client/AMQConnectionUnitTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/client/src/test/java/org/apache/qpid/client/AMQConnectionUnitTest.java')
-rw-r--r--java/client/src/test/java/org/apache/qpid/client/AMQConnectionUnitTest.java67
1 files changed, 60 insertions, 7 deletions
diff --git a/java/client/src/test/java/org/apache/qpid/client/AMQConnectionUnitTest.java b/java/client/src/test/java/org/apache/qpid/client/AMQConnectionUnitTest.java
index d186a440da..d309251b44 100644
--- a/java/client/src/test/java/org/apache/qpid/client/AMQConnectionUnitTest.java
+++ b/java/client/src/test/java/org/apache/qpid/client/AMQConnectionUnitTest.java
@@ -20,25 +20,60 @@
*/
package org.apache.qpid.client;
-import junit.framework.TestCase;
-
-import org.apache.qpid.AMQInvalidArgumentException;
+import java.util.concurrent.atomic.AtomicReference;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
-import java.util.concurrent.atomic.AtomicReference;
-public class AMQConnectionUnitTest extends TestCase
+import org.apache.qpid.AMQInvalidArgumentException;
+import org.apache.qpid.configuration.ClientProperties;
+import org.apache.qpid.jms.ConnectionURL;
+import org.apache.qpid.test.utils.QpidTestCase;
+
+public class AMQConnectionUnitTest extends QpidTestCase
{
+ String _url = "amqp://guest:guest@/test?brokerlist='tcp://localhost:5672'";
+
+ public void testVerifyQueueOnSendDefault() throws Exception
+ {
+ MockAMQConnection connection = new MockAMQConnection(_url);
+ assertFalse(connection.validateQueueOnSend());
+ }
+
+ public void testVerifyQueueOnSendViaSystemProperty() throws Exception
+ {
+ setTestSystemProperty(ClientProperties.VERIFY_QUEUE_ON_SEND, "true");
+ MockAMQConnection connection = new MockAMQConnection(_url);
+ assertTrue(connection.validateQueueOnSend());
+
+ setTestSystemProperty(ClientProperties.VERIFY_QUEUE_ON_SEND, "false");
+ connection = new MockAMQConnection(_url);
+ assertFalse(connection.validateQueueOnSend());
+ }
+
+ public void testVerifyQueueOnSendViaURL() throws Exception
+ {
+ MockAMQConnection connection = new MockAMQConnection(_url + "&" + ConnectionURL.OPTIONS_VERIFY_QUEUE_ON_SEND + "='true'");
+ assertTrue(connection.validateQueueOnSend());
+
+ connection = new MockAMQConnection(_url + "&" + ConnectionURL.OPTIONS_VERIFY_QUEUE_ON_SEND + "='false'");
+ assertFalse(connection.validateQueueOnSend());
+ }
+
+ public void testVerifyQueueOnSendViaURLoverridesSystemProperty() throws Exception
+ {
+ setTestSystemProperty(ClientProperties.VERIFY_QUEUE_ON_SEND, "false");
+ MockAMQConnection connection = new MockAMQConnection(_url + "&" + ConnectionURL.OPTIONS_VERIFY_QUEUE_ON_SEND + "='true'");
+ assertTrue(connection.validateQueueOnSend());
+ }
public void testExceptionReceived()
{
- String url = "amqp://guest:guest@/test?brokerlist='tcp://localhost:5672'";
AMQInvalidArgumentException expectedException = new AMQInvalidArgumentException("Test", null);
final AtomicReference<JMSException> receivedException = new AtomicReference<JMSException>();
try
{
- MockAMQConnection connection = new MockAMQConnection(url);
+ MockAMQConnection connection = new MockAMQConnection(_url);
connection.setExceptionListener(new ExceptionListener()
{
@@ -62,4 +97,22 @@ public class AMQConnectionUnitTest extends TestCase
assertEquals("JMSException linked exception is incorrect", expectedException, exception.getLinkedException());
}
+ /**
+ * This should expand to test all the defaults.
+ */
+ public void testDefaultStreamMessageEncoding() throws Exception
+ {
+ MockAMQConnection connection = new MockAMQConnection(_url);
+ assertTrue("Legacy Stream message encoding should be the default",connection.isUseLegacyStreamMessageFormat());
+ }
+
+ /**
+ * This should expand to test all the connection properties.
+ */
+ public void testStreamMessageEncodingProperty() throws Exception
+ {
+ MockAMQConnection connection = new MockAMQConnection(_url + "&use_legacy_stream_msg_format='false'");
+ assertFalse("Stream message encoding should be amqp/list",connection.isUseLegacyStreamMessageFormat());
+ }
+
}