summaryrefslogtreecommitdiff
path: root/qpid/java/client/src/test
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2013-02-05 14:22:56 +0000
committerRobert Gemmell <robbie@apache.org>2013-02-05 14:22:56 +0000
commit28ad82a0cb1369ae5066e4056453967489e4bd11 (patch)
tree011170e897634c015472c057a4474f43cc1ec881 /qpid/java/client/src/test
parent1a9284bc90444277a4d95e53282df368775a9936 (diff)
downloadqpid-python-28ad82a0cb1369ae5066e4056453967489e4bd11.tar.gz
QPID-4312: reduce visibility and narrow argument type for new check methods, add some unit testing of config and cleanup IDT systest a little
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1442602 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/client/AMQConnectionUnitTest.java46
-rw-r--r--qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java31
2 files changed, 72 insertions, 5 deletions
diff --git a/qpid/java/client/src/test/java/org/apache/qpid/client/AMQConnectionUnitTest.java b/qpid/java/client/src/test/java/org/apache/qpid/client/AMQConnectionUnitTest.java
index 891cb9581c..d309251b44 100644
--- a/qpid/java/client/src/test/java/org/apache/qpid/client/AMQConnectionUnitTest.java
+++ b/qpid/java/client/src/test/java/org/apache/qpid/client/AMQConnectionUnitTest.java
@@ -20,18 +20,53 @@
*/
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()
{
AMQInvalidArgumentException expectedException = new AMQInvalidArgumentException("Test", null);
@@ -79,4 +114,5 @@ public class AMQConnectionUnitTest extends TestCase
MockAMQConnection connection = new MockAMQConnection(_url + "&use_legacy_stream_msg_format='false'");
assertFalse("Stream message encoding should be amqp/list",connection.isUseLegacyStreamMessageFormat());
}
+
}
diff --git a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
index ac6cad879b..8c193622e3 100644
--- a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
+++ b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
@@ -591,5 +591,36 @@ public class ConnectionURLTest extends TestCase
assertFalse("value should be false", Boolean.valueOf(connectionURL.getOption(ConnectionURL.OPTIONS_SSL)));
}
+
+ /**
+ * Verify that when the {@value ConnectionURL#OPTIONS_VERIFY_QUEUE_ON_SEND} option is not
+ * specified, asking for the option returns null, such that this can later be used to
+ * verify it wasn't specified.
+ */
+ public void testDefaultVerifyQueueOnSend() throws URLSyntaxException
+ {
+ String url = "amqp://guest:guest@/test?brokerlist='tcp://localhost:5672'&foo='bar'";
+ ConnectionURL connectionURL = new AMQConnectionURL(url);
+
+ assertNull("default ssl value should be null", connectionURL.getOption(ConnectionURL.OPTIONS_SSL));
+ }
+
+ /**
+ * Verify that when the {@value ConnectionURL#OPTIONS_VERIFY_QUEUE_ON_SEND} option is
+ * specified, asking for the option returns the value, such that this can later be used
+ * to verify what value it was specified as.
+ */
+ public void testOverridingVerifyQueueOnSend() throws URLSyntaxException
+ {
+ String url = "amqp://guest:guest@/test?brokerlist='tcp://localhost:5672'&verifyQueueOnSend='true'";
+ ConnectionURL connectionURL = new AMQConnectionURL(url);
+
+ assertTrue("value should be true", Boolean.valueOf(connectionURL.getOption(ConnectionURL.OPTIONS_VERIFY_QUEUE_ON_SEND)));
+
+ url = "amqp://guest:guest@/test?brokerlist='tcp://localhost:5672'&verifyQueueOnSend='false'";
+ connectionURL = new AMQConnectionURL(url);
+
+ assertFalse("value should be false", Boolean.valueOf(connectionURL.getOption(ConnectionURL.OPTIONS_VERIFY_QUEUE_ON_SEND)));
+ }
}