Increased timeout to fix AMQ-4854

This commit is contained in:
Kevin Earls 2013-11-07 13:48:21 +01:00
parent 50ec158e25
commit 982b728f24
1 changed files with 38 additions and 10 deletions

View File

@ -31,10 +31,20 @@ import javax.jms.Session;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.BrokerService;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class JmsRollbackRedeliveryTest extends AutoFailTestSupport { import static org.junit.Assert.*;
public class JmsRollbackRedeliveryTest /*extends AutoFailTestSupport*/ {
@Rule
public TestName testName = new TestName();
protected static final Logger LOG = LoggerFactory.getLogger(JmsRollbackRedeliveryTest.class); protected static final Logger LOG = LoggerFactory.getLogger(JmsRollbackRedeliveryTest.class);
final int nbMessages = 10; final int nbMessages = 10;
final String destinationName = "Destination"; final String destinationName = "Destination";
@ -42,42 +52,54 @@ public class JmsRollbackRedeliveryTest extends AutoFailTestSupport {
boolean consumerClose = true; boolean consumerClose = true;
boolean rollback = true; boolean rollback = true;
BrokerService broker; BrokerService broker;
@Before
public void setUp() throws Exception { public void setUp() throws Exception {
setAutoFail(true); //setAutoFail(true);
super.setUp(); //super.setUp();
LOG.info(">>>> Starting " + testName.getMethodName());
broker = new BrokerService(); broker = new BrokerService();
broker.setPersistent(false); broker.setPersistent(false);
broker.setUseJmx(false); broker.setUseJmx(false);
broker.start(); broker.start();
broker.waitUntilStarted();
} }
@After
public void tearDown() throws Exception { public void tearDown() throws Exception {
super.tearDown(); //super.tearDown();
if (broker != null) { if (broker != null) {
broker.stop(); broker.stop();
broker.waitUntilStopped();
} }
} }
@Test
public void testRedelivery() throws Exception { public void testRedelivery() throws Exception {
doTestRedelivery(brokerUrl, false); doTestRedelivery(brokerUrl, false);
} }
@Test
public void testRedeliveryWithInterleavedProducer() throws Exception { public void testRedeliveryWithInterleavedProducer() throws Exception {
doTestRedelivery(brokerUrl, true); doTestRedelivery(brokerUrl, true);
} }
@Test
public void testRedeliveryWithPrefetch0() throws Exception { public void testRedeliveryWithPrefetch0() throws Exception {
doTestRedelivery(brokerUrl + "?jms.prefetchPolicy.queuePrefetch=0", true); doTestRedelivery(brokerUrl + "?jms.prefetchPolicy.queuePrefetch=0", true);
} }
@Test
public void testRedeliveryWithPrefetch1() throws Exception { public void testRedeliveryWithPrefetch1() throws Exception {
doTestRedelivery(brokerUrl + "?jms.prefetchPolicy.queuePrefetch=1", true); doTestRedelivery(brokerUrl + "?jms.prefetchPolicy.queuePrefetch=1", true);
} }
public void doTestRedelivery(String brokerUrl, boolean interleaveProducer) throws Exception { public void doTestRedelivery(String brokerUrl, boolean interleaveProducer) throws Exception {
LOG.info(">>>> entering doTestRedelivery interleaveProducer is " + interleaveProducer);
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUrl); ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
Connection connection = connectionFactory.createConnection(); Connection connection = connectionFactory.createConnection();
@ -115,7 +137,8 @@ public class JmsRollbackRedeliveryTest extends AutoFailTestSupport {
} }
} }
} }
@Test
public void testRedeliveryOnSingleConsumer() throws Exception { public void testRedeliveryOnSingleConsumer() throws Exception {
ConnectionFactory connectionFactory = ConnectionFactory connectionFactory =
@ -149,7 +172,9 @@ public class JmsRollbackRedeliveryTest extends AutoFailTestSupport {
session.close(); session.close();
} }
} }
@Test
public void testRedeliveryOnSingleSession() throws Exception { public void testRedeliveryOnSingleSession() throws Exception {
ConnectionFactory connectionFactory = ConnectionFactory connectionFactory =
@ -185,6 +210,7 @@ public class JmsRollbackRedeliveryTest extends AutoFailTestSupport {
} }
// AMQ-1593 // AMQ-1593
@Test
public void testValidateRedeliveryCountOnRollback() throws Exception { public void testValidateRedeliveryCountOnRollback() throws Exception {
final int numMessages = 1; final int numMessages = 1;
@ -216,6 +242,7 @@ public class JmsRollbackRedeliveryTest extends AutoFailTestSupport {
} }
// AMQ-1593 // AMQ-1593
@Test
public void testValidateRedeliveryCountOnRollbackWithPrefetch0() throws Exception { public void testValidateRedeliveryCountOnRollbackWithPrefetch0() throws Exception {
final int numMessages = 1; final int numMessages = 1;
@ -260,6 +287,7 @@ public class JmsRollbackRedeliveryTest extends AutoFailTestSupport {
session.close(); session.close();
} }
@Test
public void testRedeliveryPropertyWithNoRollback() throws Exception { public void testRedeliveryPropertyWithNoRollback() throws Exception {
final int numMessages = 1; final int numMessages = 1;
ConnectionFactory connectionFactory = ConnectionFactory connectionFactory =