activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [34/61] [abbrv] activemq-artemis git commit: added some clean up code that cause other tests fail.
Date Wed, 16 Mar 2016 15:22:03 GMT
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/3c755ce6
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/3c755ce6
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/3c755ce6

Branch: refs/heads/refactor-openwire
Commit: 3c755ce69fd11104cb2d0f5f12b27a79909d1569
Parents: e783dca
Author: Howard Gao <howard.gao@gmail.com>
Authored: Thu Feb 4 22:53:31 2016 +0800
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Mar 16 11:19:15 2016 -0400

----------------------------------------------------------------------
 .../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/3c755ce6/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<String, String> 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/3c755ce6/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/3c755ce6/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/3c755ce6/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) {


Mime
View raw message