activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [60/65] [abbrv] activemq-artemis git commit: looking for leaking server
Date Fri, 18 Mar 2016 01:42:49 GMT
looking for leaking server


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/7ed680e9
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/7ed680e9
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/7ed680e9

Branch: refs/heads/refactor-openwire
Commit: 7ed680e9d0b170510614eac2f32a21850c056dfe
Parents: e25ee47
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Fri Mar 4 17:21:56 2016 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Thu Mar 17 14:10:46 2016 -0400

----------------------------------------------------------------------
 tests/activemq5-unit-tests/pom.xml              |  9 ++++
 .../artemiswrapper/CleanupThreadRule.java       | 52 ++++++++++++++++++++
 .../artemiswrapper/OpenwireArtemisBaseTest.java |  7 +++
 .../transport/failover/ClusterUtil.java         | 25 ----------
 4 files changed, 68 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7ed680e9/tests/activemq5-unit-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/pom.xml b/tests/activemq5-unit-tests/pom.xml
index a17847e..bbfbcd3 100644
--- a/tests/activemq5-unit-tests/pom.xml
+++ b/tests/activemq5-unit-tests/pom.xml
@@ -49,6 +49,14 @@
 
    <dependencies>
 
+      <!-- I imported this to get the ThreadLeakCheck -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-server</artifactId>
+         <version>${project.version}</version>
+         <type>test-jar</type>
+      </dependency>
+
       <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>activemq-client</artifactId>
@@ -336,6 +344,7 @@
             </exclusion>
          </exclusions>
       </dependency>
+
        <!--
            JBoss Logging
        -->

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7ed680e9/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/CleanupThreadRule.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/CleanupThreadRule.java
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/CleanupThreadRule.java
new file mode 100644
index 0000000..2ddac3b
--- /dev/null
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/CleanupThreadRule.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.broker.artemiswrapper;
+
+import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
+import org.apache.activemq.artemis.core.persistence.impl.journal.OperationContextImpl;
+import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector;
+import org.junit.rules.ExternalResource;
+
+public class CleanupThreadRule extends ExternalResource {
+
+   @Override
+   protected void before() throws Throwable {
+
+   }
+
+   @Override
+   protected void after() {
+      OperationContextImpl.clearContext();
+
+      // We shutdown the global pools to give a better isolation between tests
+      try {
+         ServerLocatorImpl.clearThreadPools();
+      }
+      catch (Throwable e) {
+         e.printStackTrace();
+      }
+
+      try {
+         NettyConnector.clearThreadPools();
+      }
+      catch (Exception e) {
+         e.printStackTrace();
+      }
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7ed680e9/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
index 5c8d3b6..2f3a330 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
@@ -33,6 +33,7 @@ import org.apache.activemq.artemis.core.server.JournalType;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl;
 import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+import org.apache.activemq.artemis.tests.util.ThreadLeakCheckRule;
 import org.apache.activemq.artemis.utils.uri.URISchema;
 import org.apache.activemq.artemis.utils.uri.URISupport;
 import org.apache.activemq.broker.BrokerService;
@@ -48,6 +49,12 @@ import javax.management.ObjectName;
 public class OpenwireArtemisBaseTest {
 
    @Rule
+   public CleanupThreadRule cleanupRules = new CleanupThreadRule();
+
+   @Rule
+   public ThreadLeakCheckRule leakCheckRule = new ThreadLeakCheckRule();
+
+   @Rule
    public TemporaryFolder temporaryFolder;
    @Rule
    public TestName name = new TestName();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7ed680e9/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ClusterUtil.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ClusterUtil.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ClusterUtil.java
deleted file mode 100644
index 42f199f..0000000
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ClusterUtil.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.activemq.transport.failover;
-
-/**
- * Utilities to create broker clusters
- */
-public class ClusterUtil {
-
-}


Mime
View raw message