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 2010/03/30 15:46:49 UTC

svn commit: r929138 [2/2] - in /qpid/branches/0.5.x-dev/qpid/java: broker/etc/ broker/src/main/java/org/apache/qpid/server/configuration/ broker/src/test/java/org/apache/qpid/server/configuration/ systests/etc/ systests/src/main/java/org/apache/qpid/se...

Copied: qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-derby.xml (from r928703, qpid/branches/0.5.x-dev/qpid/java/systests/etc/config-systests.xml)
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-derby.xml?p2=qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-derby.xml&p1=qpid/branches/0.5.x-dev/qpid/java/systests/etc/config-systests.xml&r1=928703&r2=929138&rev=929138&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/systests/etc/config-systests.xml (original)
+++ qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-derby.xml Tue Mar 30 13:46:48 2010
@@ -22,8 +22,8 @@
 <configuration>
     <system/>
     <override>
-        <xml fileName="${test.config}" config-optional="true"/>
-        <xml fileName="${QPID_HOME}/etc/config-systests-settings.xml"/>
-        <xml fileName="${QPID_HOME}/etc/config.xml"/>                
+        <xml fileName="${test.virtualhosts}" optional="true"/>
+        <xml fileName="${QPID_HOME}/etc/virtualhosts-systests-derby-settings.xml"/>
+        <xml fileName="${QPID_HOME}/etc/virtualhosts.xml"/>
     </override>
 </configuration>

Copied: qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-firewall-2.xml (from r928703, qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-ServerConfigurationTest-New.xml)
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-firewall-2.xml?p2=qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-firewall-2.xml&p1=qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-ServerConfigurationTest-New.xml&r1=928703&r2=929138&rev=929138&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-ServerConfigurationTest-New.xml (original)
+++ qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-firewall-2.xml Tue Mar 30 13:46:48 2010
@@ -8,9 +8,9 @@
  - 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
@@ -20,21 +20,28 @@
  -
  -->
 <virtualhosts>
-    <default>dev-only</default>
+    <default>test</default>
+
     <virtualhost>
-        <name>dev-only</name>
-        <dev-only>            
-            <queues>
-                <exchange>amq.direct</exchange>
-		<!-- Small defaults for development -->
-                <maximumQueueDepth>102400</maximumQueueDepth>  <!-- 100k -->
-                <maximumMessageSize>20480</maximumMessageSize> <!-- 20kb -->
-                <maximumMessageAge>60000</maximumMessageAge>  <!-- 1 mins -->
+        <name>test</name>
+        <test>
+            <store>
+                <class>org.apache.qpid.server.store.MemoryMessageStore
+                </class>
+            </store>
+            <security>
+                <firewall default-action="allow"/>
+            </security>
+        </test>
+    </virtualhost>
 
-                <queue>
-                    <name>dev-queue</name>
-                </queue>
-            </queues>
-        </dev-only>
+    <virtualhost>
+        <name>test2</name>
+        <test2>
+            <store>
+                <class>org.apache.qpid.server.store.MemoryMessageStore
+                </class>
+            </store>
+        </test2>
     </virtualhost>
-</virtualhosts>
+</virtualhosts>
\ No newline at end of file

Copied: qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-firewall-3.xml (from r928703, qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-ServerConfigurationTest-New.xml)
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-firewall-3.xml?p2=qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-firewall-3.xml&p1=qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-ServerConfigurationTest-New.xml&r1=928703&r2=929138&rev=929138&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-ServerConfigurationTest-New.xml (original)
+++ qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-firewall-3.xml Tue Mar 30 13:46:48 2010
@@ -8,9 +8,9 @@
  - 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
@@ -20,21 +20,30 @@
  -
  -->
 <virtualhosts>
-    <default>dev-only</default>
+    <default>test</default>
+
     <virtualhost>
-        <name>dev-only</name>
-        <dev-only>            
-            <queues>
-                <exchange>amq.direct</exchange>
-		<!-- Small defaults for development -->
-                <maximumQueueDepth>102400</maximumQueueDepth>  <!-- 100k -->
-                <maximumMessageSize>20480</maximumMessageSize> <!-- 20kb -->
-                <maximumMessageAge>60000</maximumMessageAge>  <!-- 1 mins -->
+        <name>test</name>
+        <test>
+            <store>
+                <class>org.apache.qpid.server.store.MemoryMessageStore
+                </class>
+            </store>
+        </test>
+    </virtualhost>
 
-                <queue>
-                    <name>dev-queue</name>
-                </queue>
-            </queues>
-        </dev-only>
+    <virtualhost>
+        <name>test2</name>
+        <test2>
+            <store>
+                <class>org.apache.qpid.server.store.MemoryMessageStore
+                </class>
+            </store>
+            <security>
+         <firewall default-action="deny"/>
+     </security>
+        </test2>
     </virtualhost>
 </virtualhosts>
+
+

Copied: qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-firewall.xml (from r928703, qpid/branches/0.5.x-dev/qpid/java/systests/etc/config-systests.xml)
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-firewall.xml?p2=qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-firewall.xml&p1=qpid/branches/0.5.x-dev/qpid/java/systests/etc/config-systests.xml&r1=928703&r2=929138&rev=929138&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/systests/etc/config-systests.xml (original)
+++ qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests-firewall.xml Tue Mar 30 13:46:48 2010
@@ -22,8 +22,8 @@
 <configuration>
     <system/>
     <override>
-        <xml fileName="${test.config}" config-optional="true"/>
-        <xml fileName="${QPID_HOME}/etc/config-systests-settings.xml"/>
-        <xml fileName="${QPID_HOME}/etc/config.xml"/>                
+        <xml fileName="${test.virtualhosts}" optional="true"/>
+        <xml fileName="${QPID_FIREWALL_VIRTUALHOSTS_SETTINGS}" optional="true"/>
+        <xml fileName="${QPID_HOME}/etc/virtualhosts.xml"/>                
     </override>
 </configuration>

Copied: qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests.xml (from r928703, qpid/branches/0.5.x-dev/qpid/java/systests/etc/config-systests.xml)
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests.xml?p2=qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests.xml&p1=qpid/branches/0.5.x-dev/qpid/java/systests/etc/config-systests.xml&r1=928703&r2=929138&rev=929138&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/systests/etc/config-systests.xml (original)
+++ qpid/branches/0.5.x-dev/qpid/java/systests/etc/virtualhosts-systests.xml Tue Mar 30 13:46:48 2010
@@ -22,8 +22,7 @@
 <configuration>
     <system/>
     <override>
-        <xml fileName="${test.config}" config-optional="true"/>
-        <xml fileName="${QPID_HOME}/etc/config-systests-settings.xml"/>
-        <xml fileName="${QPID_HOME}/etc/config.xml"/>                
+        <xml fileName="${test.virtualhosts}" optional="true"/>
+        <xml fileName="${QPID_HOME}/etc/virtualhosts.xml"/>                
     </override>
 </configuration>

Modified: qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java?rev=929138&r1=929137&r2=929138&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java (original)
+++ qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java Tue Mar 30 13:46:48 2010
@@ -42,6 +42,8 @@ public class ServerConfigurationFileTest
         }
 
         saveTestConfiguration();
+        saveTestVirtualhosts();
+        
         _serverConfig = new ServerConfiguration(_configFile);
     }
 

Modified: qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java?rev=929138&r1=929137&r2=929138&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java (original)
+++ qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java Tue Mar 30 13:46:48 2010
@@ -20,19 +20,16 @@
 */
 package org.apache.qpid.server.logging;
 
+import javax.jms.Connection;
+import javax.jms.Queue;
+import javax.jms.Session;
+
 import org.apache.qpid.client.AMQDestination;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.registry.ApplicationRegistry;
 import org.apache.qpid.server.configuration.ServerConfiguration;
-import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.server.registry.ApplicationRegistry;
 import org.apache.qpid.util.FileUtils;
-import org.apache.qpid.util.LogMonitor;
-
-import javax.jms.Connection;
-import javax.jms.Queue;
-import javax.jms.Session;
-import java.io.File;
 
 public class AlertingTest extends AbstractTestLogging
 {
@@ -49,6 +46,7 @@ public class AlertingTest extends Abstra
     {
         // Update the configuration to make our virtualhost Persistent.
         makeVirtualHostPersistent(VIRTUALHOST);
+        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.expiredMessageCheckPeriod", "5000");
 
         _numMessages = 50;
 
@@ -114,7 +112,7 @@ public class AlertingTest extends Abstra
             message.append(FileUtils.readFileAsString(getTestConfigFile()));
 
             message.append("\nVirtualhost maxMessageCount:\n");                        
-            message.append((new ServerConfiguration(_configFile)).getConfig().getString("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount"));
+            message.append(new ServerConfiguration(_configFile).getVirtualHostConfig(VIRTUALHOST).getMaximumMessageCount());
 
             fail(message.toString());
         }
@@ -185,7 +183,7 @@ public class AlertingTest extends Abstra
         setupConnection();
 
         // Validate the queue depth is as expected
-        long messageCount = ((AMQSession) _session).getQueueDepth((AMQDestination) _destination);
+        long messageCount = ((AMQSession<?, ?>) _session).getQueueDepth((AMQDestination) _destination);
         assertEquals("Broker has invalid message count for test", 2, messageCount);
 
         // Ensure the alert has not occured yet
@@ -198,5 +196,4 @@ public class AlertingTest extends Abstra
         // Validate that the alert occured.
         wasAlertFired();
     }
-
 }

Modified: qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java?rev=929138&r1=929137&r2=929138&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java (original)
+++ qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java Tue Mar 30 13:46:48 2010
@@ -20,13 +20,13 @@
 */
 package org.apache.qpid.server.logging;
 
-import org.apache.commons.configuration.Configuration;
+import java.util.Arrays;
+import java.util.List;
+
 import org.apache.qpid.server.configuration.ServerConfiguration;
 import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject;
 import org.apache.qpid.util.LogMonitor;
 
-import java.util.List;
-
 /**
  * The MessageStore test suite validates that the follow log messages as
  * specified in the Functional Specification.
@@ -90,7 +90,7 @@ public class MemoryMessageStoreLoggingTe
 
         // Load VirtualHost list from file.
         ServerConfiguration configuration = new ServerConfiguration(_configFile);
-        List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
+        List<String> vhosts = Arrays.asList(configuration.getVirtualHosts());
 
         //Validate each vhost logs a creation
         results = _monitor.waitAndFindMatches("MST-1001", DEFAULT_LOG_WAIT);
@@ -101,15 +101,12 @@ public class MemoryMessageStoreLoggingTe
         {
             String result = getLog(results.get(index));
 
-            // getSlize will return extract the vhost from vh(/test) -> '/test'
+            // getSlice will return extract the vhost from vh(/test) -> '/test'
             // so remove the '/' to get the name
             String vhostName = AbstractTestLogSubject.getSlice("vh", result).substring(1);
 
-            // To get the store class used in the configuration we need to know
-            // the virtualhost name, found above. AND
-            // the index that the virtualhost is within the configuration.
-            // we can retrive that from the vhosts list previously extracted.
-            String fullStoreName = configuration.getConfig().getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
+            // Get the store class used in the configuration for the virtualhost.
+            String fullStoreName = configuration.getVirtualHostConfig(vhostName).getMessageStoreClass();
 
             // Get the Simple class name from the expected class name of o.a.q.s.s.MMS
             String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1);
@@ -157,7 +154,7 @@ public class MemoryMessageStoreLoggingTe
 
         // Load VirtualHost list from file.
         ServerConfiguration configuration = new ServerConfiguration(_configFile);
-        List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
+        List<String> vhosts = Arrays.asList(configuration.getVirtualHosts());
 
         //Validate each vhost logs a creation
         results = _monitor.waitAndFindMatches("MST-1003", DEFAULT_LOG_WAIT);
@@ -168,15 +165,12 @@ public class MemoryMessageStoreLoggingTe
         {
             String result = getLog(results.get(index));
 
-            // getSlize will return extract the vhost from vh(/test) -> '/test'
+            // getSlice will return extract the vhost from vh(/test) -> '/test'
             // so remove the '/' to get the name
             String vhostName = AbstractTestLogSubject.getSlice("vh", result).substring(1);
 
-            // To get the store class used in the configuration we need to know
-            // the virtualhost name, found above. AND
-            // the index that the virtualhost is within the configuration.
-            // we can retrive that from the vhosts list previously extracted.
-            String fullStoreName = configuration.getConfig().getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
+            // Get the store class used in the configuration for the virtualhost.
+            String fullStoreName = configuration.getVirtualHostConfig(vhostName).getMessageStoreClass();
 
             // Get the Simple class name from the expected class name of o.a.q.s.s.MMS
             String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1);

Modified: qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java?rev=929138&r1=929137&r2=929138&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java (original)
+++ qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java Tue Mar 30 13:46:48 2010
@@ -21,11 +21,12 @@
 
 package org.apache.qpid.server.logging;
 
+import java.util.Arrays;
+import java.util.List;
+
 import junit.framework.AssertionFailedError;
-import org.apache.commons.configuration.Configuration;
-import org.apache.qpid.server.configuration.ServerConfiguration;
 
-import java.util.List;
+import org.apache.qpid.server.configuration.ServerConfiguration;
 
 /**
  * Virtualhost Test Cases
@@ -60,28 +61,26 @@ public class VirtualHostLoggingTest exte
     public void testVirtualhostCreation() throws Exception
     {
         //Wait for the correct VHT message to arrive.                                 
-        _monitor.waitForMessage("VHT-1001",DEFAULT_LOG_WAIT);
-
-        List<String> results = _monitor.findMatches(VHT_PREFIX);
+        _monitor.waitForMessage(VHT_PREFIX + "1001", DEFAULT_LOG_WAIT);
+        
+        //Validate each vhost logs a creation
+        List<String> results = _monitor.findMatches(VHT_PREFIX + "1001");
+        
         try
         {
-            // Validation
+            // Load VirtualHost list from file. 
             ServerConfiguration configuration = new ServerConfiguration(_configFile);
-            List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
-
-            //Validate each vhost logs a creation
-            results = _monitor.findMatches("VHT-1001");
+            List<String> vhosts = Arrays.asList(configuration.getVirtualHosts());
 
             assertEquals("Each vhost did not create a store.", vhosts.size(), results.size());
 
             for (int index = 0; index < results.size(); index++)
             {
-                String result = getLog(results.get(index));
-
                 // Retrieve the vhostname from the log entry message 'Created : <vhostname>'
+                String result = getLog(results.get(index));
                 String vhostName = getMessageString(fromMessage(result)).split(" ")[2];
 
-                assertTrue("Virualhost named in log not found in config file:" + vhostName + ":" + vhosts, vhosts.contains(vhostName));
+                assertTrue("Virtualhost named in log not found in config file:" + vhostName + ":" + vhosts, vhosts.contains(vhostName));
             }
         }
         catch (AssertionFailedError afe)
@@ -114,21 +113,19 @@ public class VirtualHostLoggingTest exte
     {
         stopBroker();
 
-        //Wait for the correct VHT message to arrive.
-        _monitor.waitForMessage("VHT-1002",DEFAULT_LOG_WAIT);
-
-        List<String> results = _monitor.findMatches(VHT_PREFIX);
+        // Wait for the correct VHT message to arrive.                                 
+        _monitor.waitForMessage(VHT_PREFIX + "1002", DEFAULT_LOG_WAIT);
+        
+        // Validate each vhost logs a closure
+        List<String> results = _monitor.findMatches(VHT_PREFIX + "1002");
+        
         try
         {
-            // Validation
-
+            // Load VirtualHost list from file. 
             ServerConfiguration configuration = new ServerConfiguration(_configFile);
-            List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
-
-            //Validate each vhost logs a creation
-            results = _monitor.findMatches("VHT-1002");
+            List<String> vhosts = Arrays.asList(configuration.getVirtualHosts());
 
-            assertEquals("Each vhost did not create a store.", vhosts.size(), results.size());
+            assertEquals("Each vhost did not close their store.", vhosts.size(), results.size());
         }
         catch (AssertionFailedError afe)
         {

Modified: qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/security/firewall/FirewallConfigTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/security/firewall/FirewallConfigTest.java?rev=929138&r1=929137&r2=929138&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/security/firewall/FirewallConfigTest.java (original)
+++ qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/server/security/firewall/FirewallConfigTest.java Tue Mar 30 13:46:48 2010
@@ -12,8 +12,8 @@ import org.apache.qpid.test.utils.QpidTe
 
 public class FirewallConfigTest extends QpidTestCase 
 {
-
-    private File tmpFile = null;
+    private File _tmpConfig, _tmpVirtualhosts;
+    
     @Override
     protected void setUp() throws Exception
     {
@@ -25,22 +25,32 @@ public class FirewallConfigTest extends 
             fail("QPID_HOME not set");
         }
 
-        // Setup initial config.
+        // Setup initial config file.
         _configFile = new File(QPID_HOME, "etc/config-systests-firewall.xml");
-        tmpFile = File.createTempFile("config-systests-firewall", ".xml");
-        setSystemProperty("QPID_FIREWALL_SETTINGS", tmpFile.getAbsolutePath());
-        tmpFile.deleteOnExit();
+        
+        // Setup temporary config file
+        _tmpConfig = File.createTempFile("config-systests-firewall", ".xml");
+        setSystemProperty("QPID_FIREWALL_CONFIG_SETTINGS", _tmpConfig.getAbsolutePath());
+        _tmpConfig.deleteOnExit();
+
+        // Setup temporary virtualhosts file
+        _tmpVirtualhosts = File.createTempFile("virtualhosts-systests-firewall", ".xml");
+        setSystemProperty("QPID_FIREWALL_VIRTUALHOSTS_SETTINGS", _tmpVirtualhosts.getAbsolutePath());
+        _tmpVirtualhosts.deleteOnExit();
     }
 
     private void writeFirewallFile(boolean allow, boolean inVhost) throws IOException
     {
-        FileWriter out = new FileWriter(tmpFile);
+        FileWriter out = new FileWriter(inVhost ? _tmpVirtualhosts : _tmpConfig);
         String ipAddr = "127.0.0.1"; // FIXME: get this from InetAddress.getLocalHost().getAddress() ?
-        out.write("<broker>");
         if (inVhost) 
         {
             out.write("<virtualhosts><virtualhost><test>");
         }
+        else
+        {
+            out.write("<broker>");
+        }
         out.write("<security><firewall>");
         out.write("<rule access=\""+((allow) ? "allow" : "deny")+"\" network=\""+ipAddr +"\"/>");
         out.write("</firewall></security>");
@@ -48,7 +58,10 @@ public class FirewallConfigTest extends 
         {
             out.write("</test></virtualhost></virtualhosts>");
         }
-        out.write("</broker>");
+        else
+        {
+            out.write("</broker>");
+        }
         out.close();
     }
     
@@ -167,6 +180,23 @@ public class FirewallConfigTest extends 
         });
     }
     
+    public void testAllowOnReloadInVhost() throws Exception
+    {
+        testFirewall(false, true, new Runnable() {
+
+            public void run()
+            {
+                try
+                {
+                    reloadBroker();
+                } catch (Exception e)
+                {
+                    fail(e.getMessage());
+                }
+            }
+        });
+    }
+    
     public void testDenyOnReload() throws Exception
     {
         testDeny(false, new Runnable() {
@@ -203,18 +233,17 @@ public class FirewallConfigTest extends 
         );
        
     }
-    
+
     private void testDeny(boolean inVhost, Runnable restartOrReload) throws Exception
     {
-        if (_broker.equals(VM))
-        {
-            // No point running this test in a vm broker
-            return;
-        }
-        
-        writeFirewallFile(false, inVhost);        
-        super.setUp();
-        
+        testFirewall(true, inVhost, restartOrReload);
+    }
+    
+    /*
+     * Check we can get a connection
+     */
+    private boolean checkConnection() throws Exception
+    {
         Exception exception  = null;
         Connection conn = null;
         try 
@@ -225,22 +254,27 @@ public class FirewallConfigTest extends 
         {
             exception = e;
         }
-        assertNotNull(exception);
         
-        // Check we can get a connection
+        return conn != null;
+    }
+    
+    private void testFirewall(boolean initial, boolean inVhost, Runnable restartOrReload) throws Exception
+    {
+        if (_broker.equals(VM))
+        {
+            // No point running this test in a vm broker
+            return;
+        }
+        
+        writeFirewallFile(initial, inVhost);        
+        super.setUp();
+
+        assertEquals("Initial connection check failed", initial, checkConnection());
 
-        writeFirewallFile(true, inVhost);
+        // Reload changed firewall file after restart or reload
+        writeFirewallFile(!initial, inVhost);
         restartOrReload.run();
         
-        exception = null;
-        try 
-        {
-            conn = getConnection();
-        } 
-        catch (JMSException e)
-        {
-            exception = e;
-        }
-        assertNull(exception);
-    }    
+        assertEquals("Second connection check failed", !initial, checkConnection());
+    }
 }

Modified: qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java?rev=929138&r1=929137&r2=929138&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java (original)
+++ qpid/branches/0.5.x-dev/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java Tue Mar 30 13:46:48 2010
@@ -17,16 +17,46 @@
  */
 package org.apache.qpid.test.utils;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.io.PrintStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
 import junit.framework.TestCase;
 import junit.framework.TestResult;
+
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Level;
 import org.apache.qpid.AMQException;
-import org.apache.qpid.exchange.ExchangeDefaults;
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQConnectionFactory;
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.exchange.ExchangeDefaults;
 import org.apache.qpid.jms.BrokerDetails;
 import org.apache.qpid.jms.ConnectionURL;
 import org.apache.qpid.server.configuration.ServerConfiguration;
@@ -35,37 +65,9 @@ import org.apache.qpid.server.registry.C
 import org.apache.qpid.server.store.DerbyMessageStore;
 import org.apache.qpid.url.URLSyntaxException;
 import org.apache.qpid.util.LogMonitor;
-import org.apache.log4j.Level;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.LineNumberReader;
-import java.io.PrintStream;
-import java.io.Reader;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
 /**
  *
  *
@@ -85,6 +87,7 @@ public class QpidTestCase extends TestCa
     private Map<org.apache.log4j.Logger, Level> _loggerLevelSetForTest = new HashMap<org.apache.log4j.Logger, Level>();
 
     private XMLConfiguration _testConfiguration = new XMLConfiguration();
+    private XMLConfiguration _testVirtualhosts = new XMLConfiguration();
 
     protected static final String INDEX = "index";
 
@@ -175,9 +178,10 @@ public class QpidTestCase extends TestCa
 
     protected static final String QPID_HOME = "QPID_HOME";
 
-    protected static int DEFAULT_VM_PORT = 1;
-    protected static int DEFAULT_PORT = Integer.getInteger("test.port", 5672);
-    protected static int DEFAULT_MANAGEMENT_PORT = Integer.getInteger("test.mport", 8999);
+    public static final int DEFAULT_VM_PORT = 1;
+    public static final int DEFAULT_PORT = Integer.getInteger("test.port", ServerConfiguration.DEFAULT_PORT);
+    public static final int DEFAULT_MANAGEMENT_PORT = Integer.getInteger("test.mport", ServerConfiguration.DEFAULT_JMXPORT);
+    public static final int DEFAULT_SSL_PORT = Integer.getInteger("test.sslport", ServerConfiguration.DEFAULT_SSL_PORT);
 
     protected String _brokerLanguage = System.getProperty(BROKER_LANGUAGE, JAVA);
     protected String _broker = System.getProperty(BROKER, VM);
@@ -200,6 +204,7 @@ public class QpidTestCase extends TestCa
     protected List<Connection> _connections = new ArrayList<Connection>();
     public static final String QUEUE = "queue";
     public static final String TOPIC = "topic";
+    
     /** Map to hold test defined environment properties */
     private Map<String, String> _env;
 
@@ -447,14 +452,16 @@ public class QpidTestCase extends TestCa
     {
         port = getPort(port);
 
-        // Save any configuratio changes that have been made
+        // Save any configuration changes that have been made
         saveTestConfiguration();
+        saveTestVirtualhosts();
 
         Process process = null;
         if (_broker.equals(VM))
         {
             setConfigurationProperty("management.jmxport", String.valueOf(getManagementPort(port)));
             saveTestConfiguration();
+            
             // create an in_VM broker
             ApplicationRegistry.initialise(new ConfigurationFileApplicationRegistry(_configFile), port);
             TransportConnection.createVMBroker(port);
@@ -568,22 +575,41 @@ public class QpidTestCase extends TestCa
     public String getTestConfigFile()
     {
         String path = _output == null ? System.getProperty("java.io.tmpdir") : _output;
-        return path + "/" + getTestQueueName() + ".xml";
+        return path + "/" + getTestQueueName() + "-config.xml";
+    }
+
+    public String getTestVirtualhostsFile()
+    {
+        String path = _output == null ? System.getProperty("java.io.tmpdir") : _output;
+        return path + "/" + getTestQueueName() + "-virtualhosts.xml";
     }
 
     protected void saveTestConfiguration() throws ConfigurationException
     {
+        // Specifiy the test config file
         String testConfig = getTestConfigFile();
-        //Specifiy the test configuration
         setSystemProperty("test.config", testConfig);
 
-        // This is a work
+        // Create the file if configuration does not exist
         if (_testConfiguration.isEmpty())
         {
-            _testConfiguration.addProperty("test", getTestQueueName());
+            _testConfiguration.addProperty("__ignore", "true");
         }
+        _testConfiguration.save(testConfig);
+    }
 
-        _testConfiguration.save(getTestConfigFile());
+    protected void saveTestVirtualhosts() throws ConfigurationException
+    {
+        // Specifiy the test virtualhosts file
+        String testVirtualhosts = getTestVirtualhostsFile();
+        setSystemProperty("test.virtualhosts", testVirtualhosts);
+
+        // Create the file if configuration does not exist
+        if (_testVirtualhosts.isEmpty())
+        {
+            _testVirtualhosts.addProperty("__ignore", "true");
+        }
+        _testVirtualhosts.save(testVirtualhosts);
     }
 
     public void cleanBroker()
@@ -650,29 +676,23 @@ public class QpidTestCase extends TestCa
     protected void makeVirtualHostPersistent(String virtualhost)
             throws ConfigurationException, IOException
     {
-        Class storeClass = DerbyMessageStore.class;
-
-        Class bdb = null;
+        Class<?> storeClass = null;
         try
         {
-            bdb = Class.forName("org.apache.qpid.server.store.berkeleydb.BDBMessageStore");
+            // Try and lookup the BDB class
+            storeClass = Class.forName("org.apache.qpid.server.store.berkeleydb.BDBMessageStore");
         }
         catch (ClassNotFoundException e)
         {
             // No BDB store, we'll use Derby instead.
-        }
-
-        if (bdb != null)
-        {
-            storeClass = bdb;
+            storeClass = DerbyMessageStore.class;
         }
 
 
-        _testConfiguration.setProperty("virtualhosts.virtualhost." + virtualhost +
-                                  ".store.class", storeClass.getName());
-        _testConfiguration.setProperty("virtualhosts.virtualhost." + virtualhost +
-                                  ".store." + DerbyMessageStore.ENVIRONMENT_PATH_PROPERTY,
-                                  "${QPID_WORK}/" + virtualhost);
+        setConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".store.class",
+                                    storeClass.getName());
+        setConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".store." + DerbyMessageStore.ENVIRONMENT_PATH_PROPERTY,
+                                   "${QPID_WORK}/" + virtualhost);
     }
 
     /**
@@ -690,6 +710,7 @@ public class QpidTestCase extends TestCa
         // Call save Configuration to be sure we have saved the test specific
         // file. As the optional status
         saveTestConfiguration();
+        saveTestVirtualhosts();
 
         ServerConfiguration configuration = new ServerConfiguration(_configFile);
         return configuration.getConfig().getString(property);
@@ -713,9 +734,15 @@ public class QpidTestCase extends TestCa
     protected void setConfigurationProperty(String property, String value)
             throws ConfigurationException, IOException
     {
-        //Write the value in to this configuration file which will override the
-        // defaults.
-        _testConfiguration.setProperty(property, value);
+        // Choose which file to write the property to based on prefix.
+        if (property.startsWith("virtualhosts"))
+        {
+            _testVirtualhosts.setProperty(StringUtils.substringAfter(property, "virtualhosts."), value);
+        }
+        else
+        {
+            _testConfiguration.setProperty(property, value);
+        }
     }
 
     /**
@@ -736,7 +763,6 @@ public class QpidTestCase extends TestCa
         {
             _propertiesSetForBroker.put(property, value);
         }
-
     }    
 
     /**

Modified: qpid/branches/0.5.x-dev/qpid/java/test-profiles/log4j-test.xml
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/test-profiles/log4j-test.xml?rev=929138&r1=929137&r2=929138&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/test-profiles/log4j-test.xml (original)
+++ qpid/branches/0.5.x-dev/qpid/java/test-profiles/log4j-test.xml Tue Mar 30 13:46:48 2010
@@ -51,6 +51,10 @@
     <level value="WARN"/>
   </logger>
 
+  <logger name="apache.commons.configuration.ConfigurationFactory">
+    <level value="ERROR"/>
+  </logger>
+
   <root>
     <level value="${root.logging.level}"/>
     <appender-ref ref="console" />



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