INT-3683: Fix typo in schema.sql.vpp

JIRA: https://jira.spring.io/browse/INT-3683

* In addition fix `inputs` for the Gradle `generateSql` task and regenerate all SQLs
to apply the typo fix.
The previous way to generate sql scripts doesn't work properly. It is always as `UP-TO-DATE`.
Adding `inputs` to the `generateSql` show the correct behaviour.
From other side that makes `cleanSql` task as redundant.
* Applying the Travis config fix to this commit as well.

Fix HTTP test timeout

https://build.spring.io/browse/INT-B41-346

Fix `ProducerAndConsumerAutoStartupTests`

https://build.spring.io/browse/INT-B41-346

Fix `DelayerUsageTests` `time` bean scope bug

https://build.spring.io/browse/INT-B41-347

Fix `HttpInboundGatewayParserTests.java` generics Java < 8 compiler warnings

Increase Tomcat response timeout for WebSocket tests

https://build.spring.io/browse/INT-B41-349

Increase timeout in the `AsyncMessagingTemplateTests#executionException()`

Fix `ClassCastException` for the `StandardWebSocketClient#userProperties`

Increase Delay to 2 Seconds in DelayHandlerTests
This commit is contained in:
Artem Bilan
2015-07-22 17:34:18 -04:00
committed by Gary Russell
parent b69c0c2d24
commit 178c86faa4
18 changed files with 71 additions and 49 deletions

View File

@@ -61,9 +61,9 @@
<queue/>
</channel>
<beans:bean id="time" class="java.util.Calendar" factory-method="getInstance"/>
<beans:bean id="time" class="java.util.Calendar" factory-method="getInstance" scope="prototype"/>
<delayer id="delayerExpression" input-channel="inputC" output-channel="outputC" expression="new java.util.Date(@time.timeInMillis + 5000)"/>
<delayer id="delayerExpression" input-channel="inputC" output-channel="outputC" expression="new java.util.Date(@time.timeInMillis + 1000)"/>
</beans:beans>

View File

@@ -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<Message<?>> result = template.asyncSendAndReceive(MessageBuilder.withPayload("test").build());
try {
result.get(10, TimeUnit.MILLISECONDS);
result.get(10, TimeUnit.SECONDS);
fail();
}
catch (ExecutionException e) {

View File

@@ -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<Integer> received = new ArrayList<Integer>();
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<Integer> numbers = new LinkedBlockingQueue<Integer>();
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);
}
}
}

View File

@@ -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<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
return null;
}
@@ -518,6 +525,7 @@ public class DelayHandlerTests {
private volatile Thread lastThread;
@Override
public void handleMessage(Message<?> message) {
this.lastMessage = message;
this.lastThread = Thread.currentThread();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 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.
@@ -22,6 +22,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.springframework.integration.test.util.TestUtils.getPropertyValue;
@@ -114,14 +115,14 @@ public class HttpInboundGatewayParserTests {
@Test
public void checkConfig() {
assertNotNull(gateway);
assertThat((Boolean) getPropertyValue(gateway, "expectReply"), is(true));
assertThat((Boolean) getPropertyValue(gateway, "convertExceptions"), is(true));
assertThat((PollableChannel) getPropertyValue(gateway, "replyChannel"), is(responses));
assertTrue(getPropertyValue(gateway, "expectReply", Boolean.class));
assertTrue(getPropertyValue(gateway, "convertExceptions", Boolean.class));
assertSame(this.responses, getPropertyValue(gateway, "replyChannel"));
assertNotNull(TestUtils.getPropertyValue(gateway, "errorChannel"));
MessagingTemplate messagingTemplate = TestUtils.getPropertyValue(
gateway, "messagingTemplate", MessagingTemplate.class);
assertEquals(Long.valueOf(1234), TestUtils.getPropertyValue(messagingTemplate, "sendTimeout"));
assertEquals(Long.valueOf(4567), TestUtils.getPropertyValue(messagingTemplate, "receiveTimeout"));
assertEquals(1234L, TestUtils.getPropertyValue(messagingTemplate, "sendTimeout"));
assertEquals(4567L, TestUtils.getPropertyValue(messagingTemplate, "receiveTimeout"));
boolean registerDefaultConverters = TestUtils.getPropertyValue(gateway,"mergeWithDefaultConverters", Boolean.class);
assertFalse("By default the register-default-converters flag should be false", registerDefaultConverters);
@@ -132,7 +133,7 @@ public class HttpInboundGatewayParserTests {
messageConverters.size() > 0);
}
@Test(timeout=1000) @DirtiesContext
@Test @DirtiesContext
public void checkFlow() throws Exception {
requests.subscribe(handlerExpecting(any(Message.class)));
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -258,7 +259,8 @@ public class HttpInboundGatewayParserTests {
messageConverters.size() > 1);
}
public static class Person{
public static class Person {
private String name;
public String getName() {
@@ -268,9 +270,10 @@ public class HttpInboundGatewayParserTests {
public void setName(String name) {
this.name = name;
}
}
public static class PersonConverter implements Converter<Person, String>{
public static class PersonConverter implements Converter<Person, String> {
public String convert(Person source) {
return source.getName();

View File

@@ -14,6 +14,8 @@ task generateSql {
configurations { vpp }
dependencies { vpp 'foundrylogic.vpp:vpp:2.2.1' }
inputs.dir new File('src/main/sql')
def generatedResourcesDir = new File('src/main/resources/org/springframework/integration/jdbc')
outputs.dir generatedResourcesDir
@@ -45,7 +47,3 @@ task generateSql {
// tie schema generation to the build lifecycle
compileJava.dependsOn generateSql
task cleanSql (type: Delete) {
delete fileTree(dir: 'src/main/resources/org/springframework/integration/jdbc').include('*.sql').exclude('config', 'store/channel')
}

View File

@@ -14,7 +14,7 @@ CREATE TABLE INT_GROUP_TO_MESSAGE (
GROUP_KEY CHAR(36),
MESSAGE_ID CHAR(36),
REGION VARCHAR(100),
constraint GROUP_TO_MESSAG_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
constraint GROUP_TO_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
);
CREATE TABLE INT_MESSAGE_GROUP (
@@ -26,4 +26,4 @@ CREATE TABLE INT_MESSAGE_GROUP (
CREATED_DATE TIMESTAMP NOT NULL,
UPDATED_DATE TIMESTAMP DEFAULT NULL,
constraint MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION)
);
);

View File

@@ -14,7 +14,7 @@ CREATE TABLE INT_GROUP_TO_MESSAGE (
GROUP_KEY CHAR(36),
MESSAGE_ID CHAR(36),
REGION VARCHAR(100),
constraint GROUP_TO_MESSAG_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
constraint GROUP_TO_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
);
CREATE TABLE INT_MESSAGE_GROUP (
@@ -26,4 +26,4 @@ CREATE TABLE INT_MESSAGE_GROUP (
CREATED_DATE TIMESTAMP NOT NULL,
UPDATED_DATE TIMESTAMP DEFAULT NULL,
constraint MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION)
);
);

View File

@@ -14,7 +14,7 @@ CREATE TABLE INT_GROUP_TO_MESSAGE (
GROUP_KEY CHAR(36),
MESSAGE_ID CHAR(36),
REGION VARCHAR(100),
constraint GROUP_TO_MESSAG_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
constraint GROUP_TO_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
);
CREATE TABLE INT_MESSAGE_GROUP (
@@ -26,4 +26,4 @@ CREATE TABLE INT_MESSAGE_GROUP (
CREATED_DATE TIMESTAMP NOT NULL,
UPDATED_DATE TIMESTAMP DEFAULT NULL,
constraint MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION)
);
);

View File

@@ -14,7 +14,7 @@ CREATE TABLE INT_GROUP_TO_MESSAGE (
GROUP_KEY CHAR(36),
MESSAGE_ID CHAR(36),
REGION VARCHAR(100),
constraint GROUP_TO_MESSAG_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
constraint GROUP_TO_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
);
CREATE TABLE INT_MESSAGE_GROUP (
@@ -26,4 +26,4 @@ CREATE TABLE INT_MESSAGE_GROUP (
CREATED_DATE TIMESTAMP NOT NULL,
UPDATED_DATE TIMESTAMP DEFAULT NULL,
constraint MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION)
);
);

View File

@@ -14,7 +14,7 @@ CREATE TABLE INT_GROUP_TO_MESSAGE (
GROUP_KEY CHAR(36),
MESSAGE_ID CHAR(36),
REGION VARCHAR(100),
constraint GROUP_TO_MESSAG_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
constraint GROUP_TO_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
) ENGINE=InnoDB;
CREATE TABLE INT_MESSAGE_GROUP (
@@ -26,4 +26,4 @@ CREATE TABLE INT_MESSAGE_GROUP (
CREATED_DATE DATETIME(6) NOT NULL,
UPDATED_DATE DATETIME(6) DEFAULT NULL,
constraint MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION)
) ENGINE=InnoDB;
) ENGINE=InnoDB;

View File

@@ -14,7 +14,7 @@ CREATE TABLE INT_GROUP_TO_MESSAGE (
GROUP_KEY CHAR(36),
MESSAGE_ID CHAR(36),
REGION VARCHAR(100),
constraint GROUP_TO_MESSAG_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
constraint GROUP_TO_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
) ENGINE=InnoDB;
CREATE TABLE INT_MESSAGE_GROUP (
@@ -26,4 +26,4 @@ CREATE TABLE INT_MESSAGE_GROUP (
CREATED_DATE DATETIME NOT NULL,
UPDATED_DATE DATETIME DEFAULT NULL,
constraint MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION)
) ENGINE=InnoDB;
) ENGINE=InnoDB;

View File

@@ -14,7 +14,7 @@ CREATE TABLE INT_GROUP_TO_MESSAGE (
GROUP_KEY CHAR(36),
MESSAGE_ID CHAR(36),
REGION VARCHAR2(100),
constraint GROUP_TO_MESSAG_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
constraint GROUP_TO_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
);
CREATE TABLE INT_MESSAGE_GROUP (
@@ -26,4 +26,4 @@ CREATE TABLE INT_MESSAGE_GROUP (
CREATED_DATE TIMESTAMP NOT NULL,
UPDATED_DATE TIMESTAMP DEFAULT NULL,
constraint MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION)
);
);

View File

@@ -14,7 +14,7 @@ CREATE TABLE INT_GROUP_TO_MESSAGE (
GROUP_KEY CHAR(36),
MESSAGE_ID CHAR(36),
REGION VARCHAR(100),
constraint GROUP_TO_MESSAG_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
constraint GROUP_TO_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
);
CREATE TABLE INT_MESSAGE_GROUP (
@@ -26,4 +26,4 @@ CREATE TABLE INT_MESSAGE_GROUP (
CREATED_DATE TIMESTAMP NOT NULL,
UPDATED_DATE TIMESTAMP DEFAULT NULL,
constraint MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION)
);
);

View File

@@ -14,7 +14,7 @@ CREATE TABLE INT_GROUP_TO_MESSAGE (
GROUP_KEY CHAR(36),
MESSAGE_ID CHAR(36),
REGION VARCHAR(100),
constraint GROUP_TO_MESSAG_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
constraint GROUP_TO_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
);
CREATE TABLE INT_MESSAGE_GROUP (
@@ -26,4 +26,4 @@ CREATE TABLE INT_MESSAGE_GROUP (
CREATED_DATE DATETIME NOT NULL,
UPDATED_DATE DATETIME DEFAULT NULL,
constraint MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION)
);
);

View File

@@ -14,7 +14,7 @@ CREATE TABLE INT_GROUP_TO_MESSAGE (
GROUP_KEY CHAR(36),
MESSAGE_ID CHAR(36),
REGION VARCHAR(100),
constraint GROUP_TO_MESSAG_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
constraint GROUP_TO_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
) LOCK DATAROWS;
CREATE TABLE INT_MESSAGE_GROUP (
@@ -26,4 +26,4 @@ CREATE TABLE INT_MESSAGE_GROUP (
CREATED_DATE DATETIME NOT NULL,
UPDATED_DATE DATETIME DEFAULT NULL,
constraint MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION)
) LOCK DATAROWS;
) LOCK DATAROWS;

View File

@@ -14,7 +14,7 @@ CREATE TABLE INT_GROUP_TO_MESSAGE (
GROUP_KEY CHAR(36),
MESSAGE_ID CHAR(36),
REGION ${VARCHAR}(100),
constraint GROUP_TO_MESSAG_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
constraint GROUP_TO_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
)#if(${VOODOO}) ${VOODOO}#end;
CREATE TABLE INT_MESSAGE_GROUP (
@@ -26,4 +26,4 @@ CREATE TABLE INT_MESSAGE_GROUP (
CREATED_DATE ${TIMESTAMP} NOT NULL,
UPDATED_DATE ${TIMESTAMP} DEFAULT NULL,
constraint MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION)
)#if(${VOODOO}) ${VOODOO}#end;
)#if(${VOODOO}) ${VOODOO}#end;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-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.
@@ -26,10 +26,13 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.tomcat.websocket.WsWebSocketContainer;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -61,8 +64,14 @@ public class ClientWebSocketContainerTests {
@Test
public void testClientWebSocketContainer() throws Exception {
StandardWebSocketClient webSocketClient = new StandardWebSocketClient();
Map<String, Object> userProperties = new HashMap<String, Object>();
userProperties.put(WsWebSocketContainer.IO_TIMEOUT_MS_PROPERTY,
"" + (WsWebSocketContainer.IO_TIMEOUT_MS_DEFAULT * 6));
webSocketClient.setUserProperties(userProperties);
ClientWebSocketContainer container =
new ClientWebSocketContainer(new StandardWebSocketClient(), server.getWsBaseUrl() + "/ws/websocket");
new ClientWebSocketContainer(webSocketClient, server.getWsBaseUrl() + "/ws/websocket");
TestWebSocketListener messageListener = new TestWebSocketListener();
container.setMessageListener(messageListener);