INT-911 created a separate XSD element for the 'gateway' used inside a chain, to avoid 'default' in the attribute names

This commit is contained in:
Mark Fisher
2009-12-24 15:09:49 +00:00
parent c8683b5ab4
commit a8f3edd52a
4 changed files with 73 additions and 24 deletions

View File

@@ -8,7 +8,7 @@
<si:gateway id="simpleGateway"
default-request-channel="inputA"
default-reply-channel="inputB"
service-interface="org.springframework.integration.gateway.GatewayInvokingMessaheHandlerTests$SimpleGateway"/>
service-interface="org.springframework.integration.gateway.GatewayInvokingMessageHandlerTests$SimpleGateway"/>
<si:publish-subscribe-channel id="inputA" />
<si:publish-subscribe-channel id="inputB" />
@@ -19,9 +19,9 @@
<si:header name="foo" value="foo" />
</si:header-enricher>
<si:service-activator>
<bean class="org.springframework.integration.gateway.GatewayInvokingMessaheHandlerTests$SimpleService" />
<bean class="org.springframework.integration.gateway.GatewayInvokingMessageHandlerTests$SimpleService" />
</si:service-activator>
<si:gateway default-request-channel="inputC"/>
<si:gateway request-channel="inputC"/>
</si:chain>
@@ -31,7 +31,7 @@
<si:header name="name" value="oleg" />
</si:header-enricher>
<si:service-activator>
<bean class="org.springframework.integration.gateway.GatewayInvokingMessaheHandlerTests$SimpleService" />
<bean class="org.springframework.integration.gateway.GatewayInvokingMessageHandlerTests$SimpleService" />
</si:service-activator>
</si:chain>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2009 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.
@@ -13,32 +13,31 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.gateway;
import junit.framework.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.channel.SubscribableChannel;
import org.springframework.integration.core.Message;
import org.springframework.integration.message.MessageDeliveryException;
import org.springframework.integration.message.MessageHandler;
import org.springframework.integration.message.MessageHandlingException;
import org.springframework.integration.message.MessageRejectedException;
import org.springframework.integration.message.StringMessage;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* TODO - insert COMMENT
* @author Oleg Zhurakousky
* @since 2.0
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
public class GatewayInvokingMessaheHandlerTests {
public class GatewayInvokingMessageHandlerTests {
@Autowired
@Qualifier("inputA")
SubscribableChannel channel;
@@ -52,11 +51,9 @@ public class GatewayInvokingMessaheHandlerTests {
SubscribableChannel output;
@Test
public void validateGatewayInTheChainViaChannel(){
public void validateGatewayInTheChainViaChannel() {
output.subscribe(new MessageHandler() {
public void handleMessage(Message<?> message)
throws MessageRejectedException, MessageHandlingException,
MessageDeliveryException {
public void handleMessage(Message<?> message) {
Assert.assertEquals("echo:echo:hello", message.getPayload());
Assert.assertEquals("foo", message.getHeaders().get("foo"));
Assert.assertEquals("oleg", message.getHeaders().get("name"));
@@ -64,12 +61,11 @@ public class GatewayInvokingMessaheHandlerTests {
});
channel.send(new StringMessage("hello"));
}
@Test
public void validateGatewayInTheChainViaAnotherGateway(){
public void validateGatewayInTheChainViaAnotherGateway() {
output.subscribe(new MessageHandler() {
public void handleMessage(Message<?> message)
throws MessageRejectedException, MessageHandlingException,
MessageDeliveryException {
public void handleMessage(Message<?> message) {
Assert.assertEquals("echo:echo:hello", message.getPayload());
Assert.assertEquals("foo", message.getHeaders().get("foo"));
Assert.assertEquals("oleg", message.getHeaders().get("name"));
@@ -78,14 +74,15 @@ public class GatewayInvokingMessaheHandlerTests {
String result = gateway.sendRecieve("hello");
Assert.assertEquals("echo:echo:hello", result);
}
public static interface SimpleGateway{
public static interface SimpleGateway {
public String sendRecieve(String str);
}
public static class SimpleService {
public String echo(String str){
public String echo(String str) {
return "echo:" + str;
}
}
}