INT-1263, more MessageHistory related changes

This commit is contained in:
Oleg Zhurakousky
2010-09-22 22:18:45 -04:00
parent d7e1041ed4
commit 0be4d2ef60
15 changed files with 78 additions and 19 deletions

View File

@@ -189,4 +189,7 @@ public class TcpOutboundGateway extends AbstractReplyProducingMessageHandler
public void setReplyChannel(MessageChannel replyChannel) {
this.setOutputChannel(replyChannel);
}
public String getComponentType(){
return "ip:tcp-outbound-gateway";
}
}

View File

@@ -85,4 +85,7 @@ public class TcpReceivingChannelAdapter
return false;
}
public String getComponentType(){
return "ip:tcp-inbound-channel-adapter";
}
}

View File

@@ -161,4 +161,7 @@ public class TcpSendingMessageHandler extends AbstractMessageHandler implements
public void removeDeadConnection(TcpConnection connection) {
connections.remove(connection.getConnectionId());
}
public String getComponentType(){
return "ip:tcp-outbound-channel-adapter";
}
}

View File

@@ -342,4 +342,8 @@ public class UnicastSendingMessageHandler extends
public void setTaskExecutor(Executor taskExecutor) {
this.taskExecutor = taskExecutor;
}
public String getComponentType(){
return "ip:udp-outbound-channel-adapter";
}
}

View File

@@ -154,6 +154,8 @@ public class ParserUnitTests {
assertEquals(30, dfa.getPropertyValue("soReceiveBufferSize"));
assertEquals(31, dfa.getPropertyValue("soSendBufferSize"));
assertEquals(32, dfa.getPropertyValue("soTimeout"));
assertEquals("testInUdp",udpIn.getComponentName());
assertEquals("ip:udp-inbound-channel-adapter", udpIn.getComponentType());
assertEquals("127.0.0.1", dfa.getPropertyValue("localAddress"));
assertSame(taskExecutor, dfa.getPropertyValue("taskExecutor"));
}
@@ -176,6 +178,8 @@ public class ParserUnitTests {
public void testInTcp() {
DirectFieldAccessor dfa = new DirectFieldAccessor(tcpIn);
assertSame(cfS1, dfa.getPropertyValue("serverConnectionFactory"));
assertEquals("testInTcp",tcpIn.getComponentName());
assertEquals("ip:tcp-inbound-channel-adapter", tcpIn.getComponentType());
}
@Test
@@ -197,6 +201,8 @@ public class ParserUnitTests {
assertEquals(54, dfa.getPropertyValue("soTimeout"));
assertEquals("127.0.0.1", dfa.getPropertyValue("localAddress"));
assertSame(taskExecutor, dfa.getPropertyValue("taskExecutor"));
assertEquals("testOutUdp",udpOut.getComponentName());
assertEquals("ip:udp-outbound-channel-adapter", udpOut.getComponentType());
}
@Test
@@ -223,6 +229,8 @@ public class ParserUnitTests {
public void testOutTcp() {
DirectFieldAccessor dfa = new DirectFieldAccessor(tcpOut);
assertSame(cfC1, dfa.getPropertyValue("clientConnectionFactory"));
assertEquals("testOutTcpNio",tcpOut.getComponentName());
assertEquals("ip:tcp-outbound-channel-adapter", tcpOut.getComponentType());
}
@Test
@@ -230,6 +238,8 @@ public class ParserUnitTests {
DirectFieldAccessor dfa = new DirectFieldAccessor(tcpInboundGateway);
assertSame(cfS2, dfa.getPropertyValue("connectionFactory"));
assertEquals(456L, dfa.getPropertyValue("replyTimeout"));
assertEquals("inGateway",tcpInboundGateway.getComponentName());
assertEquals("ip:tcp-inbound-gateway", tcpInboundGateway.getComponentType());
}
@Test
@@ -238,6 +248,8 @@ public class ParserUnitTests {
assertSame(cfC2, dfa.getPropertyValue("connectionFactory"));
assertEquals(234L, dfa.getPropertyValue("requestTimeout"));
assertEquals(567L, dfa.getPropertyValue("replyTimeout"));
assertEquals("outGateway",tcpOutboundGateway.getComponentName());
assertEquals("ip:tcp-outbound-gateway", tcpOutboundGateway.getComponentType());
}
@Test

View File

@@ -21,6 +21,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import java.util.Properties;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -32,6 +34,7 @@ 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.integration.test.util.TestUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -74,7 +77,10 @@ public class SharedConnectionTests {
QueueChannel replies = ctx.getBean("replies", QueueChannel.class);
Message<?> message = replies.receive(10000);
MessageHistory history = MessageHistory.read(message);
assertTrue(history.containsComponent("inboundClient"));
assertNotNull(history);
Properties componentHistoryRecord = TestUtils.locateComponentInHistory(history, "inboundClient", 0);
assertNotNull(componentHistoryRecord);
assertEquals("ip:tcp-inbound-channel-adapter", componentHistoryRecord.getProperty("type"));
assertNotNull(message);
assertEquals("Test", message.getPayload());
}