You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2008/06/02 17:53:33 UTC

svn commit: r662467 - in /incubator/qpid/branches/M2.1.x: ./ java/broker/src/main/java/org/apache/qpid/server/exchange/ java/broker/src/main/java/org/apache/qpid/server/registry/ java/systests/src/main/java/org/apache/qpid/test/ java/systests/src/main/...

Author: ritchiem
Date: Mon Jun  2 08:53:33 2008
New Revision: 662467

URL: http://svn.apache.org/viewvc?rev=662467&view=rev
Log:
Merged revisions 661739-661746 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.x

........
  r661739 | ritchiem | 2008-05-30 15:42:38 +0100 (Fri, 30 May 2008) | 1 line
  
  QPID-1103 :Changed VMTestCase to allow the creation of InVM brokers based on a configuration file. Updated ApplicationRegistry as it was not correctly utilising the set configuration and always using AR 1.
........
  r661746 | ritchiem | 2008-05-30 15:54:35 +0100 (Fri, 30 May 2008) | 1 line
  
  QPID-1101 : Update to DestNameExchange to perform deep copy.
........

Added:
    incubator/qpid/branches/M2.1.x/java/systests/src/main/java/org/apache/qpid/testutil/BrokerStartupException.java
      - copied unchanged from r661746, incubator/qpid/branches/M2.x/java/systests/src/main/java/org/apache/qpid/testutil/BrokerStartupException.java
Modified:
    incubator/qpid/branches/M2.1.x/   (props changed)
    incubator/qpid/branches/M2.1.x/java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java
    incubator/qpid/branches/M2.1.x/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java
    incubator/qpid/branches/M2.1.x/java/systests/src/main/java/org/apache/qpid/test/VMTestCase.java

Propchange: incubator/qpid/branches/M2.1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/qpid/branches/M2.1.x/java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1.x/java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java?rev=662467&r1=662466&r2=662467&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1.x/java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java (original)
+++ incubator/qpid/branches/M2.1.x/java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java Mon Jun  2 08:53:33 2008
@@ -212,7 +212,7 @@
                 _logger.debug("Publishing message to queue " + queues);
             }
 
-            payload.enqueue(queues);
+            payload.enqueue(new ArrayList<AMQQueue>(queues));
 
 
         }

Modified: incubator/qpid/branches/M2.1.x/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1.x/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java?rev=662467&r1=662466&r2=662467&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1.x/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java (original)
+++ incubator/qpid/branches/M2.1.x/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java Mon Jun  2 08:53:33 2008
@@ -189,7 +189,7 @@
                 _logger.error("Unable to instantiate configuration class " + instanceType + " - ensure it has a public default constructor");
                 throw new IllegalArgumentException("Unable to instantiate configuration class " + instanceType + " - ensure it has a public default constructor", e);
             }
-            Configurator.configure(instance);
+            Configurator.configure(instance, _configuration);
             _configuredObjects.put(instanceType, instance);
         }
         return instance;

Modified: incubator/qpid/branches/M2.1.x/java/systests/src/main/java/org/apache/qpid/test/VMTestCase.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1.x/java/systests/src/main/java/org/apache/qpid/test/VMTestCase.java?rev=662467&r1=662466&r2=662467&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1.x/java/systests/src/main/java/org/apache/qpid/test/VMTestCase.java (original)
+++ incubator/qpid/branches/M2.1.x/java/systests/src/main/java/org/apache/qpid/test/VMTestCase.java Mon Jun  2 08:53:33 2008
@@ -21,13 +21,16 @@
 package org.apache.qpid.test;
 
 import junit.framework.TestCase;
+import org.apache.qpid.AMQException;
 import org.apache.qpid.client.AMQDestination;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
 import org.apache.qpid.framing.AMQShortString;
 import org.apache.qpid.jndi.PropertiesFileInitialContextFactory;
 import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.AMQException;
+import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry;
+import org.apache.qpid.testutil.BrokerStartupException;
 
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
@@ -37,6 +40,7 @@
 import javax.naming.Context;
 import javax.naming.NamingException;
 import javax.naming.spi.InitialContextFactory;
+import java.io.File;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Hashtable;
@@ -60,14 +64,7 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        try
-        {
-            TransportConnection.createVMBroker(1);
-        }
-        catch (Exception e)
-        {
-            fail("Unable to create broker: " + e);
-        }
+        startVMBroker(1);
 
         InitialContextFactory factory = new PropertiesFileInitialContextFactory();
 
@@ -118,9 +115,7 @@
         //Disabled
 //        checkQueuesClean();
 
-        TransportConnection.killVMBroker(1);
-        ApplicationRegistry.remove(1);
-
+        stopVMBroker(1);
         super.tearDown();
     }
 
@@ -161,4 +156,58 @@
         return ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHost(_virtualhost.substring(1))
                 .getQueueRegistry().getQueue(new AMQShortString(queueName)).getMessageCount();
     }
+
+    public void startVMBroker(int vmID) throws Exception
+    {
+        startVMBroker(vmID, null);
+    }
+
+    /** FIXME: for now vmID must be unique client is responsible for this. */
+    public void startVMBroker(int vmID, File configFile)
+    {
+        //If we have configuration file then load that
+        if (configFile != null)
+        {
+            if (!configFile.exists())
+            {
+                System.err.println("Configuration file not found:" + configFile);
+                fail("Configuration file not found:" + configFile);
+            }
+
+            if (System.getProperty("QPID_HOME") == null)
+            {
+                fail("QPID_HOME not set");
+            }
+
+            try
+            {
+                ConfigurationFileApplicationRegistry config = new ConfigurationFileApplicationRegistry(configFile);
+
+                //For now disable management on all configured inVM broker.
+                config.getConfiguration().setProperty("management.enabled", "false");
+
+                ApplicationRegistry.initialise(config, vmID);
+            }
+            catch (Exception e)
+            {
+                throw new BrokerStartupException("Unable to configure broker:" + vmID + " With file:" + configFile, e);
+            }
+        }
+
+        try
+        {
+            TransportConnection.createVMBroker(vmID);
+        }
+        catch (AMQVMBrokerCreationException e)
+        {
+            throw new BrokerStartupException("Unable to start broker:" + vmID, e);
+        }
+    }
+
+    public void stopVMBroker(int inVMid)
+    {
+        TransportConnection.killVMBroker(inVMid);
+        ApplicationRegistry.remove(inVMid);
+    }
+
 }