mirror of https://github.com/apache/activemq.git
testSlowConsumerIsAbortedViaJmx failed due to issue in the test setup.
This commit is contained in:
parent
bec711c7db
commit
4273b1301d
|
@ -16,11 +16,18 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.broker.policy;
|
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.ActiveMQConnection;
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.apache.activemq.broker.region.policy.AbortSlowAckConsumerStrategy;
|
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.PolicyEntry;
|
||||||
import org.apache.activemq.broker.region.policy.PolicyMap;
|
import org.apache.activemq.broker.region.policy.PolicyMap;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
|
@ -30,19 +37,13 @@ import org.junit.runners.BlockJUnit4ClassRunner;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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)
|
@RunWith(value = BlockJUnit4ClassRunner.class)
|
||||||
public class AbortSlowAckConsumer0Test extends AbortSlowConsumer0Test {
|
public class AbortSlowAckConsumer0Test extends AbortSlowConsumer0Test {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AbortSlowAckConsumer0Test.class);
|
private static final Logger LOG = LoggerFactory.getLogger(AbortSlowAckConsumer0Test.class);
|
||||||
protected long maxTimeSinceLastAck = 5 * 1000;
|
protected long maxTimeSinceLastAck = 5 * 1000;
|
||||||
|
|
||||||
|
AbortSlowAckConsumerStrategy strategy;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AbortSlowAckConsumerStrategy createSlowConsumerStrategy() {
|
protected AbortSlowAckConsumerStrategy createSlowConsumerStrategy() {
|
||||||
AbortSlowAckConsumerStrategy strategy = new AbortSlowAckConsumerStrategy();
|
AbortSlowAckConsumerStrategy strategy = new AbortSlowAckConsumerStrategy();
|
||||||
|
@ -59,7 +60,8 @@ public class AbortSlowAckConsumer0Test extends AbortSlowConsumer0Test {
|
||||||
BrokerService broker = super.createBroker();
|
BrokerService broker = super.createBroker();
|
||||||
PolicyEntry policy = new PolicyEntry();
|
PolicyEntry policy = new PolicyEntry();
|
||||||
|
|
||||||
AbortSlowAckConsumerStrategy strategy = createSlowConsumerStrategy();
|
strategy = createSlowConsumerStrategy();
|
||||||
|
underTest = strategy;
|
||||||
|
|
||||||
policy.setSlowConsumerStrategy(strategy);
|
policy.setSlowConsumerStrategy(strategy);
|
||||||
policy.setQueuePrefetch(10);
|
policy.setQueuePrefetch(10);
|
||||||
|
@ -77,12 +79,9 @@ public class AbortSlowAckConsumer0Test extends AbortSlowConsumer0Test {
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Ignore("AMQ-5001")
|
|
||||||
@Override
|
@Override
|
||||||
@Test
|
@Test
|
||||||
public void testSlowConsumerIsAbortedViaJmx() throws Exception {
|
public void testSlowConsumerIsAbortedViaJmx() throws Exception {
|
||||||
AbortSlowAckConsumerStrategy strategy = createSlowConsumerStrategy();
|
|
||||||
strategy.setMaxTimeSinceLastAck(500); // so jmx does the abort
|
strategy.setMaxTimeSinceLastAck(500); // so jmx does the abort
|
||||||
super.testSlowConsumerIsAbortedViaJmx();
|
super.testSlowConsumerIsAbortedViaJmx();
|
||||||
}
|
}
|
||||||
|
@ -113,7 +112,6 @@ public class AbortSlowAckConsumer0Test extends AbortSlowConsumer0Test {
|
||||||
@Ignore("AMQ-5001")
|
@Ignore("AMQ-5001")
|
||||||
@Test
|
@Test
|
||||||
public void testIdleConsumerCanBeAbortedNoMessages() throws Exception {
|
public void testIdleConsumerCanBeAbortedNoMessages() throws Exception {
|
||||||
AbortSlowAckConsumerStrategy strategy = createSlowConsumerStrategy();
|
|
||||||
strategy.setIgnoreIdleConsumers(false);
|
strategy.setIgnoreIdleConsumers(false);
|
||||||
|
|
||||||
ActiveMQConnection conn = (ActiveMQConnection) createConnectionFactory().createConnection();
|
ActiveMQConnection conn = (ActiveMQConnection) createConnectionFactory().createConnection();
|
||||||
|
@ -124,7 +122,6 @@ public class AbortSlowAckConsumer0Test extends AbortSlowConsumer0Test {
|
||||||
final MessageConsumer consumer = sess.createConsumer(destination);
|
final MessageConsumer consumer = sess.createConsumer(destination);
|
||||||
assertNotNull(consumer);
|
assertNotNull(consumer);
|
||||||
conn.start();
|
conn.start();
|
||||||
startProducers(destination, 20);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
consumer.receive(20000);
|
consumer.receive(20000);
|
||||||
|
@ -159,6 +156,4 @@ public class AbortSlowAckConsumer0Test extends AbortSlowConsumer0Test {
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue