From 6a7034af2fe85270cb3d2cf588203bed9edd3c76 Mon Sep 17 00:00:00 2001 From: Andrew MacBean Date: Wed, 29 Oct 2014 12:31:26 +0000 Subject: QPID-6194: [Java Broker] Add option to prevent Broker startup when it has ERRORED children git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1635114 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/qpid/server/BrokerStartupTest.java | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'qpid/java/systests/src') diff --git a/qpid/java/systests/src/test/java/org/apache/qpid/server/BrokerStartupTest.java b/qpid/java/systests/src/test/java/org/apache/qpid/server/BrokerStartupTest.java index 9f5dd2ec39..e267bf439b 100644 --- a/qpid/java/systests/src/test/java/org/apache/qpid/server/BrokerStartupTest.java +++ b/qpid/java/systests/src/test/java/org/apache/qpid/server/BrokerStartupTest.java @@ -24,6 +24,7 @@ import java.io.File; import java.util.List; import javax.jms.Connection; +import javax.jms.JMSException; import javax.jms.Queue; import javax.jms.Session; @@ -183,4 +184,50 @@ public class BrokerStartupTest extends AbstractTestLogging } } + public void testStartupWithErroredChildrenCanBeConfigured() 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)); + + //Purposely set the HTTP port to be the same as the AMQP port so that the port object becomes ERRORED + setTestSystemProperty("qpid.http_port",String.valueOf(port)); + + // Set broker to fail on startup if it has ERRORED children + setTestSystemProperty("broker.failStartupWithErroredChild", String.valueOf(Boolean.TRUE)); + + File brokerConfigFile = new File(getTestConfigFile(port)); + if (brokerConfigFile.exists()) + { + // Config exists from previous test run, delete it. + brokerConfigFile.delete(); + } + + startBroker(port, null); + + AMQConnectionURL url = new AMQConnectionURL(String.format("amqp://" + + GUEST_USERNAME + + ":" + + GUEST_PASSWORD + + "@clientid/?brokerlist='localhost:%d'", port)); + + try + { + Connection conn = getConnection(url); + fail("Connection should fail as broker startup should have failed due to ERRORED children (port)"); + conn.close(); + } + catch (JMSException jmse) + { + //pass + } + } + } + } -- cgit v1.2.1