INT-1263, added more changes and tests related valdating MessageHistory in every module
This commit is contained in:
@@ -85,5 +85,7 @@ public class TcpInboundGateway extends MessagingGatewaySupport implements TcpLis
|
||||
public void removeDeadConnection(TcpConnection connection) {
|
||||
connections.remove(connection.getConnectionId());
|
||||
}
|
||||
|
||||
public String getComponentType(){
|
||||
return "ip:tcp-inbound-gateway";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,5 +199,8 @@ public class UnicastReceivingChannelAdapter extends AbstractInternetProtocolRece
|
||||
public void setSoSendBufferSize(int soSendBufferSize) {
|
||||
this.soSendBufferSize = soSendBufferSize;
|
||||
}
|
||||
|
||||
|
||||
public String getComponentType(){
|
||||
return "ip:udp-inbound-channel-adapter";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -31,6 +33,7 @@ import org.springframework.integration.ip.tcp.connection.AbstractClientConnectio
|
||||
import org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory;
|
||||
import org.springframework.integration.ip.tcp.connection.TcpConnection;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -69,7 +72,10 @@ public class ConnectionToConnectionTests {
|
||||
connection.send(MessageBuilder.withPayload("Test").build());
|
||||
Message<?> message = serverSideChannel.receive(10000);
|
||||
MessageHistory history = MessageHistory.read(message);
|
||||
assertTrue(history.containsComponent("looper"));
|
||||
//org.springframework.integration.test.util.TestUtils
|
||||
Properties componentHistoryRecord = TestUtils.locateComponentInHistory(history, "looper", 0);
|
||||
assertNotNull(componentHistoryRecord);
|
||||
assertTrue(componentHistoryRecord.get("type").equals("ip:tcp-inbound-gateway"));
|
||||
assertNotNull(message);
|
||||
assertEquals("Test", new String((byte[]) message.getPayload()));
|
||||
}
|
||||
|
||||
@@ -16,16 +16,17 @@
|
||||
|
||||
package org.springframework.integration.ip.udp;
|
||||
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
@@ -36,6 +37,7 @@ 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;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
|
||||
/**
|
||||
* Sends and receives a simple message through to the Udp channel adapters.
|
||||
@@ -139,7 +141,9 @@ 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"));
|
||||
Properties componentHistoryRecord = TestUtils.locateComponentInHistory(history, "udpReceiver", 0);
|
||||
assertNotNull(componentHistoryRecord);
|
||||
assertEquals("ip:udp-inbound-channel-adapter", componentHistoryRecord.get("type"));
|
||||
firstReceived.countDown();
|
||||
try {
|
||||
doneProcessing.await();
|
||||
|
||||
Reference in New Issue
Block a user