From b6040139c614c33ca6e41a442465f7517c57f703 Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Sun, 2 Sep 2012 19:26:05 +0000 Subject: 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 --- .../VirtualHostConfigurationTest.java | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'qpid/java/broker/src/test') 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 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 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 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 tag has been properly loaded + assertEquals("virtual host with dots in the name has been properly loaded", TestableMemoryMessageStore.class.getName(), test.getMessageStore().getClass().getName()); + } } -- cgit v1.2.1