Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java Thu Dec 17 12:59:43 2015 @@ -52,16 +52,16 @@ public class GroupRestACLTest extends Qp public void setUp() throws Exception { _groupFile = createTemporaryGroupFile(); - getBrokerConfiguration().addGroupFileConfiguration(_groupFile.getAbsolutePath()); + getDefaultBrokerConfiguration().addGroupFileConfiguration(_groupFile.getAbsolutePath()); //DONT call super.setUp(), the tests will start the broker after configuring it } @Override - protected void customizeConfiguration() throws IOException + protected void customizeConfiguration() throws Exception { super.customizeConfiguration(); - getBrokerConfiguration().setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true); + getDefaultBrokerConfiguration().setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true); } @Override
Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java Thu Dec 17 12:59:43 2015 @@ -20,14 +20,11 @@ */ package org.apache.qpid.systest.rest.acl; -import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletResponse; -import org.apache.qpid.server.management.plugin.HttpManagement; -import org.apache.qpid.server.model.Plugin; import org.apache.qpid.server.model.Queue; import org.apache.qpid.server.security.acl.AbstractACLTestCase; import org.apache.qpid.systest.rest.QpidRestTestCase; @@ -49,10 +46,11 @@ public class QueueRestACLTest extends Qp } @Override - protected void customizeConfiguration() throws IOException + protected void customizeConfiguration() throws Exception { super.customizeConfiguration(); - getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER); + final TestBrokerConfiguration defaultBrokerConfiguration = getDefaultBrokerConfiguration(); + defaultBrokerConfiguration.configureTemporaryPasswordFile(ALLOWED_USER, DENIED_USER); AbstractACLTestCase.writeACLFileUtil(this, "ACL ALLOW-LOG ALL ACCESS MANAGEMENT", "ACL ALLOW-LOG " + ALLOWED_USER + " CREATE QUEUE", @@ -63,8 +61,6 @@ public class QueueRestACLTest extends Qp "ACL DENY-LOG " + DENIED_USER + " DELETE QUEUE", "ACL DENY-LOG ALL ALL"); - getBrokerConfiguration().setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, - HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true); } public void testCreateQueueAllowed() throws Exception Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java Thu Dec 17 12:59:43 2015 @@ -22,14 +22,11 @@ package org.apache.qpid.systest.rest.acl; import java.io.File; -import java.io.IOException; import java.net.URLEncoder; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.qpid.server.management.plugin.HttpManagement; -import org.apache.qpid.server.model.Plugin; import org.apache.qpid.server.model.PreferencesProvider; import org.apache.qpid.server.model.adapter.FileSystemPreferencesProvider; import org.apache.qpid.server.security.acl.AbstractACLTestCase; @@ -72,18 +69,15 @@ public class UserPreferencesRestACLTest } @Override - protected void customizeConfiguration() throws IOException + protected void customizeConfiguration() throws Exception { super.customizeConfiguration(); - getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER); + final TestBrokerConfiguration brokerConfiguration = getDefaultBrokerConfiguration(); + brokerConfiguration.configureTemporaryPasswordFile(ALLOWED_USER, DENIED_USER); AbstractACLTestCase.writeACLFileUtil(this, "ACL ALLOW-LOG ALL ACCESS MANAGEMENT", "ACL ALLOW-LOG " + ALLOWED_USER + " UPDATE USER", "ACL DENY-LOG " + DENIED_USER + " UPDATE USER", "ACL DENY-LOG ALL ALL"); - TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration(); - brokerConfiguration.setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, - HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true); - Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put(PreferencesProvider.NAME, "test"); attributes.put(PreferencesProvider.TYPE, FileSystemPreferencesProvider.PROVIDER_TYPE); Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java Thu Dec 17 12:59:43 2015 @@ -26,8 +26,6 @@ import java.util.Properties; import javax.servlet.http.HttpServletResponse; -import org.apache.qpid.server.management.plugin.HttpManagement; -import org.apache.qpid.server.model.Plugin; import org.apache.qpid.server.security.acl.AbstractACLTestCase; import org.apache.qpid.systest.rest.QpidRestTestCase; import org.apache.qpid.test.utils.TestBrokerConfiguration; @@ -45,21 +43,19 @@ public class UserRestACLTest extends Qpi private File _groupFile; @Override - public void setUp() throws Exception + public void startDefaultBroker() throws Exception { - _groupFile = createTemporaryGroupFile(); - getBrokerConfiguration().addGroupFileConfiguration(_groupFile.getAbsolutePath()); - - getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER, OTHER_USER); - - //DONT call super.setUp(), the tests will start the broker after configuring it + // starting broker in tests } @Override - protected void customizeConfiguration() throws IOException + protected void customizeConfiguration() throws Exception { super.customizeConfiguration(); - getBrokerConfiguration().setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true); + _groupFile = createTemporaryGroupFile(); + final TestBrokerConfiguration brokerConfiguration = getDefaultBrokerConfiguration(); + brokerConfiguration.addGroupFileConfiguration(_groupFile.getAbsolutePath()); + brokerConfiguration.configureTemporaryPasswordFile(ALLOWED_USER, DENIED_USER, OTHER_USER); } @Override @@ -97,8 +93,7 @@ public class UserRestACLTest extends Qpi "ACL ALLOW-LOG " + ALLOWED_GROUP + " CREATE USER", "ACL DENY-LOG " + DENIED_GROUP + " CREATE USER"); - //Start the broker with the custom config - super.setUp(); + super.startDefaultBroker(); String newUser = "newUser"; String password = "password"; @@ -121,8 +116,7 @@ public class UserRestACLTest extends Qpi "ACL ALLOW-LOG " + ALLOWED_GROUP + " DELETE USER", "ACL DENY-LOG " + DENIED_GROUP + " DELETE USER"); - //Start the broker with the custom config - super.setUp(); + super.startDefaultBroker(); assertUserExists(OTHER_USER); @@ -141,8 +135,7 @@ public class UserRestACLTest extends Qpi "ACL ALLOW-LOG " + ALLOWED_GROUP + " UPDATE USER", "ACL DENY-LOG " + DENIED_GROUP + " UPDATE USER"); - //Start the broker with the custom config - super.setUp(); + super.startDefaultBroker(); String newPassword = "newPassword"; Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/VirtualHostACLTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/VirtualHostACLTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/VirtualHostACLTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/VirtualHostACLTest.java Thu Dec 17 12:59:43 2015 @@ -20,16 +20,13 @@ package org.apache.qpid.systest.rest.acl; import java.io.File; -import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.apache.qpid.server.logging.VirtualHostFileLogger; -import org.apache.qpid.server.management.plugin.HttpManagement; import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.Plugin; import org.apache.qpid.server.model.VirtualHost; import org.apache.qpid.server.model.VirtualHostLogger; import org.apache.qpid.server.model.VirtualHostNode; @@ -47,26 +44,24 @@ public class VirtualHostACLTest extends private static final String DENIED_USER = "user2"; @Override - protected void customizeConfiguration() throws IOException + protected void customizeConfiguration() throws Exception { super.customizeConfiguration(); - getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER); + final TestBrokerConfiguration defaultBrokerConfiguration = getDefaultBrokerConfiguration(); + defaultBrokerConfiguration.configureTemporaryPasswordFile(ALLOWED_USER, DENIED_USER); AbstractACLTestCase.writeACLFileUtil(this, "ACL ALLOW-LOG ALL ACCESS MANAGEMENT", "ACL ALLOW-LOG " + ALLOWED_USER + " ALL VIRTUALHOST", "ACL DENY-LOG " + DENIED_USER + " ALL VIRTUALHOST", "ACL DENY-LOG ALL ALL"); - getBrokerConfiguration().setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, - HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true); - Map<String, Object> virtualHostNodeAttributes = new HashMap<>(); virtualHostNodeAttributes.put(VirtualHostNode.NAME, VHN_WITHOUT_VH); virtualHostNodeAttributes.put(VirtualHostNode.TYPE, getTestProfileVirtualHostNodeType()); // TODO need better way to determine the VHN's optional attributes virtualHostNodeAttributes.put(JsonVirtualHostNode.STORE_PATH, getStoreLocation(VHN_WITHOUT_VH)); - getBrokerConfiguration().addObjectConfiguration(VirtualHostNode.class, virtualHostNodeAttributes); + defaultBrokerConfiguration.addObjectConfiguration(VirtualHostNode.class, virtualHostNodeAttributes); } public void testCreateVirtualHostAllowed() throws Exception Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/VirtualHostNodeACLTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/VirtualHostNodeACLTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/VirtualHostNodeACLTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/acl/VirtualHostNodeACLTest.java Thu Dec 17 12:59:43 2015 @@ -19,14 +19,11 @@ package org.apache.qpid.systest.rest.acl; import java.io.File; -import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletResponse; -import org.apache.qpid.server.management.plugin.HttpManagement; -import org.apache.qpid.server.model.Plugin; import org.apache.qpid.server.model.VirtualHostNode; import org.apache.qpid.server.security.acl.AbstractACLTestCase; import org.apache.qpid.server.virtualhostnode.JsonVirtualHostNode; @@ -40,27 +37,24 @@ public class VirtualHostNodeACLTest exte private static final String DENIED_USER = "user2"; @Override - protected void customizeConfiguration() throws IOException + protected void customizeConfiguration() throws Exception { super.customizeConfiguration(); - getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER); + final TestBrokerConfiguration defaultBrokerConfiguration = getDefaultBrokerConfiguration(); + defaultBrokerConfiguration.configureTemporaryPasswordFile(ALLOWED_USER, DENIED_USER); AbstractACLTestCase.writeACLFileUtil(this, "ACL ALLOW-LOG ALL ACCESS MANAGEMENT", "ACL ALLOW-LOG " + ALLOWED_USER + " ALL VIRTUALHOSTNODE", "ACL DENY-LOG " + DENIED_USER + " ALL VIRTUALHOSTNODE", "ACL DENY-LOG ALL ALL"); - getBrokerConfiguration().setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, - HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true); - Map<String, Object> virtualHostNodeAttributes = new HashMap<>(); virtualHostNodeAttributes.put(VirtualHostNode.NAME, TEST_VIRTUAL_HOST_NODE); virtualHostNodeAttributes.put(VirtualHostNode.TYPE, getTestProfileVirtualHostNodeType()); // TODO need better way to determine the VHN's optional attributes virtualHostNodeAttributes.put(JsonVirtualHostNode.STORE_PATH, getStoreLocation(TEST_VIRTUAL_HOST_NODE)); - - getBrokerConfiguration().addObjectConfiguration(VirtualHostNode.class, virtualHostNodeAttributes); + defaultBrokerConfiguration.addObjectConfiguration(VirtualHostNode.class, virtualHostNodeAttributes); } public void testCreateVirtualHostNodeAllowed() throws Exception Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/FlowControlTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/FlowControlTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/FlowControlTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/FlowControlTest.java Thu Dec 17 12:59:43 2015 @@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory; import org.apache.qpid.client.AMQSession_0_8; import org.apache.qpid.client.message.AbstractJMSMessage; +import org.apache.qpid.test.utils.BrokerHolder; import org.apache.qpid.test.utils.QpidBrokerTestCase; public class FlowControlTest extends QpidBrokerTestCase @@ -204,16 +205,20 @@ public class FlowControlTest extends Qpi { System.err.println("Test Run:" + ++run); Thread.sleep(1000); + BrokerHolder broker = null; try { - test.startBroker(); + broker = test.createSpawnedBroker(); test.testBasicBytesFlowControl(); Thread.sleep(1000); } finally { - test.stopBroker(); + if (broker != null) + { + broker.shutdown(); + } } } } Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/ImmediateAndMandatoryPublishingTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/ImmediateAndMandatoryPublishingTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/ImmediateAndMandatoryPublishingTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/ImmediateAndMandatoryPublishingTest.java Thu Dec 17 12:59:43 2015 @@ -42,7 +42,7 @@ public class ImmediateAndMandatoryPublis @Override public void setUp() throws Exception { - getBrokerConfiguration().setBrokerAttribute(Broker.CONNECTION_CLOSE_WHEN_NO_ROUTE, false); + getDefaultBrokerConfiguration().setBrokerAttribute(Broker.CONNECTION_CLOSE_WHEN_NO_ROUTE, false); super.setUp(); _connection = getConnection(); _connection.setExceptionListener(_testExceptionListener); Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/failover/FailoverTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/failover/FailoverTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/failover/FailoverTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/failover/FailoverTest.java Thu Dec 17 12:59:43 2015 @@ -22,7 +22,6 @@ package org.apache.qpid.test.client.failover; import java.util.Random; -import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import javax.jms.Connection; @@ -39,10 +38,10 @@ import org.slf4j.LoggerFactory; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQSession; -import org.apache.qpid.jms.ConnectionListener; +import org.apache.qpid.test.utils.BrokerHolder; import org.apache.qpid.test.utils.FailoverBaseCase; -public class FailoverTest extends FailoverBaseCase implements ConnectionListener +public class FailoverTest extends FailoverBaseCase { private static final Logger _logger = LoggerFactory.getLogger(FailoverTest.class); @@ -56,25 +55,22 @@ public class FailoverTest extends Failov private Session consumerSession; private MessageConsumer consumer; - private CountDownLatch failoverComplete; private boolean CLUSTERED = Boolean.getBoolean("profile.clustered"); private int seed; private Random rand; - private int _currentPort = getFailingPort(); @Override protected void setUp() throws Exception { super.setUp(); - - numMessages = Integer.getInteger("profile.failoverMsgCount",DEFAULT_NUM_MESSAGES); - seed = Integer.getInteger("profile.failoverRandomSeed",DEFAULT_SEED); + + numMessages = Integer.getInteger("profile.failoverMsgCount", DEFAULT_NUM_MESSAGES); + seed = Integer.getInteger("profile.failoverRandomSeed", DEFAULT_SEED); rand = new Random(seed); connection = getConnection(); ((AMQConnection) connection).setConnectionListener(this); connection.start(); - failoverComplete = new CountDownLatch(1); } private void init(boolean transacted, int mode) throws Exception @@ -99,7 +95,14 @@ public class FailoverTest extends Failov } - super.tearDown(); + try + { + _alternativeBroker.shutdown(); + } + finally + { + super.tearDown(); + } } private void consumeMessages(int startIndex,int endIndex, boolean transacted) throws JMSException @@ -154,14 +157,14 @@ public class FailoverTest extends Failov public void testP2PFailover() throws Exception { - testP2PFailover(numMessages, true,true, false); + testP2PFailover(numMessages, true, true, false); } public void testP2PFailoverWithMessagesLeftToConsumeAndProduce() throws Exception { if (CLUSTERED) { - testP2PFailover(numMessages, false,false, false); + testP2PFailover(numMessages, false, false, false); } } @@ -175,7 +178,7 @@ public class FailoverTest extends Failov public void testP2PFailoverTransacted() throws Exception { - testP2PFailover(numMessages, true,true, true); + testP2PFailover(numMessages, true, true, true); } public void testP2PFailoverTransactedWithMessagesLeftToConsumeAndProduce() throws Exception @@ -189,10 +192,10 @@ public class FailoverTest extends Failov private void testP2PFailover(int totalMessages, boolean consumeAll, boolean produceAll , boolean transacted) throws Exception { init(transacted, Session.AUTO_ACKNOWLEDGE); - runP2PFailover(totalMessages,consumeAll, produceAll , transacted); + runP2PFailover(getDefaultBroker(), totalMessages,consumeAll, produceAll , transacted); } - private void runP2PFailover(int totalMessages, boolean consumeAll, boolean produceAll , boolean transacted) throws Exception + private void runP2PFailover(BrokerHolder broker, int totalMessages, boolean consumeAll, boolean produceAll , boolean transacted) throws Exception { int toProduce = totalMessages; @@ -209,7 +212,7 @@ public class FailoverTest extends Failov _logger.debug("Sending " + toProduce + " messages"); _logger.debug("=================="); - sendMessages(0,toProduce, transacted); + sendMessages(0, toProduce, transacted); // Consume some messages int toConsume = toProduce; @@ -218,7 +221,7 @@ public class FailoverTest extends Failov toConsume = toProduce - rand.nextInt(toProduce); } - consumeMessages(0,toConsume, transacted); + consumeMessages(0, toConsume, transacted); _logger.debug("=================="); _logger.debug("Consuming " + toConsume + " messages"); @@ -226,30 +229,30 @@ public class FailoverTest extends Failov _logger.info("Failing over"); - causeFailure(_currentPort, DEFAULT_FAILOVER_TIME); + causeFailure(broker, DEFAULT_FAILOVER_TIME); // Check that you produce and consume the rest of messages. _logger.debug("=================="); _logger.debug("Sending " + (totalMessages-toProduce) + " messages"); _logger.debug("=================="); - sendMessages(toProduce,totalMessages, transacted); - consumeMessages(toConsume,totalMessages, transacted); + sendMessages(toProduce, totalMessages, transacted); + consumeMessages(toConsume, totalMessages, transacted); _logger.debug("=================="); _logger.debug("Consuming " + (totalMessages-toConsume) + " messages"); _logger.debug("=================="); } - private void causeFailure(int port, long delay) + private void causeFailure(BrokerHolder broker, long delay) { - failBroker(port); + failBroker(broker); _logger.info("Awaiting Failover completion"); try { - if (!failoverComplete.await(delay, TimeUnit.MILLISECONDS)) + if (!_failoverComplete.await(delay, TimeUnit.MILLISECONDS)) { fail("failover did not complete"); } @@ -267,7 +270,7 @@ public class FailoverTest extends Failov Message msg = consumer.receive(); assertNotNull("Expected msgs not received", msg); - causeFailure(getFailingPort(), DEFAULT_FAILOVER_TIME); + causeFailure(getDefaultBroker(), DEFAULT_FAILOVER_TIME); Exception failure = null; try @@ -291,61 +294,32 @@ public class FailoverTest extends Failov { return; } - - int iterations = Integer.getInteger("profile.failoverIterations",0); - boolean useAltPort = false; - int altPort = FAILING_PORT; - int stdPort = DEFAULT_PORT; + + BrokerHolder currentBroker = getDefaultBroker(); + int iterations = Integer.getInteger("profile.failoverIterations", 3); + _logger.debug("LQ: iterations {}", iterations); + boolean useDefaultBroker = true; init(false, Session.AUTO_ACKNOWLEDGE); for (int i=0; i < iterations; i++) { _logger.debug("==================================================================="); _logger.debug("Failover In a loop : iteration number " + i); _logger.debug("==================================================================="); - - runP2PFailover(numMessages, false,false, false); - startBroker(_currentPort); - if (useAltPort) + + runP2PFailover(currentBroker, numMessages, false, false, false); + restartBroker(currentBroker); + if (useDefaultBroker) { - _currentPort = altPort; - useAltPort = false; + currentBroker = _alternativeBroker; + useDefaultBroker = false; } else { - _currentPort = stdPort; - useAltPort = true; + currentBroker = getDefaultBroker(); + useDefaultBroker = true; } - } //To prevent any failover logic being initiated when we shutdown the brokers. connection.close(); - - // Shutdown the brokers - stopBroker(altPort); - stopBroker(stdPort); - - } - - public void bytesSent(long count) - { - } - - public void bytesReceived(long count) - { - } - - public boolean preFailover(boolean redirect) - { - return true; - } - - public boolean preResubscribe() - { - return true; - } - - public void failoverComplete() - { - failoverComplete.countDown(); } } Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/ack/ClientAcknowledgeTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/ack/ClientAcknowledgeTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/ack/ClientAcknowledgeTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/ack/ClientAcknowledgeTest.java Thu Dec 17 12:59:43 2015 @@ -18,8 +18,6 @@ */ package org.apache.qpid.test.unit.ack; -import org.apache.qpid.test.utils.QpidBrokerTestCase; - import javax.jms.Connection; import javax.jms.Message; import javax.jms.MessageConsumer; @@ -27,6 +25,8 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; +import org.apache.qpid.test.utils.QpidBrokerTestCase; + public class ClientAcknowledgeTest extends QpidBrokerTestCase { private static final long ONE_DAY_MS = 1000l * 60 * 60 * 24; @@ -68,7 +68,7 @@ public class ClientAcknowledgeTest exten //restart broker to allow verification of the acks //without explicitly closing connection (which acks) - restartBroker(); + restartDefaultBroker(); // try to receive the message again, which should fail (as it was ackd) _connection = getConnection(); Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java Thu Dec 17 12:59:43 2015 @@ -20,6 +20,10 @@ */ package org.apache.qpid.test.unit.basic; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageListener; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -29,10 +33,6 @@ import org.apache.qpid.client.AMQQueue; import org.apache.qpid.client.AMQSession; import org.apache.qpid.test.utils.QpidBrokerTestCase; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; - public class SessionStartTest extends QpidBrokerTestCase implements MessageListener { private static final Logger _logger = LoggerFactory.getLogger(SessionStartTest.class); @@ -41,7 +41,6 @@ public class SessionStartTest extends Qp private AMQDestination _destination; private AMQSession _session; private int count; - public String _connectionString = "vm://:1"; protected void setUp() throws Exception { @@ -103,12 +102,4 @@ public class SessionStartTest extends Qp { return in + System.currentTimeMillis(); } - - public static void main(String[] argv) throws Exception - { - SessionStartTest test = new SessionStartTest(); - test._connectionString = (argv.length == 0) ? "localhost:5672" : argv[0]; - test.setUp(); - test.test(); - } } Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/DynamicQueueExchangeCreateTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/DynamicQueueExchangeCreateTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/DynamicQueueExchangeCreateTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/DynamicQueueExchangeCreateTest.java Thu Dec 17 12:59:43 2015 @@ -25,6 +25,14 @@ import java.io.IOException; import java.util.List; import java.util.Map; +import javax.jms.Connection; +import javax.jms.InvalidDestinationException; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.Queue; +import javax.jms.Session; + import org.apache.qpid.AMQException; import org.apache.qpid.client.AMQSession; import org.apache.qpid.configuration.ClientProperties; @@ -36,14 +44,6 @@ import org.apache.qpid.test.utils.QpidBr import org.apache.qpid.test.utils.TestBrokerConfiguration; import org.apache.qpid.url.BindingURL; -import javax.jms.Connection; -import javax.jms.InvalidDestinationException; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.Queue; -import javax.jms.Session; - public class DynamicQueueExchangeCreateTest extends QpidBrokerTestCase { private static final String TEST_VHOST = TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST; @@ -52,9 +52,9 @@ public class DynamicQueueExchangeCreateT @Override public void setUp() throws Exception { - _restTestHelper = new RestTestHelper(findFreePort()); - _restTestHelper.enableHttpManagement(getBrokerConfiguration()); + getDefaultBrokerConfiguration().addHttpManagementConfiguration(); super.setUp(); + _restTestHelper = new RestTestHelper(getDefaultBroker().getHttpPort()); } @Override Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java Thu Dec 17 12:59:43 2015 @@ -79,7 +79,7 @@ public class MaxDeliveryCountTest extend { //enable DLQ/maximumDeliveryCount support for all queues at the vhost level - TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration(); + TestBrokerConfiguration brokerConfiguration = getDefaultBrokerConfiguration(); setTestSystemProperty("queue.deadLetterQueueEnabled","true"); setTestSystemProperty("queue.maximumDeliveryAttempts", String.valueOf(MAX_DELIVERY_COUNT)); @@ -205,7 +205,7 @@ public class MaxDeliveryCountTest extend public void testWhenBrokerIsRestartedAfterEnqeuingMessages() throws Exception { - restartBroker(); + restartDefaultBroker(); doTest(Session.SESSION_TRANSACTED, _redeliverMsgs, true, false); } @@ -279,7 +279,7 @@ public class MaxDeliveryCountTest extend //restart the broker to verify persistence of the DLQ and the messages on it clientConnection.close(); - restartBroker(); + restartDefaultBroker(); final Connection clientConnection2 = getConnection(); clientConnection2.start(); Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java Thu Dec 17 12:59:43 2015 @@ -23,11 +23,16 @@ package org.apache.qpid.test.unit.client import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import javax.jms.Connection; +import javax.jms.ExceptionListener; +import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.MessageProducer; import javax.jms.Queue; +import javax.jms.Session; + import org.apache.qpid.AMQConnectionClosedException; import org.apache.qpid.AMQDisconnectedException; import org.apache.qpid.client.AMQConnection; @@ -37,11 +42,6 @@ import org.apache.qpid.client.BasicMessa import org.apache.qpid.test.utils.QpidBrokerTestCase; import org.apache.qpid.transport.ConnectionException; -import javax.jms.Connection; -import javax.jms.ExceptionListener; -import javax.jms.JMSException; -import javax.jms.Session; - /** * Tests the behaviour of the client when the Broker terminates client connection * by the Broker being shutdown gracefully or otherwise. @@ -77,7 +77,7 @@ public class BrokerClosesClientConnectio assertJmsObjectsOpen(); - stopBroker(); + stopDefaultBroker(); JMSException exception = _recordingExceptionListener.awaitException(10000); assertConnectionCloseWasReported(exception, expectedLinkedException); @@ -97,7 +97,7 @@ public class BrokerClosesClientConnectio assertJmsObjectsOpen(); - killBroker(); + killDefaultBroker(); JMSException exception = _recordingExceptionListener.awaitException(10000); assertConnectionCloseWasReported(exception, expectedLinkedException); @@ -219,7 +219,7 @@ public class BrokerClosesClientConnectio assertEquals(1, listener.getCount()); - stopBroker(); + stopDefaultBroker(); assertEquals(1, listener.getCount()); Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionFactoryTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionFactoryTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionFactoryTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionFactoryTest.java Thu Dec 17 12:59:43 2015 @@ -36,7 +36,7 @@ public class ConnectionFactoryTest exten public void testCreateConnectionWithUsernamePassword() throws Exception { - String brokerUrl = getBroker().toString(); + String brokerUrl = getBrokerDetailsFromDefaultConnectionUrl().toString(); String URL = "amqp://guest:guest@clientID/test?brokerlist='" + brokerUrl + "'"; AMQConnectionFactory factory = new AMQConnectionFactory(URL); @@ -66,7 +66,7 @@ public class ConnectionFactoryTest exten */ public void testCreatingConnectionWithInstanceMadeUsingDefaultConstructor() throws Exception { - String broker = getBroker().toString(); + String broker = getBrokerDetailsFromDefaultConnectionUrl().toString(); String url = "amqp://guest:guest@clientID/test?brokerlist='" + broker + "'"; AMQConnectionFactory factory = new AMQConnectionFactory(); Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java Thu Dec 17 12:59:43 2015 @@ -28,14 +28,14 @@ import javax.jms.QueueSession; import javax.jms.TopicSession; import org.apache.qpid.AMQConnectionFailureException; -import org.apache.qpid.QpidException; import org.apache.qpid.AMQUnresolvedAddressException; -import org.apache.qpid.client.BrokerDetails; +import org.apache.qpid.QpidException; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQConnectionURL; import org.apache.qpid.client.AMQQueue; import org.apache.qpid.client.AMQSession; import org.apache.qpid.client.AMQTopic; +import org.apache.qpid.client.BrokerDetails; import org.apache.qpid.configuration.ClientProperties; import org.apache.qpid.exchange.ExchangeDefaults; import org.apache.qpid.jms.ConnectionURL; @@ -54,11 +54,11 @@ public class ConnectionTest extends Qpid AMQConnection conn = null; try { - conn = new AMQConnection(getBroker().toString(), "guest", "guest", "fred", "test"); + conn = new AMQConnection(getBrokerDetailsFromDefaultConnectionUrl().toString(), "guest", "guest", "fred", "test"); } catch (Exception e) { - fail("Connection to " + getBroker() + " should succeed. Reason: " + e); + fail("Connection to " + getBrokerDetailsFromDefaultConnectionUrl() + " should succeed. Reason: " + e); } finally { @@ -74,7 +74,7 @@ public class ConnectionTest extends Qpid AMQConnection conn = null; try { - BrokerDetails broker = getBroker(); + BrokerDetails broker = getBrokerDetailsFromDefaultConnectionUrl(); broker.setProperty(BrokerDetails.OPTIONS_RETRY, "1"); ConnectionURL url = new AMQConnectionURL("amqp://guest:guest@clientid/test?brokerlist='" + broker @@ -123,7 +123,7 @@ public class ConnectionTest extends Qpid } catch (Exception e) { - fail("Connection to " + getBroker() + " should succeed. Reason: " + e); + fail("Connection to " + getBrokerDetailsFromDefaultConnectionUrl() + " should succeed. Reason: " + e); } finally { @@ -136,7 +136,7 @@ public class ConnectionTest extends Qpid AMQConnection conn = null; try { - BrokerDetails broker = getBroker(); + BrokerDetails broker = getBrokerDetailsFromDefaultConnectionUrl(); broker.setProperty(BrokerDetails.OPTIONS_RETRY, "0"); conn = new AMQConnection("amqp://guest:rubbishpassword@clientid/test?brokerlist='" + broker + "'"); fail("Connection should not be established password is wrong."); @@ -210,7 +210,7 @@ public class ConnectionTest extends Qpid AMQConnection conn = null; try { - BrokerDetails broker = getBroker(); + BrokerDetails broker = getBrokerDetailsFromDefaultConnectionUrl(); broker.setProperty(BrokerDetails.OPTIONS_RETRY, "0"); conn = new AMQConnection("amqp://guest:guest@clientid/rubbishhost?brokerlist='" + broker + "'"); fail("Connection should not be established"); @@ -233,7 +233,7 @@ public class ConnectionTest extends Qpid public void testClientIdCannotBeChanged() throws Exception { - Connection connection = new AMQConnection(getBroker().toString(), "guest", "guest", + Connection connection = new AMQConnection(getBrokerDetailsFromDefaultConnectionUrl().toString(), "guest", "guest", "fred", "test"); try { @@ -255,7 +255,7 @@ public class ConnectionTest extends Qpid public void testClientIdIsPopulatedAutomatically() throws Exception { - Connection connection = new AMQConnection(getBroker().toString(), "guest", "guest", + Connection connection = new AMQConnection(getBrokerDetailsFromDefaultConnectionUrl().toString(), "guest", "guest", null, "test"); try { @@ -270,7 +270,7 @@ public class ConnectionTest extends Qpid public void testUnsupportedSASLMechanism() throws Exception { - BrokerDetails broker = getBroker(); + BrokerDetails broker = getBrokerDetailsFromDefaultConnectionUrl(); broker.setProperty(BrokerDetails.OPTIONS_SASL_MECHS, "MY_MECH"); try @@ -300,7 +300,7 @@ public class ConnectionTest extends Qpid { setTestSystemProperty(ClientProperties.QPID_VERIFY_CLIENT_ID, "true"); - BrokerDetails broker = getBroker(); + BrokerDetails broker = getBrokerDetailsFromDefaultConnectionUrl(); try { Connection con = new AMQConnection(broker.toString(), "guest", "guest", @@ -329,7 +329,7 @@ public class ConnectionTest extends Qpid { setTestSystemProperty(ClientProperties.QPID_VERIFY_CLIENT_ID, "true"); - BrokerDetails broker = getBroker(); + BrokerDetails broker = getBrokerDetailsFromDefaultConnectionUrl(); try { Connection con = new AMQConnection(broker.toString(), "guest", "guest", @@ -355,7 +355,7 @@ public class ConnectionTest extends Qpid AMQConnection conn = null; try { - BrokerDetails broker = getBroker(); + BrokerDetails broker = getBrokerDetailsFromDefaultConnectionUrl(); String url = "amqp:///test?brokerlist='" + broker + "?sasl_mechs='PLAIN%2520CRAM-MD5''"; conn = new AMQConnection(url); conn.close(); Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ExceptionListenerTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ExceptionListenerTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ExceptionListenerTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ExceptionListenerTest.java Thu Dec 17 12:59:43 2015 @@ -38,12 +38,13 @@ import javax.jms.MessageListener; import javax.jms.Queue; import javax.jms.Session; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.apache.qpid.AMQConnectionClosedException; import org.apache.qpid.jms.ConnectionURL; import org.apache.qpid.test.utils.QpidBrokerTestCase; import org.apache.qpid.transport.ConnectionException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class ExceptionListenerTest extends QpidBrokerTestCase { @@ -68,7 +69,7 @@ public class ExceptionListenerTest exten Connection connection = getConnection(); connection.setExceptionListener(listener); - stopBroker(); + stopDefaultBroker(); exceptionReceivedLatch.await(10, TimeUnit.SECONDS); @@ -110,7 +111,7 @@ public class ExceptionListenerTest exten connection.setExceptionListener(listener); - stopBroker(); + stopDefaultBroker(); boolean exceptionReceived = exceptionReceivedLatch.await(10, TimeUnit.SECONDS); assertTrue("Exception listener did not hear exception within timeout", exceptionReceived); @@ -151,7 +152,7 @@ public class ExceptionListenerTest exten }; connection.setExceptionListener(listener); - stopBroker(); + stopDefaultBroker(); boolean exceptionReceived = exceptionReceivedLatch.await(10, TimeUnit.SECONDS); assertTrue("Exception listener did not hear exception within timeout", exceptionReceived); Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/ct/DurableSubscriberTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/ct/DurableSubscriberTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/ct/DurableSubscriberTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/ct/DurableSubscriberTest.java Thu Dec 17 12:59:43 2015 @@ -17,12 +17,6 @@ */ package org.apache.qpid.test.unit.ct; -import org.apache.qpid.client.AMQConnection; -import org.apache.qpid.client.AMQQueue; -import org.apache.qpid.client.AMQSession; -import org.apache.qpid.client.AMQTopic; -import org.apache.qpid.test.utils.QpidBrokerTestCase; - import javax.jms.Connection; import javax.jms.Message; import javax.jms.MessageProducer; @@ -35,6 +29,12 @@ import javax.jms.TopicPublisher; import javax.jms.TopicSession; import javax.jms.TopicSubscriber; +import org.apache.qpid.client.AMQConnection; +import org.apache.qpid.client.AMQQueue; +import org.apache.qpid.client.AMQSession; +import org.apache.qpid.client.AMQTopic; +import org.apache.qpid.test.utils.QpidBrokerTestCase; + /** * Crash Recovery tests for durable subscription * @@ -81,7 +81,7 @@ public class DurableSubscriberTest exten //now stop the server try { - restartBroker(); + restartDefaultBroker(); } catch (Exception e) { @@ -131,7 +131,7 @@ public class DurableSubscriberTest exten //now stop the server try { - restartBroker(); + restartDefaultBroker(); } catch (Exception e) { @@ -221,7 +221,7 @@ public class DurableSubscriberTest exten //now restart the server try { - restartBroker(); + restartDefaultBroker(); } catch (Exception e) { @@ -316,7 +316,7 @@ public class DurableSubscriberTest exten //now restart the server try { - restartBroker(); + restartDefaultBroker(); } catch (Exception e) { @@ -449,7 +449,7 @@ public class DurableSubscriberTest exten //now restart the server try { - restartBroker(); + restartDefaultBroker(); } catch (Exception e) { Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java Thu Dec 17 12:59:43 2015 @@ -20,15 +20,8 @@ */ package org.apache.qpid.test.unit.topic; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.client.AMQConnection; -import org.apache.qpid.client.AMQNoRouteException; -import org.apache.qpid.client.AMQQueue; -import org.apache.qpid.client.AMQSession; -import org.apache.qpid.client.AMQTopic; -import org.apache.qpid.test.utils.QpidBrokerTestCase; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import javax.jms.Connection; import javax.jms.ExceptionListener; @@ -43,8 +36,15 @@ import javax.jms.TextMessage; import javax.jms.Topic; import javax.jms.TopicSubscriber; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.qpid.client.AMQConnection; +import org.apache.qpid.client.AMQNoRouteException; +import org.apache.qpid.client.AMQQueue; +import org.apache.qpid.client.AMQSession; +import org.apache.qpid.client.AMQTopic; +import org.apache.qpid.test.utils.QpidBrokerTestCase; /** * @todo Code to check that a consumer gets only one particular method could be factored into a re-usable method (as @@ -333,7 +333,7 @@ public class DurableSubscriptionTest ext { try { - restartBroker(); + restartDefaultBroker(); } catch (Exception e) { Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactedTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactedTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactedTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactedTest.java Thu Dec 17 12:59:43 2015 @@ -21,6 +21,14 @@ package org.apache.qpid.test.unit.transacted; +import javax.jms.Connection; +import javax.jms.IllegalStateException; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.TextMessage; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,14 +38,6 @@ import org.apache.qpid.client.AMQSession import org.apache.qpid.jms.Session; import org.apache.qpid.test.utils.QpidBrokerTestCase; -import javax.jms.Connection; -import javax.jms.IllegalStateException; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.TextMessage; - public class TransactedTest extends QpidBrokerTestCase { private AMQQueue queue1; @@ -108,7 +108,7 @@ public class TransactedTest extends Qpid catch (Exception e) { _logger.error("setup error",e); - stopBroker(); + startDefaultBroker(); throw e; } } Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java Thu Dec 17 12:59:43 2015 @@ -31,7 +31,7 @@ public class TransactionTimeoutDisabledT protected void configure() throws Exception { // Setup housekeeping every second - TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration(); + TestBrokerConfiguration brokerConfiguration = getDefaultBrokerConfiguration(); setTestSystemProperty("virtualhost.housekeepingCheckPeriod", "100"); // No transaction timeout configuration. Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java Thu Dec 17 12:59:43 2015 @@ -43,10 +43,10 @@ public class TransactionTimeoutTest exte protected void configure() throws Exception { // switch off connection close in order to test timeout on publishing of unroutable messages - getBrokerConfiguration().setBrokerAttribute(Broker.CONNECTION_CLOSE_WHEN_NO_ROUTE, false); + getDefaultBrokerConfiguration().setBrokerAttribute(Broker.CONNECTION_CLOSE_WHEN_NO_ROUTE, false); // Setup housekeeping every 100ms - TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration(); + TestBrokerConfiguration brokerConfiguration = getDefaultBrokerConfiguration(); setTestSystemProperty("virtualhost.housekeepingCheckPeriod","100"); if (getName().contains("ProducerIdle")) Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/xa/QueueTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/xa/QueueTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/xa/QueueTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/xa/QueueTest.java Thu Dec 17 12:59:43 2015 @@ -17,10 +17,6 @@ */ package org.apache.qpid.test.unit.xa; -import junit.framework.TestSuite; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import javax.jms.DeliveryMode; import javax.jms.JMSException; import javax.jms.MessageConsumer; @@ -37,6 +33,10 @@ import javax.transaction.xa.XAException; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; +import junit.framework.TestSuite; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class QueueTest extends AbstractXATestCase { private static final Logger _logger = LoggerFactory.getLogger(QueueTest.class); @@ -383,7 +383,7 @@ public class QueueTest extends AbstractX try { _logger.debug("stopping broker"); - restartBroker(); + restartDefaultBroker(); init(); } catch (Exception e) @@ -572,7 +572,7 @@ public class QueueTest extends AbstractX try { _logger.debug("stopping broker"); - restartBroker(); + restartDefaultBroker(); init(); } catch (Exception e) Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/xa/TopicTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/xa/TopicTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/xa/TopicTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/xa/TopicTest.java Thu Dec 17 12:59:43 2015 @@ -17,18 +17,20 @@ */ package org.apache.qpid.test.unit.xa; -import junit.framework.TestSuite; -import org.apache.qpid.configuration.ClientProperties; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.atomic.AtomicBoolean; import javax.jms.*; import javax.transaction.xa.XAException; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; -import java.util.HashSet; -import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; + +import junit.framework.TestSuite; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.qpid.configuration.ClientProperties; /** * @@ -836,7 +838,7 @@ public class TopicTest extends AbstractX /////// stop the broker now !! try { - restartBroker(); + restartDefaultBroker(); init(); } catch (Exception e) @@ -1141,7 +1143,7 @@ public class TopicTest extends AbstractX /////// stop the server now !! try { - restartBroker(); + restartDefaultBroker(); init(); } catch (Exception e) @@ -1319,7 +1321,7 @@ public class TopicTest extends AbstractX /////// stop the server now !! try { - restartBroker(); + restartDefaultBroker(); init(); } catch (Exception e) Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/utils/BrokerCommandHelperTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/utils/BrokerCommandHelperTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/utils/BrokerCommandHelperTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/utils/BrokerCommandHelperTest.java Thu Dec 17 12:59:43 2015 @@ -17,6 +17,8 @@ */ package org.apache.qpid.test.utils; +import java.io.File; + public class BrokerCommandHelperTest extends QpidTestCase { private static final String PATH_TO_QPID_EXECUTABLE = "/path / to (/qpid"; @@ -41,7 +43,7 @@ public class BrokerCommandHelperTest ext public void testGetBrokerCommand() { - String[] brokerCommand = _brokerCommandHelper.getBrokerCommand(1, "path to config file", "json"); + String[] brokerCommand = _brokerCommandHelper.getBrokerCommand(1, TMP_FOLDER + File.separator + "work-dir", "path to config file", "json"); String[] expected = { PATH_TO_QPID_EXECUTABLE, ARGUMENT_PORT, "1", ARGUMENT_STORE_PATH, "path to config file", ARGUMENT_STORE_TYPE, "json", ARGUMENT_WITH_SPACES }; Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/utils/FailoverBaseCase.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/utils/FailoverBaseCase.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/utils/FailoverBaseCase.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/utils/FailoverBaseCase.java Thu Dec 17 12:59:43 2015 @@ -20,26 +20,42 @@ */ package org.apache.qpid.test.utils; -import java.io.File; +import java.util.concurrent.CountDownLatch; + +import javax.naming.NamingException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.qpid.client.AMQConnectionFactory; -import org.apache.qpid.util.FileUtils; +import org.apache.qpid.jms.ConnectionListener; -import javax.naming.NamingException; - -public class FailoverBaseCase extends QpidBrokerTestCase +public class FailoverBaseCase extends QpidBrokerTestCase implements ConnectionListener { protected static final Logger _logger = LoggerFactory.getLogger(FailoverBaseCase.class); public static final long DEFAULT_FAILOVER_TIME = 10000L; - protected void setUp() throws java.lang.Exception + protected CountDownLatch _failoverStarted; + protected CountDownLatch _failoverComplete; + protected BrokerHolder _alternativeBroker; + protected int _port; + protected int _alternativePort; + + @Override + protected void setUp() throws Exception { super.setUp(); - startBroker(getFailingPort()); + _failoverComplete = new CountDownLatch(1); + _failoverStarted = new CountDownLatch(1); + + _alternativeBroker = createSpawnedBroker(); + _alternativeBroker.start(); + _alternativePort = _alternativeBroker.getAmqpPort(); + + _port = getDefaultBroker().getAmqpPort(); + setTestSystemProperty("test.port.alt", String.valueOf(_alternativePort)); + setTestSystemProperty("test.port", String.valueOf(_port)); } /** @@ -66,35 +82,55 @@ public class FailoverBaseCase extends Qp return _connectionFactory; } - public void tearDown() throws Exception + public void failDefaultBroker() { - try - { - super.tearDown(); - } - finally - { - // Ensure we shutdown any secondary brokers, even if we are unable - // to cleanly tearDown the QTC. - stopBroker(getFailingPort()); - - if (isBrokerCleanBetweenTests()) - { - FileUtils.deleteDirectory(System.getProperty("QPID_WORK") + File.separator + getFailingPort()); - } - } + failBroker(getDefaultBroker()); } - public void failBroker(int port) + public void failBroker(BrokerHolder broker) { try { //TODO: use killBroker instead - stopBroker(port); + broker.shutdown(); } catch (Exception e) { throw new RuntimeException(e); } } + + public void restartBroker(BrokerHolder broker) throws Exception + { + broker.restart(); + } + + @Override + public void bytesSent(long count) + { + } + + @Override + public void bytesReceived(long count) + { + } + + @Override + public boolean preFailover(boolean redirect) + { + _failoverStarted.countDown(); + return true; + } + + @Override + public boolean preResubscribe() + { + return true; + } + + @Override + public void failoverComplete() + { + _failoverComplete.countDown(); + } } Copied: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/utils/SpawnedBrokerHolderTest.java (from r1720368, qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/BrokerHolder.java) URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/utils/SpawnedBrokerHolderTest.java?p2=qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/utils/SpawnedBrokerHolderTest.java&p1=qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/BrokerHolder.java&r1=1720368&r2=1720539&rev=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/main/java/org/apache/qpid/test/utils/BrokerHolder.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/utils/SpawnedBrokerHolderTest.java Thu Dec 17 12:59:43 2015 @@ -1,5 +1,4 @@ /* - * * 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 @@ -16,23 +15,18 @@ * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * */ -package org.apache.qpid.test.utils; -import org.apache.qpid.server.BrokerOptions; +package org.apache.qpid.test.utils; -public interface BrokerHolder +public class SpawnedBrokerHolderTest extends QpidBrokerTestCase { - public void start(BrokerOptions options) throws Exception; - void shutdown(); - void kill(); - String dumpThreads(); - - enum BrokerType + public void testRestartOnSamePort() throws Exception { - EXTERNAL /** Test case relies on a Broker started independently of the test-suite */, - INTERNAL /** Test case starts an embedded broker within this JVM */, - SPAWNED /** Test case spawns a new broker as a separate process */ + BrokerHolder broker = createSpawnedBroker(); + broker.start(); + int port = broker.getAmqpPort(); + broker.restart(); + assertEquals("broker not restarted on same port", port, broker.getAmqpPort()); } } Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/transport/MaxFrameSizeTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/transport/MaxFrameSizeTest.java?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/systests/src/test/java/org/apache/qpid/transport/MaxFrameSizeTest.java (original) +++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/transport/MaxFrameSizeTest.java Thu Dec 17 12:59:43 2015 @@ -44,7 +44,21 @@ import javax.security.sasl.SaslException import org.apache.qpid.bytebuffer.QpidByteBuffer; import org.apache.qpid.client.BrokerDetails; import org.apache.qpid.codec.ClientDecoder; -import org.apache.qpid.framing.*; +import org.apache.qpid.framing.AMQDataBlock; +import org.apache.qpid.framing.AMQFrame; +import org.apache.qpid.framing.AMQFrameDecodingException; +import org.apache.qpid.framing.AMQMethodBodyImpl; +import org.apache.qpid.framing.AMQProtocolVersionException; +import org.apache.qpid.framing.AMQShortString; +import org.apache.qpid.framing.ConnectionCloseBody; +import org.apache.qpid.framing.ConnectionCloseOkBody; +import org.apache.qpid.framing.ConnectionOpenBody; +import org.apache.qpid.framing.ConnectionOpenOkBody; +import org.apache.qpid.framing.ConnectionStartOkBody; +import org.apache.qpid.framing.ConnectionTuneOkBody; +import org.apache.qpid.framing.FieldTable; +import org.apache.qpid.framing.FrameCreatingMethodProcessor; +import org.apache.qpid.framing.ProtocolVersion; import org.apache.qpid.server.model.AuthenticationProvider; import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.Protocol; @@ -67,10 +81,10 @@ public class MaxFrameSizeTest extends Qp public void testTooSmallFrameSize() throws Exception { - getBrokerConfiguration().setObjectAttribute(AuthenticationProvider.class, - TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, - "secureOnlyMechanisms", - "[]"); + getDefaultBrokerConfiguration().setObjectAttribute(AuthenticationProvider.class, + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, + "secureOnlyMechanisms", + "[]"); super.setUp(); if(isBroker010()) @@ -138,10 +152,10 @@ public class MaxFrameSizeTest extends Qp public void testTooLargeFrameSize() throws Exception { - getBrokerConfiguration().setObjectAttribute(AuthenticationProvider.class, - TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, - "secureOnlyMechanisms", - "[]"); + getDefaultBrokerConfiguration().setObjectAttribute(AuthenticationProvider.class, + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, + "secureOnlyMechanisms", + "[]"); super.setUp(); if(isBroker010()) 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=1720539&r1=1720538&r2=1720539&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 Thu Dec 17 12:59:43 2015 @@ -56,7 +56,7 @@ public class ProtocolNegotiationTest ext { socket.setSoTimeout(SO_TIMEOUT); - final InetSocketAddress inetSocketAddress = new InetSocketAddress("localhost", getPort()); + final InetSocketAddress inetSocketAddress = new InetSocketAddress("localhost", getDefaultAmqpPort()); _logger.debug("Making connection to {}", inetSocketAddress); socket.connect(inetSocketAddress); @@ -84,7 +84,7 @@ public class ProtocolNegotiationTest ext { socket.setSoTimeout(SO_TIMEOUT); - final InetSocketAddress inetSocketAddress = new InetSocketAddress("localhost", getPort()); + final InetSocketAddress inetSocketAddress = new InetSocketAddress("localhost", getDefaultAmqpPort()); _logger.debug("Making connection to {}", inetSocketAddress); socket.connect(inetSocketAddress); @@ -118,7 +118,7 @@ public class ProtocolNegotiationTest ext final ProtocolVersion protocolVersion = convertProtocolToProtocolVersion(getBrokerProtocol()); ProtocolInitiation pi = new ProtocolInitiation(protocolVersion); - final InetSocketAddress inetSocketAddress = new InetSocketAddress("localhost", getPort()); + final InetSocketAddress inetSocketAddress = new InetSocketAddress("localhost", getDefaultAmqpPort()); _logger.debug("Making connection to {}", inetSocketAddress); socket.connect(inetSocketAddress); @@ -165,7 +165,7 @@ public class ProtocolNegotiationTest ext final ProtocolVersion protocolVersion = convertProtocolToProtocolVersion(getBrokerProtocol()); ProtocolInitiation pi = new ProtocolInitiation(protocolVersion); - final InetSocketAddress inetSocketAddress = new InetSocketAddress("localhost", getPort()); + final InetSocketAddress inetSocketAddress = new InetSocketAddress("localhost", getDefaultAmqpPort()); _logger.debug("Making connection to {}", inetSocketAddress); socket.connect(inetSocketAddress); Modified: qpid/java/trunk/test-profiles/test-provider.properties URL: http://svn.apache.org/viewvc/qpid/java/trunk/test-profiles/test-provider.properties?rev=1720539&r1=1720538&r2=1720539&view=diff ============================================================================== --- qpid/java/trunk/test-profiles/test-provider.properties (original) +++ qpid/java/trunk/test-profiles/test-provider.properties Thu Dec 17 12:59:43 2015 @@ -20,21 +20,18 @@ # # Copied from default.testprofile -test.port=15672 -test.mport=18999 -#Note : Java Management will start open second port on: mport + 100 : 19099 -test.port.ssl=15671 -test.port.alt=25672 -test.port.alt.ssl=25671 +test.port=0 +test.port.ssl=0 +test.port.alt=0 +test.port.alt.ssl=0 connectionfactory.default = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port}' connectionfactory.default.ssl = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port.ssl}?ssl='true'' -connectionfactory.failover = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port.alt};tcp://localhost:${test.port}'&sync_ack='true'&sync_publish='all'&failover='roundrobin?cyclecount='20'' -connectionfactory.failover.ssl = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port.alt.ssl}?ssl='true';tcp://localhost:${test.port.ssl}?ssl='true''&sync_ack='true'&sync_publish='all'&failover='roundrobin?cyclecount='20'' +connectionfactory.failover = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port};tcp://localhost:${test.port.alt}'&sync_ack='true'&sync_publish='all'&failover='roundrobin?cyclecount='20'' +connectionfactory.failover.ssl = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port.ssl}?ssl='true';tcp://localhost:${test.port.alt.ssl}?ssl='true''&sync_ack='true'&sync_publish='all'&failover='roundrobin?cyclecount='20'' -connectionfactory.connection1 = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port}' connectionfactory.connection2 = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port.alt}' --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org