You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2014/01/29 16:29:21 UTC

git commit: https://issues.apache.org/jira/browse/AMQ-5001

Updated Branches:
  refs/heads/trunk bec711c7d -> 4273b1301


https://issues.apache.org/jira/browse/AMQ-5001

testSlowConsumerIsAbortedViaJmx failed due to issue in the test setup.

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

Branch: refs/heads/trunk
Commit: 4273b1301dc6315c28fb9841b97a0bf77b81515b
Parents: bec711c
Author: Timothy Bish <ta...@gmai.com>
Authored: Wed Jan 29 10:29:12 2014 -0500
Committer: Timothy Bish <ta...@gmai.com>
Committed: Wed Jan 29 10:29:12 2014 -0500

----------------------------------------------------------------------
 .../policy/AbortSlowAckConsumer0Test.java       | 35 +++++++++-----------
 1 file changed, 15 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/4273b130/activemq-unit-tests/src/test/java/org/apache/activemq/broker/policy/AbortSlowAckConsumer0Test.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/policy/AbortSlowAckConsumer0Test.java b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/policy/AbortSlowAckConsumer0Test.java
index d682926..886c5ec 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/policy/AbortSlowAckConsumer0Test.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/policy/AbortSlowAckConsumer0Test.java
@@ -16,11 +16,18 @@
  */
 package org.apache.activemq.broker.policy;
 
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import javax.jms.ConnectionFactory;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+
 import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.region.policy.AbortSlowAckConsumerStrategy;
-import org.apache.activemq.broker.region.policy.AbortSlowConsumerStrategy;
 import org.apache.activemq.broker.region.policy.PolicyEntry;
 import org.apache.activemq.broker.region.policy.PolicyMap;
 import org.junit.Ignore;
@@ -30,19 +37,13 @@ import org.junit.runners.BlockJUnit4ClassRunner;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jms.ConnectionFactory;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.Session;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
 @RunWith(value = BlockJUnit4ClassRunner.class)
 public class AbortSlowAckConsumer0Test extends AbortSlowConsumer0Test {
     private static final Logger LOG = LoggerFactory.getLogger(AbortSlowAckConsumer0Test.class);
     protected long maxTimeSinceLastAck = 5 * 1000;
 
+    AbortSlowAckConsumerStrategy strategy;
+
     @Override
     protected AbortSlowAckConsumerStrategy createSlowConsumerStrategy() {
         AbortSlowAckConsumerStrategy strategy = new AbortSlowAckConsumerStrategy();
@@ -59,7 +60,8 @@ public class AbortSlowAckConsumer0Test extends AbortSlowConsumer0Test {
         BrokerService broker = super.createBroker();
         PolicyEntry policy = new PolicyEntry();
 
-        AbortSlowAckConsumerStrategy strategy = createSlowConsumerStrategy();
+        strategy = createSlowConsumerStrategy();
+        underTest = strategy;
 
         policy.setSlowConsumerStrategy(strategy);
         policy.setQueuePrefetch(10);
@@ -77,12 +79,9 @@ public class AbortSlowAckConsumer0Test extends AbortSlowConsumer0Test {
         return factory;
     }
 
-
-    @Ignore("AMQ-5001")
     @Override
     @Test
     public void testSlowConsumerIsAbortedViaJmx() throws Exception {
-        AbortSlowAckConsumerStrategy strategy = createSlowConsumerStrategy();
         strategy.setMaxTimeSinceLastAck(500); // so jmx does the abort
         super.testSlowConsumerIsAbortedViaJmx();
     }
@@ -106,14 +105,13 @@ public class AbortSlowAckConsumer0Test extends AbortSlowConsumer0Test {
         try {
             consumer.receive(20000);
             fail("Slow consumer not aborted.");
-        } catch(Exception ex) {
+        } catch (Exception ex) {
         }
     }
 
     @Ignore("AMQ-5001")
     @Test
     public void testIdleConsumerCanBeAbortedNoMessages() throws Exception {
-        AbortSlowAckConsumerStrategy strategy = createSlowConsumerStrategy();
         strategy.setIgnoreIdleConsumers(false);
 
         ActiveMQConnection conn = (ActiveMQConnection) createConnectionFactory().createConnection();
@@ -124,12 +122,11 @@ public class AbortSlowAckConsumer0Test extends AbortSlowConsumer0Test {
         final MessageConsumer consumer = sess.createConsumer(destination);
         assertNotNull(consumer);
         conn.start();
-        startProducers(destination, 20);
 
         try {
             consumer.receive(20000);
             fail("Idle consumer not aborted.");
-        } catch(Exception ex) {
+        } catch (Exception ex) {
         }
     }
 
@@ -156,9 +153,7 @@ public class AbortSlowAckConsumer0Test extends AbortSlowConsumer0Test {
         try {
             consumer.receive(20000);
             fail("Slow consumer not aborted.");
-        } catch(Exception ex) {
+        } catch (Exception ex) {
         }
     }
-
-
 }