You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2013/02/28 17:14:57 UTC

svn commit: r1451244 [42/45] - in /qpid/branches/asyncstore: ./ bin/ cpp/ cpp/bindings/ cpp/bindings/qmf/ cpp/bindings/qmf/python/ cpp/bindings/qmf/ruby/ cpp/bindings/qmf2/ cpp/bindings/qmf2/examples/cpp/ cpp/bindings/qmf2/python/ cpp/bindings/qmf2/rub...

Modified: qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-bdb-settings.xml
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-bdb-settings.xml?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-bdb-settings.xml (original)
+++ qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-bdb-settings.xml Thu Feb 28 16:14:30 2013
@@ -20,37 +20,13 @@
  -
  -->
 <virtualhosts>
-    <work>${QPID_WORK}</work>
-
-    <virtualhost>
-        <name>localhost</name>
-        <localhost>
-            <store>
-                <class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class>
-                <environment-path>${work}/bdbstore/localhost-store</environment-path>
-            </store>
-        </localhost>
-    </virtualhost>
-
-    <virtualhost>
-        <name>development</name>
-        <development>
-            <store>
-                <class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class>
-                <environment-path>${work}/bdbstore/development-store</environment-path>
-            </store>
-        </development>
-    </virtualhost>
-
     <virtualhost>
         <name>test</name>
         <test>
             <store>
                 <class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class>
-                <environment-path>${work}/bdbstore/test-store</environment-path>
+                <environment-path>${QPID_WORK}/test-store</environment-path>
             </store>
         </test>
     </virtualhost>
 </virtualhosts>
-
-

Modified: qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml (original)
+++ qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml Thu Feb 28 16:14:30 2013
@@ -20,35 +20,12 @@
  -
  -->
 <virtualhosts>
-    <directory>${QPID_HOME}/virtualhosts</directory>
-    <default>test</default>
-    
-    <virtualhost>
-        <localhost>
-            <store>
-                <factoryclass>org.apache.qpid.server.store.derby.DerbyMessageStoreFactory</factoryclass>
-                <environment-path>:memory:</environment-path>
-            </store>
-        </localhost>
-    </virtualhost>
-
-    <virtualhost>
-        <development>
-            <store>
-                <factoryclass>org.apache.qpid.server.store.derby.DerbyMessageStoreFactory</factoryclass>
-                <environment-path>:memory:</environment-path>
-            </store>
-        </development>
-    </virtualhost>
-
     <virtualhost>
         <test>
             <store>
-                <factoryclass>org.apache.qpid.server.store.derby.DerbyMessageStoreFactory</factoryclass>
+                <class>org.apache.qpid.server.store.derby.DerbyMessageStore</class>
                 <environment-path>:memory:</environment-path>
             </store>
         </test>
     </virtualhost>
 </virtualhosts>
-
-

Modified: qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-derby-settings.xml
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-derby-settings.xml?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-derby-settings.xml (original)
+++ qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-derby-settings.xml Thu Feb 28 16:14:30 2013
@@ -20,35 +20,12 @@
  -
  -->
 <virtualhosts>
-    <directory>${QPID_HOME}/virtualhosts</directory>
-    <default>test</default>
-    
-    <virtualhost>
-        <localhost>
-            <store>
-                <class>org.apache.qpid.server.store.derby.DerbyMessageStore</class>
-                <environment-path>${QPID_WORK}/derbyDB/localhost-store</environment-path>
-            </store>
-        </localhost>
-    </virtualhost>
-
-    <virtualhost>
-        <development>
-            <store>
-                <class>org.apache.qpid.server.store.derby.DerbyMessageStore</class>
-                <environment-path>${QPID_WORK}/derbyDB/development-store</environment-path>
-            </store>
-        </development>
-    </virtualhost>
-
     <virtualhost>
         <test>
             <store>
                 <class>org.apache.qpid.server.store.derby.DerbyMessageStore</class>
-                <environment-path>${QPID_WORK}/derbyDB/test-store</environment-path>
+                <environment-path>${QPID_WORK}/test-store</environment-path>
             </store>
         </test>
     </virtualhost>
 </virtualhosts>
-
-

Modified: qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-settings.xml
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-settings.xml?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-settings.xml (original)
+++ qpid/branches/asyncstore/java/systests/etc/virtualhosts-systests-settings.xml Thu Feb 28 16:14:30 2013
@@ -22,136 +22,11 @@
 <virtualhosts>
     <default>test</default>
     <virtualhost>
-        <name>localhost</name>
-        <localhost>
-            <store>
-                <class>org.apache.qpid.server.store.MemoryMessageStore</class>
-            </store>
-
-            <housekeeping>
-                <threadCount>2</threadCount>
-                <checkPeriod>20000</checkPeriod>
-            </housekeeping>
-
-            <exchanges>
-                <exchange>
-                    <type>direct</type>
-                    <name>test.direct</name>
-                    <durable>true</durable>
-                </exchange>
-                <exchange>
-                    <type>topic</type>
-                    <name>test.topic</name>
-                </exchange>
-            </exchanges>
-            <queues>
-                <exchange>amq.direct</exchange>
-                <maximumQueueDepth>4235264</maximumQueueDepth>
-                <!-- 4Mb -->
-                <maximumMessageSize>2117632</maximumMessageSize>
-                <!-- 2Mb -->
-                <maximumMessageAge>600000</maximumMessageAge>
-                <!-- 10 mins -->
-                <maximumMessageCount>50</maximumMessageCount>
-                <!-- 50 messages -->
-
-                <queue>
-                    <name>queue</name>
-                </queue>
-                <queue>
-                    <name>ping</name>
-                </queue>
-                <queue>
-                    <name>test-queue</name>
-                    <test-queue>
-                        <exchange>test.direct</exchange>
-                        <durable>true</durable>
-                    </test-queue>
-                </queue>
-                <queue>
-                    <name>test-ping</name>
-                    <test-ping>
-                        <exchange>test.direct</exchange>
-                    </test-ping>
-                </queue>
-
-            </queues>
-        </localhost>
-    </virtualhost>
-
-
-    <virtualhost>
-        <name>development</name>
-        <development>
-            <store>
-                <class>org.apache.qpid.server.store.MemoryMessageStore</class>
-            </store>
-
-            <queues>
-                <minimumAlertRepeatGap>30000</minimumAlertRepeatGap>
-                <maximumMessageCount>50</maximumMessageCount>
-                <queue>
-                    <name>queue</name>
-                    <queue>
-                        <exchange>amq.direct</exchange>
-                        <maximumQueueDepth>4235264</maximumQueueDepth>
-                        <!-- 4Mb -->
-                        <maximumMessageSize>2117632</maximumMessageSize>
-                        <!-- 2Mb -->
-                        <maximumMessageAge>600000</maximumMessageAge>
-                        <!-- 10 mins -->
-                    </queue>
-                </queue>
-                <queue>
-                    <name>ping</name>
-                    <ping>
-                        <exchange>amq.direct</exchange>
-                        <maximumQueueDepth>4235264</maximumQueueDepth>
-                        <!-- 4Mb -->
-                        <maximumMessageSize>2117632</maximumMessageSize>
-                        <!-- 2Mb -->
-                        <maximumMessageAge>600000</maximumMessageAge>
-                        <!-- 10 mins -->
-                    </ping>
-                </queue>
-            </queues>
-        </development>
-    </virtualhost>
-    <virtualhost>
         <name>test</name>
         <test>
             <store>
                 <class>org.apache.qpid.server.store.MemoryMessageStore</class>
             </store>
-
-            <queues>
-                <minimumAlertRepeatGap>30000</minimumAlertRepeatGap>
-                <maximumMessageCount>50</maximumMessageCount>
-                <queue>
-                    <name>queue</name>
-                    <queue>
-                        <exchange>amq.direct</exchange>
-                        <maximumQueueDepth>4235264</maximumQueueDepth>
-                        <!-- 4Mb -->
-                        <maximumMessageSize>2117632</maximumMessageSize>
-                        <!-- 2Mb -->
-                        <maximumMessageAge>600000</maximumMessageAge>
-                        <!-- 10 mins -->
-                    </queue>
-                </queue>
-                <queue>
-                    <name>ping</name>
-                    <ping>
-                        <exchange>amq.direct</exchange>
-                        <maximumQueueDepth>4235264</maximumQueueDepth>
-                        <!-- 4Mb -->
-                        <maximumMessageSize>2117632</maximumMessageSize>
-                        <!-- 2Mb -->
-                        <maximumMessageAge>600000</maximumMessageAge>
-                        <!-- 10 mins -->
-                    </ping>
-                </queue>
-            </queues>
         </test>
     </virtualhost>
 </virtualhosts>

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java Thu Feb 28 16:14:30 2013
@@ -27,7 +27,6 @@ import org.apache.qpid.framing.AMQShortS
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 
 import javax.jms.Connection;
-import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
@@ -72,10 +71,11 @@ public class AMQQueueDeferredOrderingTes
                 for (int i = start; i < end && !interrupted(); i++)
                 {
                     producer.send(session.createTextMessage(Integer.toString(i)));
+                    ((AMQSession<?, ?>)session).sync();
                 }
                 this._logger.info("Sent " + (end - start) + " messages");
             }
-            catch (JMSException e)
+            catch (Exception e)
             {
                 throw new RuntimeException(e);
             }
@@ -101,7 +101,7 @@ public class AMQQueueDeferredOrderingTes
         con.start();
     }
 
-    public void testPausedOrder() throws Exception
+    public void testMessagesSentByTwoThreadsAreDeliveredInOrder() throws Exception
     {
 
         // Setup initial messages
@@ -121,9 +121,9 @@ public class AMQQueueDeferredOrderingTes
         for (int i = 0; i < numMessages; i++)
         {
             Message msg = consumer.receive(3000);
-            assertNotNull("Message should not be null", msg);
-            assertTrue("Message should be a text message", msg instanceof TextMessage);
-            assertEquals("Message content does not match expected", Integer.toString(i), ((TextMessage) msg).getText());
+            assertNotNull("Message " + i + " should not be null", msg);
+            assertTrue("Message " + i + " should be a text message", msg instanceof TextMessage);
+            assertEquals("Message content " + i + "does not match expected", Integer.toString(i), ((TextMessage) msg).getText());
         }
     }
 

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java Thu Feb 28 16:14:30 2013
@@ -25,11 +25,12 @@ import org.apache.qpid.client.AMQSession
 import org.apache.qpid.framing.AMQShortString;
 import org.apache.qpid.jms.BrokerDetails;
 import org.apache.qpid.jms.ConnectionListener;
-import org.apache.qpid.jms.ConnectionURL;
 import org.apache.qpid.jms.FailoverPolicy;
 import org.apache.qpid.test.utils.FailoverBaseCase;
+import org.apache.qpid.url.URLSyntaxException;
 
 import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
 import javax.jms.Destination;
 import javax.jms.ExceptionListener;
 import javax.jms.JMSException;
@@ -929,18 +930,22 @@ public class FailoverBehaviourTest exten
         return queue;
     }
 
-    private AMQConnection createConnectionWithFailover() throws NamingException, JMSException
+    private AMQConnection createConnectionWithFailover() throws NamingException, JMSException, URLSyntaxException
     {
-        AMQConnection connection;
-        AMQConnectionFactory connectionFactory = (AMQConnectionFactory)getConnectionFactory("default");
-        ConnectionURL connectionURL = connectionFactory.getConnectionURL();
-        connectionURL.setOption(ConnectionURL.OPTIONS_FAILOVER, "singlebroker");
-        connectionURL.setOption(ConnectionURL.OPTIONS_FAILOVER_CYCLE, "2");
-        BrokerDetails details = connectionURL.getBrokerDetails(0);
-        details.setProperty(BrokerDetails.OPTIONS_RETRY, "200");
-        details.setProperty(BrokerDetails.OPTIONS_CONNECT_DELAY, "1000");
+        BrokerDetails origBrokerDetails = ((AMQConnectionFactory) getConnectionFactory("default")).getConnectionURL().getBrokerDetails(0);
 
-        connection = (AMQConnection)connectionFactory.createConnection("admin", "admin");
+        String retries = "200";
+        String connectdelay = "1000";
+        String cycleCount = "2";
+
+        String newUrlFormat="amqp://username:password@clientid/test?brokerlist=" +
+                            "'tcp://%s:%s?retries='%s'&connectdelay='%s''&failover='singlebroker?cyclecount='%s''";
+
+        String newUrl = String.format(newUrlFormat, origBrokerDetails.getHost(), origBrokerDetails.getPort(),
+                                                    retries, connectdelay, cycleCount);
+
+        ConnectionFactory connectionFactory = new AMQConnectionFactory(newUrl);
+        AMQConnection connection = (AMQConnection) connectionFactory.createConnection("admin", "admin");
         connection.setConnectionListener(this);
         return connection;
     }
@@ -1313,7 +1318,7 @@ public class FailoverBehaviourTest exten
      * @param acknowledgeMode session acknowledge mode
      * @throws JMSException
      */
-    private void sessionCloseWhileFailoverImpl(int acknowledgeMode) throws JMSException
+    private void sessionCloseWhileFailoverImpl(int acknowledgeMode) throws Exception
     {
         initDelayedFailover(acknowledgeMode);
 
@@ -1324,9 +1329,14 @@ public class FailoverBehaviourTest exten
 
         failBroker(getFailingPort());
 
+        // wait until failover is started
+        _failoverStarted.await(5, TimeUnit.SECONDS);
+
         // test whether session#close blocks while failover is in progress
         _consumerSession.close();
 
+        assertTrue("Failover has not completed yet but session was closed", _failoverComplete.await(5, TimeUnit.SECONDS));
+
         assertFailoverException();
     }
 
@@ -1360,10 +1370,8 @@ public class FailoverBehaviourTest exten
      * @param acknowledgeMode session acknowledge mode
      * @throws JMSException
      */
-    private void browserCloseWhileFailoverImpl(int acknowledgeMode) throws JMSException
+    private void browserCloseWhileFailoverImpl(int acknowledgeMode) throws Exception
     {
-        setDelayedFailoverPolicy();
-
         QueueBrowser browser = prepareQueueBrowser(acknowledgeMode);
 
         @SuppressWarnings("unchecked")
@@ -1373,8 +1381,13 @@ public class FailoverBehaviourTest exten
 
         failBroker(getFailingPort());
 
+        // wait until failover is started
+        _failoverStarted.await(5, TimeUnit.SECONDS);
+
         browser.close();
 
+        assertTrue("Failover has not completed yet but browser was closed", _failoverComplete.await(5, TimeUnit.SECONDS));
+
         assertFailoverException();
     }
 
@@ -1402,5 +1415,11 @@ public class FailoverBehaviourTest exten
         ((AMQConnection) _connection).setFailoverPolicy(failoverPolicy);
         return failoverPolicy;
     }
-    
+
+    @Override
+    public void failBroker(int port)
+    {
+        killBroker(port);
+    }
+
 }

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java Thu Feb 28 16:14:30 2013
@@ -20,54 +20,55 @@
  */
 package org.apache.qpid.client.ssl;
 
-import org.apache.qpid.client.AMQConnection;
+import static org.apache.qpid.test.utils.TestSSLConstants.KEYSTORE;
+import static org.apache.qpid.test.utils.TestSSLConstants.KEYSTORE_PASSWORD;
+import static org.apache.qpid.test.utils.TestSSLConstants.TRUSTSTORE;
+import static org.apache.qpid.test.utils.TestSSLConstants.TRUSTSTORE_PASSWORD;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.client.AMQConnectionURL;
 import org.apache.qpid.client.AMQTestConnection_0_10;
+import org.apache.qpid.jms.ConnectionURL;
+import org.apache.qpid.server.model.Port;
+import org.apache.qpid.server.model.Transport;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
-import org.apache.qpid.transport.Connection;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 
+import javax.jms.Connection;
+import javax.jms.JMSException;
 import javax.jms.Session;
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
 
 public class SSLTest extends QpidBrokerTestCase
 {
-    private static final String KEYSTORE = "test-profiles/test_resources/ssl/java_client_keystore.jks";
-    private static final String KEYSTORE_PASSWORD = "password";
-    private static final String TRUSTSTORE = "test-profiles/test_resources/ssl/java_client_truststore.jks";
-    private static final String TRUSTSTORE_PASSWORD = "password";
     private static final String CERT_ALIAS_APP1 = "app1";
     private static final String CERT_ALIAS_APP2 = "app2";
 
     @Override
     protected void setUp() throws Exception
     {
-        if(isJavaBroker())
-        {
-            setTestClientSystemProperty("profile.use_ssl", "true");
-            setConfigurationProperty("connector.ssl.enabled", "true");
-            setConfigurationProperty("connector.ssl.sslOnly", "true");
-            setConfigurationProperty("connector.ssl.wantClientAuth", "true");
-        }
-
-        // set the ssl system properties
-        setSystemProperty("javax.net.ssl.keyStore", KEYSTORE);
-        setSystemProperty("javax.net.ssl.keyStorePassword", KEYSTORE_PASSWORD);
-        setSystemProperty("javax.net.ssl.trustStore", TRUSTSTORE);
-        setSystemProperty("javax.net.ssl.trustStorePassword", TRUSTSTORE_PASSWORD);
         setSystemProperty("javax.net.debug", "ssl");
-        super.setUp();
+
+        setSslStoreSystemProperties();
+
+        //We dont call super.setUp, the tests start the broker after deciding
+        //whether to run and then configuring it appropriately
     }
 
     public void testCreateSSLConnectionUsingConnectionURLParams() throws Exception
     {
-        if (Boolean.getBoolean("profile.use_ssl"))
+        if (shouldPerformTest())
         {
-            // Clear the ssl system properties
-            setSystemProperty("javax.net.ssl.keyStore", null);
-            setSystemProperty("javax.net.ssl.keyStorePassword", null);
-            setSystemProperty("javax.net.ssl.trustStore", null);
-            setSystemProperty("javax.net.ssl.trustStorePassword", null);
+            clearSslStoreSystemProperties();
             
+            //Start the broker (NEEDing client certificate authentication)
+            configureJavaBrokerIfNecessary(true, true, true, false);
+            super.setUp();
+
             String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:%s" +
             "?ssl='true'&ssl_verify_hostname='true'" + 
             "&key_store='%s'&key_store_password='%s'" +
@@ -76,24 +77,75 @@ public class SSLTest extends QpidBrokerT
             
             url = String.format(url,QpidBrokerTestCase.DEFAULT_SSL_PORT,
                     KEYSTORE,KEYSTORE_PASSWORD,TRUSTSTORE,TRUSTSTORE_PASSWORD);
-            
-            AMQConnection con = new AMQConnection(url);
+
+            Connection con = getConnection(new AMQConnectionURL(url));
             assertNotNull("connection should be successful", con);
             Session ssn = con.createSession(false,Session.AUTO_ACKNOWLEDGE); 
             assertNotNull("create session should be successful", ssn);
-        }        
+        }
+    }
+
+    /**
+     * Create an SSL connection using the SSL system properties for the trust and key store, but using
+     * the {@link ConnectionURL} ssl='true' option to indicate use of SSL at a Connection level,
+     * without specifying anything at the {@link ConnectionURL#OPTIONS_BROKERLIST} level.
+     */
+    public void testSslConnectionOption() throws Exception
+    {
+        if (shouldPerformTest())
+        {
+            //Start the broker (NEEDing client certificate authentication)
+            configureJavaBrokerIfNecessary(true, true, true, false);
+            super.setUp();
+
+            //Create URL enabling SSL at the connection rather than brokerlist level
+            String url = "amqp://guest:guest@test/?ssl='true'&brokerlist='tcp://localhost:%s'";
+            url = String.format(url,QpidBrokerTestCase.DEFAULT_SSL_PORT);
+
+            Connection con = getConnection(new AMQConnectionURL(url));
+            assertNotNull("connection should be successful", con);
+            Session ssn = con.createSession(false,Session.AUTO_ACKNOWLEDGE);
+            assertNotNull("create session should be successful", ssn);
+        }
+    }
+
+    /**
+     * Create an SSL connection using the SSL system properties for the trust and key store, but using
+     * the {@link ConnectionURL} ssl='true' option to indicate use of SSL at a Connection level,
+     * overriding the false setting at the {@link ConnectionURL#OPTIONS_BROKERLIST} level.
+     */
+    public void testSslConnectionOptionOverridesBrokerlistOption() throws Exception
+    {
+        if (shouldPerformTest())
+        {
+            //Start the broker (NEEDing client certificate authentication)
+            configureJavaBrokerIfNecessary(true, true, true, false);
+            super.setUp();
+
+            //Create URL enabling SSL at the connection, overriding the false at the brokerlist level
+            String url = "amqp://guest:guest@test/?ssl='true'&brokerlist='tcp://localhost:%s?ssl='false''";
+            url = String.format(url,QpidBrokerTestCase.DEFAULT_SSL_PORT);
+
+            Connection con = getConnection(new AMQConnectionURL(url));
+            assertNotNull("connection should be successful", con);
+            Session ssn = con.createSession(false,Session.AUTO_ACKNOWLEDGE);
+            assertNotNull("create session should be successful", ssn);
+        }
     }
 
     public void testCreateSSLConnectionUsingSystemProperties() throws Exception
     {
-        if (Boolean.getBoolean("profile.use_ssl"))
+        if (shouldPerformTest())
         {
+            //Start the broker (NEEDing client certificate authentication)
+            configureJavaBrokerIfNecessary(true, true, true, false);
+            super.setUp();
 
             String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:%s?ssl='true''";
 
             url = String.format(url,QpidBrokerTestCase.DEFAULT_SSL_PORT);
             
-            AMQConnection con = new AMQConnection(url);
+            Connection con = getConnection(new AMQConnectionURL(url));
             assertNotNull("connection should be successful", con);
             Session ssn = con.createSession(false,Session.AUTO_ACKNOWLEDGE); 
             assertNotNull("create session should be successful", ssn);
@@ -102,14 +154,18 @@ public class SSLTest extends QpidBrokerT
 
     public void testMultipleCertsInSingleStore() throws Exception
     {
-        if (Boolean.getBoolean("profile.use_ssl"))
+        if (shouldPerformTest())
         {
+            //Start the broker (NEEDing client certificate authentication)
+            configureJavaBrokerIfNecessary(true, true, true, false);
+            super.setUp();
+
             String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:" + 
             QpidBrokerTestCase.DEFAULT_SSL_PORT + 
             "?ssl='true'&ssl_cert_alias='" + CERT_ALIAS_APP1 + "''";
             
             AMQTestConnection_0_10 con = new AMQTestConnection_0_10(url);      
-            Connection transportCon = con.getConnection();
+            org.apache.qpid.transport.Connection transportCon = con.getConnection();
             String userID = transportCon.getSecurityLayer().getUserID();
             assertEquals("The correct certificate was not choosen","app1@acme.org",userID);
             con.close();
@@ -126,65 +182,82 @@ public class SSLTest extends QpidBrokerT
         }        
     }
     
-    public void testVerifyHostNameWithIncorrectHostname()
+    public void testVerifyHostNameWithIncorrectHostname() throws Exception
     {
-        if (Boolean.getBoolean("profile.use_ssl"))
+        if (shouldPerformTest())
         {
+            //Start the broker (WANTing client certificate authentication)
+            configureJavaBrokerIfNecessary(true, true, false, true);
+            super.setUp();
+
             String url = "amqp://guest:guest@test/?brokerlist='tcp://127.0.0.1:" + 
             QpidBrokerTestCase.DEFAULT_SSL_PORT + 
             "?ssl='true'&ssl_verify_hostname='true''";
             
             try
             {
-                AMQConnection con = new AMQConnection(url);
+                getConnection(new AMQConnectionURL(url));
                 fail("Hostname verification failed. No exception was thrown");
             }
             catch (Exception e)
             {
-                ByteArrayOutputStream bout = new ByteArrayOutputStream();
-                e.printStackTrace(new PrintStream(bout));
-                String strace = bout.toString();
-                assertTrue("Correct exception not thrown",strace.contains("SSL hostname verification failed"));
+                verifyExceptionCausesContains(e, "SSL hostname verification failed");
             }
-            
         }        
     }
+
+    private void verifyExceptionCausesContains(Exception e, String expectedString)
+    {
+        ByteArrayOutputStream bout = new ByteArrayOutputStream();
+        e.printStackTrace(new PrintStream(bout));
+        String strace = bout.toString();
+        assertTrue("Correct exception not thrown", strace.contains(expectedString));
+    }
     
     public void testVerifyLocalHost() throws Exception
     {
-        if (Boolean.getBoolean("profile.use_ssl"))
+        if (shouldPerformTest())
         {
+            //Start the broker (WANTing client certificate authentication)
+            configureJavaBrokerIfNecessary(true, true, false, true);
+            super.setUp();
+
             String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:" + 
             QpidBrokerTestCase.DEFAULT_SSL_PORT + 
             "?ssl='true'&ssl_verify_hostname='true''";
 
-            AMQConnection con = new AMQConnection(url);
-            assertNotNull("connection should have been created", con); 
+            Connection con = getConnection(new AMQConnectionURL(url));
+            assertNotNull("connection should have been created", con);
         }
     }
     
     public void testVerifyLocalHostLocalDomain() throws Exception
     {
-        if (Boolean.getBoolean("profile.use_ssl"))
+        if (shouldPerformTest())
         {
+            //Start the broker (WANTing client certificate authentication)
+            configureJavaBrokerIfNecessary(true, true, false, true);
+            super.setUp();
+
             String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost.localdomain:" + 
             QpidBrokerTestCase.DEFAULT_SSL_PORT + 
             "?ssl='true'&ssl_verify_hostname='true''";
 
-            AMQConnection con = new AMQConnection(url);
+            Connection con = getConnection(new AMQConnectionURL(url));
             assertNotNull("connection should have been created", con);
         }        
     }
 
     public void testCreateSSLConnectionUsingConnectionURLParamsTrustStoreOnly() throws Exception
     {
-        if (Boolean.getBoolean("profile.use_ssl"))
+        if (shouldPerformTest())
         {
-            // Clear the ssl system properties
-            setSystemProperty("javax.net.ssl.keyStore", null);
-            setSystemProperty("javax.net.ssl.keyStorePassword", null);
-            setSystemProperty("javax.net.ssl.trustStore", null);
-            setSystemProperty("javax.net.ssl.trustStorePassword", null);
+            clearSslStoreSystemProperties();
+
+            //Start the broker (WANTing client certificate authentication)
+            configureJavaBrokerIfNecessary(true, true, false, true);
+            super.setUp();
+
             
             String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:%s" +
             "?ssl='true'&ssl_verify_hostname='true'" + 
@@ -193,10 +266,122 @@ public class SSLTest extends QpidBrokerT
 
             url = String.format(url,QpidBrokerTestCase.DEFAULT_SSL_PORT, TRUSTSTORE,TRUSTSTORE_PASSWORD);
 
-            AMQConnection con = new AMQConnection(url);
+            Connection con = getConnection(new AMQConnectionURL(url));
             assertNotNull("connection should be successful", con);
             Session ssn = con.createSession(false,Session.AUTO_ACKNOWLEDGE); 
             assertNotNull("create session should be successful", ssn);
         }        
     }
+
+    /**
+     * Verifies that when the broker is configured to NEED client certificates,
+     * a client which doesn't supply one fails to connect.
+     */
+    public void testClientCertMissingWhilstNeeding() throws Exception
+    {
+        missingClientCertWhileNeedingOrWantingTestImpl(true, false, false);
+    }
+
+    /**
+     * Verifies that when the broker is configured to WANT client certificates,
+     * a client which doesn't supply one succeeds in connecting.
+     */
+    public void testClientCertMissingWhilstWanting() throws Exception
+    {
+        missingClientCertWhileNeedingOrWantingTestImpl(false, true, true);
+    }
+
+    /**
+     * Verifies that when the broker is configured to WANT and NEED client certificates
+     * that a client which doesn't supply one fails to connect.
+     */
+    public void testClientCertMissingWhilstWantingAndNeeding() throws Exception
+    {
+        missingClientCertWhileNeedingOrWantingTestImpl(true, true, false);
+    }
+
+    private void missingClientCertWhileNeedingOrWantingTestImpl(boolean needClientCerts,
+                            boolean wantClientCerts, boolean shouldSucceed) throws Exception
+    {
+        if (shouldPerformTest())
+        {
+            clearSslStoreSystemProperties();
+
+            //Start the broker
+            configureJavaBrokerIfNecessary(true, true, needClientCerts, wantClientCerts);
+            super.setUp();
+
+            String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:%s" +
+            "?ssl='true'&trust_store='%s'&trust_store_password='%s''";
+
+            url = String.format(url,QpidBrokerTestCase.DEFAULT_SSL_PORT,TRUSTSTORE,TRUSTSTORE_PASSWORD);
+            try
+            {
+                Connection con = getConnection(new AMQConnectionURL(url));
+                if(!shouldSucceed)
+                {
+                    fail("Connection succeeded, expected exception was not thrown");
+                }
+                else
+                {
+                    //Use the connection to verify it works
+                    con.createSession(true, Session.SESSION_TRANSACTED);
+                }
+            }
+            catch(JMSException e)
+            {
+                if(shouldSucceed)
+                {
+                    _logger.error("Caught unexpected exception",e);
+                    fail("Connection failed, unexpected exception thrown");
+                }
+                else
+                {
+                    //expected
+                    verifyExceptionCausesContains(e, "Caused by: javax.net.ssl.SSLException:");
+                }
+            }
+        }
+    }
+
+    private boolean shouldPerformTest()
+    {
+        // We run the SSL tests on all the Java broker profiles
+        if(isJavaBroker())
+        {
+            setTestClientSystemProperty(PROFILE_USE_SSL, "true");
+        }
+
+        return Boolean.getBoolean(PROFILE_USE_SSL);
+    }
+
+    private void configureJavaBrokerIfNecessary(boolean sslEnabled, boolean sslOnly, boolean needClientAuth, boolean wantClientAuth) throws ConfigurationException
+    {
+        if(isJavaBroker())
+        {
+            Map<String, Object> sslPortAttributes = new HashMap<String, Object>();
+            sslPortAttributes.put(Port.TRANSPORTS, Collections.singleton(Transport.SSL));
+            sslPortAttributes.put(Port.PORT, DEFAULT_SSL_PORT);
+            sslPortAttributes.put(Port.NEED_CLIENT_AUTH, needClientAuth);
+            sslPortAttributes.put(Port.WANT_CLIENT_AUTH, wantClientAuth);
+            sslPortAttributes.put(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_SSL_PORT);
+            getBrokerConfiguration().addPortConfiguration(sslPortAttributes);
+        }
+    }
+
+    private void setSslStoreSystemProperties()
+    {
+        setSystemProperty("javax.net.ssl.keyStore", KEYSTORE);
+        setSystemProperty("javax.net.ssl.keyStorePassword", KEYSTORE_PASSWORD);
+        setSystemProperty("javax.net.ssl.trustStore", TRUSTSTORE);
+        setSystemProperty("javax.net.ssl.trustStorePassword", TRUSTSTORE_PASSWORD);
+    }
+
+    private void clearSslStoreSystemProperties()
+    {
+        setSystemProperty("javax.net.ssl.keyStore", null);
+        setSystemProperty("javax.net.ssl.keyStorePassword", null);
+        setSystemProperty("javax.net.ssl.trustStore", null);
+        setSystemProperty("javax.net.ssl.trustStorePassword", null);
+    }
 }

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java Thu Feb 28 16:14:30 2013
@@ -30,6 +30,7 @@ import org.apache.qpid.util.LogMonitor;
 import javax.jms.Connection;
 import javax.jms.Queue;
 import javax.jms.Session;
+import java.io.File;
 import java.util.List;
 
 /**
@@ -72,10 +73,7 @@ public class BrokerStartupTest extends A
         if (isJavaBroker() && isExternalBroker() && !isInternalBroker())
         {
             //Remove test Log4j config from the commandline
-            _brokerCommand = _brokerCommand.substring(0, _brokerCommand.indexOf("-l"));
-
-            // Add an invalid value
-            _brokerCommand += " -l invalid";
+            setBrokerCommandLog4JFile(new File("invalid file"));
 
             // The  broker has a built in default log4j configuration set up
             // so if the the broker cannot load the -l value it will use default
@@ -145,4 +143,4 @@ public class BrokerStartupTest extends A
         }
     }
 
-}
\ No newline at end of file
+}

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/SupportedProtocolVersionsTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/SupportedProtocolVersionsTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/SupportedProtocolVersionsTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/SupportedProtocolVersionsTest.java Thu Feb 28 16:14:30 2013
@@ -23,13 +23,17 @@ package org.apache.qpid.server;
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.configuration.ClientProperties;
 import org.apache.qpid.framing.ProtocolVersion;
-import org.apache.qpid.server.configuration.ServerConfiguration;
+import org.apache.qpid.server.configuration.BrokerProperties;
+import org.apache.qpid.server.model.Protocol;
+import org.apache.qpid.server.model.adapter.PortFactoryTest;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 
 /**
  * Tests to validate it is possible to disable support for particular protocol
  * versions entirely, rather than selectively excluding them on particular ports,
  * and it is possible to configure the reply to an unsupported protocol initiation.
+ *<p>
+ * Protocol exclusion/inclusion are unit tested as part of {@link PortFactoryTest}
  */
 public class SupportedProtocolVersionsTest extends QpidBrokerTestCase
 {
@@ -41,8 +45,8 @@ public class SupportedProtocolVersionsTe
     private void clearProtocolSupportManipulations()
     {
         //Remove the QBTC provided protocol manipulations, giving only the protocols which default to enabled
-        setTestSystemProperty(QpidBrokerTestCase.BROKER_PROTOCOL_EXCLUDES, null);
-        setTestSystemProperty(QpidBrokerTestCase.BROKER_PROTOCOL_INCLUDES, null);
+        setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_EXCLUDES, null);
+        setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_INCLUDES, null);
     }
 
     /**
@@ -87,8 +91,8 @@ public class SupportedProtocolVersionsTe
         clearProtocolSupportManipulations();
 
         //disable 0-10 and 1-0 support
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP010ENABLED, "false");
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP10ENABLED, "false");
+        setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_EXCLUDES,
+                Protocol.AMQP_1_0 + "," + Protocol.AMQP_0_10);
 
         super.setUp();
 
@@ -100,52 +104,14 @@ public class SupportedProtocolVersionsTe
         connection.close();
     }
 
-    public void testDisabling091and010and10() throws Exception
-    {
-        clearProtocolSupportManipulations();
-
-        //disable 0-91 and 0-10 and 1-0 support
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP10ENABLED, "false");
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP010ENABLED, "false");
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP091ENABLED, "false");
-
-        super.setUp();
-
-        //Verify initially requesting a 0-10 connection now negotiates a 0-9
-        //connection as the broker should reply with its highest supported protocol
-        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10");
-        AMQConnection connection = (AMQConnection) getConnection();
-        assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_9, connection.getProtocolVersion());
-        connection.close();
-    }
-
-    public void testDisabling09and091and010and10() throws Exception
-    {
-        clearProtocolSupportManipulations();
-
-        //disable 0-9, 0-91, 0-10 and 1-0 support
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP09ENABLED, "false");
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP091ENABLED, "false");
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP010ENABLED, "false");
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP10ENABLED, "false");
-
-        super.setUp();
-
-        //Verify initially requesting a 0-10 connection now negotiates a 0-8
-        //connection as the broker should reply with its highest supported protocol
-        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10");
-        AMQConnection connection = (AMQConnection) getConnection();
-        assertEquals("Unexpected protocol version in use", ProtocolVersion.v8_0, connection.getProtocolVersion());
-        connection.close();
-    }
-
     public void testConfiguringReplyingToUnsupported010ProtocolInitiationWith09insteadOf091() throws Exception
     {
         clearProtocolSupportManipulations();
 
         //disable 0-10 support, and set the default unsupported protocol initiation reply to 0-9
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP010ENABLED, "false");
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP_SUPPORTED_REPLY, "v0_9");
+        setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_EXCLUDES,
+                Protocol.AMQP_1_0 + "," + Protocol.AMQP_0_10);
+        setSystemProperty(BrokerProperties.PROPERTY_DEFAULT_SUPPORTED_PROTOCOL_REPLY, "v0_9");
 
         super.setUp();
 
@@ -164,71 +130,5 @@ public class SupportedProtocolVersionsTe
         connection.close();
     }
 
-    public void testProtocolInclusionThroughQBTCSystemPropertiesOverridesProtocolExclusion() throws Exception
-    {
-        testProtocolInclusionOverridesProtocolExclusion(false);
-    }
-
-    public void testProtocolInclusionThroughConfigOverridesProtocolExclusion() throws Exception
-    {
-        testProtocolInclusionOverridesProtocolExclusion(true);
-    }
-
-    private void testProtocolInclusionOverridesProtocolExclusion(boolean useConfig) throws Exception
-    {
-        clearProtocolSupportManipulations();
-
-        //selectively exclude 0-10 and 1-0 on the test port
-        setTestSystemProperty(QpidBrokerTestCase.BROKER_PROTOCOL_EXCLUDES,"--exclude-0-10 @PORT --exclude-1-0 @PORT");
-
-        super.setUp();
-
-        //Verify initially requesting a 0-10 connection negotiates a 0-9-1 connection
-        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10");
-        AMQConnection connection = (AMQConnection) getConnection();
-        assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_91, connection.getProtocolVersion());
-        connection.close();
-
-        stopBroker();
-
-        if(useConfig)
-        {
-            //selectively include 0-10 support again on the test port through config
-            setConfigurationProperty(ServerConfiguration.CONNECTOR_INCLUDE_010, String.valueOf(getPort()));
-        }
-        else
-        {
-            //selectively include 0-10 support again on the test port through QBTC sys props
-            setTestSystemProperty(QpidBrokerTestCase.BROKER_PROTOCOL_INCLUDES,"--include-0-10 @PORT");
-        }
-
-        startBroker();
-
-        //Verify requesting a 0-10 connection now returns one
-        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10");
-        connection = (AMQConnection) getConnection();
-        assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_10, connection.getProtocolVersion());
-        connection.close();
-    }
-
-    public void testProtocolInclusionOverridesProtocolDisabling() throws Exception
-    {
-        clearProtocolSupportManipulations();
-
-        //disable 0-10 and 1-0
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP010ENABLED, "false");
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP10ENABLED, "false");
-
-        //selectively include 0-10 support again on the test port
-        setConfigurationProperty(ServerConfiguration.CONNECTOR_INCLUDE_010, String.valueOf(getPort()));
-
-        super.setUp();
-
-        //Verify initially requesting a 0-10 connection still works
-        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10");
-        AMQConnection connection = (AMQConnection) getConnection();
-        assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_10, connection.getProtocolVersion());
-        connection.close();
-    }
 
 }
\ No newline at end of file

Propchange: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/SupportedProtocolVersionsTest.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/SupportedProtocolVersionsTest.java:r1375509-1450773

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java Thu Feb 28 16:14:30 2013
@@ -20,12 +20,7 @@
  */
 package org.apache.qpid.server.logging;
 
-import org.apache.commons.configuration.ConfigurationException;
-
-import org.apache.qpid.server.configuration.ServerConfiguration;
 import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.util.InternalBrokerBaseCase;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 import org.apache.qpid.util.LogMonitor;
 
@@ -47,8 +42,6 @@ public class AbstractTestLogging extends
     public static final String TEST_LOG_PREFIX = "MESSAGE";
     protected LogMonitor _monitor;
 
-    private InternalBrokerBaseCase _configLoader;
-
     @Override
     public void setUp() throws Exception
     {
@@ -58,32 +51,6 @@ public class AbstractTestLogging extends
         _monitor = new LogMonitor(_outputFile);
     }
 
-    protected ServerConfiguration getServerConfig() throws ConfigurationException
-    {
-        ServerConfiguration _serverConfiguration;
-        if (isExternalBroker())
-        {
-            _serverConfiguration = new ServerConfiguration(_configFile)
-            {
-                @Override
-                public void initialise() throws ConfigurationException
-                {
-                    //Overriding initialise to only setup the vhosts and not
-                    //perform the ConfigurationPlugin setup, removing need for
-                    //an ApplicationRegistry to be loaded.
-                    setupVirtualHosts(getConfig());
-                }
-            };
-            _serverConfiguration.initialise();
-        }
-        else
-        {
-            _serverConfiguration = ApplicationRegistry.getInstance().getConfiguration();
-        }
-
-        return _serverConfiguration;
-    }
-
     protected void setLogMessagePrefix()
     {
         //set the message prefix to facilitate scraping from the munged test output.
@@ -94,10 +61,6 @@ public class AbstractTestLogging extends
     public void tearDown() throws Exception
     {
         _monitor.close();
-        if (isExternalBroker() && _configLoader != null)
-        {
-            _configLoader.tearDown();
-        }
         super.tearDown();
     }
 
@@ -159,7 +122,7 @@ public class AbstractTestLogging extends
     }
 
     protected String fromMessage(String log)
-    {
+    {;
         int startSubject = log.indexOf("]") + 1;
         int start = log.indexOf("]", startSubject) + 1;
 

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/AccessControlLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/AccessControlLoggingTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/AccessControlLoggingTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/AccessControlLoggingTest.java Thu Feb 28 16:14:30 2013
@@ -31,10 +31,10 @@ import java.util.List;
 
 /**
  * ACL version 2/3 file testing to verify that ACL actor logging works correctly.
- * 
+ *
  * This suite of tests validate that the AccessControl messages occur correctly
  * and according to the following format:
- * 
+ *
  * <pre>
  * ACL-1001 : Allowed Operation Object {PROPERTIES}
  * ACL-1002 : Denied Operation Object {PROPERTIES}
@@ -83,12 +83,12 @@ public class AccessControlLoggingTest ex
         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         conn.start();
         ((AMQSession<?, ?>) sess).createQueue(new AMQShortString("allow"), false, false, false);
-        
+
         List<String> matches = findMatches(ACL_LOG_PREFIX);
-        
+
         assertTrue("Should be no ACL log messages", matches.isEmpty());
     }
-    
+
     /**
      * Test that {@code allow-log} ACL entries log correctly.
      */
@@ -98,25 +98,25 @@ public class AccessControlLoggingTest ex
         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         conn.start();
         ((AMQSession<?, ?>) sess).createQueue(new AMQShortString("allow-log"), false, false, false);
-        
+
         List<String> matches = findMatches(ACL_LOG_PREFIX);
-        
+
         assertEquals("Should only be one ACL log message", 1, matches.size());
-        
+
         String log = getLogMessage(matches, 0);
         String actor = fromActor(log);
         String subject = fromSubject(log);
         String message = getMessageString(fromMessage(log));
-        
+
         validateMessageID(ACL_LOG_PREFIX + 1001, log);
-        
-        assertTrue("Actor should contain the user identity", actor.contains(USER));
+
+        assertTrue("Actor " + actor + " should contain the user identity: " + USER, actor.contains(USER));
         assertTrue("Subject should be empty", subject.length() == 0);
         assertTrue("Message should start with 'Allowed'", message.startsWith("Allowed"));
         assertTrue("Message should contain 'Create Queue'", message.contains("Create Queue"));
         assertTrue("Message should have contained the queue name", message.contains("allow-log"));
     }
-    
+
     /**
      * Test that {@code deny-log} ACL entries log correctly.
      */
@@ -134,25 +134,25 @@ public class AccessControlLoggingTest ex
             // Denied, so exception thrown
             assertEquals("Expected ACCESS_REFUSED error code", AMQConstant.ACCESS_REFUSED, amqe.getErrorCode());
         }
-        
+
         List<String> matches = findMatches(ACL_LOG_PREFIX);
-        
+
         assertEquals("Should only be one ACL log message", 1, matches.size());
-        
+
         String log = getLogMessage(matches, 0);
         String actor = fromActor(log);
         String subject = fromSubject(log);
         String message = getMessageString(fromMessage(log));
-        
+
         validateMessageID(ACL_LOG_PREFIX + 1002, log);
-        
-        assertTrue("Actor should contain the user identity", actor.contains(USER));
+
+        assertTrue("Actor " + actor + " should contain the user identity: " + USER, actor.contains(USER));
         assertTrue("Subject should be empty", subject.length() == 0);
         assertTrue("Message should start with 'Denied'", message.startsWith("Denied"));
         assertTrue("Message should contain 'Create Queue'", message.contains("Create Queue"));
         assertTrue("Message should have contained the queue name", message.contains("deny-log"));
     }
-    
+
     /**
      * Test that {@code deny} ACL entries do not log anything.
      */
@@ -170,9 +170,9 @@ public class AccessControlLoggingTest ex
             // Denied, so exception thrown
             assertEquals("Expected ACCESS_REFUSED error code", AMQConstant.ACCESS_REFUSED, amqe.getErrorCode());
         }
-        
+
         List<String> matches = findMatches(ACL_LOG_PREFIX);
-        
+
         assertTrue("Should be no ACL log messages", matches.isEmpty());
     }
 }

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java Thu Feb 28 16:14:30 2013
@@ -22,10 +22,6 @@ package org.apache.qpid.server.logging;
 
 import org.apache.qpid.client.AMQDestination;
 import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.configuration.ServerConfiguration;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.util.FileUtils;
 
 import javax.jms.Connection;
 import javax.jms.Queue;
@@ -44,29 +40,19 @@ public class AlertingTest extends Abstra
 
     public void setUp() throws Exception
     {
-        // Update the configuration to make our virtualhost Persistent.
-        makeVirtualHostPersistent(VIRTUALHOST);
-        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "5000");
-
         _numMessages = 50;
 
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", String.valueOf(ALERT_LOG_WAIT_PERIOD));
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount", String.valueOf(_numMessages));
+
         // Then we do the normal setup stuff like starting the broker, getting a connection etc.
         super.setUp();
 
         setupConnection();
     }
 
-    @Override
-    public void tearDown() throws Exception
-    {
-        // Ensure queue is clean for next run.
-        drainQueue(_destination);
-        super.tearDown();
-    }
-
-
     /**
-     * Create a new connection and ensure taht our destination queue is created
+     * Create a new connection and ensure that our destination queue is created
      * and bound.
      *
      * Note that the tests here that restart the broker rely on persistence.
@@ -102,20 +88,6 @@ public class AlertingTest extends Abstra
         if (!waitForMessage(MESSAGE_COUNT_ALERT, ALERT_LOG_WAIT_PERIOD))
         {
             StringBuffer message = new StringBuffer("Could not find 'MESSAGE_COUNT_ALERT' in log file: " + _monitor.getMonitoredFile().getAbsolutePath());
-            message.append("\n");
-
-            // Add the current contents of the log file to test output
-            message.append(_monitor.readFile());
-
-            // Write the test config file to test output
-            message.append("Server configuration overrides in use:\n");
-            message.append(FileUtils.readFileAsString(getTestConfigFile()));
-
-            message.append("\nVirtualhost maxMessageCount:\n");
-            ServerConfiguration config = new ServerConfiguration(_configFile);
-            config.initialise();
-            message.append(config.getVirtualHostConfig(VIRTUALHOST).getMaximumMessageCount());
-
             fail(message.toString());
         }
     }
@@ -148,9 +120,6 @@ public class AlertingTest extends Abstra
      * Test sends two messages to the broker then restarts the broker with new
      * configuration.
      *
-     * If the test is running inVM the test validates that the new configuration
-     * has been applied.
-     *
      * Validates that we only have two messages on the queue and then sends
      * enough messages to trigger the alert.
      *
@@ -172,31 +141,24 @@ public class AlertingTest extends Abstra
         _monitor.markDiscardPoint();
 
         // Change max message count to 5, start broker and make sure that that's triggered at the right time
-        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount", "5");
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount", "5");
 
         startBroker();
 
-        if (isInternalBroker())
-        {
-            assertEquals("Alert Max Msg Count is not correct", 5, ApplicationRegistry.getInstance().getVirtualHostRegistry().
-                    getVirtualHost(VIRTUALHOST).getQueueRegistry().getQueue(new AMQShortString(_destination.getQueueName())).
-                    getMaximumMessageCount());
-        }
-
         setupConnection();
 
         // Validate the queue depth is as expected
         long messageCount = ((AMQSession<?, ?>) _session).getQueueDepth((AMQDestination) _destination);
         assertEquals("Broker has invalid message count for test", 2, messageCount);
 
-        // Ensure the alert has not occured yet
+        // Ensure the alert has not occurred yet
         assertLoggingNotYetOccured(MESSAGE_COUNT_ALERT);
 
         // Trigger the new value
         sendMessage(_session, _destination, 3);
         _session.commit();
 
-        // Validate that the alert occured.
+        // Validate that the alert occurred.
         wasAlertFired();
     }
 }

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java Thu Feb 28 16:14:30 2013
@@ -23,12 +23,20 @@ package org.apache.qpid.server.logging;
 import junit.framework.AssertionFailedError;
 
 import org.apache.qpid.server.BrokerOptions;
+import org.apache.qpid.server.model.Port;
+import org.apache.qpid.server.model.Transport;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 import org.apache.qpid.transport.ConnectionException;
 import org.apache.qpid.util.LogMonitor;
 
 import java.io.IOException;
 import java.net.Socket;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * Broker Test Suite
@@ -47,6 +55,8 @@ import java.util.List;
  */
 public class BrokerLoggingTest extends AbstractTestLogging
 {
+    private static final String BROKER_MESSAGE_LOG_REG_EXP = ".*\\[\\w*\\] (BRK\\-\\d*) .*";
+    private static final Pattern BROKER_MESSAGE_LOG_PATTERN = Pattern.compile(BROKER_MESSAGE_LOG_REG_EXP);
     private static final String BRK_LOG_PREFIX = "BRK-";
 
     public void setUp() throws Exception
@@ -95,7 +105,7 @@ public class BrokerLoggingTest extends A
             _monitor = new LogMonitor(_outputFile);
 
 
-            String configFilePath = _configFile.toString();
+            String configFilePath = getConfigPath();
 
             // Ensure we wait for TESTID to be logged
             waitAndFindMatches(TESTID);
@@ -118,8 +128,9 @@ public class BrokerLoggingTest extends A
                              1, results.size());
 
                 //3
-                assertTrue("Config file details not correctly logged",
-                           log.endsWith(configFilePath));
+                assertTrue("Config file details not correctly logged, got "
+                        + log + " but expected it to end with " + configFilePath,
+                        log.endsWith(configFilePath));
             }
             catch (AssertionFailedError afe)
             {
@@ -130,6 +141,11 @@ public class BrokerLoggingTest extends A
         }
     }
 
+    private String getConfigPath()
+    {
+        return getPathRelativeToWorkingDirectory(getTestConfigFile(DEFAULT_PORT));
+    }
+
     /**
      * Description:
      * On startup the broker must report correctly report the log4j file in use. This is important as it can help diagnose why logging messages are not being reported.
@@ -155,8 +171,7 @@ public class BrokerLoggingTest extends A
         {
             String TESTID = "BRK-1007";
 
-            //Remove test Log4j config from the commandline
-            _brokerCommand = _brokerCommand.substring(0, _brokerCommand.indexOf("-l"));
+            _brokerCommandHelper.removeBrokerCommandLog4JFile();
 
             startBroker();
 
@@ -243,8 +258,7 @@ public class BrokerLoggingTest extends A
         // This logging startup code only occurs when you run a Java broker
         if (isJavaBroker() && isExternalBroker())
         {
-            // Get custom -l value used during testing for the broker startup
-            String customLog4j = _brokerCommand.substring(_brokerCommand.indexOf("-l") + 2).trim();
+            String customLog4j = getBrokerCommandLog4JFile().getAbsolutePath();
 
             String TESTID = "BRK-1007";
 
@@ -293,8 +307,10 @@ public class BrokerLoggingTest extends A
                                  1, findMatches(TESTID).size());
 
                     //3
-                    assertTrue("Log4j file details not correctly logged:" + getMessageString(log),
-                               getMessageString(log).endsWith(customLog4j));
+                    String messageString = getMessageString(log);
+                    assertTrue("Log4j file details not correctly logged. Message '"
+                            + messageString + "' should contain '" +customLog4j + "'",
+                            messageString.endsWith(customLog4j));
 
                     validation = true;
                 }
@@ -442,10 +458,13 @@ public class BrokerLoggingTest extends A
                 {
                     String log = getLog(rawLog);
 
+                    // using custom method to get id as getMessageId() fails to correctly identify id
+                    // because of using brackets for protocols
+                    String id = getBrokerLogId(log);
                     // Ensure we do not have a BRK-1002 message
-                    if (!getMessageID(log).equals(TESTID))
+                    if (!id.equals(TESTID))
                     {
-                        if (getMessageID(log).equals("BRK-1001"))
+                        if (id.equals("BRK-1001"))
                         {
                             foundBRK1001 = true;
                         }
@@ -455,7 +474,7 @@ public class BrokerLoggingTest extends A
                     assertTrue("BRK-1001 not logged before this message", foundBRK1001);
 
                     //1
-                    validateMessageID(TESTID, log);
+                    assertEquals("Incorrect message", TESTID, id);
 
                     //2
                     //There will be 2 copies of the startup message (one via SystemOut, and one via Log4J)
@@ -465,7 +484,7 @@ public class BrokerLoggingTest extends A
                     //3
                     String message = getMessageString(log);
                     assertTrue("Expected Listen log not correct" + message,
-                               message.endsWith("Listening on TCP port " + getPort()));
+                               message.endsWith("Listening on [TCP] port " + getPort()));
 
                     validation = true;
                 }
@@ -481,6 +500,16 @@ public class BrokerLoggingTest extends A
         }
     }
 
+    private String getBrokerLogId(String log)
+    {
+        Matcher m = BROKER_MESSAGE_LOG_PATTERN.matcher(log);
+        if (m.matches())
+        {
+            return m.group(1);
+        }
+        return getMessageID(log);
+    }
+
     /**
      * Description:
      * On startup the broker may listen on a number of ports and protocols. Each of these must be reported as they are made available.
@@ -498,8 +527,8 @@ public class BrokerLoggingTest extends A
      * 1. The BRK ID is correct
      * 2. This occurs after the BRK-1001 startup message
      * 3. With SSL enabled in the configuration two BRK-1002 will be printed (order is not specified)
-     * 1. One showing values TCP / 5672
-     * 2. One showing values TCP/SSL / 5672
+     * 1. One showing values [TCP] 5672
+     * 2. One showing values [SSL] 5671
      *
      * @throws Exception caused by broker startup
      */
@@ -512,12 +541,11 @@ public class BrokerLoggingTest extends A
             String TESTID = "BRK-1002";
 
             // Enable SSL on the connection
-            setConfigurationProperty("connector.ssl.enabled", "true");
-            setConfigurationProperty("connector.ssl.sslOnly", "false");
-            setConfigurationProperty("connector.ssl.keyStorePath", getConfigurationStringProperty("management.ssl.keyStorePath"));
-            setConfigurationProperty("connector.ssl.keyStorePassword", getConfigurationStringProperty("management.ssl.keyStorePassword"));
-
-            Integer sslPort = Integer.parseInt(getConfigurationStringProperty("connector.ssl.port"));
+            Map<String, Object> sslPortAttributes = new HashMap<String, Object>();
+            sslPortAttributes.put(Port.TRANSPORTS, Collections.singleton(Transport.SSL));
+            sslPortAttributes.put(Port.PORT, DEFAULT_SSL_PORT);
+            sslPortAttributes.put(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_SSL_PORT);
+            getBrokerConfiguration().addPortConfiguration(sslPortAttributes);
 
             startBroker();
 
@@ -545,10 +573,11 @@ public class BrokerLoggingTest extends A
                 {
                     String log = getLog(rawLog);
 
+                    String id = getBrokerLogId(log);
                     // Ensure we do not have a BRK-1002 message
-                    if (!getMessageID(log).equals(TESTID))
+                    if (!id.equals(TESTID))
                     {
-                        if (getMessageID(log).equals("BRK-1001"))
+                        if (id.equals("BRK-1001"))
                         {
                             foundBRK1001 = true;
                         }
@@ -558,7 +587,7 @@ public class BrokerLoggingTest extends A
                     assertTrue("BRK-1001 not logged before this message", foundBRK1001);
 
                     //1
-                    validateMessageID(TESTID, log);
+                    assertEquals("Incorrect message", TESTID, id);
 
                     //2
                     //There will be 4 copies of the startup message (two via SystemOut, and two via Log4J)
@@ -570,16 +599,16 @@ public class BrokerLoggingTest extends A
                     //Check the first
                     String message = getMessageString(getLog(listenMessages .get(0)));
                     assertTrue("Expected Listen log not correct" + message,
-                               message.endsWith("Listening on TCP port " + getPort()));
+                               message.endsWith("Listening on [TCP] port " + getPort()));
 
                     // Check the third, ssl listen.
                     message = getMessageString(getLog(listenMessages .get(2)));
                     assertTrue("Expected Listen log not correct" + message,
-                               message.endsWith("Listening on TCP/SSL port " + sslPort));
+                               message.endsWith("Listening on [SSL] port " + DEFAULT_SSL_PORT));
 
                     //4 Test ports open
                     testSocketOpen(getPort());
-                    testSocketOpen(sslPort);
+                    testSocketOpen(DEFAULT_SSL_PORT);
 
                     validation = true;
                 }
@@ -803,11 +832,11 @@ public class BrokerLoggingTest extends A
             String TESTID = "BRK-1003";
 
             // Enable SSL on the connection
-            setConfigurationProperty("connector.ssl.enabled", "true");
-            setConfigurationProperty("connector.ssl.keyStorePath", getConfigurationStringProperty("management.ssl.keyStorePath"));
-            setConfigurationProperty("connector.ssl.keyStorePassword", getConfigurationStringProperty("management.ssl.keyStorePassword"));
-
-            Integer sslPort = Integer.parseInt(getConfigurationStringProperty("connector.ssl.port"));
+            Map<String, Object> sslPortAttributes = new HashMap<String, Object>();
+            sslPortAttributes.put(Port.TRANSPORTS, Collections.singleton(Transport.SSL));
+            sslPortAttributes.put(Port.PORT, DEFAULT_SSL_PORT);
+            sslPortAttributes.put(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_SSL_PORT);
+            getBrokerConfiguration().addPortConfiguration(sslPortAttributes);
 
             startBroker();
 
@@ -848,13 +877,13 @@ public class BrokerLoggingTest extends A
                 // Check second, ssl, listen.
                 message = getMessageString(getLog(listenMessages.get(1)));
                 assertTrue("Expected shutdown log not correct" + message,
-                           message.endsWith("TCP/SSL port " + sslPort));
+                           message.endsWith("TCP/SSL port " + DEFAULT_SSL_PORT));
 
                 //4
                 //Test Port closed
                 checkSocketClosed(getPort());
                 //Test SSL Port closed
-                checkSocketClosed(sslPort);
+                checkSocketClosed(DEFAULT_SSL_PORT);
             }
             catch (AssertionFailedError afe)
             {
@@ -999,4 +1028,5 @@ public class BrokerLoggingTest extends A
                  + ". Due to:" + e.getMessage());
         }
     }
+
 }

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java Thu Feb 28 16:14:30 2013
@@ -66,8 +66,8 @@ public class SubscriptionLoggingTest ext
 
         _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
-        _queue = (Queue) getInitialContext().lookup(QUEUE);
-        _topic = (Topic) getInitialContext().lookup(TOPIC);
+        _queue = _session.createQueue(getTestQueueName() + "Queue");
+        _topic = _session.createTopic(getTestQueueName() + "Topic");
     }
 
     /**
@@ -434,10 +434,6 @@ public class SubscriptionLoggingTest ext
             throw afe;
         }
         _connection.close();
-
-        //Ensure the queue is drained before the test ends
-        drainQueue(_queue);
-
     }
 
     /**

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java Thu Feb 28 16:14:30 2013
@@ -23,7 +23,6 @@ package org.apache.qpid.server.logging;
 
 import junit.framework.AssertionFailedError;
 
-import org.apache.qpid.server.configuration.ServerConfiguration;
 
 import java.util.Arrays;
 import java.util.List;
@@ -68,7 +67,7 @@ public class VirtualHostLoggingTest exte
         
         try
         {
-            List<String> vhosts = Arrays.asList(getServerConfig().getVirtualHosts());
+            List<String> vhosts = Arrays.asList("test");
 
             assertEquals("Each vhost did not create a store.", vhosts.size(), results.size());
 
@@ -110,23 +109,17 @@ public class VirtualHostLoggingTest exte
 
         // Wait for the correct VHT message to arrive.                                 
         waitForMessage(VHT_PREFIX + "1002");
-        
+
         // Validate each vhost logs a closure
         List<String> results = findMatches(VHT_PREFIX + "1002");
-        
+
         try
         {
-            // Load VirtualHost list from file. 
-            ServerConfiguration configuration = new ServerConfiguration(_configFile);
-            configuration.initialise();
-            List<String> vhosts = Arrays.asList(configuration.getVirtualHosts());
-
-            assertEquals("Each vhost did not close their store.", vhosts.size(), results.size());
+            assertEquals("Each vhost did not close their store.", 1, results.size());
         }
         catch (AssertionFailedError afe)
         {
             dumpLogs(results, _monitor);
-
             throw afe;
         }
     }

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java Thu Feb 28 16:14:30 2013
@@ -39,7 +39,7 @@ import org.apache.qpid.test.utils.QpidBr
  */
 public class NoLocalAfterRecoveryTest extends QpidBrokerTestCase
 {
-    protected final String MY_TOPIC_SUBSCRIPTION_NAME = this.getName();
+    protected final String MY_TOPIC_SUBSCRIPTION_NAME = getTestQueueName();
     protected static final int SEND_COUNT = 10;
 
     public void testNoLocalNotQueued() throws Exception

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java Thu Feb 28 16:14:30 2013
@@ -30,6 +30,7 @@ import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageListener;
 import javax.jms.Session;
+
 import java.util.Random;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -54,7 +55,9 @@ public class MultipleTransactedBatchProd
         //debug level logging often makes this test pass artificially, turn the level down to info.
         setSystemProperty("amqj.server.logging.level", "INFO");
         _receivedLatch = new CountDownLatch(MESSAGE_COUNT * NUM_PRODUCERS);
-        setConfigurationProperty("management.enabled", "true");
+
+        getBrokerConfiguration().addJmxManagementConfiguration();
+
         super.setUp();
         _queueName = getTestQueueName();
         _failMsg = null;

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java Thu Feb 28 16:14:30 2013
@@ -26,6 +26,7 @@ import org.apache.qpid.client.AMQConnect
 import org.apache.qpid.client.AMQConnectionURL;
 import org.apache.qpid.jms.ConnectionListener;
 import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 import org.apache.qpid.url.URLSyntaxException;
 
@@ -45,7 +46,7 @@ import java.util.concurrent.TimeUnit;
 /**
  * Abstract test case for ACLs.
  * 
- * This base class contains convenience methods to mange ACL files and implements a mechanism that allows each
+ * This base class contains convenience methods to manage ACL files and implements a mechanism that allows each
  * test method to run its own setup code before the broker starts.
  * 
  * TODO move the pre broker-startup setup method invocation code to {@link QpidBrokerTestCase}
@@ -58,25 +59,11 @@ public abstract class AbstractACLTestCas
 {
     /** Used to synchronise {@link #tearDown()} when exceptions are thrown */
     protected CountDownLatch _exceptionReceived;
-    
-    /** Override this to return the name of the configuration XML file. */
-    public String getConfig()
-    {
-        return "config-systests.xml";
-    }
 
-    /**
-     * This setup method checks {@link #getConfig()} and {@link #getHostList()} to initialise the broker with specific
-     * ACL configurations and then runs an optional per-test setup method, which is simply a method with the same name
-     * as the test, but starting with {@code setUp} rather than {@code test}.
-     * 
-     * @see org.apache.qpid.test.utils.QpidBrokerTestCase#setUp()
-     */
     @Override
     public void setUp() throws Exception
     {
-        // Initialise ACLs.
-        _configFile = new File("build" + File.separator + "etc" + File.separator + getConfig());
+        getBrokerConfiguration().setBrokerAttribute(Broker.GROUP_FILE, System.getProperty(QPID_HOME) + "/etc/groups-systests");
 
         // run test specific setup
         String testSetup = StringUtils.replace(getName(), "test", "setUp");
@@ -123,11 +110,11 @@ public abstract class AbstractACLTestCas
 
         if (vhost == null)
         {
-            testcase.setConfigurationProperty("security.acl", aclFile.getAbsolutePath());
+            testcase.getBrokerConfiguration().setBrokerAttribute(Broker.ACL_FILE, aclFile.getAbsolutePath());
         }
         else
         {
-            testcase.setConfigurationProperty("virtualhosts.virtualhost." + vhost + ".security.acl", aclFile.getAbsolutePath());
+            testcase.setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + vhost + ".security.acl", aclFile.getAbsolutePath());
         }
 
         PrintWriter out = new PrintWriter(new FileWriter(aclFile));

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java Thu Feb 28 16:14:30 2013
@@ -33,14 +33,19 @@ import java.lang.management.RuntimeMXBea
  */
 public class ExternalACLJMXTest extends AbstractACLTestCase
 {
+
     private JMXTestUtils _jmx;
 
     private static final String TEST_QUEUE_OWNER = "admin";
     private static final String TEST_VHOST = "test";
+    private static final String TEST2_VHOST = "test2";
 
     @Override
     public void setUp() throws Exception
     {
+        createTestVirtualHost(0, TEST_VHOST);
+        createTestVirtualHost(0, TEST2_VHOST);
+
         _jmx = new JMXTestUtils(this);
         _jmx.setUp();
         super.setUp();
@@ -54,15 +59,14 @@ public class ExternalACLJMXTest extends 
         super.tearDown();
     }
 
-    /**
-     * Ensure an empty ACL defaults to DENY ALL.
-     */
-    public void setUpDenyAllIsDefault() throws Exception
+    public void setUpDenyAllIsCatchAllRule() throws Exception
     {
-        writeACLFile(null, "#Empty ACL file");
+        writeACLFile(null,
+                "ACL ALLOW admin ACCESS MANAGEMENT",
+                "#No more rules, default catch all (deny all) should apply");
     }
 
-    public void testDenyAllIsDefault() throws Exception
+    public void testDenyAllIsCatchAllRule() throws Exception
     {
         //try a broker-level method
         ServerInformation info = _jmx.getServerInformation();
@@ -115,6 +119,7 @@ public class ExternalACLJMXTest extends 
     public void setUpVhostAllowOverridesGlobalDeny() throws Exception
     {
         writeACLFile(null,
+                "ACL ALLOW admin ACCESS MANAGEMENT",
                 "ACL DENY admin UPDATE METHOD component='VirtualHost.VirtualHostManager' name='createNewQueue'");
         writeACLFile(TEST_VHOST,
                 "ACL ALLOW admin UPDATE METHOD component='VirtualHost.VirtualHostManager' name='createNewQueue'");
@@ -128,7 +133,7 @@ public class ExternalACLJMXTest extends 
         //try a vhost-level method on a different vhost
         try
         {
-            _jmx.createQueue("development", getTestQueueName(), TEST_QUEUE_OWNER, true);
+            _jmx.createQueue(TEST2_VHOST, getTestQueueName(), TEST_QUEUE_OWNER, true);
             fail("Exception not thrown");
         }
         catch (SecurityException e)
@@ -144,6 +149,7 @@ public class ExternalACLJMXTest extends 
     public void setUpUpdateComponentOnlyAllow() throws Exception
     {
         writeACLFile(null,
+                "ACL ALLOW admin ACCESS MANAGEMENT",
                 "ACL ALLOW admin UPDATE METHOD component='VirtualHost.VirtualHostManager'");
     }
 
@@ -162,6 +168,7 @@ public class ExternalACLJMXTest extends 
     public void setUpUpdateMethodOnlyAllow() throws Exception
     {
         writeACLFile(null,
+                "ACL ALLOW admin ACCESS MANAGEMENT",
                 "ACL ALLOW admin UPDATE METHOD");
     }
 
@@ -179,8 +186,8 @@ public class ExternalACLJMXTest extends 
      */
     public void setUpCreateQueueSuccess() throws Exception
     {
-        writeACLFile(TEST_VHOST,
-                "ACL ALLOW admin UPDATE METHOD component='VirtualHost.VirtualHostManager' name='createNewQueue'");
+        writeACLFile(null, "ACL ALLOW admin ACCESS MANAGEMENT");
+        writeACLFile(TEST_VHOST, "ACL ALLOW admin UPDATE METHOD component='VirtualHost.VirtualHostManager' name='createNewQueue'");
     }
 
     public void testCreateQueueSuccess() throws Exception
@@ -194,6 +201,7 @@ public class ExternalACLJMXTest extends 
      */
     public void setUpCreateQueueSuccessNoAMQPRights() throws Exception
     {
+        writeACLFile(null, "ACL ALLOW admin ACCESS MANAGEMENT");
         writeACLFile(TEST_VHOST,
                 "ACL ALLOW admin UPDATE METHOD component='VirtualHost.VirtualHostManager' name='createNewQueue'",
                 "ACL DENY admin CREATE QUEUE");
@@ -210,6 +218,7 @@ public class ExternalACLJMXTest extends 
      */
     public void setUpCreateQueueDenied() throws Exception
     {
+        writeACLFile(null, "ACL ALLOW admin ACCESS MANAGEMENT");
         writeACLFile(TEST_VHOST,
                 "ACL DENY admin UPDATE METHOD component='VirtualHost.VirtualHostManager' name='createNewQueue'");
     }
@@ -234,6 +243,7 @@ public class ExternalACLJMXTest extends 
     public void setUpServerInformationUpdateDenied() throws Exception
     {
         writeACLFile(null,
+                "ACL ALLOW admin ACCESS MANAGEMENT",
                 "ACL DENY admin UPDATE METHOD component='ServerInformation' name='resetStatistics'");
     }
 
@@ -258,6 +268,7 @@ public class ExternalACLJMXTest extends 
     public void setUpServerInformationAccessGranted() throws Exception
     {
         writeACLFile(null,
+        "ACL ALLOW admin ACCESS MANAGEMENT",
         "ACL ALLOW-LOG admin ACCESS METHOD component='ServerInformation' name='getManagementApiMajorVersion'");
     }
 
@@ -284,6 +295,7 @@ public class ExternalACLJMXTest extends 
     public void setUpServerInformationUpdateMethodPermission() throws Exception
     {
         writeACLFile(null,
+                "ACL ALLOW admin ACCESS MANAGEMENT",
                 "ACL ALLOW admin UPDATE METHOD component='ServerInformation' name='resetStatistics'");
     }
 
@@ -300,7 +312,9 @@ public class ExternalACLJMXTest extends 
      */
     public void setUpServerInformationAllMethodPermissions() throws Exception
     {
-        writeACLFile(null, "ACL ALLOW admin ALL METHOD component='ServerInformation'");
+        writeACLFile(null,
+                "ACL ALLOW admin ACCESS MANAGEMENT",
+                "ACL ALLOW admin ALL METHOD component='ServerInformation'");
     }
 
     public void testServerInformationAllMethodPermissions() throws Exception



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