You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ke...@apache.org on 2014/10/17 12:03:13 UTC

git commit: Changed or added timeouts to try to prevent CI hangs

Repository: activemq
Updated Branches:
  refs/heads/trunk 51a2596c5 -> 76e29bdf9


Changed or added timeouts to try to prevent CI hangs


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

Branch: refs/heads/trunk
Commit: 76e29bdf9c296d74b941dba85fdf5f077536353e
Parents: 51a2596
Author: Kevin Earls <ke...@kevinearls.com>
Authored: Fri Oct 17 12:03:04 2014 +0200
Committer: Kevin Earls <ke...@kevinearls.com>
Committed: Fri Oct 17 12:03:04 2014 +0200

----------------------------------------------------------------------
 .../activemq/transport/amqp/AMQ4696Test.java    |  2 +-
 .../activemq/transport/amqp/AMQ4920Test.java    |  2 +-
 .../transport/amqp/AmqpTransformerTest.java     |  4 +-
 .../activemq/transport/amqp/JMSClientTest.java  | 57 +++-----------------
 .../transport/amqp/JMSClientTestSupport.java    | 32 +++++++++--
 .../transport/amqp/bugs/AMQ4914Test.java        |  6 +--
 6 files changed, 40 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/76e29bdf/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AMQ4696Test.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AMQ4696Test.java b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AMQ4696Test.java
index 29b485e..738b70d 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AMQ4696Test.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AMQ4696Test.java
@@ -33,7 +33,7 @@ import org.junit.Test;
 
 public class AMQ4696Test extends AmqpTestSupport {
 
-    @Test
+    @Test(timeout=30*1000)
     public void simpleDurableTopicTest() throws Exception {
         String TOPIC_NAME = "topic://AMQ4696Test" + System.currentTimeMillis();
         String durableClientId = "AMQPDurableTopicTestClient";

http://git-wip-us.apache.org/repos/asf/activemq/blob/76e29bdf/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AMQ4920Test.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AMQ4920Test.java b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AMQ4920Test.java
index 1279d17..8137b8b 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AMQ4920Test.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AMQ4920Test.java
@@ -54,7 +54,7 @@ public class AMQ4920Test extends AmqpTestSupport {
         super.setUp();
     }
 
-    @Test(timeout = 5 * 60 * 1000)
+    @Test(timeout = 1 * 60 * 1000)
     public void testSendWithMultipleConsumers() throws Exception {
         ConnectionFactory connectionFactory = new ConnectionFactoryImpl("localhost", port, "admin", "admin");
         Connection connection = connectionFactory.createConnection();

http://git-wip-us.apache.org/repos/asf/activemq/blob/76e29bdf/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AmqpTransformerTest.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AmqpTransformerTest.java b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AmqpTransformerTest.java
index 9a8b3f6..8c00472 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AmqpTransformerTest.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AmqpTransformerTest.java
@@ -52,7 +52,7 @@ public class AmqpTransformerTest {
     private int openwirePort;
     private static final String TEST_QUEUE = "txqueue";
 
-    @Test(timeout=60 * 1000)
+    @Test(timeout = 30 * 1000)
     public void testNativeTransformation() throws Exception {
 
         // default is native
@@ -149,7 +149,7 @@ public class AmqpTransformerTest {
         openwireConn.close();
     }
 
-    @Test(timeout=60 * 1000)
+    @Test(timeout = 30 * 1000)
     public void testJmsTransformation() throws Exception {
 
         // default is native

http://git-wip-us.apache.org/repos/asf/activemq/blob/76e29bdf/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java
index 65ec92c..de0bca0 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java
@@ -42,7 +42,6 @@ import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.jms.Topic;
 
-import org.apache.activemq.broker.jmx.BrokerViewMBean;
 import org.apache.activemq.broker.jmx.ConnectorViewMBean;
 import org.apache.activemq.broker.jmx.QueueViewMBean;
 import org.apache.activemq.transport.amqp.joram.ActiveMQAdmin;
@@ -137,7 +136,7 @@ public class JMSClientTest extends JMSClientTestSupport {
         }
     }
 
-    @Test
+    @Test(timeout=30*1000)
     public void testTransactedConsumer() throws Exception {
         ActiveMQAdmin.enableJMSFrameTracing();
         final int msgCount = 1;
@@ -392,7 +391,7 @@ public class JMSClientTest extends JMSClientTestSupport {
         }
     }
 
-    @Test(timeout=90000)
+    @Test(timeout=30000)
     public void testConsumerReceiveNoWaitThrowsWhenBrokerStops() throws Exception {
         connection = createConnection();
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -426,7 +425,7 @@ public class JMSClientTest extends JMSClientTestSupport {
         assertTrue(t.passed());
     }
 
-    @Test(timeout=60000)
+    @Test(timeout=30000)
     public void testConsumerReceiveTimedThrowsWhenBrokerStops() throws Exception {
         connection = createConnection();
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -521,7 +520,7 @@ public class JMSClientTest extends JMSClientTestSupport {
         }
     }
 
-    @Test(timeout=120000)
+    @Test(timeout=30 * 1000)
     public void testProduceAndConsumeLargeNumbersOfMessages() throws JMSException {
         int count = 2000;
         connection = createConnection();
@@ -630,50 +629,6 @@ public class JMSClientTest extends JMSClientTestSupport {
     }
 
     @Test(timeout=30000)
-    public void testDurableConsumerUnsubscribe() throws Exception {
-        ActiveMQAdmin.enableJMSFrameTracing();
-
-        final BrokerViewMBean broker = getProxyToBroker();
-
-        connection = createConnection();
-        connection.start();
-
-        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        Topic topic = session.createTopic(getDestinationName());
-        MessageConsumer consumer = session.createDurableSubscriber(topic, "DurbaleTopic");
-
-        assertTrue(Wait.waitFor(new Wait.Condition() {
-
-            @Override
-            public boolean isSatisified() throws Exception {
-                return broker.getInactiveDurableTopicSubscribers().length == 0 &&
-                       broker.getDurableTopicSubscribers().length == 1;
-            }
-        }));
-
-        consumer.close();
-
-        assertTrue(Wait.waitFor(new Wait.Condition() {
-
-            @Override
-            public boolean isSatisified() throws Exception {
-                return broker.getInactiveDurableTopicSubscribers().length == 1 &&
-                       broker.getDurableTopicSubscribers().length == 0;
-            }
-        }));
-
-        session.unsubscribe("DurbaleTopic");
-        assertTrue(Wait.waitFor(new Wait.Condition() {
-
-            @Override
-            public boolean isSatisified() throws Exception {
-                return broker.getInactiveDurableTopicSubscribers().length == 0 &&
-                       broker.getDurableTopicSubscribers().length == 0;
-            }
-        }));
-    }
-
-    @Test(timeout=30000)
     public void testTopicConsumerAsync() throws Exception {
         ActiveMQAdmin.enableJMSFrameTracing();
         final CountDownLatch latch = new CountDownLatch(1);
@@ -740,7 +695,7 @@ public class JMSClientTest extends JMSClientTestSupport {
         }
     }
 
-    @Test(timeout=60000)
+    @Test(timeout=30000)
     public void testConnectionsAreClosed() throws Exception {
         ActiveMQAdmin.enableJMSFrameTracing();
 
@@ -871,7 +826,7 @@ public class JMSClientTest extends JMSClientTestSupport {
         return builder.toString();
     }
 
-    @Test(timeout = 60 * 1000)
+    @Test(timeout = 30 * 1000)
     public void testSendLargeMessage() throws JMSException, InterruptedException {
         connection = createConnection();
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

http://git-wip-us.apache.org/repos/asf/activemq/blob/76e29bdf/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTestSupport.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTestSupport.java b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTestSupport.java
index 81af2ca..5a341d8 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTestSupport.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTestSupport.java
@@ -23,6 +23,13 @@ import javax.jms.JMSException;
 import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl;
 import org.junit.After;
 
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
 public class JMSClientTestSupport extends AmqpTestSupport {
 
     protected Connection connection;
@@ -30,16 +37,31 @@ public class JMSClientTestSupport extends AmqpTestSupport {
     @Override
     @After
     public void tearDown() throws Exception {
-        if (connection != null) {
-            try {
-                connection.close();
-            } catch (Exception e) {
-            }
+        ExecutorService executor = Executors.newSingleThreadExecutor();
+        Future<Boolean> future = executor.submit(new CloseConnectionTask());
+        try {
+            LOG.debug("tearDown started.");
+            future.get(60, TimeUnit.SECONDS);
+        } catch (TimeoutException e) {
+            throw new Exception("CloseConnection timed out");
         }
+        executor.shutdownNow();
 
         super.tearDown();
     }
 
+    public class CloseConnectionTask implements Callable<Boolean> {
+        @Override
+        public Boolean call() throws Exception {
+            if (connection != null) {
+                LOG.debug("in CloseConnectionTask.call(), calling connection.close()");
+                connection.close();
+            }
+
+            return Boolean.TRUE;
+        }
+    }
+
     /**
      * @return the proper destination name to use for each test method invocation.
      */

http://git-wip-us.apache.org/repos/asf/activemq/blob/76e29bdf/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/bugs/AMQ4914Test.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/bugs/AMQ4914Test.java b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/bugs/AMQ4914Test.java
index 704e3d1..abf9c6d 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/bugs/AMQ4914Test.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/bugs/AMQ4914Test.java
@@ -56,21 +56,21 @@ public class AMQ4914Test extends AmqpTestSupport {
         return builder.toString();
     }
 
-    @Test(timeout = 2 * 60 * 1000)
+    @Test(timeout = 60 * 1000)
     public void testSendSmallerMessages() throws JMSException {
         for (int i = 512; i <= (16 * 1024); i += 512) {
             doTestSendLargeMessage(i);
         }
     }
 
-    @Test(timeout = 2 * 60 * 1000)
+    @Test(timeout = 60 * 1000)
     public void testSendFixedSizedMessages() throws JMSException {
         doTestSendLargeMessage(65536);
         doTestSendLargeMessage(65536 * 2);
         doTestSendLargeMessage(65536 * 4);
     }
 
-    @Test(timeout = 5 * 60 * 1000)
+    @Test(timeout = 60 * 1000)
     public void testSendHugeMessage() throws JMSException {
         doTestSendLargeMessage(1024 * 1024 * 10);
     }