Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5097118A61 for ; Tue, 1 Mar 2016 16:38:01 +0000 (UTC) Received: (qmail 65591 invoked by uid 500); 1 Mar 2016 16:37:59 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 65465 invoked by uid 500); 1 Mar 2016 16:37:59 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 64224 invoked by uid 99); 1 Mar 2016 16:37:58 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Mar 2016 16:37:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C4271E03BE; Tue, 1 Mar 2016 16:37:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: clebertsuconic@apache.org To: commits@activemq.apache.org Date: Tue, 01 Mar 2016 16:38:47 -0000 Message-Id: <41ec051984c943c4abbac3d4031d8877@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [51/52] [abbrv] activemq-artemis git commit: tests cleanup, added some more debug information tests cleanup, added some more debug information Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/7723f26c Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/7723f26c Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/7723f26c Branch: refs/heads/refactor-openwire Commit: 7723f26c3606483aeb325a15a2fa5e1e8377431e Parents: 83a4bba Author: Howard Gao Authored: Mon Feb 29 22:25:17 2016 +0800 Committer: Clebert Suconic Committed: Tue Mar 1 11:37:32 2016 -0500 ---------------------------------------------------------------------- .../apache/activemq/broker/BrokerService.java | 4 +-- .../artemiswrapper/ArtemisBrokerWrapper.java | 2 +- .../transport/tcp/TcpTransportFactory.java | 30 ++++++++++++++------ .../apache/activemq/CombinationTestSupport.java | 2 +- ...ExclusiveConsumerStartupDestinationTest.java | 1 + .../apache/activemq/ExclusiveConsumerTest.java | 2 ++ .../activemq/JmsTransactionTestSupport.java | 1 + ...sTopicSendReceiveWithTwoConnectionsTest.java | 2 ++ .../transport/tcp/SslBrokerServiceTest.java | 1 + 9 files changed, 33 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7723f26c/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java ---------------------------------------------------------------------- diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java index cbf41e1..b6acee4 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java @@ -101,7 +101,6 @@ public class BrokerService implements Service { private Throwable startException = null; private boolean startAsync = false; public Set extraConnectors = new HashSet<>(); -// public Set sslConnectors = new HashSet<>(); private List transportConnectors = new ArrayList<>(); private File dataDirectoryFile; @@ -591,12 +590,13 @@ public class BrokerService implements Service { return port; } - private static boolean checkPort(final int port) { + public static boolean checkPort(final int port) { ServerSocket ssocket = null; try { ssocket = new ServerSocket(port); } catch (Exception e) { + LOG.info("port " + port + " is being used."); return false; } finally { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7723f26c/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java ---------------------------------------------------------------------- diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java index 83c12db..1a0e297 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java @@ -96,7 +96,7 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase { } if (this.bservice.enableSsl()) { //default - addServerAcceptor(serverConfig, new BrokerService.ConnectorInfo(61611)); + addServerAcceptor(serverConfig, new BrokerService.ConnectorInfo(61611, true)); } for (BrokerService.ConnectorInfo info : bservice.extraConnectors) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7723f26c/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java ---------------------------------------------------------------------- diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java index 5b07f48..c44dd72 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java @@ -31,6 +31,7 @@ import org.apache.activemq.TransportLoggerSupport; import org.apache.activemq.artemiswrapper.ArtemisBrokerHelper; import org.apache.activemq.broker.BrokerRegistry; import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.artemiswrapper.ArtemisBrokerWrapper; import org.apache.activemq.openwire.OpenWireFormat; import org.apache.activemq.transport.*; import org.apache.activemq.util.IOExceptionSupport; @@ -44,12 +45,7 @@ public class TcpTransportFactory extends TransportFactory { private static final Logger LOG = LoggerFactory.getLogger(TcpTransportFactory.class); - private static volatile String brokerService = null; - - //if a broker is started or stopped it should set this. - public static void setBrokerName(String name) { - brokerService = name; - } + private static volatile InternalServiceInfo brokerService = null; @Override public Transport doConnect(URI location) throws Exception { @@ -59,11 +55,11 @@ public class TcpTransportFactory extends TransportFactory { URI location1 = URISupport.createRemainingURI(location, Collections.EMPTY_MAP); LOG.info("deciding whether starting an internal broker: " + brokerService + " flag: " + BrokerService.disableWrapper); - if (brokerService == null && !BrokerService.disableWrapper) { + if (brokerService == null && !BrokerService.disableWrapper && BrokerService.checkPort(location1.getPort())) { LOG.info("starting internal broker: " + location1); ArtemisBrokerHelper.startArtemisBroker(location1); - brokerService = location.toString(); + brokerService = new InternalServiceInfo(location.toString()); if (brokerId != null) { BrokerRegistry.getInstance().bind(brokerId, ArtemisBrokerHelper.getBroker()); @@ -185,6 +181,7 @@ public class TcpTransportFactory extends TransportFactory { //remember call this if the test is using the internal broker. public static void clearService() { + LOG.info("#### clearing internal service " + brokerService); if (brokerService != null) { try { ArtemisBrokerHelper.stopArtemisBroker(); @@ -197,4 +194,21 @@ public class TcpTransportFactory extends TransportFactory { } } } + + //added createTime for debugging + private static class InternalServiceInfo { + private String internalService; + private long createTime; + + public InternalServiceInfo(String brokerService) { + this.internalService = brokerService; + this.createTime = System.currentTimeMillis(); + LOG.info("just created " + this); + } + + @Override + public String toString() { + return internalService + "@" + createTime; + } + } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7723f26c/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java ---------------------------------------------------------------------- diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java index d7caafa..dc8f138 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java @@ -116,7 +116,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport { public static void checkStopped() throws Exception { ArtemisBrokerHelper.stopArtemisBroker(); boolean notStopped = BrokerService.checkStopped(); - TcpTransportFactory.setBrokerName(null); + TcpTransportFactory.clearService(); if (notStopped) { fail("brokers not stopped see exceptions above"); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7723f26c/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerStartupDestinationTest.java ---------------------------------------------------------------------- diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerStartupDestinationTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerStartupDestinationTest.java index 06fbbbe..1e0555c 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerStartupDestinationTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerStartupDestinationTest.java @@ -98,6 +98,7 @@ public class ExclusiveConsumerStartupDestinationTest extends EmbeddedBrokerTestS } } + //Exclusive consumer not implemented yet. public void testFailoverToAnotherExclusiveConsumerCreatedFirst() throws JMSException, InterruptedException { Connection conn = createConnection(true); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7723f26c/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java ---------------------------------------------------------------------- diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java index b2c1d8a..5bc647e 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java @@ -28,6 +28,7 @@ import junit.framework.TestCase; import org.apache.activemq.artemiswrapper.ArtemisBrokerHelper; import org.apache.activemq.command.ActiveMQQueue; +import org.apache.activemq.transport.tcp.TcpTransportFactory; public class ExclusiveConsumerTest extends TestCase { @@ -44,6 +45,7 @@ public class ExclusiveConsumerTest extends TestCase { @Override protected void tearDown() throws Exception { + TcpTransportFactory.clearService(); super.tearDown(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7723f26c/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java ---------------------------------------------------------------------- diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java index dfcf302..abaf52d 100755 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java @@ -36,6 +36,7 @@ import org.apache.activemq.broker.BrokerFactory; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.test.JmsResourceProvider; import org.apache.activemq.test.TestSupport; +import org.apache.activemq.transport.tcp.TcpTransportFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7723f26c/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsTest.java ---------------------------------------------------------------------- diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsTest.java index 00452d1..1f8d8da 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsTest.java @@ -23,6 +23,7 @@ import javax.jms.MessageConsumer; import javax.jms.Session; import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.transport.tcp.TcpTransportFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -103,6 +104,7 @@ public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTes receiveSession.close(); sendConnection.close(); receiveConnection.close(); + TcpTransportFactory.clearService(); } /** http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7723f26c/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SslBrokerServiceTest.java ---------------------------------------------------------------------- diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SslBrokerServiceTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SslBrokerServiceTest.java index 3a1c9a4..d380246 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SslBrokerServiceTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SslBrokerServiceTest.java @@ -124,6 +124,7 @@ public class SslBrokerServiceTest extends TransportBrokerTestSupport { private void makeSSLConnection(SSLContext context, String enabledSuites[], TransportConnector connector) throws Exception, UnknownHostException, SocketException { + System.out.println("-----connector: " + connector); SSLSocket sslSocket = (SSLSocket) context.getSocketFactory().createSocket("localhost", connector.getUri().getPort()); if (enabledSuites != null) {