You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2013/01/24 18:55:21 UTC

svn commit: r1438107 [2/3] - in /qpid/branches/java-broker-config-qpid-4390/qpid/java: ./ bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/ bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/ broker-plugins/management-http...

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java Thu Jan 24 17:55:19 2013
@@ -27,7 +27,9 @@ import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.exchange.ExchangeDefaults;
 import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 import org.apache.qpid.util.LogMonitor;
 
 import java.util.List;
@@ -60,16 +62,15 @@ public class StatisticsReportingTest ext
     @Override
     public void setUp() throws Exception
     {
-        createTestVirtualHost(VHOST_NAME1);
-        createTestVirtualHost(VHOST_NAME2);
-        createTestVirtualHost(VHOST_NAME3);
-
-        setConfigurationProperty("statistics.generation.broker", "true");
-        setConfigurationProperty("statistics.generation.virtualhosts", "true");
+        createTestVirtualHost(0, VHOST_NAME1);
+        createTestVirtualHost(0, VHOST_NAME2);
+        createTestVirtualHost(0, VHOST_NAME3);
 
         if (getName().equals("testEnabledStatisticsReporting"))
         {
-            setConfigurationProperty("statistics.reporting.period", "10");
+            TestBrokerConfiguration config = getBrokerConfiguration();
+            config.removeObjectConfiguration(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST);
+            config.setBrokerAttribute(Broker.STATISTICS_REPORTING_PERIOD, 10);
         }
 
         _monitor = new LogMonitor(_outputFile);

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java Thu Jan 24 17:55:19 2013
@@ -60,9 +60,9 @@ public class StoreOverfullTest extends Q
 
     public void setUp() throws Exception
     {
-        setConfigurationProperty("virtualhosts.virtualhost.test.store.class", QuotaMessageStore.class.getName());
-        setConfigurationProperty("virtualhosts.virtualhost.test.store.overfull-size", String.valueOf(OVERFULL_SIZE));
-        setConfigurationProperty("virtualhosts.virtualhost.test.store.underfull-size", String.valueOf(UNDERFULL_SIZE));
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.store.class", QuotaMessageStore.class.getName());
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.store.overfull-size", String.valueOf(OVERFULL_SIZE));
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.store.underfull-size", String.valueOf(UNDERFULL_SIZE));
 
         super.setUp();
 

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/ManagementLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/ManagementLoggingTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/ManagementLoggingTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/ManagementLoggingTest.java Thu Jan 24 17:55:19 2013
@@ -24,11 +24,14 @@ package org.apache.qpid.systest.manageme
 import org.apache.qpid.server.configuration.BrokerProperties;
 import org.apache.qpid.server.configuration.ServerConfiguration;
 import org.apache.qpid.server.logging.AbstractTestLogging;
+import org.apache.qpid.server.model.Port;
+import org.apache.qpid.server.model.Transport;
 import org.apache.qpid.test.utils.JMXTestUtils;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 import org.apache.qpid.test.utils.TestSSLConstants;
 import org.apache.qpid.util.LogMonitor;
 
-import java.io.File;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -247,7 +250,7 @@ public class ManagementLoggingTest exten
 
             // Validate the keystore path is as expected
             assertTrue("SSL Keystore entry expected.:" + getMessageString(log),
-                       getMessageString(log).endsWith(new File(getConfigurationStringProperty("management.ssl.keyStorePath")).getName()));
+                       getMessageString(log).endsWith(TestSSLConstants.BROKER_KEYSTORE));
         }
     }
 
@@ -304,13 +307,17 @@ public class ManagementLoggingTest exten
 
     private void startBrokerAndCreateMonitor(boolean managementEnabled, boolean useManagementSSL) throws Exception
     {
-        //Ensure management is on
-        setConfigurationProperty("management.enabled", String.valueOf(managementEnabled));
+        TestBrokerConfiguration config = getBrokerConfiguration();
+
+        if (managementEnabled)
+        {
+            config.addJmxManagementConfiguration();
+        }
 
         if(useManagementSSL)
         {
             // This test requires we have an ssl connection
-            setConfigurationProperty("management.ssl.enabled", "true");
+            config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_JMX_PORT, Port.TRANSPORTS, Collections.singleton(Transport.SSL));
 
             setSystemProperty("javax.net.ssl.keyStore", "test-profiles/test_resources/ssl/java_broker_keystore.jks");
             setSystemProperty("javax.net.ssl.keyStorePassword", "password");

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/StatisticsTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/StatisticsTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/StatisticsTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/StatisticsTest.java Thu Jan 24 17:55:19 2013
@@ -53,8 +53,8 @@ public class StatisticsTest extends Qpid
     @Override
     public void setUp() throws Exception
     {
-        createTestVirtualHost(TEST_VIRTUALHOST1);
-        createTestVirtualHost(TEST_VIRTUALHOST2);
+        createTestVirtualHost(0, TEST_VIRTUALHOST1);
+        createTestVirtualHost(0, TEST_VIRTUALHOST2);
 
         _jmxUtils = new JMXTestUtils(this, TEST_USER, TEST_PASSWORD);
         _jmxUtils.setUp();

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementTest.java Thu Jan 24 17:55:19 2013
@@ -23,15 +23,23 @@ import java.io.File;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.jms.Connection;
 import javax.jms.JMSException;
 
 import org.apache.qpid.management.common.mbeans.UserManagement;
-import org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
+import org.apache.qpid.server.model.Port;
+import org.apache.qpid.server.model.Protocol;
+import org.apache.qpid.server.model.Transport;
+import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
+import org.apache.qpid.server.security.auth.manager.AbstractPrincipalDatabaseAuthManagerFactory;
+import org.apache.qpid.server.security.auth.manager.PlainPasswordFileAuthenticationManagerFactory;
 import org.apache.qpid.test.utils.JMXTestUtils;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 import org.apache.qpid.tools.security.Passwd;
 
 /**
@@ -53,9 +61,10 @@ public class UserManagementTest extends 
         _passwd = createPasswordEncodingUtility();
         _passwordFile = createTemporaryPasswordFileWithJmxAdminUser();
 
-        setConfigurationProperty("security.pd-auth-manager.principal-database.class", getPrincipalDatabaseImplClass().getName());
-        setConfigurationProperty("security.pd-auth-manager.principal-database.attributes.attribute.name", "passwordFile");
-        setConfigurationProperty("security.pd-auth-manager.principal-database.attributes.attribute.value", _passwordFile.getAbsolutePath());
+        Map<String, Object> newAttributes = new HashMap<String, Object>();
+        newAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, getAuthenticationManagerType());
+        newAttributes.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_PATH, _passwordFile.getAbsolutePath());
+        getBrokerConfiguration().setObjectAttributes(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, newAttributes);
 
         _jmxUtils = new JMXTestUtils(this);
         _jmxUtils.setUp();
@@ -163,9 +172,9 @@ public class UserManagementTest extends 
         };
     }
 
-    protected Class<? extends PrincipalDatabase> getPrincipalDatabaseImplClass()
+    protected String getAuthenticationManagerType()
     {
-        return PlainPasswordFilePrincipalDatabase.class;
+        return PlainPasswordFileAuthenticationManagerFactory.PROVIDER_TYPE;
     }
 
     private File createTemporaryPasswordFileWithJmxAdminUser() throws Exception

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementWithBase64MD5PasswordsTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementWithBase64MD5PasswordsTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementWithBase64MD5PasswordsTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementWithBase64MD5PasswordsTest.java Thu Jan 24 17:55:19 2013
@@ -18,8 +18,7 @@
  */
 package org.apache.qpid.systest.management.jmx;
 
-import org.apache.qpid.server.security.auth.database.Base64MD5PasswordFilePrincipalDatabase;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
+import org.apache.qpid.server.security.auth.manager.Base64MD5PasswordFileAuthenticationManagerFactory;
 import org.apache.qpid.tools.security.Passwd;
 
 public class UserManagementWithBase64MD5PasswordsTest extends UserManagementTest
@@ -31,9 +30,8 @@ public class UserManagementWithBase64MD5
     }
 
     @Override
-    protected Class<? extends PrincipalDatabase> getPrincipalDatabaseImplClass()
+    protected String getAuthenticationManagerType()
     {
-        return Base64MD5PasswordFilePrincipalDatabase.class;
+        return Base64MD5PasswordFileAuthenticationManagerFactory.PROVIDER_TYPE;
     }
-
 }

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java Thu Jan 24 17:55:19 2013
@@ -25,10 +25,14 @@ import static org.apache.qpid.test.utils
 
 import java.io.IOException;
 import java.net.HttpURLConnection;
+import java.util.Collections;
 
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.model.Port;
+import org.apache.qpid.server.model.Protocol;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 
 public class BasicAuthRestTest extends QpidRestTestCase
 {
@@ -51,11 +55,11 @@ public class BasicAuthRestTest extends Q
     private void configure(boolean useSsl) throws ConfigurationException, IOException
     {
         getRestTestHelper().setUseSsl(useSsl);
-        setConfigurationProperty("management.http.enabled",  String.valueOf(!useSsl));
-        setConfigurationProperty("management.http.port", Integer.toString(getRestTestHelper().getHttpPort()));
-        setConfigurationProperty("management.https.enabled", String.valueOf(useSsl));
-        setConfigurationProperty("management.https.port", Integer.toString(getRestTestHelper().getHttpPort()));
-        setConfigurationProperty("management.enabled", "false"); //JMX
+        if (useSsl)
+        {
+            getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT, Port.PROTOCOLS, Collections.singleton(Protocol.HTTPS));
+        }
+        super.customizeConfiguration();
     }
 
     private void verifyGetBrokerAttempt(int responseCode) throws IOException
@@ -91,7 +95,8 @@ public class BasicAuthRestTest extends Q
     public void testEnablingForHttp() throws Exception
     {
         configure(false);
-        setConfigurationProperty("management.http.basic-auth", "true");
+
+        getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true);
         super.setUp();
 
         // Try the attempt with authentication, it should succeed because
@@ -103,7 +108,7 @@ public class BasicAuthRestTest extends Q
     public void testDisablingForHttps() throws Exception
     {
         configure(true);
-        setConfigurationProperty("management.https.basic-auth", "false");
+        getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpsBasicAuthenticationEnabled", false);
         super.setUp();
         setSystemProperty("javax.net.ssl.trustStore", TRUSTSTORE);
         setSystemProperty("javax.net.ssl.trustStorePassword", TRUSTSTORE_PASSWORD);

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BindingRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BindingRestTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BindingRestTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BindingRestTest.java Thu Jan 24 17:55:19 2013
@@ -34,7 +34,8 @@ public class BindingRestTest extends Qpi
     {
         List<Map<String, Object>> bindings = getRestTestHelper().getJsonAsList("/rest/binding");
         assertNotNull("Bindings cannot be null", bindings);
-        assertTrue("Unexpected number of bindings", bindings.size() >= EXPECTED_VIRTUALHOSTS.length * EXPECTED_QUEUES.length);
+        assertTrue("Unexpected number of bindings: " + bindings.size(),
+                bindings.size() >= EXPECTED_VIRTUALHOSTS.length * EXPECTED_QUEUES.length);
         for (Map<String, Object> binding : bindings)
         {
             Asserts.assertBinding((String) binding.get(Binding.NAME), (String) binding.get(Binding.EXCHANGE), binding);

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java Thu Jan 24 17:55:19 2013
@@ -24,10 +24,16 @@ import static org.apache.qpid.test.utils
 import static org.apache.qpid.test.utils.TestSSLConstants.TRUSTSTORE_PASSWORD;
 
 import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.Port;
+import org.apache.qpid.server.model.Protocol;
+import org.apache.qpid.server.model.Transport;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 
 public class BrokerRestHttpsTest extends QpidRestTestCase
 {
@@ -43,11 +49,12 @@ public class BrokerRestHttpsTest extends
     @Override
     protected void customizeConfiguration() throws ConfigurationException, IOException
     {
+        super.customizeConfiguration();
         getRestTestHelper().setUseSsl(true);
-        setConfigurationProperty("management.enabled", "true");
-        setConfigurationProperty("management.http.enabled", "false");
-        setConfigurationProperty("management.https.enabled", "true");
-        setConfigurationProperty("management.https.port", Integer.toString(getRestTestHelper().getHttpPort()));
+        Map<String, Object> newAttributes = new HashMap<String, Object>();
+        newAttributes.put(Port.PROTOCOLS, Collections.singleton(Protocol.HTTPS));
+        newAttributes.put(Port.TRANSPORTS, Collections.singleton(Transport.SSL));
+        getBrokerConfiguration().setObjectAttributes(TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT,newAttributes);
     }
 
     public void testGetWithHttps() throws Exception

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java Thu Jan 24 17:55:19 2013
@@ -32,6 +32,7 @@ import org.apache.qpid.server.model.Life
 import org.apache.qpid.server.model.Port;
 import org.apache.qpid.server.model.State;
 import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 
 public class BrokerRestTest extends QpidRestTestCase
 {
@@ -61,15 +62,15 @@ public class BrokerRestTest extends Qpid
 
         @SuppressWarnings("unchecked")
         List<Map<String, Object>> ports = (List<Map<String, Object>>) brokerDetails.get(BROKER_PORTS_ATTRIBUTE);
-        assertEquals("Unexpected number of ports", 2, ports.size());
+        assertEquals("Unexpected number of ports", 4, ports.size());
 
         for (Map<String, Object> port : ports)
         {
             Asserts.assertPortAttributes(port);
         }
 
-        Map<String, Object> amqpPort = getRestTestHelper().find(Port.NAME, getPort() +"-AMQP", ports);
-        Map<String, Object> httpPort = getRestTestHelper().find(Port.NAME, getRestTestHelper().getHttpPort() + "-HTTP", ports);
+        Map<String, Object> amqpPort = getRestTestHelper().find(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT, ports);
+        Map<String, Object> httpPort = getRestTestHelper().find(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT, ports);
 
         assertEquals("Unexpected binding address", "*", amqpPort.get(Port.BINDING_ADDRESS));
         assertNotNull("Cannot find AMQP port", amqpPort);

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java Thu Jan 24 17:55:19 2013
@@ -26,6 +26,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.Group;
 import org.apache.qpid.server.model.GroupProvider;
 import org.apache.qpid.server.model.LifetimePolicy;
@@ -42,8 +43,7 @@ public class GroupProviderRestTest exten
     {
         _groupFile = createTemporaryGroupFile();
 
-        setConfigurationProperty("security.file-group-manager.attributes.attribute.name", "groupFile");
-        setConfigurationProperty("security.file-group-manager.attributes.attribute.value", _groupFile.getAbsolutePath());
+        getBrokerConfiguration().setBrokerAttribute(Broker.GROUP_FILE, _groupFile.getAbsolutePath());
 
         super.setUp();
     }

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupRestTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupRestTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupRestTest.java Thu Jan 24 17:55:19 2013
@@ -26,6 +26,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.GroupMember;
 
 public class GroupRestTest extends QpidRestTestCase
@@ -42,8 +43,7 @@ public class GroupRestTest extends QpidR
     {
         _groupFile = createTemporaryGroupFile();
 
-        setConfigurationProperty("security.file-group-manager.attributes.attribute.name", "groupFile");
-        setConfigurationProperty("security.file-group-manager.attributes.attribute.value", _groupFile.getAbsolutePath());
+        getBrokerConfiguration().setBrokerAttribute(Broker.GROUP_FILE, _groupFile.getAbsolutePath());
 
         super.setUp();
     }

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java Thu Jan 24 17:55:19 2013
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.qpid.server.model.Port;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 
 public class PortRestTest extends QpidRestTestCase
 {
@@ -32,14 +33,14 @@ public class PortRestTest extends QpidRe
     {
         List<Map<String, Object>> ports = getRestTestHelper().getJsonAsList("/rest/port/");
         assertNotNull("Port data cannot be null", ports);
-        assertEquals("Unexpected number of ports", 2, ports.size());
+        assertEquals("Unexpected number of ports", 4, ports.size());
 
-        String httpPortName = getRestTestHelper().getHttpPort() + "-HTTP";
+        String httpPortName = TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT;
         Map<String, Object> portData = getRestTestHelper().find(Port.NAME, httpPortName, ports);
         assertNotNull("Http port " + httpPortName + " is not found", portData);
         Asserts.assertPortAttributes(portData);
 
-        String amqpPortName = getPort() + "-AMQP";
+        String amqpPortName = TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT;
         Map<String, Object> amqpPortData = getRestTestHelper().find(Port.NAME, amqpPortName, ports);
         assertNotNull("Amqp port " + amqpPortName + " is not found", amqpPortData);
         Asserts.assertPortAttributes(amqpPortData);
@@ -49,7 +50,7 @@ public class PortRestTest extends QpidRe
     {
         List<Map<String, Object>> ports = getRestTestHelper().getJsonAsList("/rest/port/");
         assertNotNull("Ports data cannot be null", ports);
-        assertEquals("Unexpected number of ports", 2, ports.size());
+        assertEquals("Unexpected number of ports", 4, ports.size());
         for (Map<String, Object> portMap : ports)
         {
             String portName = (String) portMap.get(Port.NAME);

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java Thu Jan 24 17:55:19 2013
@@ -23,6 +23,8 @@ package org.apache.qpid.systest.rest;
 import java.io.IOException;
 
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.model.Port;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 
 public class QpidRestTestCase extends QpidBrokerTestCase
@@ -43,11 +45,11 @@ public class QpidRestTestCase extends Qp
         // Set up virtualhost config with queues and bindings to the amq.direct
         for (String virtualhost : EXPECTED_VIRTUALHOSTS)
         {
-            createTestVirtualHost(virtualhost);
+            createTestVirtualHost(0, virtualhost);
             for (String queue : EXPECTED_QUEUES)
             {
-                setConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".queues.exchange", "amq.direct");
-                setConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".queues.queue(-1).name", queue);
+                setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".queues.exchange", "amq.direct");
+                setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".queues.queue(-1).name", queue);
             }
         }
 
@@ -70,10 +72,9 @@ public class QpidRestTestCase extends Qp
 
     protected void customizeConfiguration() throws ConfigurationException, IOException
     {
-        setConfigurationProperty("management.enabled", "false");
-        setConfigurationProperty("management.http.enabled", "true");
-        setConfigurationProperty("management.https.enabled", "false");
-        setConfigurationProperty("management.http.port", Integer.toString(_restTestHelper.getHttpPort()));
+        TestBrokerConfiguration config = getBrokerConfiguration();
+        config.addHttpManagementConfiguration();
+        config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT, Port.PORT, _restTestHelper.getHttpPort());
     }
 
     public RestTestHelper getRestTestHelper()

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java Thu Jan 24 17:55:19 2013
@@ -51,8 +51,10 @@ import junit.framework.Assert;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.log4j.Logger;
+import org.apache.qpid.server.security.auth.manager.AbstractPrincipalDatabaseAuthManagerFactory;
 import org.apache.qpid.ssl.SSLContextFactory;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 import org.codehaus.jackson.JsonGenerationException;
 import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
@@ -292,6 +294,7 @@ public class RestTestHelper
 
     public void assertNumberOfGroupMembers(Map<String, Object> data, int expectedNumberOfGroupMembers)
     {
+        @SuppressWarnings("unchecked")
         List<Map<String, Object>> groups = (List<Map<String, Object>>) data.get("groupmembers");
         if (groups == null)
         {
@@ -327,7 +330,8 @@ public class RestTestHelper
 
     public void createOrUpdateUser(String username, String password, int responseCode) throws IOException
     {
-        HttpURLConnection connection = openManagementConnection("/rest/user/PrincipalDatabaseAuthenticationManager/" + username, "PUT");
+        HttpURLConnection connection = openManagementConnection("/rest/user/"
+                + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + username, "PUT");
 
         Map<String, Object> data = new HashMap<String, Object>();
         data.put("password", password);
@@ -355,14 +359,16 @@ public class RestTestHelper
 
     public void removeUserById(String id) throws IOException
     {
-        HttpURLConnection connection = openManagementConnection("/rest/user/PrincipalDatabaseAuthenticationManager?id=" + id, "DELETE");
+        HttpURLConnection connection = openManagementConnection("/rest/user/"
+                + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "?id=" + id, "DELETE");
         Assert.assertEquals("Unexpected response code", HttpServletResponse.SC_OK, connection.getResponseCode());
         connection.disconnect();
     }
 
     public void removeUser(String username, int responseCode) throws IOException
     {
-        HttpURLConnection connection = openManagementConnection("/rest/user/PrincipalDatabaseAuthenticationManager/" + username, "DELETE");
+        HttpURLConnection connection = openManagementConnection("/rest/user/"
+                + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + username, "DELETE");
         Assert.assertEquals("Unexpected response code", responseCode, connection.getResponseCode());
         connection.disconnect();
     }
@@ -374,6 +380,7 @@ public class RestTestHelper
 
     public void assertNumberOfGroups(Map<String, Object> data, int expectedNumberOfGroups)
     {
+        @SuppressWarnings("unchecked")
         List<Map<String, Object>> groups = (List<Map<String, Object>>) data.get("groups");
         if (groups == null)
         {
@@ -400,8 +407,8 @@ public class RestTestHelper
     {
         _passwdFile = createTemporaryPasswdFile(users);
 
-        testCase.setConfigurationProperty("security.pd-auth-manager.principal-database.attributes.attribute.name", "passwordFile");
-        testCase.setConfigurationProperty("security.pd-auth-manager.principal-database.attributes.attribute.value", _passwdFile.getAbsolutePath());
+        testCase.getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER,
+                AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_PATH, _passwdFile.getAbsolutePath());
     }
 
     public void tearDown()

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java Thu Jan 24 17:55:19 2013
@@ -27,6 +27,7 @@ import java.io.OutputStream;
 import java.net.HttpURLConnection;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -35,6 +36,10 @@ import javax.crypto.spec.SecretKeySpec;
 
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
+import org.apache.qpid.server.security.auth.manager.AbstractPrincipalDatabaseAuthManagerFactory;
+import org.apache.qpid.server.security.auth.manager.Base64MD5PasswordFileAuthenticationManagerFactory;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 import org.apache.qpid.tools.security.Passwd;
 import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
@@ -422,9 +427,9 @@ public class SaslRestTest extends QpidRe
         }
 
         // configure broker to use Base64MD5PasswordFilePrincipalDatabase
-        setConfigurationProperty("security.pd-auth-manager.principal-database.class",
-                "org.apache.qpid.server.security.auth.database.Base64MD5PasswordFilePrincipalDatabase");
-        setConfigurationProperty("security.pd-auth-manager.principal-database.attributes.attribute.value", passwordFile.getAbsolutePath());
-        setConfigurationProperty("management.http.sasl-auth", "true");
+        Map<String, Object> newAttributes = new HashMap<String, Object>();
+        newAttributes.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_PATH, passwordFile.getAbsolutePath());
+        newAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, Base64MD5PasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
+        getBrokerConfiguration().setObjectAttributes(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, newAttributes);
     }
 }

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/StructureRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/StructureRestTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/StructureRestTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/StructureRestTest.java Thu Jan 24 17:55:19 2013
@@ -24,6 +24,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.qpid.server.model.Port;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 
 public class StructureRestTest extends QpidRestTestCase
 {
@@ -40,7 +41,7 @@ public class StructureRestTest extends Q
 
         @SuppressWarnings("unchecked")
         List<Map<String, Object>> ports = (List<Map<String, Object>>) structure.get("ports");
-        assertEquals("Unexpected number of ports", 2, ports.size());
+        assertEquals("Unexpected number of ports", 4, ports.size());
 
         @SuppressWarnings("unchecked")
         List<Map<String, Object>> providers = (List<Map<String, Object>>) structure.get("authenticationproviders");
@@ -94,12 +95,12 @@ public class StructureRestTest extends Q
         }
 
 
-        String httpPortName = getRestTestHelper().getHttpPort() + "-HTTP";
+        String httpPortName = TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT;
         Map<String, Object> portData = getRestTestHelper().find(Port.NAME, httpPortName, ports);
         assertNotNull("Http Port " + httpPortName + " is not found", portData);
         assertNode(portData, httpPortName);
 
-        String amqpPortName = getPort() + "-AMQP";
+        String amqpPortName = TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT;
         Map<String, Object> amqpPortData = getRestTestHelper().find(Port.NAME, amqpPortName, ports);
         assertNotNull("Amqp port " + amqpPortName + " is not found", amqpPortData);
         assertNode(amqpPortData, amqpPortName);

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/UserRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/UserRestTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/UserRestTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/UserRestTest.java Thu Jan 24 17:55:19 2013
@@ -24,6 +24,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.qpid.server.model.User;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 
 public class UserRestTest extends QpidRestTestCase
 {
@@ -56,8 +57,8 @@ public class UserRestTest extends QpidRe
             assertNotNull("Attribute " + User.ID, user.get(User.ID));
             String userName = (String) user.get(User.NAME);
             assertNotNull("Attribute " + User.NAME, userName);
-            Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("/rest/user/PrincipalDatabaseAuthenticationManager/"
-                    + userName);
+            Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("/rest/user/"
+                    + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + userName);
             assertUser(userDetails);
             assertEquals("Unexpected user name", userName, userDetails.get(User.NAME));
         }
@@ -68,8 +69,8 @@ public class UserRestTest extends QpidRe
         String userName = getTestName();
         getRestTestHelper().createOrUpdateUser(userName, "newPassword");
 
-        Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("/rest/user/PrincipalDatabaseAuthenticationManager/"
-                + userName);
+        Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("/rest/user/"
+                + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + userName);
         assertUser(userDetails);
         assertEquals("Unexpected user name", userName, userDetails.get(User.NAME));
     }
@@ -79,13 +80,14 @@ public class UserRestTest extends QpidRe
         String userName = getTestName();
         getRestTestHelper().createOrUpdateUser(userName, "newPassword");
 
-        Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("/rest/user/PrincipalDatabaseAuthenticationManager/"
-                + userName);
+        Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("/rest/user/"
+                + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + userName);
         String id = (String) userDetails.get(User.ID);
 
         getRestTestHelper().removeUserById(id);
 
-        List<Map<String, Object>> users = getRestTestHelper().getJsonAsList("/rest/user/PrincipalDatabaseAuthenticationManager/" + userName);
+        List<Map<String, Object>> users = getRestTestHelper().getJsonAsList("/rest/user/"
+                + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + userName);
         assertEquals("User should be deleted", 0, users.size());
     }
 

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java Thu Jan 24 17:55:19 2013
@@ -28,8 +28,11 @@ import java.util.Properties;
 
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.security.acl.AbstractACLTestCase;
 import org.apache.qpid.systest.rest.QpidRestTestCase;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 
 public class GroupRestACLTest extends QpidRestTestCase
 {
@@ -49,15 +52,19 @@ public class GroupRestACLTest extends Qp
     public void setUp() throws Exception
     {
         _groupFile = createTemporaryGroupFile();
-
-        setConfigurationProperty("management.http.basic-auth", "true");
-        setConfigurationProperty("security.file-group-manager.attributes.attribute.name", "groupFile");
-        setConfigurationProperty("security.file-group-manager.attributes.attribute.value", _groupFile.getAbsolutePath());
+        getBrokerConfiguration().setBrokerAttribute(Broker.GROUP_FILE, _groupFile.getAbsolutePath());
 
         //DONT call super.setUp(), the tests will start the broker after configuring it
     }
 
     @Override
+    protected void customizeConfiguration() throws ConfigurationException, IOException
+    {
+        super.customizeConfiguration();
+        getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true);
+    }
+
+    @Override
     public void tearDown() throws Exception
     {
         super.tearDown();

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java Thu Jan 24 17:55:19 2013
@@ -28,8 +28,11 @@ import java.util.Properties;
 
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.security.acl.AbstractACLTestCase;
 import org.apache.qpid.systest.rest.QpidRestTestCase;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
 
@@ -49,10 +52,7 @@ public class UserRestACLTest extends Qpi
     public void setUp() throws Exception
     {
         _groupFile = createTemporaryGroupFile();
-
-        setConfigurationProperty("management.http.basic-auth", "true");
-        setConfigurationProperty("security.file-group-manager.attributes.attribute.name", "groupFile");
-        setConfigurationProperty("security.file-group-manager.attributes.attribute.value", _groupFile.getAbsolutePath());
+        getBrokerConfiguration().setBrokerAttribute(Broker.GROUP_FILE, _groupFile.getAbsolutePath());
 
         getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER, OTHER_USER);
 
@@ -60,6 +60,13 @@ public class UserRestACLTest extends Qpi
     }
 
     @Override
+    protected void customizeConfiguration() throws ConfigurationException, IOException
+    {
+        super.customizeConfiguration();
+        getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true);
+    }
+
+    @Override
     public void tearDown() throws Exception
     {
         super.tearDown();
@@ -163,7 +170,8 @@ public class UserRestACLTest extends Qpi
     private void checkPassword(String username, String password, boolean passwordExpectedToBeCorrect) throws IOException
     {
         getRestTestHelper().setUsernameAndPassword(username, password);
-        HttpURLConnection connection = getRestTestHelper().openManagementConnection("/rest/user/PrincipalDatabaseAuthenticationManager/", "GET");
+        HttpURLConnection connection = getRestTestHelper().openManagementConnection("/rest/user/"
+                + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/", "GET");
 
         boolean passwordIsCorrect = connection.getResponseCode() == HttpServletResponse.SC_OK;
 
@@ -174,14 +182,14 @@ public class UserRestACLTest extends Qpi
 
     private void assertUserDoesNotExist(String newUser) throws JsonParseException, JsonMappingException, IOException
     {
-        String path = "/rest/user/PrincipalDatabaseAuthenticationManager/" + newUser;
+        String path = "/rest/user/" + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + newUser;
         List<Map<String, Object>> userDetailsList = getRestTestHelper().getJsonAsList(path);
         assertTrue(userDetailsList.isEmpty());
     }
 
     private void assertUserExists(String username) throws IOException
     {
-        String path = "/rest/user/PrincipalDatabaseAuthenticationManager/" + username;
+        String path = "/rest/user/" + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + username;
         Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList(path);
 
         assertEquals(

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java Thu Jan 24 17:55:19 2013
@@ -63,8 +63,7 @@ public class JMSDestinationTest extends 
 
     public void setUp() throws Exception
     {
-        //Ensure JMX management is enabled for MovedToQueue test 
-        setConfigurationProperty("management.enabled", "true");
+        getBrokerConfiguration().addJmxManagementConfiguration();
 
         super.setUp();
 

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java Thu Jan 24 17:55:19 2013
@@ -54,11 +54,9 @@ public class SyncWaitDelayTest extends Q
     public void setUp() throws Exception
     {
 
-        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.class", "org.apache.qpid.server.store.SlowMessageStore");
-        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.delays.commitTran.post", String.valueOf(POST_COMMIT_DELAY));
-        setConfigurationProperty("management.enabled", "false");
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.class", "org.apache.qpid.server.store.SlowMessageStore");
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.delays.commitTran.post", String.valueOf(POST_COMMIT_DELAY));
 
-        
         super.setUp();
 
         //Set the syncWrite timeout to be just larger than the delay on the commitTran.

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java Thu Jan 24 17:55:19 2013
@@ -74,14 +74,13 @@ public class MaxDeliveryCountTest extend
     public void setUp() throws Exception
     {
         //enable DLQ/maximumDeliveryCount support for all queues at the vhost level
-        setConfigurationProperty("virtualhosts.virtualhost.test.queues.maximumDeliveryCount",
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.queues.maximumDeliveryCount",
                 String.valueOf(MAX_DELIVERY_COUNT));
-        setConfigurationProperty("virtualhosts.virtualhost.test.queues.deadLetterQueues",
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.queues.deadLetterQueues",
                                 String.valueOf(true));
 
         //Ensure management is on
-        setConfigurationProperty("management.enabled", "true");
-        setConfigurationProperty("management.ssl.enabled", "false");
+        getBrokerConfiguration().addJmxManagementConfiguration();
 
         // Set client-side flag to allow the server to determine if messages
         // dead-lettered or requeued.

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java Thu Jan 24 17:55:19 2013
@@ -73,7 +73,7 @@ public class DurableSubscriptionTest ext
 
     public void setUp() throws Exception
     {
-        setConfigurationProperty("management.enabled", "true");     
+        getBrokerConfiguration().addJmxManagementConfiguration();
         _jmxConnected=false;
         super.setUp();
     }

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java Thu Jan 24 17:55:19 2013
@@ -29,7 +29,7 @@ public class TransactionTimeoutDisabledT
     protected void configure() throws Exception
     {
         // Setup housekeeping every second
-        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100");
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100");
 
         // No transaction timeout configuration.
     }

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java Thu Jan 24 17:55:19 2013
@@ -40,28 +40,28 @@ public class TransactionTimeoutTest exte
     protected void configure() throws Exception
     {
         // Setup housekeeping every second
-        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100");
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100");
 
         if (getName().contains("ProducerIdle"))
         {
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "0");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "0");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "500");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "1500");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "0");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "0");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "500");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "1500");
         }
         else if (getName().contains("ProducerOpen"))
         {
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "1000");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "2000");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "0");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "0");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "1000");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "2000");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "0");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "0");
         }
         else
         {
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "1000");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "2000");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "500");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "1000");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "1000");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "2000");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "500");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "1000");
         }
     }
 

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java Thu Jan 24 17:55:19 2013
@@ -31,6 +31,8 @@ import org.apache.qpid.management.common
 import org.apache.qpid.management.common.mbeans.ManagedQueue;
 import org.apache.qpid.management.common.mbeans.ServerInformation;
 import org.apache.qpid.management.common.mbeans.UserManagement;
+import org.apache.qpid.server.model.Plugin;
+import org.apache.qpid.server.plugin.PluginFactory;
 
 import javax.management.InstanceNotFoundException;
 import javax.management.JMException;
@@ -45,7 +47,9 @@ import javax.management.ObjectName;
 import javax.management.remote.JMXConnector;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 /**
@@ -77,7 +81,7 @@ public class JMXTestUtils
 
     public void setUp() throws IOException, ConfigurationException, Exception
     {
-        _test.setConfigurationProperty("management.enabled", "true");
+        _test.getBrokerConfiguration().addJmxManagementConfiguration();
     }
 
     public void open() throws Exception

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java?rev=1438107&r1=1438106&r2=1438107&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java Thu Jan 24 17:55:19 2013
@@ -59,10 +59,10 @@ import org.apache.qpid.jms.BrokerDetails
 import org.apache.qpid.jms.ConnectionURL;
 import org.apache.qpid.server.BrokerLauncher;
 import org.apache.qpid.server.BrokerOptions;
-import org.apache.qpid.server.ProtocolExclusion;
-import org.apache.qpid.server.ProtocolInclusion;
 import org.apache.qpid.server.configuration.BrokerProperties;
 import org.apache.qpid.server.configuration.ServerConfiguration;
+import org.apache.qpid.server.model.Port;
+import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.protocol.AmqpProtocolVersion;
 import org.apache.qpid.server.store.MessageStoreConstants;
 import org.apache.qpid.server.store.derby.DerbyMessageStore;
@@ -85,9 +85,9 @@ public class QpidBrokerTestCase extends 
     public static final String GUEST_PASSWORD = "guest";
 
     protected final static String QpidHome = System.getProperty("QPID_HOME");
-    protected File _configFile = new File(System.getProperty("broker.config"));
+    protected final File _configFile = new File(System.getProperty("broker.config"));
     protected File _logConfigFile = new File(System.getProperty("log4j.configuration"));
-
+    protected final String _brokerStoreType = System.getProperty("broker.config-store-type", "json");
     protected static final Logger _logger = Logger.getLogger(QpidBrokerTestCase.class);
     protected static final int LOGMONITOR_TIMEOUT = 5000;
 
@@ -95,7 +95,7 @@ public class QpidBrokerTestCase extends 
 
     private Map<String, String> _propertiesSetForBroker = new HashMap<String, String>();
 
-    private XMLConfiguration _testConfiguration = new XMLConfiguration();
+    private Map<Integer, TestBrokerConfiguration> _brokerConfigurations;
     private XMLConfiguration _testVirtualhosts = new XMLConfiguration();
 
     protected static final String INDEX = "index";
@@ -115,12 +115,10 @@ public class QpidBrokerTestCase extends 
 
     // system properties
     private static final String TEST_VIRTUALHOSTS = "test.virtualhosts";
-    private static final String TEST_CONFIG = "test.config";
     private static final String BROKER_LANGUAGE = "broker.language";
     protected static final String BROKER_TYPE = "broker.type";
     private static final String BROKER_COMMAND = "broker.command";
     private static final String BROKER_CLEAN_BETWEEN_TESTS = "broker.clean.between.tests";
-    private static final String BROKER_EXISTING_QPID_WORK = "broker.existing.qpid.work";
     private static final String BROKER_VERSION = "broker.version";
     protected static final String BROKER_READY = "broker.ready";
     private static final String BROKER_STOPPED = "broker.stopped";
@@ -128,8 +126,6 @@ public class QpidBrokerTestCase extends 
     private static final String BROKER_LOG_INTERLEAVE = "broker.log.interleave";
     private static final String BROKER_LOG_PREFIX = "broker.log.prefix";
     private static final String BROKER_PERSITENT = "broker.persistent";
-    public static final String BROKER_PROTOCOL_EXCLUDES = "broker.protocol.excludes";
-    public static final String BROKER_PROTOCOL_INCLUDES = "broker.protocol.includes";
     public static final String PROFILE_USE_SSL = "profile.use_ssl";
 
     // values
@@ -138,7 +134,6 @@ public class QpidBrokerTestCase extends 
 
     protected static final String QPID_HOME = "QPID_HOME";
 
-    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 FAILING_PORT = Integer.parseInt(System.getProperty("test.port.alt"));
     public static final int DEFAULT_MANAGEMENT_PORT = Integer.getInteger("test.mport", ServerConfiguration.DEFAULT_JMXPORT_REGISTRYSERVER);
@@ -188,14 +183,49 @@ public class QpidBrokerTestCase extends 
     }
     private MessageType _messageType  = MessageType.TEXT;
 
-    public QpidBrokerTestCase(String name)
-    {
-        super(name);
-    }
-    
+
     public QpidBrokerTestCase()
     {
         super();
+
+        _brokerConfigurations = new HashMap<Integer, TestBrokerConfiguration>();
+    }
+
+    public TestBrokerConfiguration getBrokerConfiguration(int port)
+    {
+        int actualPort = getPort(port);
+
+        synchronized (_brokerConfigurations)
+        {
+            TestBrokerConfiguration configuration = _brokerConfigurations.get(actualPort);
+            if (configuration == null)
+            {
+                configuration = createBrokerConfiguration(actualPort);
+            }
+            return configuration;
+        }
+    }
+
+    public TestBrokerConfiguration getBrokerConfiguration()
+    {
+        return getBrokerConfiguration(DEFAULT_PORT);
+    }
+
+    public TestBrokerConfiguration createBrokerConfiguration(int port)
+    {
+        int actualPort = getPort(port);
+        TestBrokerConfiguration  configuration = new TestBrokerConfiguration(System.getProperty(_brokerStoreType), _configFile.getAbsolutePath());
+        synchronized (_brokerConfigurations)
+        {
+            _brokerConfigurations.put(actualPort, configuration);
+        }
+        if (actualPort != DEFAULT_PORT)
+        {
+            configuration.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT, Port.PORT, actualPort);
+            configuration.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_RMI_PORT, Port.PORT, getManagementPort(actualPort));
+            configuration.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_JMX_PORT, Port.PORT, getManagementPort(actualPort) + ServerConfiguration.JMXPORT_CONNECTORSERVER_OFFSET);
+        }
+        return configuration;
     }
 
     public Logger getLogger()
@@ -287,16 +317,6 @@ public class QpidBrokerTestCase extends 
             fail("Unable to test without config file:" + _configFile);
         }
 
-        String existingQpidWorkPath = System.getProperty(BROKER_EXISTING_QPID_WORK);
-        if(existingQpidWorkPath != null && !existingQpidWorkPath.equals(""))
-        {
-
-            String qpidWork = getQpidWork(_brokerType, getPort());
-            File existing = new File(existingQpidWorkPath);
-            cleanBrokerWork(qpidWork);
-            FileUtils.copyRecursive(existing, new File(qpidWork));
-        }
-
         startBroker();
     }
 
@@ -352,20 +372,14 @@ public class QpidBrokerTestCase extends 
         }
     }
 
-    protected String getBrokerCommand(int port) throws MalformedURLException
+    protected String getBrokerCommand(int port, String configPath) throws MalformedURLException
     {
-        final int sslPort = port-1;
-        final String protocolExcludesList = getProtocolExcludesList(port, sslPort);
-        final String protocolIncludesList = getProtocolIncludesList(port, sslPort);
-
         return _brokerCommand
-                .replace("@PORT", "" + port)
-                .replace("@SSL_PORT", "" + sslPort)
-                .replace("@MPORT", "" + getManagementPort(port))
-                .replace("@CONFIG_FILE", _configFile.toString())
+                .replace("@STORE_PATH", configPath)
+                .replace("@STORE_TYPE", "json")
                 .replace("@LOG_CONFIG_FILE", _logConfigFile.toString())
-                .replace("@EXCLUDES", protocolExcludesList)
-                .replace("@INCLUDES", protocolIncludesList);
+                // for cpp profile only
+                .replace("@PORT", "" + port);
     }
 
     public void startBroker() throws Exception
@@ -375,16 +389,18 @@ public class QpidBrokerTestCase extends 
 
     public void startBroker(int port) throws Exception
     {
-        startBroker(port, _testConfiguration, _testVirtualhosts);
+        int actualPort = getPort(port);
+        TestBrokerConfiguration configuration = getBrokerConfiguration(actualPort);
+        startBroker(actualPort, configuration, _testVirtualhosts);
     }
 
-    public void startBroker(int port, XMLConfiguration testConfiguration, XMLConfiguration virtualHosts) throws Exception
+    public void startBroker(int port, TestBrokerConfiguration testConfiguration, XMLConfiguration virtualHosts) throws Exception
     {
         port = getPort(port);
-
-        // Save any configuration changes that have been made
         String testConfig = saveTestConfiguration(port, testConfiguration);
         String virtualHostsConfig = saveTestVirtualhosts(port, virtualHosts);
+        _logger.info("Set test.virtualhosts property to: " + virtualHostsConfig);
+        setSystemProperty(TEST_VIRTUALHOSTS, virtualHostsConfig);
 
         if(_brokers.get(port) != null)
         {
@@ -396,19 +412,13 @@ public class QpidBrokerTestCase extends 
         if (_brokerType.equals(BrokerType.INTERNAL) && !existingInternalBroker())
         {
             setSystemProperty(BrokerProperties.PROPERTY_USE_CUSTOM_RMI_SOCKET_FACTORY, "false");
-            testConfig = saveTestConfiguration(port, testConfiguration);
-            _logger.info("Set test.config property to: " + testConfig);
-            _logger.info("Set test.virtualhosts property to: " + virtualHostsConfig);
-            setSystemProperty(TEST_CONFIG, testConfig);
-            setSystemProperty(TEST_VIRTUALHOSTS, virtualHostsConfig);
 
             BrokerOptions options = new BrokerOptions();
-            options.setConfigFile(_configFile.getAbsolutePath());
-            options.addPort(port);
 
-            addExcludedPorts(port, DEFAULT_SSL_PORT, options);
-            addIncludedPorts(port, DEFAULT_SSL_PORT, options);
+            options.setConfigurationStoreType(_brokerStoreType);
+            options.setConfigurationStoreLocation(testConfig);
 
+            options.addPort(port);
             options.setJmxPortRegistryServer(getManagementPort(port));
 
             //Set the log config file, relying on the log4j.configuration system property
@@ -425,7 +435,7 @@ public class QpidBrokerTestCase extends 
         {
             // Add the port to QPID_WORK to ensure unique working dirs for multi broker tests
             final String qpidWork = getQpidWork(_brokerType, port);
-            String cmd = getBrokerCommand(port);
+            String cmd = getBrokerCommand(port, testConfig);
             _logger.info("starting external broker: " + cmd);
             ProcessBuilder pb = new ProcessBuilder(cmd.split("\\s+"));
             pb.redirectErrorStream(true);
@@ -461,17 +471,13 @@ public class QpidBrokerTestCase extends 
             // Add default test logging levels that are used by the log4j-test
             // Use the convenience methods to push the current logging setting
             // in to the external broker's QPID_OPTS string.
-            if (System.getProperty("amqj.protocol.logging.level") != null)
-            {
-                setSystemProperty("amqj.protocol.logging.level");
-            }
-            if (System.getProperty("root.logging.level") != null)
-            {
-                setSystemProperty("root.logging.level");
-            }
+            setSystemProperty("amqj.protocol.logging.level");
+            setSystemProperty("root.logging.level");
+            setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_EXCLUDES);
+            setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_INCLUDES);
 
             // set test.config and test.virtualhosts
-            String qpidOpts = " -D" + TEST_CONFIG + "=" + testConfig + " -D" + TEST_VIRTUALHOSTS + "=" + virtualHostsConfig;
+            String qpidOpts = " -D" + TEST_VIRTUALHOSTS + "=" + virtualHostsConfig;
 
             // Add all the specified system properties to QPID_OPTS
             if (!_propertiesSetForBroker.isEmpty())
@@ -487,9 +493,6 @@ public class QpidBrokerTestCase extends 
             }
             processEnv.put("QPID_OPTS", qpidOpts);
 
-            _logger.info("Set test.config property to: " + testConfig);
-            _logger.info("Set test.virtualhosts property to: " + virtualHostsConfig);
-
             // cpp broker requires that the work directory is created
             createBrokerWork(qpidWork);
 
@@ -530,64 +533,6 @@ public class QpidBrokerTestCase extends 
         }
     }
 
-    private void addExcludedPorts(int port, int sslPort, BrokerOptions options)
-    {
-        final String protocolExcludesList = getProtocolExcludesList(port, sslPort);
-
-        if (protocolExcludesList.equals(""))
-        {
-            return;
-        }
-        final String[] toks = protocolExcludesList.split("\\s");
-
-        if(toks.length % 2 != 0)
-        {
-            throw new IllegalArgumentException("Must be an even number of tokens in '" + protocolExcludesList + "'");
-        }
-        for (int i = 0; i < toks.length; i=i+2)
-        {
-            String excludeArg = toks[i];
-            final int excludedPort = Integer.parseInt(toks[i+1]);
-            options.addExcludedPort(ProtocolExclusion.lookup(excludeArg), excludedPort);
-
-            _logger.info("Adding protocol exclusion " + excludeArg + " " + excludedPort);
-        }
-    }
-
-    protected String getProtocolExcludesList(int port, int sslPort)
-    {
-        return System.getProperty(BROKER_PROTOCOL_EXCLUDES,"").replace("@PORT", "" + port).replace("@SSL_PORT", "" + sslPort);
-    }
-
-    private String getProtocolIncludesList(int port, int sslPort)
-    {
-        return System.getProperty(BROKER_PROTOCOL_INCLUDES, "").replace("@PORT", "" + port).replace("@SSL_PORT", "" + sslPort);
-    }
-
-    private void addIncludedPorts(int port, int sslPort, BrokerOptions options)
-    {
-        final String protocolIncludesList = getProtocolIncludesList(port, sslPort);
-
-        if (protocolIncludesList.equals(""))
-        {
-            return;
-        }
-        final String[] toks = protocolIncludesList.split("\\s");
-
-        if(toks.length % 2 != 0)
-        {
-            throw new IllegalArgumentException("Must be an even number of tokens in '" + protocolIncludesList + "'");
-        }
-        for (int i = 0; i < toks.length; i=i+2)
-        {
-            String includeArg = toks[i];
-            final int includedPort = Integer.parseInt(toks[i+1]);
-            options.addIncludedPort(ProtocolInclusion.lookup(includeArg), includedPort);
-
-            _logger.info("Adding protocol inclusion " + includeArg + " " + includedPort);
-        }
-    }
-
     private boolean existingInternalBroker()
     {
         for(BrokerHolder holder : _brokers.values())
@@ -618,7 +563,7 @@ public class QpidBrokerTestCase extends 
 
     public String getTestConfigFile(int port)
     {
-        return _output + "/" + getTestQueueName() + "-" + port + "-config.xml";
+        return _output + "/" + getTestQueueName() + "-" + port + "-config";
     }
 
     public String getTestVirtualhostsFile(int port)
@@ -631,45 +576,30 @@ public class QpidBrokerTestCase extends 
         return file.replace(System.getProperty(QPID_HOME,"QPID_HOME") + "/","");
     }
 
-    protected void saveTestConfiguration() throws ConfigurationException
+    private String relativeToWorkingDirectory(String file)
     {
-        String relative = saveTestConfiguration(getPort(), _testConfiguration);
-        _logger.info("Set test.config property to: " + relative);
-        setSystemProperty(TEST_CONFIG, relative);
+        File configLocation = new File(file);
+        File workingDirectory = new File(System.getProperty("user.dir"));
+        return configLocation.getAbsolutePath().replace(workingDirectory.getAbsolutePath(), "").substring(1);
     }
 
-    protected String saveTestConfiguration(int port, XMLConfiguration testConfiguration) throws ConfigurationException
+    protected String saveTestConfiguration(int port, TestBrokerConfiguration testConfiguration) throws ConfigurationException
     {
         // Specify the test config file
         String testConfig = getTestConfigFile(port);
-        String relative = relativeToQpidHome(testConfig);
-
-        _logger.info("Saving test virtualhosts file at: " + testConfig);
+        String relative = relativeToWorkingDirectory(testConfig);
+        _logger.info("Saving test broker configuration at: " + testConfig);
 
-        // Create the file if configuration does not exist
-        if (testConfiguration.isEmpty())
-        {
-            testConfiguration.addProperty("__ignore", "true");
-        }
-        testConfiguration.save(testConfig);
+        testConfiguration.save(new File(testConfig));
         return relative;
     }
 
-    protected void saveTestVirtualhosts() throws ConfigurationException
-    {
-        String relative = saveTestVirtualhosts(getPort(), _testVirtualhosts);
-        _logger.info("Set test.virtualhosts property to: " + relative);
-        setSystemProperty(TEST_VIRTUALHOSTS, relative);
-    }
-
     protected String saveTestVirtualhosts(int port, XMLConfiguration virtualHostConfiguration) throws ConfigurationException
     {
         // Specify the test virtualhosts file
         String testVirtualhosts = getTestVirtualhostsFile(port);
         String relative = relativeToQpidHome(testVirtualhosts);
 
-        _logger.info("Set test.virtualhosts property to: " + testVirtualhosts);
-
         // Create the file if configuration does not exist
         if (virtualHostConfiguration.isEmpty())
         {
@@ -817,11 +747,12 @@ public class QpidBrokerTestCase extends 
 
     /**
      * Creates a new virtual host within the test virtualhost file.
-     *
+     * @param brokerPort broker port
      * @param virtualHostName virtual host name
+     *
      * @throws ConfigurationException
      */
-    protected void createTestVirtualHost(String virtualHostName) throws ConfigurationException
+    protected void createTestVirtualHost(int brokerPort, String virtualHostName) throws ConfigurationException
     {
         String storeClassName = getTestProfileMessageStoreClassName();
 
@@ -843,29 +774,13 @@ public class QpidBrokerTestCase extends 
         {
             _testVirtualhosts.setProperty("virtualhost." + virtualHostName + ".store." + MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY, storeDir);
         }
-    }
-
-    /**
-     * Get a property value from the current configuration file.
-     *
-     * @param property the property to lookup
-     *
-     * @return the requested String Value
-     *
-     * @throws org.apache.commons.configuration.ConfigurationException
-     *
-     */
-    protected String getConfigurationStringProperty(String property) throws ConfigurationException
-    {
-        // Call save Configuration to be sure we have saved the test specific
-        // file. As the optional status
-        saveTestConfiguration();
-        saveTestVirtualhosts();
 
-        ServerConfiguration configuration = new ServerConfiguration(_configFile);
-        // Don't need to configuration.configure() here as we are just pulling
-        // values directly by String.
-        return configuration.getConfig().getString(property);
+        // add new virtual host configuration to the broker store
+        Map<String, Object> attributes = new HashMap<String, Object>();
+        attributes.put(VirtualHost.NAME, virtualHostName);
+        attributes.put(VirtualHost.CONFIG_PATH,  System.getProperty("broker.virtualhosts-config"));
+        int port = getPort(brokerPort);
+        getBrokerConfiguration(port).addHostConfiguration(attributes);
     }
 
     /**
@@ -882,7 +797,7 @@ public class QpidBrokerTestCase extends 
      *
      * @throws ConfigurationException when loading the current config file
      */
-    public void setConfigurationProperty(String property, String value) throws ConfigurationException
+    public void setVirtualHostConfigurationProperty(String property, String value) throws ConfigurationException
     {
         // Choose which file to write the property to based on prefix.
         if (property.startsWith("virtualhosts"))
@@ -891,7 +806,7 @@ public class QpidBrokerTestCase extends 
         }
         else
         {
-            _testConfiguration.setProperty(property, value);
+            throw new ConfigurationException("Cannot set broker configuration as property");
         }
     }
 
@@ -926,7 +841,11 @@ public class QpidBrokerTestCase extends 
      */
     protected void setSystemProperty(String property)
     {
-        setSystemProperty(property, System.getProperty(property));
+        String value = System.getProperty(property);
+        if (value != null)
+        {
+            setSystemProperty(property, value);
+        }
     }
 
     /**
@@ -946,7 +865,14 @@ public class QpidBrokerTestCase extends 
     protected void setSystemProperty(String property, String value)
     {
         // Record the value for the external broker
-        _propertiesSetForBroker.put(property, value);
+        if (value == null)
+        {
+            _propertiesSetForBroker.remove(property);
+        }
+        else
+        {
+            _propertiesSetForBroker.put(property, value);
+        }
 
         //Set the value for the test client vm aswell.
         setTestClientSystemProperty(property, value);
@@ -1395,13 +1321,4 @@ public class QpidBrokerTestCase extends 
         _testVirtualhosts = testVirtualhosts;
     }
 
-    public XMLConfiguration getTestConfiguration()
-    {
-        return _testConfiguration;
-    }
-
-    public void setTestConfiguration(XMLConfiguration testConfiguration)
-    {
-        _testConfiguration = testConfiguration;
-    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org