qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject svn commit: r1064085 - in /qpid/trunk/qpid/java: broker/src/main/java/org/apache/qpid/server/configuration/ systests/src/main/java/org/apache/qpid/server/logging/
Date Thu, 27 Jan 2011 11:18:59 GMT
Author: robbie
Date: Thu Jan 27 11:18:59 2011
New Revision: 1064085

URL: http://svn.apache.org/viewvc?rev=1064085&view=rev
Log:
QPID-3023: enable using the ServerConfiguration directly instead of leveraging an internal
broker (via IBBC) to load the vhost config required for the tests

Modified:
    qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java

Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java?rev=1064085&r1=1064084&r2=1064085&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
(original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
Thu Jan 27 11:18:59 2011
@@ -212,7 +212,7 @@ public class ServerConfiguration extends
      * both, as a fix for QPID-2360 and QPID-2361.
      */
     @SuppressWarnings("unchecked")
-    private void setupVirtualHosts(Configuration conf) throws ConfigurationException
+    protected void setupVirtualHosts(Configuration conf) throws ConfigurationException
     {
         List<String> vhostFiles = conf.getList("virtualhosts");
         Configuration vhostConfig = conf.subset("virtualhosts");

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java?rev=1064085&r1=1064084&r2=1064085&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java
(original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java
Thu Jan 27 11:18:59 2011
@@ -20,19 +20,6 @@
  */
 package org.apache.qpid.server.logging;
 
-import org.apache.qpid.server.configuration.ServerConfiguration;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
-import org.apache.qpid.server.logging.actors.CurrentActor;
-import org.apache.qpid.server.logging.actors.TestLogActor;
-import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.store.SkeletonMessageStore;
-import org.apache.qpid.server.util.InternalBrokerBaseCase;
-import org.apache.qpid.server.util.TestApplicationRegistry;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-import org.apache.qpid.util.LogMonitor;
-
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.HashMap;
@@ -40,6 +27,14 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
+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;
+
 /**
  * Abstract superclass for logging test set up and utility methods.
  *
@@ -50,7 +45,6 @@ public class AbstractTestLogging extends
     public static final long DEFAULT_LOG_WAIT = 2000;
     public static final String TEST_LOG_PREFIX = "MESSAGE";
     protected LogMonitor _monitor;
-    ServerConfiguration _serverConfiguration;
 
     InternalBrokerBaseCase _configLoader;
 
@@ -61,61 +55,32 @@ public class AbstractTestLogging extends
         
         super.setUp();
         _monitor = new LogMonitor(_outputFile);
+    }
 
+    protected ServerConfiguration getServerConfig() throws ConfigurationException
+    {
+        ServerConfiguration _serverConfiguration;
         if (isExternalBroker())
         {
-            _serverConfiguration = new ServerConfiguration(_configFile);
-
-            _configLoader = new InternalBrokerBaseCase()
+            _serverConfiguration = new ServerConfiguration(_configFile)
             {
                 @Override
-                protected void createBroker() throws Exception
+                public void initialise() throws ConfigurationException
                 {
-                    setStarted(true);
-                    CurrentActor.set(new TestLogActor(new SystemOutMessageLogger()));
-
-                    // Prevent the InVM broker from logging and spoiling tests.
-                    _serverConfiguration.getConfig().setProperty(ServerConfiguration.STATUS_UPDATES,
"off");
-
-                    setConfiguration(_serverConfiguration);
-                    setRegistry(new TestApplicationRegistry(getConfiguration())
-                    {
-                        /**
-                         * Create a virtualhost with a {@link org.apache.qpid.server.store.SkeletonMessageStore}
instead
-                         * of the configured one, but remember the original configuration.
-                         */
-                        @Override
-                        public VirtualHost createVirtualHost(final VirtualHostConfiguration
vhostConfig) throws Exception
-                        {
-                            String oldClass = vhostConfig.getMessageStoreClass();
-                            vhostConfig.setMessageStoreClass(SkeletonMessageStore.class.getName());
-                            VirtualHost host = super.createVirtualHost(vhostConfig);
-                            vhostConfig.setMessageStoreClass(oldClass);
-                            return host;
-                        }
-                    });
-                    ApplicationRegistry.initialise(getRegistry());
-
-                }
-
-                @Override
-                protected void stopBroker()
-                {
-                    ApplicationRegistry.remove();
+                    //Overriding initialise to only setup the vhosts and not
+                    //perform the ConfigurationPlugin setup, removing need for
+                    //an ApplicationRegistry to be loaded.
+                    setupVirtualHosts(getConfig());
                 }
             };
-
-            // Set the test name as this will be used to define some default queues
-            // VirtualHost, use test as this is a default vhost name.
-            _configLoader.setName("test");
-
-            _configLoader.setUp();
+            _serverConfiguration.initialise();
         }
         else
         {
             _serverConfiguration = ApplicationRegistry.getInstance().getConfiguration();
         }
 
+        return _serverConfiguration;
     }
 
     protected void setLogMessagePrefix()

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java?rev=1064085&r1=1064084&r2=1064085&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java
(original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java
Thu Jan 27 11:18:59 2011
@@ -92,7 +92,7 @@ public class MemoryMessageStoreLoggingTe
         results = waitAndFindMatches("MST-1001");
 
         // Load VirtualHost list from file.
-        List<String> vhosts = Arrays.asList(_serverConfiguration.getVirtualHosts());
+        List<String> vhosts = Arrays.asList(getServerConfig().getVirtualHosts());
 
         assertEquals("Each vhost did not create a store.", vhosts.size(), results.size());
 
@@ -105,7 +105,7 @@ public class MemoryMessageStoreLoggingTe
             String vhostName = AbstractTestLogSubject.getSlice("vh", result).substring(1);
 
             // Get the store class used in the configuration for the virtualhost.
-            String fullStoreName = _serverConfiguration.getVirtualHostConfig(vhostName).getMessageStoreClass();
+            String fullStoreName = getServerConfig().getVirtualHostConfig(vhostName).getMessageStoreClass();
 
             // Get the Simple class name from the expected class name of o.a.q.s.s.MMS
             String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1);

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java?rev=1064085&r1=1064084&r2=1064085&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java
(original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java
Thu Jan 27 11:18:59 2011
@@ -68,7 +68,7 @@ public class VirtualHostLoggingTest exte
         
         try
         {
-            List<String> vhosts = Arrays.asList(_serverConfiguration.getVirtualHosts());
+            List<String> vhosts = Arrays.asList(getServerConfig().getVirtualHosts());
 
             assertEquals("Each vhost did not create a store.", vhosts.size(), results.size());
 



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


Mime
View raw message