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/27 15:42:45 UTC
[4/6] qpid-jms git commit: add test for getting properties of the
connection factory
add test for getting properties of the connection factory
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/0af121b5
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/0af121b5
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/0af121b5
Branch: refs/heads/master
Commit: 0af121b52745660d79abf66e55874eec9b93e4ce
Parents: d1ce3ef
Author: Robert Gemmell <ro...@apache.org>
Authored: Tue Jan 27 11:46:43 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Tue Jan 27 14:42:04 2015 +0000
----------------------------------------------------------------------
.../qpid/jms/JmsConnectionFactoryTest.java | 32 ++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/0af121b5/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 9546ec9..dde6bba 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
@@ -33,14 +33,16 @@ import org.junit.Test;
public class JmsConnectionFactoryTest extends QpidJmsTestCase {
+ private static String CLIENT_ID_PROP = "clientID";
+ private static String QUEUE_PREFIX_PROP = "queuePrefix";
+
@Test
public void testSetProperties() throws Exception {
String clientID = getTestName();
String queuePrefix = "q:";
String jmsOptionPrefix = "jms.";
- String clientIDprop = "clientID";
String baseUri = "amqp://localhost:1234";
- String uri = baseUri + "?" + jmsOptionPrefix + clientIDprop + "=" + clientID;
+ String uri = baseUri + "?" + jmsOptionPrefix + CLIENT_ID_PROP + "=" + clientID;
// Create a connection factory object
JmsConnectionFactory cf = new JmsConnectionFactory();
@@ -67,6 +69,32 @@ public class JmsConnectionFactoryTest extends QpidJmsTestCase {
}
@Test
+ public void testGetProperties() throws Exception {
+ String clientID = getTestName();
+ String queuePrefix = "q:";
+ String jmsOptionPrefix = "jms.";
+ String clientIDprop = "clientID";
+ String baseUri = "amqp://localhost:1234";
+ String uri = baseUri + "?" + jmsOptionPrefix + clientIDprop + "=" + clientID;
+
+ JmsConnectionFactory cf = new JmsConnectionFactory();
+
+ // Set the URI property, itself containing a property option in its query
+ cf.setBrokerURI(uri);
+ // Set another property directly
+ cf.setQueuePrefix(queuePrefix);
+
+ // Get the properties
+ Map<String, String> props = cf.getProperties();
+
+ // Verify the clientID property option from the URI was applied.
+ assertTrue(CLIENT_ID_PROP + " property not found", props.containsKey(CLIENT_ID_PROP));
+ assertEquals("clientID uri property query option not applied as expected", clientID, props.get(CLIENT_ID_PROP));
+ assertTrue(QUEUE_PREFIX_PROP + " property not found", props.containsKey(QUEUE_PREFIX_PROP));
+ assertEquals("queue prefix property not applied as expected", queuePrefix, props.get(QUEUE_PREFIX_PROP));
+ }
+
+ @Test
public void testSerializeThenDeserialize() 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