Refactored channel adapter parsing to accommodate recent adapter changes.

This commit is contained in:
Mark Fisher
2008-01-02 16:55:56 +00:00
parent acd86b863a
commit 0377856bd1
10 changed files with 105 additions and 12 deletions

View File

@@ -29,11 +29,27 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @author Mark Fisher
*/
public class AdapterBusTests {
public class AdapterTests {
@Test
public void testAdapters() throws IOException, InterruptedException {
AbstractApplicationContext context = new ClassPathXmlApplicationContext("adapterBusTests.xml", this.getClass());
public void testAdaptersWithBeanDefinitions() throws IOException, InterruptedException {
AbstractApplicationContext context = new ClassPathXmlApplicationContext("adapterTests.xml", this.getClass());
TestSink sink = (TestSink) context.getBean("sink");
assertNull(sink.get());
context.start();
String result = null;
int attempts = 0;
while (result == null && attempts++ < 100) {
Thread.sleep(5);
result = sink.get();
}
assertNotNull(result);
context.close();
}
@Test
public void testAdaptersWithNamespace() throws IOException, InterruptedException {
AbstractApplicationContext context = new ClassPathXmlApplicationContext("adapterTestsWithNamespace.xml", this.getClass());
TestSink sink = (TestSink) context.getBean("sink");
assertNull(sink.get());
context.start();

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
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-1.0.xsd">
<si:message-bus/>
<si:channel id="inputChannel"/>
<si:channel id="outputChannel"/>
<si:source-adapter ref="source" method="foo" channel="inputChannel" period="100"/>
<si:target-adapter ref="sink" method="store" channel="outputChannel"/>
<si:endpoint input-channel="inputChannel" default-output-channel="outputChannel"/>
<bean id="source" class="org.springframework.integration.adapter.TestSource"/>
<bean id="sink" class="org.springframework.integration.adapter.TestSink"/>
</beans>