INT-1029: Support for outbound-gateways in chain

XSD refactoring: remove use="required" from 'request-channel' attribute of all 'outbound-gateways'
Tests for all 'outbound-gateways' inside the <chain>
This commit is contained in:
Artem Bilan
2012-06-07 15:03:39 +03:00
committed by Oleg Zhurakousky
parent c3860e14b7
commit 5bc41bc60b
37 changed files with 731 additions and 214 deletions

View File

@@ -28,6 +28,15 @@
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="gatewayType">
<xsd:attribute name="request-channel" type="xsd:string" use="required">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="expect-reply" type="xsd:string" default="true"/>
<xsd:attribute name="registry-host" type="xsd:string"/>
<xsd:attribute name="registry-port" type="xsd:string"/>
@@ -57,6 +66,15 @@
<xsd:sequence>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="request-channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="host" type="xsd:string" use="required"/>
<xsd:attribute name="port" type="xsd:string"/>
<xsd:attribute name="remote-channel" type="xsd:string" use="required"/>
@@ -81,15 +99,6 @@
</xsd:annotation>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="request-channel" type="xsd:string" use="required">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="reply-channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
@@ -104,4 +113,4 @@
<xsd:attribute name="auto-startup" type="xsd:string" default="true"/>
</xsd:complexType>
</xsd:schema>
</xsd:schema>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 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,14 +26,17 @@ 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.core.PollableChannel;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.rmi.RmiInboundGateway;
import org.springframework.integration.rmi.RmiOutboundGateway;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.test.util.TestUtils;
/**
* @author Mark Fisher
* @author Gary Russell
* @author Artem Bilan
*/
public class RmiOutboundGatewayParserTests {
@@ -67,15 +70,27 @@ public class RmiOutboundGatewayParserTests {
assertEquals("test", result.getPayload());
}
@Test
public void endpointInvocation() {
@Test //INT-1029
public void testRmiOutboundGatewayInsideChain() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"rmiOutboundGatewayParserTests.xml", this.getClass());
MessageChannel localChannel = (MessageChannel) context.getBean("localChannel");
localChannel.send(new GenericMessage<String>("test"));
MessageChannel localChannel = context.getBean("rmiOutboundGatewayInsideChain", MessageChannel.class);
localChannel.send(MessageBuilder.withPayload("test").build());
Message<?> result = testChannel.receive(1000);
assertNotNull(result);
assertEquals("test", result.getPayload());
}
@Test //INT-1029
public void testRmiRequestReplyWithinChain() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"rmiOutboundGatewayParserTests.xml", this.getClass());
MessageChannel localChannel = context.getBean("requestReplyRmiWithChainChannel", MessageChannel.class);
localChannel.send(MessageBuilder.withPayload("test").build());
PollableChannel replyChannel = context.getBean("replyChannel", PollableChannel.class);
Message<?> result = replyChannel.receive();
assertNotNull(result);
assertEquals("TEST", result.getPayload());
}
}

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:rmi="http://www.springframework.org/schema/integration/rmi"
xsi:schemaLocation="http://www.springframework.org/schema/beans
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:rmi="http://www.springframework.org/schema/integration/rmi"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
@@ -13,9 +13,29 @@
<channel id="localChannel"/>
<rmi:outbound-gateway id="gateway"
order="23"
request-channel="localChannel"
remote-channel="testChannel"
host="localhost"/>
order="23"
request-channel="localChannel"
remote-channel="testChannel"
host="localhost"/>
</beans:beans>
<chain input-channel="rmiOutboundGatewayInsideChain">
<rmi:outbound-gateway remote-channel="testChannel" host="localhost"/>
</chain>
<channel id="remoteChannel"/>
<rmi:inbound-gateway request-channel="remoteChannel"/>
<service-activator input-channel="remoteChannel" expression="payload.toUpperCase()"/>
<channel id="replyChannel">
<queue/>
</channel>
<chain input-channel="requestReplyRmiWithChainChannel" output-channel="replyChannel">
<rmi:outbound-gateway remote-channel="remoteChannel" host="localhost"/>
</chain>
</beans:beans>