mirror of
https://github.com/apache/activemq.git
synced 2025-02-27 20:59:06 +00:00
Speed tests up a bit. Bridge formation fails for a few tests
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@982099 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c1acb4030d
commit
8c4bb36bbe
@ -149,16 +149,18 @@ public class JmsMultipleBrokersTestSupport extends CombinationTestSupport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void waitForBridgeFormation() throws Exception {
|
protected boolean waitForBridgeFormation() throws Exception {
|
||||||
|
boolean success = true;
|
||||||
for (BrokerItem brokerItem : brokers.values()) {
|
for (BrokerItem brokerItem : brokers.values()) {
|
||||||
final BrokerService broker = brokerItem.broker;
|
final BrokerService broker = brokerItem.broker;
|
||||||
if (!broker.getNetworkConnectors().isEmpty()) {
|
if (success && !broker.getNetworkConnectors().isEmpty()) {
|
||||||
Wait.waitFor(new Wait.Condition() {
|
success = success && Wait.waitFor(new Wait.Condition() {
|
||||||
public boolean isSatisified() throws Exception {
|
public boolean isSatisified() throws Exception {
|
||||||
return !broker.getNetworkConnectors().get(0).activeBridges().isEmpty();
|
return !broker.getNetworkConnectors().get(0).activeBridges().isEmpty();
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void startAllBrokers() throws Exception {
|
protected void startAllBrokers() throws Exception {
|
||||||
@ -386,6 +388,7 @@ public class JmsMultipleBrokersTestSupport extends CombinationTestSupport {
|
|||||||
brokerItem.destroy();
|
brokerItem.destroy();
|
||||||
}
|
}
|
||||||
brokers.clear();
|
brokers.clear();
|
||||||
|
destinations.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Class to group broker components together
|
// Class to group broker components together
|
||||||
|
@ -37,6 +37,7 @@ import org.apache.activemq.command.ActiveMQDestination;
|
|||||||
import org.apache.activemq.command.ConsumerInfo;
|
import org.apache.activemq.command.ConsumerInfo;
|
||||||
import org.apache.activemq.command.MessageDispatch;
|
import org.apache.activemq.command.MessageDispatch;
|
||||||
import org.apache.activemq.util.MessageIdList;
|
import org.apache.activemq.util.MessageIdList;
|
||||||
|
import org.apache.activemq.util.Wait;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
@ -48,10 +49,6 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
protected static final int MESSAGE_COUNT = 100;
|
protected static final int MESSAGE_COUNT = 100;
|
||||||
private static final long MAX_WAIT_MILLIS = 10000;
|
private static final long MAX_WAIT_MILLIS = 10000;
|
||||||
|
|
||||||
interface Condition {
|
|
||||||
boolean isSatisified() throws Exception;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BrokerA -> BrokerB -> BrokerC
|
* BrokerA -> BrokerB -> BrokerC
|
||||||
*/
|
*/
|
||||||
@ -61,7 +58,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
bridgeBrokers("BrokerB", "BrokerC");
|
bridgeBrokers("BrokerB", "BrokerC");
|
||||||
|
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
// Setup destination
|
// Setup destination
|
||||||
Destination dest = createDestination("TEST.FOO", false);
|
Destination dest = createDestination("TEST.FOO", false);
|
||||||
@ -89,7 +86,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
bridgeBrokers("BrokerB", "BrokerC");
|
bridgeBrokers("BrokerB", "BrokerC");
|
||||||
|
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
// Setup destination
|
// Setup destination
|
||||||
Destination dest = createDestination("TEST.FOO", false);
|
Destination dest = createDestination("TEST.FOO", false);
|
||||||
@ -121,7 +118,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
bridgeBrokers("BrokerB", "BrokerC", true, 1, false);
|
bridgeBrokers("BrokerB", "BrokerC", true, 1, false);
|
||||||
|
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
// Setup destination
|
// Setup destination
|
||||||
Destination dest = createDestination("TEST.FOO", false);
|
Destination dest = createDestination("TEST.FOO", false);
|
||||||
@ -163,7 +160,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
bridgeBrokers("BrokerB", "BrokerC", true, 1, false);
|
bridgeBrokers("BrokerB", "BrokerC", true, 1, false);
|
||||||
|
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
// Setup destination
|
// Setup destination
|
||||||
Destination dest = createDestination("TEST.FOO", false);
|
Destination dest = createDestination("TEST.FOO", false);
|
||||||
@ -205,7 +202,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
bridgeBrokers("BrokerC", "BrokerB");
|
bridgeBrokers("BrokerC", "BrokerB");
|
||||||
|
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
// Setup destination
|
// Setup destination
|
||||||
Destination dest = createDestination("TEST.FOO", false);
|
Destination dest = createDestination("TEST.FOO", false);
|
||||||
@ -238,7 +235,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
bridgeBrokers("BrokerC", "BrokerA");
|
bridgeBrokers("BrokerC", "BrokerA");
|
||||||
|
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
// Setup destination
|
// Setup destination
|
||||||
Destination dest = createDestination("TEST.FOO", false);
|
Destination dest = createDestination("TEST.FOO", false);
|
||||||
@ -269,7 +266,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
bridgeAllBrokers();
|
bridgeAllBrokers();
|
||||||
|
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
// Setup destination
|
// Setup destination
|
||||||
Destination dest = createDestination("TEST.FOO", false);
|
Destination dest = createDestination("TEST.FOO", false);
|
||||||
@ -292,31 +289,19 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
|
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
|
||||||
MessageIdList msgsC = getConsumerMessages("BrokerC", clientC);
|
MessageIdList msgsC = getConsumerMessages("BrokerC", clientC);
|
||||||
|
|
||||||
waitFor(new Condition() {
|
assertTrue("Messaged not received within time limit", Wait.waitFor(new Wait.Condition() {
|
||||||
public boolean isSatisified() {
|
public boolean isSatisified() {
|
||||||
return msgsA.getMessageCount() == MESSAGE_COUNT;
|
return msgsA.getMessageCount() == MESSAGE_COUNT;
|
||||||
}
|
}
|
||||||
});
|
}, MAX_WAIT_MILLIS));
|
||||||
|
|
||||||
assertEquals(MESSAGE_COUNT * 3, msgsA.getMessageCount() + msgsB.getMessageCount() + msgsC.getMessageCount());
|
assertEquals(MESSAGE_COUNT * 3, msgsA.getMessageCount() + msgsB.getMessageCount() + msgsC.getMessageCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
// on slow machines some more waiting is required on account of slow advisories
|
|
||||||
private void waitFor(Condition condition) throws Exception {
|
|
||||||
final long expiry = System.currentTimeMillis() + MAX_WAIT_MILLIS;
|
|
||||||
while (!condition.isSatisified() && System.currentTimeMillis() < expiry) {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
}
|
|
||||||
if (System.currentTimeMillis() >= expiry) {
|
|
||||||
LOG.error("expired while waiting for condition " + condition);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllConnectedUsingMulticastProducerConsumerOnA() throws Exception {
|
public void testAllConnectedUsingMulticastProducerConsumerOnA() throws Exception {
|
||||||
bridgeAllBrokers("default", 3, false);
|
bridgeAllBrokers("default", 3, false);
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
// Setup destination
|
// Setup destination
|
||||||
Destination dest = createDestination("TEST.FOO", false);
|
Destination dest = createDestination("TEST.FOO", false);
|
||||||
@ -342,7 +327,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
public void testAllConnectedWithSpare() throws Exception {
|
public void testAllConnectedWithSpare() throws Exception {
|
||||||
bridgeAllBrokers("default", 3, false);
|
bridgeAllBrokers("default", 3, false);
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
// Setup destination
|
// Setup destination
|
||||||
Destination dest = createDestination("TEST.FOO", false);
|
Destination dest = createDestination("TEST.FOO", false);
|
||||||
@ -370,13 +355,12 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
* http://issues.apache.org/activemq/browse/AMQ-2530 - which highlights that
|
* http://issues.apache.org/activemq/browse/AMQ-2530 - which highlights that
|
||||||
* For a Conduit bridge - local subscription Ids weren't removed in a ConduitBridge
|
* For a Conduit bridge - local subscription Ids weren't removed in a ConduitBridge
|
||||||
* The test fails because on closing clientA - clientB correctly receives all the
|
* The test fails because on closing clientA - clientB correctly receives all the
|
||||||
* messages - ie. half dont get stuck on BrokerA -
|
* messages - ie. half don't get stuck on BrokerA -
|
||||||
*/
|
*/
|
||||||
public void XtestMigrateConsumerStuckMessages() throws Exception {
|
public void XtestMigrateConsumerStuckMessages() throws Exception {
|
||||||
boolean suppressQueueDuplicateSubscriptions = false;
|
bridgeAllBrokers("default", 3, false);
|
||||||
bridgeAllBrokers("default", 3, suppressQueueDuplicateSubscriptions);
|
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
// Setup destination
|
// Setup destination
|
||||||
Destination dest = createDestination("TEST.FOO", false);
|
Destination dest = createDestination("TEST.FOO", false);
|
||||||
@ -434,7 +418,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
boolean decreaseNetworkConsumerPriority = true;
|
boolean decreaseNetworkConsumerPriority = true;
|
||||||
bridgeAllBrokers("default", 3, suppressQueueDuplicateSubscriptions, decreaseNetworkConsumerPriority);
|
bridgeAllBrokers("default", 3, suppressQueueDuplicateSubscriptions, decreaseNetworkConsumerPriority);
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
// Setup destination
|
// Setup destination
|
||||||
Destination dest = createDestination("TEST.FOO", false);
|
Destination dest = createDestination("TEST.FOO", false);
|
||||||
@ -476,9 +460,8 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
public void testNoDuplicateQueueSubs() throws Exception {
|
public void testNoDuplicateQueueSubs() throws Exception {
|
||||||
|
|
||||||
bridgeAllBrokers("default", 3, true);
|
bridgeAllBrokers("default", 3, true);
|
||||||
|
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
// Setup destination
|
// Setup destination
|
||||||
Destination dest = createDestination("TEST.FOO", false);
|
Destination dest = createDestination("TEST.FOO", false);
|
||||||
@ -548,8 +531,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
});
|
});
|
||||||
|
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
|
|
||||||
// Setup consumers
|
// Setup consumers
|
||||||
String brokerName = "BrokerA";
|
String brokerName = "BrokerA";
|
||||||
@ -576,7 +558,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
|
|
||||||
bridgeAllBrokers("default", 3, false);
|
bridgeAllBrokers("default", 3, false);
|
||||||
startAllBrokers();
|
startAllBrokers();
|
||||||
waitForBridgeFormation();
|
assertTrue("Bridge formation incomplete", waitForBridgeFormation());
|
||||||
|
|
||||||
// Setup destination
|
// Setup destination
|
||||||
Destination dest = createDestination("TEST.FOO", false);
|
Destination dest = createDestination("TEST.FOO", false);
|
||||||
@ -614,11 +596,11 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
|
|||||||
|
|
||||||
private void verifyConsumerCount(BrokerService broker, int count, final Destination dest) throws Exception {
|
private void verifyConsumerCount(BrokerService broker, int count, final Destination dest) throws Exception {
|
||||||
final RegionBroker regionBroker = (RegionBroker) broker.getRegionBroker();
|
final RegionBroker regionBroker = (RegionBroker) broker.getRegionBroker();
|
||||||
waitFor(new Condition() {
|
assertTrue("RegionBroker should have at least one destination", Wait.waitFor(new Wait.Condition() {
|
||||||
public boolean isSatisified() throws Exception {
|
public boolean isSatisified() throws Exception {
|
||||||
return !regionBroker.getDestinations(ActiveMQDestination.transform(dest)).isEmpty();
|
return !regionBroker.getDestinations(ActiveMQDestination.transform(dest)).isEmpty();
|
||||||
}
|
}
|
||||||
});
|
}, MAX_WAIT_MILLIS));
|
||||||
Queue internalQueue = (Queue) regionBroker.getDestinations(ActiveMQDestination.transform(dest)).iterator().next();
|
Queue internalQueue = (Queue) regionBroker.getDestinations(ActiveMQDestination.transform(dest)).iterator().next();
|
||||||
assertEquals("consumer count on " + broker.getBrokerName() + " matches for q: " + internalQueue, count, internalQueue.getConsumers().size());
|
assertEquals("consumer count on " + broker.getBrokerName() + " matches for q: " + internalQueue, count, internalQueue.getConsumers().size());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user