You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/03/19 06:08:40 UTC
[34/67] [abbrv] activemq-artemis git commit: added some clean up code
that cause other tests fail.
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/ebd1c69a
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/ebd1c69a
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/ebd1c69a
Branch: refs/heads/refactor-openwire
Commit: ebd1c69ae47a99239137967f9163ea70f3dc2485
Parents: 52d30f9
Author: Howard Gao <ho...@gmail.com>
Authored: Thu Feb 4 22:53:31 2016 +0800
Committer: Clebert Suconic <cl...@apache.org>
Committed: Sat Mar 19 01:07:37 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/ebd1c69a/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/ebd1c69a/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/ebd1c69a/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/ebd1c69a/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) {