You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2016/04/15 17:57:34 UTC
svn commit: r1739327 - in /qpid/java/trunk:
systests/src/main/java/org/apache/qpid/test/utils/
systests/src/test/java/org/apache/qpid/transport/ test-profiles/
Author: orudyy
Date: Fri Apr 15 15:57:34 2016
New Revision: 1739327
URL: http://svn.apache.org/viewvc?rev=1739327&view=rev
Log:
QPID-7204: Add ability into system tests to override test, client and broker system properties from properties file
Added:
qpid/java/trunk/test-profiles/apache-ci.test.overridden.properties
Modified:
qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/AbstractBrokerHolder.java
qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java
qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/SpawnedBrokerHolder.java
qpid/java/trunk/systests/src/test/java/org/apache/qpid/transport/ProtocolNegotiationTest.java
Modified: qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/AbstractBrokerHolder.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/AbstractBrokerHolder.java?rev=1739327&r1=1739326&r2=1739327&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/AbstractBrokerHolder.java (original)
+++ qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/AbstractBrokerHolder.java Fri Apr 15 15:57:34 2016
@@ -243,10 +243,6 @@ public abstract class AbstractBrokerHold
options.setManagementModePassword(QpidBrokerTestCase.MANAGEMENT_MODE_PASSWORD);
}
options.setStartupLoggedToSystemOut(false);
- if (System.getProperty("test.broker.system.properties") != null)
- {
- options.setInitialSystemProperties(System.getProperty("test.broker.system.properties"));
- }
return options;
}
Modified: qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java?rev=1739327&r1=1739326&r2=1739327&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java (original)
+++ qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java Fri Apr 15 15:57:34 2016
@@ -18,12 +18,15 @@
package org.apache.qpid.test.utils;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import javax.jms.BytesMessage;
import javax.jms.Connection;
@@ -94,6 +97,7 @@ public class QpidBrokerTestCase extends
private static final Boolean BROKER_PERSISTENT = Boolean.getBoolean("broker.persistent");
private static final Protocol BROKER_PROTOCOL =
Protocol.valueOf("AMQP_" + System.getProperty("broker.version", "v0_9").substring(1));
+ private static final String TEST_OVERRIDDEN_PROPERTIES = "test.overridden.properties";
private static List<BrokerHolder> _brokerList = new ArrayList<>();
static
@@ -118,6 +122,39 @@ public class QpidBrokerTestCase extends
if (JAVA.equals(BROKER_LANGUAGE))
{
+ String pathToFileWithOverriddenClientAndBrokerProperties = System.getProperty(TEST_OVERRIDDEN_PROPERTIES);
+ if (pathToFileWithOverriddenClientAndBrokerProperties != null)
+ {
+ File file = new File(pathToFileWithOverriddenClientAndBrokerProperties);
+ if (file.exists())
+ {
+ _logger.info("Loading overridden system properties from {}", file.getAbsolutePath());
+ try (InputStream propertiesStream = new FileInputStream(file))
+ {
+ Properties properties = new Properties();
+ properties.load(propertiesStream);
+ for (String propertyName : properties.stringPropertyNames())
+ {
+ setSystemProperty(propertyName, properties.getProperty(propertyName));
+ }
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(String.format(
+ "Cannot load overridden properties from '%s'. Verify value provided with system property '%s'",
+ file.getAbsolutePath(),
+ TEST_OVERRIDDEN_PROPERTIES), e);
+ }
+ }
+ else
+ {
+ throw new RuntimeException(String.format(
+ "File with overridden properties at '%s' does not exists. Verify value provided with system property '%s'",
+ file.getAbsolutePath(),
+ TEST_OVERRIDDEN_PROPERTIES));
+ }
+ }
+
try
{
Broker.populateSystemPropertiesFromDefaults(null);
Modified: qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/SpawnedBrokerHolder.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/SpawnedBrokerHolder.java?rev=1739327&r1=1739326&r2=1739327&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/SpawnedBrokerHolder.java (original)
+++ qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/SpawnedBrokerHolder.java Fri Apr 15 15:57:34 2016
@@ -100,15 +100,6 @@ public class SpawnedBrokerHolder extends
cmd = newCmd;
}
- if (brokerOptions.getInitialSystemProperties() != null)
- {
- String[] newCmd = new String[cmd.length + 2];
- System.arraycopy(cmd, 0, newCmd, 0, cmd.length);
- newCmd[cmd.length] = "-props";
- newCmd[cmd.length + 1] = brokerOptions.getInitialSystemProperties();
- cmd = newCmd;
- }
-
ProcessBuilder pb = new ProcessBuilder(cmd);
pb.redirectErrorStream(true);
Map<String, String> processEnv = pb.environment();
Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/transport/ProtocolNegotiationTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/transport/ProtocolNegotiationTest.java?rev=1739327&r1=1739326&r2=1739327&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/transport/ProtocolNegotiationTest.java (original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/transport/ProtocolNegotiationTest.java Fri Apr 15 15:57:34 2016
@@ -27,8 +27,10 @@ import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -45,6 +47,7 @@ import org.apache.qpid.server.configurat
import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.Port;
import org.apache.qpid.server.model.Protocol;
+import org.apache.qpid.server.model.port.AmqpPort;
import org.apache.qpid.server.protocol.v0_10.ServerDisassembler;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -65,10 +68,13 @@ public class ProtocolNegotiationTest ext
TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT,
Port.PROTOCOLS,
Arrays.asList(getBrokerProtocol()));
+ Map<String,String> overriddenPortContext = new HashMap<>();
+ overriddenPortContext.put(BrokerProperties.PROPERTY_DEFAULT_SUPPORTED_PROTOCOL_REPLY, null);
+ overriddenPortContext.put(AmqpPort.PROTOCOL_HANDSHAKE_TIMEOUT, String.valueOf(AmqpPort.DEFAULT_PROTOCOL_HANDSHAKE_TIMEOUT));
config.setObjectAttribute(Port.class,
TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT,
Port.CONTEXT,
- Collections.singletonMap(BrokerProperties.PROPERTY_DEFAULT_SUPPORTED_PROTOCOL_REPLY, null));
+ overriddenPortContext);
config.setBrokerAttribute(Broker.CONTEXT,
Collections.singletonMap(BrokerProperties.PROPERTY_DEFAULT_SUPPORTED_PROTOCOL_REPLY, null));
Added: qpid/java/trunk/test-profiles/apache-ci.test.overridden.properties
URL: http://svn.apache.org/viewvc/qpid/java/trunk/test-profiles/apache-ci.test.overridden.properties?rev=1739327&view=auto
==============================================================================
--- qpid/java/trunk/test-profiles/apache-ci.test.overridden.properties (added)
+++ qpid/java/trunk/test-profiles/apache-ci.test.overridden.properties Fri Apr 15 15:57:34 2016
@@ -0,0 +1,22 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+qpid.port.protocol_handshake_timeout=10000
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org