You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2015/01/26 19:26:48 UTC
[1/3] qpid-jms git commit: add basic tests for connection factory
[de]serialization
Repository: qpid-jms
Updated Branches:
refs/heads/master ee509a04c -> df3073848
add basic tests for connection factory [de]serialization
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/846521dd
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/846521dd
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/846521dd
Branch: refs/heads/master
Commit: 846521dd9ea065874bd04da93f868d1b6e95a793
Parents: a2e47c9
Author: Robert Gemmell <ro...@apache.org>
Authored: Mon Jan 26 17:38:25 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Mon Jan 26 18:26:22 2015 +0000
----------------------------------------------------------------------
.../qpid/jms/JmsConnectionFactoryTest.java | 77 ++++++++++++++++++++
.../java/org/apache/qpid/jms/JmsQueueTest.java | 14 ++--
.../apache/qpid/jms/JmsTemporaryQueueTest.java | 14 ++--
.../apache/qpid/jms/JmsTemporaryTopicTest.java | 14 ++--
.../java/org/apache/qpid/jms/JmsTopicTest.java | 14 ++--
.../qpid/jms/SerializationTestSupport.java | 16 ++--
6 files changed, 112 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/846521dd/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java
new file mode 100644
index 0000000..38e0f42
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms;
+
+import static org.apache.qpid.jms.SerializationTestSupport.roundTripSerialize;
+import static org.apache.qpid.jms.SerializationTestSupport.serialize;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.fail;
+
+import java.util.Map;
+
+import org.junit.Test;
+
+public class JmsConnectionFactoryTest {
+
+ @Test
+ public void testSerializeThenDeserialize() throws Exception {
+ String uri = "amqp://localhost:1234";
+
+ JmsConnectionFactory cf = new JmsConnectionFactory(uri);
+ Map<String, String> props = cf.getProperties();
+
+ Object roundTripped = roundTripSerialize(cf);
+
+ assertNotNull("Null object returned", roundTripped);
+ assertEquals("Unexpected type", JmsConnectionFactory.class, roundTripped.getClass());
+ assertEquals("Unexpected uri", uri, ((JmsConnectionFactory)roundTripped).getBrokerURI());
+
+ Map<String, String> props2 = ((JmsConnectionFactory)roundTripped).getProperties();
+ assertEquals("Properties were not equal", props, props2);
+ }
+
+ @Test
+ public void testSerializeTwoConnectionFactories() throws Exception {
+ String uri = "amqp://localhost:1234";
+
+ JmsConnectionFactory cf1 = new JmsConnectionFactory(uri);
+ JmsConnectionFactory cf2 = new JmsConnectionFactory(uri);
+
+ byte[] bytes1 = serialize(cf1);
+ byte[] bytes2 = serialize(cf2);
+
+ assertArrayEquals(bytes1, bytes2);
+ }
+
+ @Test
+ public void testSerializeTwoDifferentConnectionFactories() throws Exception {
+ JmsConnectionFactory cf1 = new JmsConnectionFactory("amqp://localhost:1234");
+ JmsConnectionFactory cf2 = new JmsConnectionFactory("amqp://localhost:5678");
+
+ byte[] bytes1 = serialize(cf1);
+ byte[] bytes2 = serialize(cf2);
+
+ try {
+ assertArrayEquals(bytes1, bytes2);
+ fail("Expected arrays to differ");
+ } catch (AssertionError ae) {
+ // Expected, pass
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/846521dd/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsQueueTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsQueueTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsQueueTest.java
index 74d914d..cbfd2b0 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsQueueTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsQueueTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.qpid.jms;
-import static org.apache.qpid.jms.SerializationTestSupport.roundTripSerializeDestination;
-import static org.apache.qpid.jms.SerializationTestSupport.serializeDestination;
+import static org.apache.qpid.jms.SerializationTestSupport.roundTripSerialize;
+import static org.apache.qpid.jms.SerializationTestSupport.serialize;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -128,7 +128,7 @@ public class JmsQueueTest extends QpidJmsTestCase {
String name = "myQueue";
JmsQueue queue = new JmsQueue(name);
- Destination roundTripped = roundTripSerializeDestination(queue);
+ Object roundTripped = roundTripSerialize(queue);
assertNotNull("Null destination returned", roundTripped);
assertEquals("Unexpected type", JmsQueue.class, roundTripped.getClass());
@@ -145,8 +145,8 @@ public class JmsQueueTest extends QpidJmsTestCase {
assertEquals("Destinations were not equal", queue1, queue2);
- byte[] bytes1 = serializeDestination(queue1);
- byte[] bytes2 = serializeDestination(queue2);
+ byte[] bytes1 = serialize(queue1);
+ byte[] bytes2 = serialize(queue2);
assertArrayEquals("Serialized bytes were not equal", bytes1, bytes2);
}
@@ -158,8 +158,8 @@ public class JmsQueueTest extends QpidJmsTestCase {
assertNotEquals("Destinations were not expected to be equal", queue1, queue2);
- byte[] bytes1 = serializeDestination(queue1);
- byte[] bytes2 = serializeDestination(queue2);
+ byte[] bytes1 = serialize(queue1);
+ byte[] bytes2 = serialize(queue2);
try {
assertArrayEquals(bytes1, bytes2);
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/846521dd/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTemporaryQueueTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTemporaryQueueTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTemporaryQueueTest.java
index e81cc92..8bc7ac7 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTemporaryQueueTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTemporaryQueueTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.qpid.jms;
-import static org.apache.qpid.jms.SerializationTestSupport.roundTripSerializeDestination;
-import static org.apache.qpid.jms.SerializationTestSupport.serializeDestination;
+import static org.apache.qpid.jms.SerializationTestSupport.roundTripSerialize;
+import static org.apache.qpid.jms.SerializationTestSupport.serialize;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -136,7 +136,7 @@ public class JmsTemporaryQueueTest extends QpidJmsTestCase {
String name = "myQueue";
JmsTemporaryQueue queue = new JmsTemporaryQueue(name);
- Destination roundTripped = roundTripSerializeDestination(queue);
+ Object roundTripped = roundTripSerialize(queue);
assertNotNull("Null destination returned", roundTripped);
assertEquals("Unexpected type", JmsTemporaryQueue.class, roundTripped.getClass());
@@ -153,8 +153,8 @@ public class JmsTemporaryQueueTest extends QpidJmsTestCase {
assertEquals("Destinations were not equal", queue1, queue2);
- byte[] bytes1 = serializeDestination(queue1);
- byte[] bytes2 = serializeDestination(queue2);
+ byte[] bytes1 = serialize(queue1);
+ byte[] bytes2 = serialize(queue2);
assertArrayEquals("Serialized bytes were not equal", bytes1, bytes2);
}
@@ -166,8 +166,8 @@ public class JmsTemporaryQueueTest extends QpidJmsTestCase {
assertNotEquals("Destinations were not expected to be equal", queue1, queue2);
- byte[] bytes1 = serializeDestination(queue1);
- byte[] bytes2 = serializeDestination(queue2);
+ byte[] bytes1 = serialize(queue1);
+ byte[] bytes2 = serialize(queue2);
try {
assertArrayEquals(bytes1, bytes2);
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/846521dd/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTemporaryTopicTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTemporaryTopicTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTemporaryTopicTest.java
index 2df05ea..1d90c30 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTemporaryTopicTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTemporaryTopicTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.qpid.jms;
-import static org.apache.qpid.jms.SerializationTestSupport.roundTripSerializeDestination;
-import static org.apache.qpid.jms.SerializationTestSupport.serializeDestination;
+import static org.apache.qpid.jms.SerializationTestSupport.roundTripSerialize;
+import static org.apache.qpid.jms.SerializationTestSupport.serialize;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -136,7 +136,7 @@ public class JmsTemporaryTopicTest extends QpidJmsTestCase {
String name = "myTopic";
JmsTemporaryTopic topic = new JmsTemporaryTopic(name);
- Destination roundTripped = roundTripSerializeDestination(topic);
+ Object roundTripped = roundTripSerialize(topic);
assertNotNull("Null destination returned", roundTripped);
assertEquals("Unexpected type", JmsTemporaryTopic.class, roundTripped.getClass());
@@ -153,8 +153,8 @@ public class JmsTemporaryTopicTest extends QpidJmsTestCase {
assertEquals("Destinations were not equal", topic1, topic2);
- byte[] bytes1 = serializeDestination(topic1);
- byte[] bytes2 = serializeDestination(topic2);
+ byte[] bytes1 = serialize(topic1);
+ byte[] bytes2 = serialize(topic2);
assertArrayEquals("Serialized bytes were not equal", bytes1, bytes2);
}
@@ -166,8 +166,8 @@ public class JmsTemporaryTopicTest extends QpidJmsTestCase {
assertNotEquals("Destinations were not expected to be equal", topic1, topic2);
- byte[] bytes1 = serializeDestination(topic1);
- byte[] bytes2 = serializeDestination(topic2);
+ byte[] bytes1 = serialize(topic1);
+ byte[] bytes2 = serialize(topic2);
try {
assertArrayEquals(bytes1, bytes2);
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/846521dd/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTopicTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTopicTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTopicTest.java
index 184e740..666a182 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTopicTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTopicTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.qpid.jms;
-import static org.apache.qpid.jms.SerializationTestSupport.roundTripSerializeDestination;
-import static org.apache.qpid.jms.SerializationTestSupport.serializeDestination;
+import static org.apache.qpid.jms.SerializationTestSupport.roundTripSerialize;
+import static org.apache.qpid.jms.SerializationTestSupport.serialize;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -128,7 +128,7 @@ public class JmsTopicTest extends QpidJmsTestCase {
String name = "myTopic";
JmsTopic topic = new JmsTopic(name);
- Destination roundTripped = roundTripSerializeDestination(topic);
+ Object roundTripped = roundTripSerialize(topic);
assertNotNull("Null destination returned", roundTripped);
assertEquals("Unexpected type", JmsTopic.class, roundTripped.getClass());
@@ -145,8 +145,8 @@ public class JmsTopicTest extends QpidJmsTestCase {
assertEquals("Destinations were not equal", topic1, topic2);
- byte[] bytes1 = serializeDestination(topic1);
- byte[] bytes2 = serializeDestination(topic2);
+ byte[] bytes1 = serialize(topic1);
+ byte[] bytes2 = serialize(topic2);
assertArrayEquals("Serialized bytes were not equal", bytes1, bytes2);
}
@@ -158,8 +158,8 @@ public class JmsTopicTest extends QpidJmsTestCase {
assertNotEquals("Destinations were not expected to be equal", topic1, topic2);
- byte[] bytes1 = serializeDestination(topic1);
- byte[] bytes2 = serializeDestination(topic2);
+ byte[] bytes1 = serialize(topic1);
+ byte[] bytes2 = serialize(topic2);
try {
assertArrayEquals(bytes1, bytes2);
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/846521dd/qpid-jms-client/src/test/java/org/apache/qpid/jms/SerializationTestSupport.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/SerializationTestSupport.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/SerializationTestSupport.java
index a4cef4c..a91723b 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/SerializationTestSupport.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/SerializationTestSupport.java
@@ -22,27 +22,25 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import javax.jms.Destination;
-
public class SerializationTestSupport {
- public static Destination roundTripSerializeDestination(final JmsDestination dest) throws IOException, ClassNotFoundException {
- byte[] bytes = serializeDestination(dest);
- Object deserializedObject = deserializeDestination(bytes);
+ public static Object roundTripSerialize(final Object o) throws IOException, ClassNotFoundException {
+ byte[] bytes = serialize(o);
+ Object deserializedObject = deserialize(bytes);
- return (Destination) deserializedObject;
+ return deserializedObject;
}
- public static byte[] serializeDestination(final JmsDestination dest) throws IOException {
+ public static byte[] serialize(final Object o) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
- oos.writeObject(dest);
+ oos.writeObject(o);
oos.close();
byte[] bytes = bos.toByteArray();
return bytes;
}
- public static Object deserializeDestination(byte[] bytes) throws IOException, ClassNotFoundException {
+ public static Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException {
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bis);
Object deserializedObject = ois.readObject();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/3] qpid-jms git commit: remove unused property
Posted by ro...@apache.org.
remove unused property
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/a2e47c99
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/a2e47c99
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/a2e47c99
Branch: refs/heads/master
Commit: a2e47c99b10d41f7e8f6b72713a38bbe0c811749
Parents: ee509a0
Author: Robert Gemmell <ro...@apache.org>
Authored: Mon Jan 26 17:15:22 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Mon Jan 26 18:26:22 2015 +0000
----------------------------------------------------------------------
.../apache/qpid/jms/JmsConnectionFactory.java | 21 --------------------
1 file changed, 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a2e47c99/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java
index 38dcfcd..cf2efd1 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java
@@ -65,7 +65,6 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact
private long requestTimeout = JmsConnectionInfo.DEFAULT_REQUEST_TIMEOUT;
private long closeTimeout = JmsConnectionInfo.DEFAULT_CLOSE_TIMEOUT;
private long connectTimeout = JmsConnectionInfo.DEFAULT_CONNECT_TIMEOUT;
- private boolean watchRemoteDestinations = true;
private IdGenerator clientIdGenerator;
private String clientIDPrefix;
private IdGenerator connectionIdGenerator;
@@ -581,26 +580,6 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact
}
/**
- * Indicates if the Connection's created from this factory will watch for updates
- * from the remote peer informing of temporary destination creation and destruction.
- *
- * @return true if destination monitoring is enabled.
- */
- public boolean isWatchRemoteDestinations() {
- return watchRemoteDestinations;
- }
-
- /**
- * Enable or disable monitoring of remote temporary destination life-cycles.
- *
- * @param watchRemoteDestinations
- * true if connection instances should monitor remote destination life-cycles.
- */
- public void setWatchRemoteDestinations(boolean watchRemoteDestinations) {
- this.watchRemoteDestinations = watchRemoteDestinations;
- }
-
- /**
* Returns true if the client should always send messages using a synchronous
* send operation regardless of persistence mode, or inside a transaction.
*
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[3/3] qpid-jms git commit: remove Serializable from PrefetchPolicy
object as we extract its properties from the parent ConnectionFactory rather
than serialize it directly
Posted by ro...@apache.org.
remove Serializable from PrefetchPolicy object as we extract its properties from the parent ConnectionFactory rather than serialize it directly
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/df307384
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/df307384
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/df307384
Branch: refs/heads/master
Commit: df30738480895939aeb581a542e0a70f405b10b5
Parents: 846521d
Author: Robert Gemmell <ro...@apache.org>
Authored: Mon Jan 26 18:06:13 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Mon Jan 26 18:26:23 2015 +0000
----------------------------------------------------------------------
.../org/apache/qpid/jms/JmsPrefetchPolicy.java | 6 +----
.../qpid/jms/JmsConnectionFactoryTest.java | 25 ++++++++++++++++++++
2 files changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/df307384/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsPrefetchPolicy.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsPrefetchPolicy.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsPrefetchPolicy.java
index 1716821..5e2c355 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsPrefetchPolicy.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsPrefetchPolicy.java
@@ -16,17 +16,13 @@
*/
package org.apache.qpid.jms;
-import java.io.Serializable;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Defines the prefetch message policies for different types of consumers
*/
-public class JmsPrefetchPolicy extends Object implements Serializable {
-
- private static final long serialVersionUID = 5298685386681646744L;
+public class JmsPrefetchPolicy {
public static final int MAX_PREFETCH_SIZE = Short.MAX_VALUE;
public static final int DEFAULT_QUEUE_PREFETCH = 1000;
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/df307384/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java
index 38e0f42..b5ee632 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java
@@ -21,6 +21,7 @@ import static org.apache.qpid.jms.SerializationTestSupport.serialize;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Map;
@@ -47,6 +48,30 @@ public class JmsConnectionFactoryTest {
}
@Test
+ public void testSerializeThenDeserializeMaintainsPrefetchPolicy() throws Exception {
+ String topicPrefetchValue = "17";
+ String topicPrefetchKey = "prefetchPolicy.topicPrefetch";
+ String uri = "amqp://localhost:1234?jms." + topicPrefetchKey + "=" + topicPrefetchValue;
+
+ JmsConnectionFactory cf = new JmsConnectionFactory(uri);
+ Map<String, String> props = cf.getProperties();
+
+ assertTrue("Props dont contain expected prefetch policy change", props.containsKey(topicPrefetchKey));
+ assertEquals("Unexpected value", topicPrefetchValue, props.get(topicPrefetchKey));
+
+ Object roundTripped = roundTripSerialize(cf);
+
+ assertNotNull("Null object returned", roundTripped);
+ assertEquals("Unexpected type", JmsConnectionFactory.class, roundTripped.getClass());
+
+ Map<String, String> props2 = ((JmsConnectionFactory)roundTripped).getProperties();
+ assertTrue("Props dont contain expected prefetch policy change", props2.containsKey(topicPrefetchKey));
+ assertEquals("Unexpected value", topicPrefetchValue, props2.get(topicPrefetchKey));
+
+ assertEquals("Properties were not equal", props, props2);
+ }
+
+ @Test
public void testSerializeTwoConnectionFactories() throws Exception {
String uri = "amqp://localhost:1234";
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org