summaryrefslogtreecommitdiff
path: root/qpid/java/broker/src/test
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2012-09-02 19:26:05 +0000
committerRobert Gemmell <robbie@apache.org>2012-09-02 19:26:05 +0000
commitb6040139c614c33ca6e41a442465f7517c57f703 (patch)
tree070e6f58de0f98bc8ad213c858a07a997dbe015a /qpid/java/broker/src/test
parent698e26ae1e8414d8945ab91af62e92a615d127b1 (diff)
downloadqpid-python-b6040139c614c33ca6e41a442465f7517c57f703.tar.gz
QPID-4238: escape tags for queue and virtualhost names with dots in them when accessing the XML configuration, works around CommonsConfiguration behaviour with element names containing dots
Applied patch from Jakub Scholz git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1380037 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker/src/test')
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
index bd54c930dd..25e066de76 100644
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
+++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
@@ -319,4 +319,49 @@ public class VirtualHostConfigurationTest extends InternalBrokerBaseCase
ce.getMessage());
}
}
+
+ /*
+ * Tests that the queues with dots in the names are fully supported. The XML configuration
+ * had problems with handling the tags containing dots due to the design of the Apache Commons
+ * Configuration library. The dots need to be escaped when accessing the XML configuration.
+ */
+ public void testDotsInQueueName() throws Exception
+ {
+ // Set up vhosts and queue
+ getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + ".queues(-1).queue(-1).name", "dot.in.a.name");
+ // Add a single property which is inside the <dot.in.a.name> queue tag - the maximum delivery count
+ getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + ".queues.queue.dot..in..a..name.maximumDeliveryCount", 5);
+
+ // Start the broker now.
+ super.createBroker();
+
+ // Get vhosts
+ VirtualHost test = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHost(getName());
+
+ // Check, that the property stored within the <dot.in.a.name> tag has been properly loaded
+ assertEquals("queue with dots in its name has been properly loaded", 5, test.getConfiguration().getQueueConfiguration("dot.in.a.name").getMaxDeliveryCount());
+ }
+
+ /*
+ * Tests that the virtual hosts with dots in the names are fully supported. The XML
+ * configuration had problems with handling the tags containing dots due to the design
+ * of the Apache Commons Configuration library. The dots need to be escaped when
+ * accessing the XML configuration.
+ */
+ public void testDotsInVirtualHostName() throws Exception
+ {
+ // Set up vhosts
+ getConfigXml().addProperty("virtualhosts.virtualhost.name", "dot.in.a.name");
+ // Add a single property which is inside the <dot.in.a.name> virtual host tag - the message store
+ getConfigXml().addProperty("virtualhosts.virtualhost.dot..in..a..name.store.class", TestableMemoryMessageStore.class.getName());
+
+ // Start the broker now.
+ super.createBroker();
+
+ // Get vhosts
+ VirtualHost test = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHost("dot.in.a.name");
+
+ // Check, that the property stored within the <dot.in.a.name> tag has been properly loaded
+ assertEquals("virtual host with dots in the name has been properly loaded", TestableMemoryMessageStore.class.getName(), test.getMessageStore().getClass().getName());
+ }
}