INT-1257, added tests and minor modification to support MessageHistory in MAIL, JDBC, IP, HTTP modules

This commit is contained in:
Oleg Zhurakousky
2010-09-21 22:15:37 -04:00
parent fa570a4295
commit c4d31af848
15 changed files with 96 additions and 21 deletions

View File

@@ -7,6 +7,7 @@
http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<int:message-history/>
<bean id="tcpIpUtils" class="org.springframework.integration.ip.util.SocketUtils" />

View File

@@ -16,6 +16,7 @@
package org.springframework.integration.ip.tcp;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -25,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.integration.Message;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory;
import org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory;
import org.springframework.integration.ip.tcp.connection.TcpConnection;
@@ -66,6 +68,8 @@ public class ConnectionToConnectionTests {
TcpConnection connection = client.getConnection();
connection.send(MessageBuilder.withPayload("Test").build());
Message<?> message = serverSideChannel.receive(10000);
MessageHistory history = MessageHistory.read(message);
assertTrue(history.containsComponent("looper"));
assertNotNull(message);
assertEquals("Test", new String((byte[]) message.getPayload()));
}

View File

@@ -7,7 +7,8 @@
http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<int:message-history/>
<bean id="tcpIpUtils" class="org.springframework.integration.ip.util.SocketUtils" />
<bean id="serializer" class="org.springframework.commons.serializer.java.JavaStreamingConverter" />

View File

@@ -16,6 +16,7 @@
package org.springframework.integration.ip.tcp;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
@@ -29,6 +30,7 @@ import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -71,6 +73,8 @@ public class SharedConnectionTests {
input.send(MessageBuilder.withPayload("Test").build());
QueueChannel replies = ctx.getBean("replies", QueueChannel.class);
Message<?> message = replies.receive(10000);
MessageHistory history = MessageHistory.read(message);
assertTrue(history.containsComponent("inboundClient"));
assertNotNull(message);
assertEquals("Test", message.getPayload());
}

View File

@@ -32,6 +32,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
import org.springframework.integration.support.channel.ChannelResolver;
@@ -137,6 +138,8 @@ public class UdpUnicastEndToEndTests implements Runnable {
}
QueueChannel channel = ctx.getBean("udpOutChannel", QueueChannel.class);
finalMessage = (Message<byte[]>) channel.receive();
MessageHistory history = MessageHistory.read(finalMessage);
assertTrue(history.containsComponent("udpReceiver"));
firstReceived.countDown();
try {
doneProcessing.await();

View File

@@ -12,7 +12,8 @@
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd
http://www.springframework.org/schema/integration/ip
http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd">
<message-history/>
<!--
Play with the buffer size to force errors. If the checkLength property is
set and this buffer is too small, we'll throw an exception.