diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests-context.xml
index 9136b78979..952b965762 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests-context.xml
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests-context.xml
@@ -61,9 +61,9 @@
-
+
-
+
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/core/AsyncMessagingTemplateTests.java b/spring-integration-core/src/test/java/org/springframework/integration/core/AsyncMessagingTemplateTests.java
index 1ca7427f59..4148885b79 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/core/AsyncMessagingTemplateTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/core/AsyncMessagingTemplateTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -406,7 +406,7 @@ public class AsyncMessagingTemplateTests {
template.setDefaultDestination(channel);
Future> result = template.asyncSendAndReceive(MessageBuilder.withPayload("test").build());
try {
- result.get(10, TimeUnit.MILLISECONDS);
+ result.get(10, TimeUnit.SECONDS);
fail();
}
catch (ExecutionException e) {
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ProducerAndConsumerAutoStartupTests.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ProducerAndConsumerAutoStartupTests.java
index b2cf1b426d..9fd71e3ce5 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ProducerAndConsumerAutoStartupTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ProducerAndConsumerAutoStartupTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -18,6 +18,7 @@ package org.springframework.integration.endpoint;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.test.context.ContextConfiguration;
@@ -35,6 +36,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Mark Fisher
* @author Iwein Fuld
+ * @author Artem Bilan
* @since 2.0.0
*/
@ContextConfiguration
@@ -52,9 +54,9 @@ public class ProducerAndConsumerAutoStartupTests {
public void test() throws Exception {
List received = new ArrayList();
for (int i = 0; i < 3; i++) {
- received.add(consumer.poll(500));
+ received.add(this.consumer.poll(10000));
}
- context.stop();
+ this.context.stop();
assertEquals(new Integer(1), received.get(0));
assertEquals(new Integer(2), received.get(1));
assertEquals(new Integer(3), received.get(2));
@@ -66,12 +68,13 @@ public class ProducerAndConsumerAutoStartupTests {
private final AtomicInteger count = new AtomicInteger();
public Integer next() throws InterruptedException {
- if (count.get()>2){
+ if (this.count.get() > 2) {
//prevent message overload
return null;
}
- return new Integer(count.incrementAndGet());
+ return this.count.incrementAndGet();
}
+
}
@@ -80,12 +83,13 @@ public class ProducerAndConsumerAutoStartupTests {
private final BlockingQueue numbers = new LinkedBlockingQueue();
public void receive(Integer number) {
- numbers.add(number);
+ this.numbers.add(number);
}
Integer poll(long timeoutInMillis) throws InterruptedException {
- return numbers.poll(timeoutInMillis, TimeUnit.MILLISECONDS);
+ return this.numbers.poll(timeoutInMillis, TimeUnit.MILLISECONDS);
}
+
}
}
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java
index bba38271b4..ffe91a10d3 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java
@@ -243,6 +243,7 @@ public class DelayHandlerTests {
final CountDownLatch latch = new CountDownLatch(1);
new Thread(new Runnable() {
+ @Override
public void run() {
try {
taskScheduler.getScheduledExecutor().awaitTermination(10000, TimeUnit.MILLISECONDS);
@@ -267,6 +268,7 @@ public class DelayHandlerTests {
final CountDownLatch latch = new CountDownLatch(1);
new Thread(new Runnable() {
+ @Override
public void run() {
try {
taskScheduler.getScheduledExecutor().awaitTermination(10000, TimeUnit.MILLISECONDS);
@@ -286,6 +288,7 @@ public class DelayHandlerTests {
this.startDelayerHandler();
output.unsubscribe(resultHandler);
output.subscribe(new MessageHandler() {
+ @Override
public void handleMessage(Message> message) {
throw new UnsupportedOperationException("intentional test failure");
}
@@ -305,6 +308,7 @@ public class DelayHandlerTests {
output.unsubscribe(resultHandler);
errorChannel.subscribe(resultHandler);
output.subscribe(new MessageHandler() {
+ @Override
public void handleMessage(Message> message) {
throw new UnsupportedOperationException("intentional test failure");
}
@@ -338,6 +342,7 @@ public class DelayHandlerTests {
output.unsubscribe(resultHandler);
customErrorChannel.subscribe(resultHandler);
output.subscribe(new MessageHandler() {
+ @Override
public void handleMessage(Message> message) {
throw new UnsupportedOperationException("intentional test failure");
}
@@ -369,6 +374,7 @@ public class DelayHandlerTests {
output.unsubscribe(resultHandler);
defaultErrorChannel.subscribe(resultHandler);
output.subscribe(new MessageHandler() {
+ @Override
public void handleMessage(Message> message) {
throw new UnsupportedOperationException("intentional test failure");
}
@@ -388,7 +394,7 @@ public class DelayHandlerTests {
@Test //INT-1132
public void testReschedulePersistedMessagesOnStartup() throws Exception {
MessageGroupStore messageGroupStore = new SimpleMessageStore();
- this.delayHandler.setDefaultDelay(200);
+ this.delayHandler.setDefaultDelay(2000);
this.delayHandler.setMessageStore(messageGroupStore);
this.startDelayerHandler();
Message> message = MessageBuilder.withPayload("test").build();
@@ -430,6 +436,7 @@ public class DelayHandlerTests {
public void testDoubleOnApplicationEvent() throws Exception {
this.delayHandler = Mockito.spy(this.delayHandler);
Mockito.doAnswer(new Answer