From 6fa7bd72f94ed7f71d5b0c58883dcac180ea67e5 Mon Sep 17 00:00:00 2001 From: Robert Godfrey Date: Sun, 13 Apr 2014 08:49:34 +0000 Subject: QPID-5687 : [Java Broker] fix the initial config store to use "type" not "pluginType", add a test that checks the broker will startup with no config store. Change the handling of ${amqp.qpid_port} and friends to allow setting through system properties git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1586938 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/qpid/server/BrokerStartupTest.java | 41 ++++++++++++++++++---- .../apache/qpid/test/utils/QpidBrokerTestCase.java | 2 +- 2 files changed, 35 insertions(+), 8 deletions(-) (limited to 'qpid/java/systests') diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java index eba2a638c0..e3d0901942 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java @@ -20,6 +20,13 @@ */ package org.apache.qpid.server; +import java.io.File; +import java.util.List; + +import javax.jms.Connection; +import javax.jms.Queue; +import javax.jms.Session; + import junit.framework.AssertionFailedError; import org.apache.log4j.Level; import org.apache.log4j.Logger; @@ -27,12 +34,6 @@ import org.apache.log4j.Logger; import org.apache.qpid.server.logging.AbstractTestLogging; 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; - /** * Series of tests to validate the external Java broker starts up as expected. */ @@ -47,7 +48,33 @@ public class BrokerStartupTest extends AbstractTestLogging //part of the test case. } - + /** + * This test simply tests that the broker will startup even if there is no config file (i.e. that it can use the + * currently packaged initial config file (all system tests by default generate their own config file). + * + * It makes the assumption that setting the system property qpid.amqp_port + * to the value of getPort(0) will allow a connection to be established with getConnection() + * + * @throws Exception + */ + public void testStartupWithNoConfig() throws Exception + { + if (isJavaBroker()) + { + int port = getPort(0); + int managementPort = getManagementPort(port); + int connectorServerPort = managementPort + JMXPORT_CONNECTORSERVER_OFFSET; + + setTestSystemProperty("qpid.amqp_port",String.valueOf(port)); + setTestSystemProperty("qpid.jmx_port",String.valueOf(managementPort)); + setTestSystemProperty("qpid.rmi_port",String.valueOf(connectorServerPort)); + startBroker(port, null); + + Connection conn = getConnection(); + assertNotNull(conn); + conn.close(); + } + } /** * Description: * Test that providing an invalid broker logging configuration file does not diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java index 8dcf3b9010..c31f2eed3d 100755 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java @@ -689,7 +689,7 @@ public class QpidBrokerTestCase extends QpidTestCase { String testConfig = getTestConfigFile(port); String relative = getPathRelativeToWorkingDirectory(testConfig); - if (!testConfiguration.isSaved()) + if (testConfiguration != null && !testConfiguration.isSaved()) { _logger.info("Saving test broker configuration at: " + testConfig); testConfiguration.save(new File(testConfig)); -- cgit v1.2.1