diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2012-09-28 17:28:00 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2012-09-28 17:28:00 +0000 |
| commit | 6b72b73914da12f5773735b300e85a9c2a1aaa20 (patch) | |
| tree | ea5cf4bb4b375fbd25e1f88d44ed17163435553f /java/client/src/test | |
| parent | 74b3e384c7d901ba13dce4c81f7032f262806f8d (diff) | |
| download | qpid-python-6b72b73914da12f5773735b300e85a9c2a1aaa20.tar.gz | |
QPID-3906 Fixed an error with the default. Added unit tests for testing
StreamMessage encoding defaults.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1391567 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src/test')
| -rw-r--r-- | java/client/src/test/java/org/apache/qpid/client/AMQConnectionUnitTest.java | 21 | ||||
| -rw-r--r-- | java/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java | 10 |
2 files changed, 29 insertions, 2 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..891cb9581c 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 @@ -30,15 +30,15 @@ import java.util.concurrent.atomic.AtomicReference; public class AMQConnectionUnitTest extends TestCase { + String _url = "amqp://guest:guest@/test?brokerlist='tcp://localhost:5672'"; 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 +62,21 @@ 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()); + } } diff --git a/java/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java b/java/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java index d0cd24adf6..59181c3a13 100644 --- a/java/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java +++ b/java/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java @@ -18,6 +18,7 @@ */ package org.apache.qpid.client; +import org.apache.qpid.client.message.AMQPEncodedListMessage; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.test.utils.QpidTestCase; import org.apache.qpid.transport.*; @@ -28,6 +29,8 @@ import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.MessageProducer; +import javax.jms.StreamMessage; + import java.util.ArrayList; import java.util.List; @@ -459,6 +462,13 @@ public class AMQSession_0_10Test extends QpidTestCase assertNotNull("ExchangeDeclare event was not sent", event); } + public void testCreateStreamMessage() throws Exception + { + AMQSession_0_10 session = createAMQSession_0_10(); + StreamMessage m = session.createStreamMessage(); + assertTrue("Legacy Stream message encoding should be the default" + m.getClass(),!(m instanceof AMQPEncodedListMessage)); + } + public void testGetQueueDepthWithSync() { // slow down a flush thread |
