summaryrefslogtreecommitdiff
path: root/qpid/java/systests/src
diff options
context:
space:
mode:
authorAndrew MacBean <macbean@apache.org>2014-10-29 12:31:26 +0000
committerAndrew MacBean <macbean@apache.org>2014-10-29 12:31:26 +0000
commit6a7034af2fe85270cb3d2cf588203bed9edd3c76 (patch)
treed6e9c1dd202c95787c42db7eeab98509e7f6c7d1 /qpid/java/systests/src
parentcbb9d1e220351d5da2fbbdad27430e334c352e07 (diff)
downloadqpid-python-6a7034af2fe85270cb3d2cf588203bed9edd3c76.tar.gz
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
Diffstat (limited to 'qpid/java/systests/src')
-rw-r--r--qpid/java/systests/src/test/java/org/apache/qpid/server/BrokerStartupTest.java47
1 files changed, 47 insertions, 0 deletions
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
+ }
+ }
+ }
+
}