Skip to content

Commit 1ee0639

Browse files
committed
Increase wait timeout in the AbsCorMHandlerTests
https://build.spring.io/browse/INT-MASTERSPRING40-414/
1 parent 9d17e09 commit 1ee0639

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

spring-integration-core/src/test/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandlerTests.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected void afterRelease(MessageGroup group, Collection<Message<?>> completed
9696
waitReapCompleteLatch.countDown();
9797
});
9898

99-
final List<Message<?>> outputMessages = new ArrayList<Message<?>>();
99+
final List<Message<?>> outputMessages = new ArrayList<>();
100100
handler.setOutputChannel((message, timeout) -> {
101101
/*
102102
* Executes when group 'bar' completes normally
@@ -137,7 +137,7 @@ protected void afterRelease(MessageGroup group, Collection<Message<?>> completed
137137
.build();
138138
handler.handleMessage(message);
139139

140-
assertTrue(waitReapCompleteLatch.await(10, TimeUnit.SECONDS));
140+
assertTrue(waitReapCompleteLatch.await(20, TimeUnit.SECONDS));
141141
// Before INT-2751 we got bar + bar + qux
142142
assertEquals(2, outputMessages.size()); // bar + qux
143143
// normal release
@@ -154,7 +154,7 @@ public void testReaperReapsAnEmptyGroup() throws Exception {
154154
final MessageGroupStore groupStore = new SimpleMessageStore();
155155
AggregatingMessageHandler handler = new AggregatingMessageHandler(group -> group, groupStore);
156156

157-
final List<Message<?>> outputMessages = new ArrayList<Message<?>>();
157+
final List<Message<?>> outputMessages = new ArrayList<>();
158158
handler.setOutputChannel((message, timeout) -> {
159159
/*
160160
* Executes when group 'bar' completes normally
@@ -181,7 +181,7 @@ public void testReaperReapsAnEmptyGroupAfterConfiguredDelay() throws Exception {
181181
final MessageGroupStore groupStore = new SimpleMessageStore();
182182
AggregatingMessageHandler handler = new AggregatingMessageHandler(group -> group, groupStore);
183183

184-
final List<Message<?>> outputMessages = new ArrayList<Message<?>>();
184+
final List<Message<?>> outputMessages = new ArrayList<>();
185185
handler.setOutputChannel((message, timeout) -> {
186186
/*
187187
* Executes when group 'bar' completes normally
@@ -233,8 +233,8 @@ public void testReapWithChangeInSameMillisecond() throws Exception {
233233
Method forceComplete =
234234
AbstractCorrelatingMessageHandler.class.getDeclaredMethod("forceComplete", MessageGroup.class);
235235
forceComplete.setAccessible(true);
236-
GenericMessage<String> secondMessage = new GenericMessage<String>("bar");
237-
mgs.addMessagesToGroup("foo", new GenericMessage<String>("foo"), secondMessage);
236+
GenericMessage<String> secondMessage = new GenericMessage<>("bar");
237+
mgs.addMessagesToGroup("foo", new GenericMessage<>("foo"), secondMessage);
238238
MessageGroup group = mgs.getMessageGroup("foo");
239239
// remove a message
240240
mgs.removeMessagesFromGroup("foo", secondMessage);
@@ -256,7 +256,7 @@ public void testDontReapIfAlreadyComplete() throws Exception {
256256
QueueChannel outputChannel = new QueueChannel();
257257
handler.setOutputChannel(outputChannel);
258258
MessageGroupStore mgs = TestUtils.getPropertyValue(handler, "messageStore", MessageGroupStore.class);
259-
mgs.addMessagesToGroup("foo", new GenericMessage<String>("foo"));
259+
mgs.addMessagesToGroup("foo", new GenericMessage<>("foo"));
260260
mgs.completeGroup("foo");
261261
mgs = spy(mgs);
262262
new DirectFieldAccessor(handler).setPropertyValue("messageStore", mgs);
@@ -282,7 +282,7 @@ public void testDontReapIfAlreadyCompleteAfterRefetch() throws Exception {
282282
QueueChannel outputChannel = new QueueChannel();
283283
handler.setOutputChannel(outputChannel);
284284
MessageGroupStore mgs = TestUtils.getPropertyValue(handler, "messageStore", MessageGroupStore.class);
285-
mgs.addMessagesToGroup("foo", new GenericMessage<String>("foo"));
285+
mgs.addMessagesToGroup("foo", new GenericMessage<>("foo"));
286286
MessageGroup group = new SimpleMessageGroup(mgs.getMessageGroup("foo"));
287287
mgs.completeGroup("foo");
288288
mgs = spy(mgs);
@@ -311,7 +311,7 @@ public void testDontReapIfNewGroupFoundDuringRefetch() throws Exception {
311311
QueueChannel outputChannel = new QueueChannel();
312312
handler.setOutputChannel(outputChannel);
313313
MessageGroupStore mgs = TestUtils.getPropertyValue(handler, "messageStore", MessageGroupStore.class);
314-
mgs.addMessagesToGroup("foo", new GenericMessage<String>("foo"));
314+
mgs.addMessagesToGroup("foo", new GenericMessage<>("foo"));
315315
MessageGroup group = new SimpleMessageGroup(mgs.getMessageGroup("foo"));
316316
mgs = spy(mgs);
317317
new DirectFieldAccessor(handler).setPropertyValue("messageStore", mgs);
@@ -383,7 +383,7 @@ public void testScheduleRemoveAnEmptyGroupAfterConfiguredDelay() throws Exceptio
383383
final MessageGroupStore groupStore = new SimpleMessageStore();
384384
AggregatingMessageHandler handler = new AggregatingMessageHandler(group -> group, groupStore);
385385

386-
final List<Message<?>> outputMessages = new ArrayList<Message<?>>();
386+
final List<Message<?>> outputMessages = new ArrayList<>();
387387
handler.setOutputChannel((message, timeout) -> {
388388
/*
389389
* Executes when group 'bar' completes normally
@@ -422,7 +422,7 @@ public void testScheduleRemoveAnEmptyGroupAfterConfiguredDelay() throws Exceptio
422422
}
423423

424424
@Test
425-
public void testDontReapMessageOfOtherHandler() throws Exception {
425+
public void testDontReapMessageOfOtherHandler() {
426426
MessageGroupStore groupStore = new SimpleMessageStore();
427427

428428
AggregatingMessageHandler handler1 = new AggregatingMessageHandler(group -> group, groupStore);
@@ -443,7 +443,8 @@ public void testDontReapMessageOfOtherHandler() throws Exception {
443443

444444
groupStore.expireMessageGroups(0);
445445

446-
assertTrue(handler1DiscardChannel.getQueueSize() == 2);
447-
assertTrue(handler2DiscardChannel.getQueueSize() == 1);
446+
assertEquals(2, handler1DiscardChannel.getQueueSize());
447+
assertEquals(1, handler2DiscardChannel.getQueueSize());
448448
}
449+
449450
}

0 commit comments

Comments
 (0)