Skip to content

Commit d890f14

Browse files
garyrussellartembilan
authored andcommitted
More JMS Test speed improvements
- reduce timeouts for tests that expect to time out - reduce iterations
1 parent fd94955 commit d890f14

File tree

5 files changed

+12
-19
lines changed

5 files changed

+12
-19
lines changed

spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithCachedConsumersTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -166,8 +166,7 @@ public void messageCorrelationBasedOnRequestCorrelationIdNonOptimized() throws E
166166
return message;
167167
});
168168
}).start();
169-
org.springframework.messaging.Message<?> siReplyMessage = gateway.exchange(new GenericMessage<String>("foo"));
170-
assertEquals("bar", siReplyMessage.getPayload());
169+
gateway.exchange(new GenericMessage<String>("foo"));
171170
}
172171
finally {
173172
context.close();

spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithNonCachedConsumersTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -149,8 +149,7 @@ public void messageCorrelationBasedOnRequestCorrelationIdNonOptimized() throws E
149149
return message;
150150
});
151151
}).start();
152-
org.springframework.messaging.Message<?> siReplyMessage = gateway.exchange(new GenericMessage<String>("foo"));
153-
assertEquals("bar", siReplyMessage.getPayload());
152+
gateway.exchange(new GenericMessage<String>("foo"));
154153
}
155154
finally {
156155
context.close();

spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithTempReplyQueuesTests.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.integration.jms.request_reply;
1818

1919
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertTrue;
2021
import static org.junit.Assert.fail;
2122

2223
import java.util.ArrayList;
@@ -25,6 +26,7 @@
2526
import java.util.concurrent.CountDownLatch;
2627
import java.util.concurrent.ExecutorService;
2728
import java.util.concurrent.Executors;
29+
import java.util.concurrent.TimeUnit;
2830
import java.util.concurrent.atomic.AtomicInteger;
2931

3032
import javax.jms.ConnectionFactory;
@@ -211,7 +213,7 @@ public void testConcurrently() throws Exception {
211213
new ClassPathXmlApplicationContext("mult-producer-and-consumers-temp-reply.xml", this.getClass());
212214
final RequestReplyExchanger gateway = context.getBean(RequestReplyExchanger.class);
213215
ExecutorService executor = Executors.newFixedThreadPool(10);
214-
final int testNumbers = 100;
216+
final int testNumbers = 30;
215217
final CountDownLatch latch = new CountDownLatch(testNumbers);
216218
final AtomicInteger failures = new AtomicInteger();
217219
final AtomicInteger timeouts = new AtomicInteger();
@@ -234,18 +236,11 @@ public void testConcurrently() throws Exception {
234236
failures.incrementAndGet();
235237
}
236238
}
237-
// if (latch.getCount()%100 == 0){
238-
// long count = testNumbers-latch.getCount();
239-
// if (count > 0){
240-
// print(failures, timeouts, missmatches, testNumbers-latch.getCount());
241-
// }
242-
// }
243239
latch.countDown();
244240
});
245241
}
246-
latch.await();
242+
assertTrue(latch.await(30, TimeUnit.SECONDS));
247243
print(failures, timeouts, missmatches, testNumbers);
248-
Thread.sleep(5000);
249244
assertEquals(0, missmatches.get());
250245
assertEquals(0, failures.get());
251246
assertEquals(0, timeouts.get());

spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-cached-consumers.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
connection-factory="jmsConnectionFactory"
1313
request-destination="siOutQueueOptimizedA"
1414
reply-destination="siInQueueOptimizedA"
15-
receive-timeout="10000"
15+
receive-timeout="100"
1616
correlation-key="JMSCorrelationID">
1717
<int-jms:reply-listener />
1818
</int-jms:outbound-gateway>
@@ -73,7 +73,7 @@
7373

7474
<int-jms:outbound-gateway request-channel="jmsInNonOptimizedD"
7575
connection-factory="jmsConnectionFactory"
76-
receive-timeout="10000"
76+
receive-timeout="100"
7777
request-destination="siOutQueueNonOptimizedD"
7878
reply-destination="siInQueueNonOptimizedD">
7979
<int-jms:reply-listener />

spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-no-cached-consumers.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
<int-jms:outbound-gateway request-channel="jmsInNonOptimized"
3333
connection-factory="jmsConnectionFactory"
34-
receive-timeout="10000"
34+
receive-timeout="100"
3535
request-destination="siOutQueueB"
3636
reply-destination="siInQueueB">
3737
<int-jms:reply-listener />
@@ -52,7 +52,7 @@
5252
<int-jms:outbound-gateway request-channel="jmsInOptimizedC"
5353
connection-factory="jmsConnectionFactory"
5454
request-destination="siOutQueueC"
55-
receive-timeout="10000"
55+
receive-timeout="100"
5656
reply-destination="siInQueueC"
5757
correlation-key="JMSCorrelationID">
5858
<int-jms:reply-listener />

0 commit comments

Comments
 (0)