NO-JIRA Speeding up tests
This commit is contained in:
parent
b9103e0903
commit
636ff8a9c8
|
@ -77,7 +77,6 @@ public class DupQueueTest extends MessageTestBase {
|
|||
|
||||
res = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
|
||||
Assert.assertEquals(200, res.getStatus());
|
||||
Assert.assertEquals("2", res.getEntity(String.class));
|
||||
res.releaseConnection();
|
||||
session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
|
||||
System.out.println("session: " + session);
|
||||
|
@ -85,7 +84,6 @@ public class DupQueueTest extends MessageTestBase {
|
|||
System.out.println("consumeNext: " + consumeNext);
|
||||
res = consumeNext.request().post(String.class);
|
||||
res.releaseConnection();
|
||||
Assert.assertEquals(503, res.getStatus());
|
||||
|
||||
res = session.request().delete();
|
||||
res.releaseConnection();
|
||||
|
|
|
@ -164,7 +164,7 @@ public class AmqpClientTestSupport extends AmqpTestSupport {
|
|||
server.getConfiguration().setBindingsDirectory(server.getConfiguration().getBindingsDirectory() + port);
|
||||
server.getConfiguration().setPagingDirectory(server.getConfiguration().getPagingDirectory() + port);
|
||||
server.getConfiguration().setJMXManagementEnabled(true);
|
||||
server.getConfiguration().setMessageExpiryScanPeriod(5000);
|
||||
server.getConfiguration().setMessageExpiryScanPeriod(100);
|
||||
server.setMBeanServer(mBeanServer);
|
||||
|
||||
// Add any additional Acceptors needed for tests
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
|||
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
|
||||
import org.apache.activemq.artemis.core.server.impl.LastValueQueue;
|
||||
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
|
||||
import org.apache.activemq.artemis.tests.util.Wait;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@ -187,9 +188,11 @@ public class JMSNonDestructiveTest extends JMSClientTestSupport {
|
|||
|
||||
//Consume Once
|
||||
receive(consumerConnectionSupplier, NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME);
|
||||
assertEquals("Ensure Message count", 1, queueBinding.getQueue().getMessageCount());
|
||||
Wait.assertEquals(1, queueBinding.getQueue()::getMessageCount);
|
||||
|
||||
Thread.sleep(500);
|
||||
// Wait for expiration
|
||||
Wait.waitFor(() -> queueBinding.getQueue().getMessageCount() == 0, 200); // notice the small timeout here is intended,
|
||||
// as it will not suceed if we disable scan as we expect the client to expire destinations
|
||||
|
||||
//Consume Again this time we expect the message to be expired, so nothing delivered
|
||||
receiveNull(consumerConnectionSupplier, NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME);
|
||||
|
@ -280,7 +283,7 @@ public class JMSNonDestructiveTest extends JMSClientTestSupport {
|
|||
}
|
||||
|
||||
public void testNonDestructiveLVQTombstone(ConnectionSupplier producerConnectionSupplier, ConnectionSupplier consumerConnectionSupplier) throws Exception {
|
||||
int tombstoneTimeToLive = 500;
|
||||
int tombstoneTimeToLive = 50;
|
||||
|
||||
QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(NON_DESTRUCTIVE_TOMBSTONE_LVQ_QUEUE_NAME));
|
||||
LastValueQueue lastValueQueue = (LastValueQueue)queueBinding.getQueue();
|
||||
|
|
|
@ -2865,7 +2865,7 @@ public class MessageConsumerTest extends JMSTestCase {
|
|||
|
||||
conn1.setClientID(CLIENT_ID1);
|
||||
|
||||
Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
Session sess1 = conn1.createSession(true, Session.SESSION_TRANSACTED);
|
||||
MessageProducer prod = sess1.createProducer(null);
|
||||
prod.setDeliveryMode(DeliveryMode.PERSISTENT);
|
||||
|
||||
|
@ -2879,17 +2879,16 @@ public class MessageConsumerTest extends JMSTestCase {
|
|||
TextMessage tm = sess1.createTextMessage("hello");
|
||||
prod.send(ActiveMQServerTestCase.topic1, tm);
|
||||
}
|
||||
sess1.commit();
|
||||
|
||||
int count = 0;
|
||||
while (true) {
|
||||
for (int count = 0; count < NUM_MESSAGES; count++) {
|
||||
TextMessage tm = (TextMessage) durable.receive(1500);
|
||||
if (tm == null) {
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
Assert.assertNotNull(tm);
|
||||
}
|
||||
|
||||
ProxyAssertSupport.assertEquals(NUM_MESSAGES, count);
|
||||
Assert.assertNull(durable.receiveNoWait());
|
||||
|
||||
sess1.commit();
|
||||
|
||||
durable.close();
|
||||
|
||||
|
@ -2946,17 +2945,12 @@ public class MessageConsumerTest extends JMSTestCase {
|
|||
Session sess3 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
MessageConsumer durable3 = sess3.createDurableSubscriber(ActiveMQServerTestCase.topic1, "mySubscription2");
|
||||
|
||||
int count = 0;
|
||||
while (true) {
|
||||
for (int i = 0; i < NUM_MESSAGES; i++) {
|
||||
TextMessage tm = (TextMessage) durable3.receive(1000);
|
||||
if (tm == null) {
|
||||
break;
|
||||
}
|
||||
Assert.assertNotNull(tm);
|
||||
ProxyAssertSupport.assertEquals("hello", tm.getText());
|
||||
count++;
|
||||
}
|
||||
|
||||
ProxyAssertSupport.assertEquals(NUM_MESSAGES, count);
|
||||
Assert.assertNull(durable3.receiveNoWait());
|
||||
|
||||
log.debug("received " + NUM_MESSAGES + " messages");
|
||||
|
||||
|
@ -3030,7 +3024,7 @@ public class MessageConsumerTest extends JMSTestCase {
|
|||
durable = sess3.createDurableSubscriber(ActiveMQServerTestCase.topic1, "mySubscription");
|
||||
int count = 0;
|
||||
while (true) {
|
||||
TextMessage tm = (TextMessage) durable.receive(1000);
|
||||
TextMessage tm = (TextMessage) durable.receive(100);
|
||||
if (tm == null) {
|
||||
break;
|
||||
}
|
||||
|
@ -3137,7 +3131,7 @@ public class MessageConsumerTest extends JMSTestCase {
|
|||
final int NUM_TO_RECEIVE = NUM_MESSAGES - 1;
|
||||
|
||||
for (int i = 0; i < NUM_TO_RECEIVE; i++) {
|
||||
TextMessage tm = (TextMessage) durable.receive(3000);
|
||||
TextMessage tm = (TextMessage) durable.receive(300);
|
||||
ProxyAssertSupport.assertNotNull(tm);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue