Removed 'handler' and 'handler-chain' elements.

This commit is contained in:
Mark Fisher
2008-09-05 01:03:45 +00:00
parent 4fb3480320
commit e22bf81927
8 changed files with 0 additions and 329 deletions

View File

@@ -27,7 +27,6 @@ import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;
@@ -54,31 +53,6 @@ public class EndpointParserTests {
assertEquals("test", handler.getMessageString());
}
@Test
public void testHandlerAdapterEndpoint() throws InterruptedException {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"handlerAdapterEndpointTests.xml", this.getClass());
context.start();
MessageChannel channel = (MessageChannel) context.getBean("testChannel");
TestBean bean = (TestBean) context.getBean("testBean");
assertNull(bean.getMessage());
channel.send(new GenericMessage<String>("test"));
bean.getLatch().await(500, TimeUnit.MILLISECONDS);
assertEquals("test", bean.getMessage());
}
@Test
public void testHandlerChainEndpoint() throws InterruptedException {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"endpointWithHandlerChainElement.xml", this.getClass());
MessageChannel channel = (MessageChannel) context.getBean("testChannel");
PollableChannel replyChannel = (PollableChannel) context.getBean("replyChannel");
channel.send(new StringMessage("test"));
Message<?> reply = replyChannel.receive(500);
assertNotNull(reply);
assertEquals("test-1-2-3", reply.getPayload());
}
@Test
public void testEndpointWithSelectorAccepts() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(

View File

@@ -1,62 +0,0 @@
/*
* Copyright 2002-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.handler.MessageHandler;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.StringMessage;
/**
* @author Mark Fisher
*/
public class HandlerParserTests {
@Test
public void testTopLevelHandlerAdapter() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"handlerAdapterParserTests.xml", HandlerParserTests.class);
MessageHandler adapter = (MessageHandler) context.getBean("handlerAdapter");
assertNotNull(adapter);
Message<?> reply = adapter.handle(new StringMessage("foo"));
assertNotNull(reply);
assertEquals("bar", reply.getPayload());
}
@Test
public void testHandlerChain() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"handlerChainParserTests.xml", HandlerParserTests.class);
TestBean testBean = (TestBean) context.getBean("testBean");
assertNull(testBean.getMessage());
MessageHandler handlerChain = (MessageHandler) context.getBean("handlerChain");
assertNotNull(handlerChain);
Message<?> reply = handlerChain.handle(new StringMessage("test"));
assertNotNull(reply);
assertEquals(0, testBean.getLatch().getCount());
assertEquals("foo", testBean.getMessage());
assertEquals("bar", reply.getPayload());
}
}

View File

@@ -1,42 +0,0 @@
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
<message-bus/>
<channel id="testChannel">
<queue capacity="5"/>
</channel>
<channel id="replyChannel">
<queue capacity="5"/>
</channel>
<handler-chain id="chain">
<handler ref="handler1"/>
<handler ref="handler2"/>
<handler ref="handler3"/>
</handler-chain>
<service-activator input-channel="testChannel" ref="chain" output-channel="replyChannel">
<poller period="100"/>
</service-activator>
<beans:bean id="handler1" class="org.springframework.integration.config.TestConcatenatingHandler">
<beans:constructor-arg value="-1"/>
</beans:bean>
<beans:bean id="handler2" class="org.springframework.integration.config.TestConcatenatingHandler">
<beans:constructor-arg value="-2"/>
</beans:bean>
<beans:bean id="handler3" class="org.springframework.integration.config.TestConcatenatingHandler">
<beans:constructor-arg value="-3"/>
</beans:bean>
</beans:beans>

View File

@@ -1,24 +0,0 @@
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
<beans:bean id="messageBus" class="org.springframework.integration.bus.DefaultMessageBus"/>
<channel id="testChannel">
<queue capacity="50"/>
</channel>
<service-activator input-channel="testChannel" ref="testBean" method="store">
<poller period="100"/>
</service-activator>
<beans:bean id="testBean" class="org.springframework.integration.config.TestBean">
<beans:constructor-arg value="1"/>
</beans:bean>
</beans:beans>

View File

@@ -1,17 +0,0 @@
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
<handler id="handlerAdapter" ref="testBean" method="store"/>
<beans:bean id="testBean" class="org.springframework.integration.config.TestBean">
<beans:constructor-arg value="1"/>
<beans:property name="replyMessageText" value="bar"/>
</beans:bean>
</beans:beans>

View File

@@ -1,28 +0,0 @@
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
<handler-chain id="handlerChain">
<handler ref="handler1"/>
<handler ref="handler2"/>
<handler ref="testBean" method="store"/>
</handler-chain>
<handler id="handler1" ref="testBean" method="store"/>
<beans:bean id="handler2" class="org.springframework.integration.config.TestHandler">
<beans:constructor-arg value="1"/>
<beans:property name="replyMessageText" value="foo"/>
</beans:bean>
<beans:bean id="testBean" class="org.springframework.integration.config.TestBean">
<beans:constructor-arg value="1"/>
<beans:property name="replyMessageText" value="bar"/>
</beans:bean>
</beans:beans>