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 024E718C74 for ; Thu, 4 Feb 2016 14:54:43 +0000 (UTC) Received: (qmail 83540 invoked by uid 500); 4 Feb 2016 14:54:42 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 83502 invoked by uid 500); 4 Feb 2016 14:54:42 -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 83493 invoked by uid 99); 4 Feb 2016 14:54:42 -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; Thu, 04 Feb 2016 14:54:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B3807DFC90; Thu, 4 Feb 2016 14:54:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: gaohoward@apache.org To: commits@activemq.apache.org Message-Id: <122c8af65b544c808bc9791a0b158143@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: activemq-artemis git commit: added some clean up code that cause other tests fail. Date: Thu, 4 Feb 2016 14:54:42 +0000 (UTC) Repository: activemq-artemis Updated Branches: refs/heads/refactor-openwire 6666ed3f3 -> 2229a78bb added some clean up code that cause other tests fail. Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2229a78b Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2229a78b Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2229a78b Branch: refs/heads/refactor-openwire Commit: 2229a78bb7f96358108085810275fc7f4e9f2f44 Parents: 6666ed3 Author: Howard Gao Authored: Thu Feb 4 22:53:31 2016 +0800 Committer: Howard Gao Committed: Thu Feb 4 22:53:31 2016 +0800 ---------------------------------------------------------------------- .../activemq/transport/tcp/TcpTransportFactory.java | 15 ++++++++++++++- .../apache/activemq/QueueConsumerPriorityTest.java | 3 +++ .../test/java/org/apache/activemq/TimeStampTest.java | 10 ++++++++++ .../org/apache/activemq/TransactionContextTest.java | 10 ++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2229a78b/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 b3ac85f..4ddc2a6 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 @@ -57,6 +57,8 @@ public class TcpTransportFactory extends TransportFactory { Map params = URISupport.parseParameters(location); String brokerId = params.remove("invmBrokerId"); 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) { ArtemisBrokerHelper.startArtemisBroker(location1); @@ -179,7 +181,18 @@ public class TcpTransportFactory extends TransportFactory { return new InactivityMonitor(transport, format); } + //remember call this if the test is using the internal broker. public static void clearService() { - brokerService = null; + if (brokerService != null) { + try { + ArtemisBrokerHelper.stopArtemisBroker(); + } + catch (Exception e) { + e.printStackTrace(); + } + finally { + brokerService = null; + } + } } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2229a78b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/QueueConsumerPriorityTest.java ---------------------------------------------------------------------- diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/QueueConsumerPriorityTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/QueueConsumerPriorityTest.java index 0358323..296f52b 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/QueueConsumerPriorityTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/QueueConsumerPriorityTest.java @@ -26,7 +26,9 @@ import javax.jms.Session; 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 QueueConsumerPriorityTest extends TestCase { @@ -43,6 +45,7 @@ public class QueueConsumerPriorityTest extends TestCase { @Override protected void tearDown() throws Exception { + TcpTransportFactory.clearService(); super.tearDown(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2229a78b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TimeStampTest.java ---------------------------------------------------------------------- diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TimeStampTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TimeStampTest.java index 87c5fc9..c1c058f 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TimeStampTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TimeStampTest.java @@ -34,6 +34,16 @@ import org.apache.activemq.broker.view.ConnectionDotFilePlugin; public class TimeStampTest extends TestCase { + @Override + public void setUp() { + BrokerService.disableWrapper = true; + } + + @Override + public void tearDown() { + BrokerService.disableWrapper = false; + } + public void test() throws Exception { BrokerService broker = new BrokerService(); broker.setPersistent(false); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2229a78b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TransactionContextTest.java ---------------------------------------------------------------------- diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TransactionContextTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TransactionContextTest.java index beab88e..4991c92 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TransactionContextTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TransactionContextTest.java @@ -23,9 +23,14 @@ import java.util.concurrent.atomic.AtomicInteger; import javax.jms.TransactionRolledBackException; +import org.apache.activemq.artemiswrapper.ArtemisBrokerHelper; +import org.apache.activemq.broker.BrokerService; import org.apache.activemq.transaction.Synchronization; +import org.apache.activemq.transport.tcp.TcpTransportFactory; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; public class TransactionContextTest { @@ -40,6 +45,11 @@ public class TransactionContextTest { underTest = new TransactionContext(connection); } + @AfterClass + public static void cleanup() throws Exception { + TcpTransportFactory.clearService(); + } + @After public void tearDown() throws Exception { if (connection != null) {