add some more logging if tests fails

This commit is contained in:
gtully 2015-05-11 16:45:59 +01:00
parent e19293de5f
commit d467220085
1 changed files with 9 additions and 5 deletions

View File

@ -41,6 +41,7 @@ import javax.net.ssl.KeyManager;
import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManager;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.AutoFailTestSupport;
import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.SslContext; import org.apache.activemq.broker.SslContext;
import org.apache.activemq.broker.TransportConnector; import org.apache.activemq.broker.TransportConnector;
@ -346,7 +347,7 @@ public class FailoverStaticNetworkTest {
while (!done.get()) { while (!done.get()) {
brokerA = createBroker("tcp", "61610", null); brokerA = createBroker("tcp", "61610", null);
brokerA.setBrokerName("Pair"); brokerA.setBrokerName("Pair");
brokerA.setBrokerObjectName(new ObjectName(brokerA.getManagementContext().getJmxDomainName() + ":" + "BrokerName=" brokerA.setBrokerObjectName(new ObjectName(brokerA.getManagementContext().getJmxDomainName() + ":" + "brokerName="
+ JMXSupport.encodeObjectNamePart("A") + "," + "Type=Broker")); + JMXSupport.encodeObjectNamePart("A") + "," + "Type=Broker"));
((KahaDBPersistenceAdapter)brokerA.getPersistenceAdapter()).getLocker().setLockAcquireSleepInterval(1000); ((KahaDBPersistenceAdapter)brokerA.getPersistenceAdapter()).getLocker().setLockAcquireSleepInterval(1000);
brokerA.start(); brokerA.start();
@ -377,7 +378,7 @@ public class FailoverStaticNetworkTest {
brokerA1 = createBroker("tcp", "61611", null); brokerA1 = createBroker("tcp", "61611", null);
brokerA1.setBrokerName("Pair"); brokerA1.setBrokerName("Pair");
// so they can coexist in local jmx we set the object name b/c the brokername identifies the shared store // so they can coexist in local jmx we set the object name b/c the brokername identifies the shared store
brokerA1.setBrokerObjectName(new ObjectName(brokerA.getManagementContext().getJmxDomainName() + ":" + "BrokerName=" brokerA1.setBrokerObjectName(new ObjectName(brokerA.getManagementContext().getJmxDomainName() + ":" + "brokerName="
+ JMXSupport.encodeObjectNamePart("A1") + "," + "Type=Broker")); + JMXSupport.encodeObjectNamePart("A1") + "," + "Type=Broker"));
((KahaDBPersistenceAdapter)brokerA1.getPersistenceAdapter()).getLocker().setLockAcquireSleepInterval(1000); ((KahaDBPersistenceAdapter)brokerA1.getPersistenceAdapter()).getLocker().setLockAcquireSleepInterval(1000);
brokerA1.start(); brokerA1.start();
@ -394,12 +395,12 @@ public class FailoverStaticNetworkTest {
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
BrokerService currentMaster = (i%2 == 0 ? brokerA : brokerA1); BrokerService currentMaster = (i%2 == 0 ? brokerA : brokerA1);
LOG.info("iteration: " + i + ", using: " + currentMaster.getBrokerObjectName().getKeyProperty("BrokerName")); LOG.info("iteration: " + i + ", using: " + currentMaster.getBrokerObjectName().getKeyProperty("brokerName"));
currentMaster.waitUntilStarted(); currentMaster.waitUntilStarted();
doTestNetworkSendReceive(brokerB, currentMaster); doTestNetworkSendReceive(brokerB, currentMaster);
LOG.info("Stopping " + currentMaster.getBrokerObjectName().getKeyProperty("BrokerName")); LOG.info("Stopping " + currentMaster.getBrokerObjectName().getKeyProperty("brokerName"));
currentMaster.stop(); currentMaster.stop();
currentMaster.waitUntilStopped(); currentMaster.waitUntilStopped();
} }
@ -434,10 +435,13 @@ public class FailoverStaticNetworkTest {
@Override @Override
public boolean isSatisified() throws Exception { public boolean isSatisified() throws Exception {
Message message = consumer.receive(5000); Message message = consumer.receive(5000);
LOG.info("from: " + from.getBrokerObjectName().getKeyProperty("BrokerName") + ", received: " + message); LOG.info("from: " + from.getBrokerObjectName().getKeyProperty("brokerName") + ", received: " + message);
return message != null; return message != null;
} }
}); });
if (!gotMessage) {
AutoFailTestSupport.dumpAllThreads("noMessage");
}
try { try {
consConn.close(); consConn.close();
} catch (JMSException ignored) { } catch (JMSException ignored) {