qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject svn commit: r1660604 - in /qpid/trunk/qpid/java: broker-core/src/main/java/org/apache/qpid/server/ broker-core/src/main/java/org/apache/qpid/server/model/ systests/src/main/java/org/apache/qpid/test/utils/
Date Wed, 18 Feb 2015 11:56:07 GMT
Author: kwall
Date: Wed Feb 18 11:56:07 2015
New Revision: 1660604

URL: http://svn.apache.org/r1660604
Log:
QPID-6390: [Java System Tests] Ensure that Broker's system properties are loaded before the
test begins to use the Model to create test config

Modified:
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java?rev=1660604&r1=1660603&r2=1660604&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java Wed
Feb 18 11:56:07 2015
@@ -320,12 +320,12 @@ public class Broker implements BrokerShu
         }
     }
 
-    private void populateSystemPropertiesFromDefaults(final String initialProperties) throws
IOException
+    public static void populateSystemPropertiesFromDefaults(final String initialProperties)
throws IOException
     {
         URL initialPropertiesLocation;
         if(initialProperties == null)
         {
-            initialPropertiesLocation = getClass().getClassLoader().getResource("system.properties");
+            initialPropertiesLocation = Broker.class.getClassLoader().getResource("system.properties");
         }
         else
         {
@@ -335,7 +335,11 @@ public class Broker implements BrokerShu
         Properties props = new Properties(QpidProperties.asProperties());
         if(initialPropertiesLocation != null)
         {
-            props.load(initialPropertiesLocation.openStream());
+
+            try(InputStream inStream = initialPropertiesLocation.openStream())
+            {
+                props.load(inStream);
+            }
         }
 
         Set<String> propertyNames = new HashSet<>(props.stringPropertyNames());
@@ -344,7 +348,6 @@ public class Broker implements BrokerShu
         {
             System.setProperty(propName, props.getProperty(propName));
         }
-
     }
 
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java?rev=1660604&r1=1660603&r2=1660604&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java
(original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java
Wed Feb 18 11:56:07 2015
@@ -156,7 +156,7 @@ public class ConfiguredObjectFactoryImpl
             factory = categoryFactories.get(_defaultTypes.get(category));
             if(factory == null)
             {
-                throw new NoFactoryForTypeException(category, _defaultTypes.get(category));
+                throw new NoFactoryForTypeException(category, type);
             }
         }
         return factory;

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java?rev=1660604&r1=1660603&r2=1660604&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java
(original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java
Wed Feb 18 11:56:07 2015
@@ -59,6 +59,7 @@ import org.apache.qpid.exchange.Exchange
 import org.apache.qpid.framing.AMQShortString;
 import org.apache.qpid.jms.BrokerDetails;
 import org.apache.qpid.jms.ConnectionURL;
+import org.apache.qpid.server.Broker;
 import org.apache.qpid.server.BrokerOptions;
 import org.apache.qpid.server.configuration.BrokerProperties;
 import org.apache.qpid.server.configuration.updater.TaskExecutor;
@@ -189,6 +190,19 @@ public class QpidBrokerTestCase extends
         _brokerConfigurations = new HashMap<Integer, TestBrokerConfiguration>();
         initialiseSpawnedBrokerLogConfigFile();
         _brokerCommandTemplate = BROKER_COMMAND_TEMPLATE;
+
+
+        if (JAVA.equals(_brokerLanguage))
+        {
+            try
+            {
+                Broker.populateSystemPropertiesFromDefaults(null);
+            }
+            catch (IOException ioe)
+            {
+                throw new RuntimeException("Failed to load Java broker system properties",
ioe);
+            }
+        }
     }
 
     public TestBrokerConfiguration getBrokerConfiguration(int port)



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


Mime
View raw message