More JMS Test speed improvements

- reduce timeouts for tests that expect to time out
- reduce iterations
This commit is contained in:
Gary Russell
2018-01-18 15:20:47 -05:00
committed by Artem Bilan
parent fd94955771
commit d890f14c5d
5 changed files with 12 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -166,8 +166,7 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti
return message;
});
}).start();
org.springframework.messaging.Message<?> siReplyMessage = gateway.exchange(new GenericMessage<String>("foo"));
assertEquals("bar", siReplyMessage.getPayload());
gateway.exchange(new GenericMessage<String>("foo"));
}
finally {
context.close();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -149,8 +149,7 @@ public class RequestReplyScenariosWithNonCachedConsumersTests extends ActiveMQMu
return message;
});
}).start();
org.springframework.messaging.Message<?> siReplyMessage = gateway.exchange(new GenericMessage<String>("foo"));
assertEquals("bar", siReplyMessage.getPayload());
gateway.exchange(new GenericMessage<String>("foo"));
}
finally {
context.close();

View File

@@ -17,6 +17,7 @@
package org.springframework.integration.jms.request_reply;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.ArrayList;
@@ -25,6 +26,7 @@ import java.util.Random;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import javax.jms.ConnectionFactory;
@@ -211,7 +213,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti
new ClassPathXmlApplicationContext("mult-producer-and-consumers-temp-reply.xml", this.getClass());
final RequestReplyExchanger gateway = context.getBean(RequestReplyExchanger.class);
ExecutorService executor = Executors.newFixedThreadPool(10);
final int testNumbers = 100;
final int testNumbers = 30;
final CountDownLatch latch = new CountDownLatch(testNumbers);
final AtomicInteger failures = new AtomicInteger();
final AtomicInteger timeouts = new AtomicInteger();
@@ -234,18 +236,11 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti
failures.incrementAndGet();
}
}
// if (latch.getCount()%100 == 0){
// long count = testNumbers-latch.getCount();
// if (count > 0){
// print(failures, timeouts, missmatches, testNumbers-latch.getCount());
// }
// }
latch.countDown();
});
}
latch.await();
assertTrue(latch.await(30, TimeUnit.SECONDS));
print(failures, timeouts, missmatches, testNumbers);
Thread.sleep(5000);
assertEquals(0, missmatches.get());
assertEquals(0, failures.get());
assertEquals(0, timeouts.get());

View File

@@ -12,7 +12,7 @@
connection-factory="jmsConnectionFactory"
request-destination="siOutQueueOptimizedA"
reply-destination="siInQueueOptimizedA"
receive-timeout="10000"
receive-timeout="100"
correlation-key="JMSCorrelationID">
<int-jms:reply-listener />
</int-jms:outbound-gateway>
@@ -73,7 +73,7 @@
<int-jms:outbound-gateway request-channel="jmsInNonOptimizedD"
connection-factory="jmsConnectionFactory"
receive-timeout="10000"
receive-timeout="100"
request-destination="siOutQueueNonOptimizedD"
reply-destination="siInQueueNonOptimizedD">
<int-jms:reply-listener />

View File

@@ -31,7 +31,7 @@
<int-jms:outbound-gateway request-channel="jmsInNonOptimized"
connection-factory="jmsConnectionFactory"
receive-timeout="10000"
receive-timeout="100"
request-destination="siOutQueueB"
reply-destination="siInQueueB">
<int-jms:reply-listener />
@@ -52,7 +52,7 @@
<int-jms:outbound-gateway request-channel="jmsInOptimizedC"
connection-factory="jmsConnectionFactory"
request-destination="siOutQueueC"
receive-timeout="10000"
receive-timeout="100"
reply-destination="siInQueueC"
correlation-key="JMSCorrelationID">
<int-jms:reply-listener />