qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ai...@apache.org
Subject svn commit: r758749 - in /qpid/branches/0.5-release/qpid/java/broker/src: main/java/org/apache/qpid/server/configuration/ServerConfiguration.java test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
Date Thu, 26 Mar 2009 17:12:57 GMT
Author: aidan
Date: Thu Mar 26 17:12:19 2009
New Revision: 758749

URL: http://svn.apache.org/viewvc?rev=758749&view=rev
Log:
QPID-1776: fix interpolation of variables.

Modified:
    qpid/branches/0.5-release/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
    qpid/branches/0.5-release/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java

Modified: qpid/branches/0.5-release/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java?rev=758749&r1=758748&r2=758749&view=diff
==============================================================================
--- qpid/branches/0.5-release/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
(original)
+++ qpid/branches/0.5-release/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
Thu Mar 26 17:12:19 2009
@@ -130,10 +130,16 @@
                 for (int j = 0; j < hosts.size(); j++)
                 {
                     String name = (String) hosts.get(j);
-                    CompositeConfiguration mungedConf = new CompositeConfiguration();
-                    mungedConf.addConfiguration(conf.subset("virtualhosts.virtualhost."+name));
-                    mungedConf.addConfiguration(vhostConfiguration.subset("virtualhost."
+ name));
-                    VirtualHostConfiguration vhostConfig = new VirtualHostConfiguration(name,
mungedConf, this);
+                    // Add the keys of the virtual host to the main config then bail out
+                    
+                    Configuration myConf = vhostConfiguration.subset("virtualhost." + name);
+                    Iterator k = myConf.getKeys();
+                    while (k.hasNext())
+                    {
+                        String key = (String) k.next();
+                        conf.setProperty("virtualhosts.virtualhost."+name+"."+key, myConf.getProperty(key));
+                    }
+                    VirtualHostConfiguration vhostConfig = new VirtualHostConfiguration(name,
conf.subset("virtualhosts.virtualhost."+name), this);
                     _virtualHosts.put(vhostConfig.getName(), vhostConfig);
                 }
             }

Modified: qpid/branches/0.5-release/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java?rev=758749&r1=758748&r2=758749&view=diff
==============================================================================
--- qpid/branches/0.5-release/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
(original)
+++ qpid/branches/0.5-release/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
Thu Mar 26 17:12:19 2009
@@ -677,6 +677,24 @@
         assertEquals(true, config.getQpidNIO()); // From the second file, not
                                                  // present in the first
     }
+    
+    public void testVariableInterpolation() throws Exception
+    {
+        File mainFile = File.createTempFile(getClass().getName(), null);
+
+        mainFile.deleteOnExit();
+
+        FileWriter out = new FileWriter(mainFile);
+        out.write("<broker>\n");
+        out.write("\t<work>foo</work>\n");
+        out.write("\t<management><ssl><keyStorePath>${work}</keyStorePath></ssl></management>\n");
+        out.write("</broker>\n");
+        out.close();
+
+        ServerConfiguration config = new ServerConfiguration(mainFile.getAbsoluteFile());
+        assertEquals("Did not get correct interpolated value", 
+                "foo", config.getManagementKeyStorePath());
+    }
 
     public void testCombinedConfigurationFirewall() throws Exception
     {



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message