From fdfb537a164c8a948530d19f38cefc958010efba Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Thu, 16 Jul 2009 18:04:40 +0000 Subject: [PATCH] INT-727, INT-728 Refactored parsers so that default beans (errorChannel, nullChannel, and taskScheduler) will always be configured - even when not using the core namespace. Also added support for the 'auto-startup' attribute on several adapters. --- .../config/AbstractRemotingGatewayParser.java | 4 + .../file/config/FileNamespaceHandler.java | 4 +- .../config/spring-integration-file-1.0.xsd | 3 +- .../DefaultConfigurationTests-context.xml | 12 ++ .../config/DefaultConfigurationTests.java | 66 +++++++++++ .../http/config/HttpNamespaceHandler.java | 4 +- .../config/spring-integration-http-1.0.xsd | 2 - .../DefaultConfigurationTests-context.xml | 12 ++ .../config/DefaultConfigurationTests.java | 66 +++++++++++ .../config/HttpInvokerNamespaceHandler.java | 6 +- .../spring-integration-httpinvoker-1.0.xsd | 4 +- .../DefaultConfigurationTests-context.xml | 12 ++ .../config/DefaultConfigurationTests.java | 66 +++++++++++ .../.classpath | 1 + org.springframework.integration.jms/ivy.xml | 1 + .../jms/config/JmsNamespaceHandler.java | 6 +- .../jms/config/spring-integration-jms-1.0.xsd | 9 +- .../DefaultConfigurationTests-context.xml | 20 ++++ .../jms/config/DefaultConfigurationTests.java | 66 +++++++++++ .../mail/config/MailNamespaceHandler.java | 6 +- .../config/spring-integration-mail-1.0.xsd | 6 +- .../DefaultConfigurationTests-context.xml | 20 ++++ .../config/DefaultConfigurationTests.java | 66 +++++++++++ .../rmi/config/RmiNamespaceHandler.java | 6 +- .../rmi/config/spring-integration-rmi-1.0.xsd | 4 +- .../DefaultConfigurationTests-context.xml | 12 ++ .../rmi/config/DefaultConfigurationTests.java | 66 +++++++++++ .../IntegrationSecurityNamespaceHandler.java | 6 +- .../DefaultConfigurationTests-context.xml | 16 +++ .../config/DefaultConfigurationTests.java | 66 +++++++++++ .../config/commonSecurityConfiguration.xml | 2 - .../.classpath | 1 + .../stream/config/StreamNamespaceHandler.java | 6 +- .../config/spring-integration-stream-1.0.xsd | 4 +- .../DefaultConfigurationTests-context.xml | 12 ++ .../config/DefaultConfigurationTests.java | 66 +++++++++++ .../ws/config/WsNamespaceHandler.java | 6 +- .../ws/config/spring-integration-ws-1.0.xsd | 6 +- .../DefaultConfigurationTests-context.xml | 12 ++ .../ws/config/DefaultConfigurationTests.java | 66 +++++++++++ .../IntegrationXmlNamespaceHandler.java | 6 +- .../xml/config/spring-integration-xml-1.0.xsd | 27 ++--- .../DefaultConfigurationTests-context.xml | 12 ++ .../xml/config/DefaultConfigurationTests.java | 66 +++++++++++ .../AbstractIntegrationNamespaceHandler.java | 102 +++++++++++++++++ .../xml/IntegrationNamespaceHandler.java | 106 +++++------------- 46 files changed, 1004 insertions(+), 134 deletions(-) create mode 100644 org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/DefaultConfigurationTests-context.xml create mode 100644 org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/DefaultConfigurationTests.java create mode 100644 org.springframework.integration.http/src/test/java/org/springframework/integration/http/config/DefaultConfigurationTests-context.xml create mode 100644 org.springframework.integration.http/src/test/java/org/springframework/integration/http/config/DefaultConfigurationTests.java create mode 100644 org.springframework.integration.httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/DefaultConfigurationTests-context.xml create mode 100644 org.springframework.integration.httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/DefaultConfigurationTests.java create mode 100644 org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/DefaultConfigurationTests-context.xml create mode 100644 org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/DefaultConfigurationTests.java create mode 100644 org.springframework.integration.mail/src/test/java/org/springframework/integration/mail/config/DefaultConfigurationTests-context.xml create mode 100644 org.springframework.integration.mail/src/test/java/org/springframework/integration/mail/config/DefaultConfigurationTests.java create mode 100644 org.springframework.integration.rmi/src/test/java/org/springframework/integration/rmi/config/DefaultConfigurationTests-context.xml create mode 100644 org.springframework.integration.rmi/src/test/java/org/springframework/integration/rmi/config/DefaultConfigurationTests.java create mode 100644 org.springframework.integration.security/src/test/java/org/springframework/integration/security/config/DefaultConfigurationTests-context.xml create mode 100644 org.springframework.integration.security/src/test/java/org/springframework/integration/security/config/DefaultConfigurationTests.java create mode 100644 org.springframework.integration.stream/src/test/java/org/springframework/integration/stream/config/DefaultConfigurationTests-context.xml create mode 100644 org.springframework.integration.stream/src/test/java/org/springframework/integration/stream/config/DefaultConfigurationTests.java create mode 100644 org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/DefaultConfigurationTests-context.xml create mode 100644 org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/DefaultConfigurationTests.java create mode 100644 org.springframework.integration.xml/src/test/java/org/springframework/integration/xml/config/DefaultConfigurationTests-context.xml create mode 100644 org.springframework.integration.xml/src/test/java/org/springframework/integration/xml/config/DefaultConfigurationTests.java create mode 100644 org.springframework.integration/src/main/java/org/springframework/integration/config/xml/AbstractIntegrationNamespaceHandler.java diff --git a/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/config/AbstractRemotingGatewayParser.java b/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/config/AbstractRemotingGatewayParser.java index 6cb3c4e771..6c8b08f882 100644 --- a/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/config/AbstractRemotingGatewayParser.java +++ b/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/config/AbstractRemotingGatewayParser.java @@ -61,6 +61,10 @@ public abstract class AbstractRemotingGatewayParser extends AbstractSimpleBeanDe if (StringUtils.hasText(replyChannel)) { builder.addPropertyReference("replyChannel", replyChannel); } + String autoStartup = element.getAttribute("auto-startup"); + if (StringUtils.hasText(autoStartup)) { + builder.addPropertyValue("autoStartup", autoStartup); + } this.doPostProcess(builder, element); } diff --git a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileNamespaceHandler.java b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileNamespaceHandler.java index 0055aa57fe..259f948f56 100644 --- a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileNamespaceHandler.java +++ b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileNamespaceHandler.java @@ -16,7 +16,7 @@ package org.springframework.integration.file.config; -import org.springframework.beans.factory.xml.NamespaceHandlerSupport; +import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; /** * Namespace handler for Spring Integration's 'file' namespace. @@ -24,7 +24,7 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport; * @author Iwein Fuld * @author Mark Fisher */ -public class FileNamespaceHandler extends NamespaceHandlerSupport { +public class FileNamespaceHandler extends AbstractIntegrationNamespaceHandler { public void init() { registerBeanDefinitionParser("inbound-channel-adapter", new FileInboundChannelAdapterParser()); diff --git a/org.springframework.integration.file/src/main/resources/org/springframework/integration/file/config/spring-integration-file-1.0.xsd b/org.springframework.integration.file/src/main/resources/org/springframework/integration/file/config/spring-integration-file-1.0.xsd index fef8f4a275..c2c89f3aa6 100644 --- a/org.springframework.integration.file/src/main/resources/org/springframework/integration/file/config/spring-integration-file-1.0.xsd +++ b/org.springframework.integration.file/src/main/resources/org/springframework/integration/file/config/spring-integration-file-1.0.xsd @@ -10,7 +10,8 @@ - + + + + + + diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/DefaultConfigurationTests.java b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/DefaultConfigurationTests.java new file mode 100644 index 0000000000..ab07769c53 --- /dev/null +++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/DefaultConfigurationTests.java @@ -0,0 +1,66 @@ +/* + * 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. + * 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.file.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.channel.NullChannel; +import org.springframework.integration.channel.PublishSubscribeChannel; +import org.springframework.integration.scheduling.SimpleTaskScheduler; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Mark Fisher + * @since 1.0.3 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class DefaultConfigurationTests { + + @Autowired + private ApplicationContext context; + + + @Test + public void verifyErrorChannel() { + Object errorChannel = context.getBean("errorChannel"); + assertNotNull(errorChannel); + assertEquals(PublishSubscribeChannel.class, errorChannel.getClass()); + } + + @Test + public void verifyNullChannel() { + Object nullChannel = context.getBean("nullChannel"); + assertNotNull(nullChannel); + assertEquals(NullChannel.class, nullChannel.getClass()); + } + + @Test + public void verifyTaskScheduler() { + Object taskScheduler = context.getBean("taskScheduler"); + assertNotNull(taskScheduler); + assertEquals(SimpleTaskScheduler.class, taskScheduler.getClass()); + } + +} diff --git a/org.springframework.integration.http/src/main/java/org/springframework/integration/http/config/HttpNamespaceHandler.java b/org.springframework.integration.http/src/main/java/org/springframework/integration/http/config/HttpNamespaceHandler.java index dd15135997..193116e914 100644 --- a/org.springframework.integration.http/src/main/java/org/springframework/integration/http/config/HttpNamespaceHandler.java +++ b/org.springframework.integration.http/src/main/java/org/springframework/integration/http/config/HttpNamespaceHandler.java @@ -16,7 +16,7 @@ package org.springframework.integration.http.config; -import org.springframework.beans.factory.xml.NamespaceHandlerSupport; +import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; /** * Namespace handler for Spring Integration's http namespace. @@ -24,7 +24,7 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport; * @author Mark Fisher * @since 1.0.2 */ -public class HttpNamespaceHandler extends NamespaceHandlerSupport { +public class HttpNamespaceHandler extends AbstractIntegrationNamespaceHandler { public void init() { this.registerBeanDefinitionParser("inbound-channel-adapter", new HttpInboundEndpointParser(false)); diff --git a/org.springframework.integration.http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-1.0.xsd b/org.springframework.integration.http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-1.0.xsd index a83240a525..c2ad1310bf 100644 --- a/org.springframework.integration.http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-1.0.xsd +++ b/org.springframework.integration.http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-1.0.xsd @@ -3,14 +3,12 @@ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:tool="http://www.springframework.org/schema/tool" - xmlns:integration="http://www.springframework.org/schema/integration" targetNamespace="http://www.springframework.org/schema/integration/http" elementFormDefault="qualified" attributeFormDefault="unqualified"> - + + + + + diff --git a/org.springframework.integration.http/src/test/java/org/springframework/integration/http/config/DefaultConfigurationTests.java b/org.springframework.integration.http/src/test/java/org/springframework/integration/http/config/DefaultConfigurationTests.java new file mode 100644 index 0000000000..69f5e81d3d --- /dev/null +++ b/org.springframework.integration.http/src/test/java/org/springframework/integration/http/config/DefaultConfigurationTests.java @@ -0,0 +1,66 @@ +/* + * 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. + * 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.http.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.channel.NullChannel; +import org.springframework.integration.channel.PublishSubscribeChannel; +import org.springframework.integration.scheduling.SimpleTaskScheduler; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Mark Fisher + * @since 1.0.3 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class DefaultConfigurationTests { + + @Autowired + private ApplicationContext context; + + + @Test + public void verifyErrorChannel() { + Object errorChannel = context.getBean("errorChannel"); + assertNotNull(errorChannel); + assertEquals(PublishSubscribeChannel.class, errorChannel.getClass()); + } + + @Test + public void verifyNullChannel() { + Object nullChannel = context.getBean("nullChannel"); + assertNotNull(nullChannel); + assertEquals(NullChannel.class, nullChannel.getClass()); + } + + @Test + public void verifyTaskScheduler() { + Object taskScheduler = context.getBean("taskScheduler"); + assertNotNull(taskScheduler); + assertEquals(SimpleTaskScheduler.class, taskScheduler.getClass()); + } + +} diff --git a/org.springframework.integration.httpinvoker/src/main/java/org/springframework/integration/httpinvoker/config/HttpInvokerNamespaceHandler.java b/org.springframework.integration.httpinvoker/src/main/java/org/springframework/integration/httpinvoker/config/HttpInvokerNamespaceHandler.java index 2490b46671..ac8cbfbebb 100644 --- a/org.springframework.integration.httpinvoker/src/main/java/org/springframework/integration/httpinvoker/config/HttpInvokerNamespaceHandler.java +++ b/org.springframework.integration.httpinvoker/src/main/java/org/springframework/integration/httpinvoker/config/HttpInvokerNamespaceHandler.java @@ -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. @@ -16,14 +16,14 @@ package org.springframework.integration.httpinvoker.config; -import org.springframework.beans.factory.xml.NamespaceHandlerSupport; +import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; /** * Namespace handler for Spring Integration's httpinvoker namespace. * * @author Mark Fisher */ -public class HttpInvokerNamespaceHandler extends NamespaceHandlerSupport { +public class HttpInvokerNamespaceHandler extends AbstractIntegrationNamespaceHandler { public void init() { this.registerBeanDefinitionParser("inbound-gateway", new HttpInvokerInboundGatewayParser()); diff --git a/org.springframework.integration.httpinvoker/src/main/resources/org/springframework/integration/httpinvoker/config/spring-integration-httpinvoker-1.0.xsd b/org.springframework.integration.httpinvoker/src/main/resources/org/springframework/integration/httpinvoker/config/spring-integration-httpinvoker-1.0.xsd index 187dfc7f6e..bc8755bbfc 100644 --- a/org.springframework.integration.httpinvoker/src/main/resources/org/springframework/integration/httpinvoker/config/spring-integration-httpinvoker-1.0.xsd +++ b/org.springframework.integration.httpinvoker/src/main/resources/org/springframework/integration/httpinvoker/config/spring-integration-httpinvoker-1.0.xsd @@ -10,7 +10,8 @@ - + + \ No newline at end of file diff --git a/org.springframework.integration.httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/DefaultConfigurationTests-context.xml b/org.springframework.integration.httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/DefaultConfigurationTests-context.xml new file mode 100644 index 0000000000..9616d95f44 --- /dev/null +++ b/org.springframework.integration.httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/DefaultConfigurationTests-context.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/org.springframework.integration.httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/DefaultConfigurationTests.java b/org.springframework.integration.httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/DefaultConfigurationTests.java new file mode 100644 index 0000000000..37df408aaa --- /dev/null +++ b/org.springframework.integration.httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/DefaultConfigurationTests.java @@ -0,0 +1,66 @@ +/* + * 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. + * 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.httpinvoker.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.channel.NullChannel; +import org.springframework.integration.channel.PublishSubscribeChannel; +import org.springframework.integration.scheduling.SimpleTaskScheduler; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Mark Fisher + * @since 1.0.3 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class DefaultConfigurationTests { + + @Autowired + private ApplicationContext context; + + + @Test + public void verifyErrorChannel() { + Object errorChannel = context.getBean("errorChannel"); + assertNotNull(errorChannel); + assertEquals(PublishSubscribeChannel.class, errorChannel.getClass()); + } + + @Test + public void verifyNullChannel() { + Object nullChannel = context.getBean("nullChannel"); + assertNotNull(nullChannel); + assertEquals(NullChannel.class, nullChannel.getClass()); + } + + @Test + public void verifyTaskScheduler() { + Object taskScheduler = context.getBean("taskScheduler"); + assertNotNull(taskScheduler); + assertEquals(SimpleTaskScheduler.class, taskScheduler.getClass()); + } + +} diff --git a/org.springframework.integration.jms/.classpath b/org.springframework.integration.jms/.classpath index a179784807..20c6fbebf4 100644 --- a/org.springframework.integration.jms/.classpath +++ b/org.springframework.integration.jms/.classpath @@ -11,6 +11,7 @@ + diff --git a/org.springframework.integration.jms/ivy.xml b/org.springframework.integration.jms/ivy.xml index 43656589cd..e2e9b21734 100644 --- a/org.springframework.integration.jms/ivy.xml +++ b/org.springframework.integration.jms/ivy.xml @@ -23,6 +23,7 @@ + diff --git a/org.springframework.integration.jms/src/main/java/org/springframework/integration/jms/config/JmsNamespaceHandler.java b/org.springframework.integration.jms/src/main/java/org/springframework/integration/jms/config/JmsNamespaceHandler.java index 0494ed230c..ddbb7e5a5d 100644 --- a/org.springframework.integration.jms/src/main/java/org/springframework/integration/jms/config/JmsNamespaceHandler.java +++ b/org.springframework.integration.jms/src/main/java/org/springframework/integration/jms/config/JmsNamespaceHandler.java @@ -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. @@ -16,7 +16,7 @@ package org.springframework.integration.jms.config; -import org.springframework.beans.factory.xml.NamespaceHandlerSupport; +import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; import org.springframework.integration.config.xml.SimpleHeaderEnricherParser; import org.springframework.integration.jms.JmsHeaders; @@ -25,7 +25,7 @@ import org.springframework.integration.jms.JmsHeaders; * * @author Mark Fisher */ -public class JmsNamespaceHandler extends NamespaceHandlerSupport { +public class JmsNamespaceHandler extends AbstractIntegrationNamespaceHandler { public void init() { this.registerBeanDefinitionParser("inbound-gateway", new JmsMessageDrivenEndpointParser(true)); diff --git a/org.springframework.integration.jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-1.0.xsd b/org.springframework.integration.jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-1.0.xsd index f1b45b2a86..d332952434 100644 --- a/org.springframework.integration.jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-1.0.xsd +++ b/org.springframework.integration.jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-1.0.xsd @@ -10,7 +10,8 @@ - + - @@ -214,7 +214,6 @@ - @@ -314,6 +313,7 @@ + + @@ -489,7 +490,7 @@ - + \ No newline at end of file diff --git a/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/DefaultConfigurationTests-context.xml b/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/DefaultConfigurationTests-context.xml new file mode 100644 index 0000000000..b601c58c16 --- /dev/null +++ b/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/DefaultConfigurationTests-context.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + diff --git a/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/DefaultConfigurationTests.java b/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/DefaultConfigurationTests.java new file mode 100644 index 0000000000..d58150222c --- /dev/null +++ b/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/DefaultConfigurationTests.java @@ -0,0 +1,66 @@ +/* + * 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. + * 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.jms.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.channel.NullChannel; +import org.springframework.integration.channel.PublishSubscribeChannel; +import org.springframework.integration.scheduling.SimpleTaskScheduler; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Mark Fisher + * @since 1.0.3 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class DefaultConfigurationTests { + + @Autowired + private ApplicationContext context; + + + @Test + public void verifyErrorChannel() { + Object errorChannel = context.getBean("errorChannel"); + assertNotNull(errorChannel); + assertEquals(PublishSubscribeChannel.class, errorChannel.getClass()); + } + + @Test + public void verifyNullChannel() { + Object nullChannel = context.getBean("nullChannel"); + assertNotNull(nullChannel); + assertEquals(NullChannel.class, nullChannel.getClass()); + } + + @Test + public void verifyTaskScheduler() { + Object taskScheduler = context.getBean("taskScheduler"); + assertNotNull(taskScheduler); + assertEquals(SimpleTaskScheduler.class, taskScheduler.getClass()); + } + +} diff --git a/org.springframework.integration.mail/src/main/java/org/springframework/integration/mail/config/MailNamespaceHandler.java b/org.springframework.integration.mail/src/main/java/org/springframework/integration/mail/config/MailNamespaceHandler.java index 68db456faa..1c48c2fd90 100644 --- a/org.springframework.integration.mail/src/main/java/org/springframework/integration/mail/config/MailNamespaceHandler.java +++ b/org.springframework.integration.mail/src/main/java/org/springframework/integration/mail/config/MailNamespaceHandler.java @@ -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. @@ -16,7 +16,7 @@ package org.springframework.integration.mail.config; -import org.springframework.beans.factory.xml.NamespaceHandlerSupport; +import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; import org.springframework.integration.config.xml.SimpleHeaderEnricherParser; import org.springframework.integration.mail.MailHeaders; @@ -25,7 +25,7 @@ import org.springframework.integration.mail.MailHeaders; * * @author Mark Fisher */ -public class MailNamespaceHandler extends NamespaceHandlerSupport { +public class MailNamespaceHandler extends AbstractIntegrationNamespaceHandler { public void init() { this.registerBeanDefinitionParser("outbound-channel-adapter", new MailOutboundChannelAdapterParser()); diff --git a/org.springframework.integration.mail/src/main/resources/org/springframework/integration/mail/config/spring-integration-mail-1.0.xsd b/org.springframework.integration.mail/src/main/resources/org/springframework/integration/mail/config/spring-integration-mail-1.0.xsd index 50a09e1947..1047a39d44 100644 --- a/org.springframework.integration.mail/src/main/resources/org/springframework/integration/mail/config/spring-integration-mail-1.0.xsd +++ b/org.springframework.integration.mail/src/main/resources/org/springframework/integration/mail/config/spring-integration-mail-1.0.xsd @@ -10,7 +10,8 @@ - + + @@ -137,7 +139,7 @@ ]]> - + diff --git a/org.springframework.integration.mail/src/test/java/org/springframework/integration/mail/config/DefaultConfigurationTests-context.xml b/org.springframework.integration.mail/src/test/java/org/springframework/integration/mail/config/DefaultConfigurationTests-context.xml new file mode 100644 index 0000000000..984240444a --- /dev/null +++ b/org.springframework.integration.mail/src/test/java/org/springframework/integration/mail/config/DefaultConfigurationTests-context.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + diff --git a/org.springframework.integration.mail/src/test/java/org/springframework/integration/mail/config/DefaultConfigurationTests.java b/org.springframework.integration.mail/src/test/java/org/springframework/integration/mail/config/DefaultConfigurationTests.java new file mode 100644 index 0000000000..ea6e9cf723 --- /dev/null +++ b/org.springframework.integration.mail/src/test/java/org/springframework/integration/mail/config/DefaultConfigurationTests.java @@ -0,0 +1,66 @@ +/* + * 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. + * 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.mail.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.channel.NullChannel; +import org.springframework.integration.channel.PublishSubscribeChannel; +import org.springframework.integration.scheduling.SimpleTaskScheduler; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Mark Fisher + * @since 1.0.3 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class DefaultConfigurationTests { + + @Autowired + private ApplicationContext context; + + + @Test + public void verifyErrorChannel() { + Object errorChannel = context.getBean("errorChannel"); + assertNotNull(errorChannel); + assertEquals(PublishSubscribeChannel.class, errorChannel.getClass()); + } + + @Test + public void verifyNullChannel() { + Object nullChannel = context.getBean("nullChannel"); + assertNotNull(nullChannel); + assertEquals(NullChannel.class, nullChannel.getClass()); + } + + @Test + public void verifyTaskScheduler() { + Object taskScheduler = context.getBean("taskScheduler"); + assertNotNull(taskScheduler); + assertEquals(SimpleTaskScheduler.class, taskScheduler.getClass()); + } + +} diff --git a/org.springframework.integration.rmi/src/main/java/org/springframework/integration/rmi/config/RmiNamespaceHandler.java b/org.springframework.integration.rmi/src/main/java/org/springframework/integration/rmi/config/RmiNamespaceHandler.java index 7f5046ca1d..dcf7a2e793 100644 --- a/org.springframework.integration.rmi/src/main/java/org/springframework/integration/rmi/config/RmiNamespaceHandler.java +++ b/org.springframework.integration.rmi/src/main/java/org/springframework/integration/rmi/config/RmiNamespaceHandler.java @@ -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. @@ -16,14 +16,14 @@ package org.springframework.integration.rmi.config; -import org.springframework.beans.factory.xml.NamespaceHandlerSupport; +import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; /** * Namespace handler for Spring Integration's rmi namespace. * * @author Mark Fisher */ -public class RmiNamespaceHandler extends NamespaceHandlerSupport { +public class RmiNamespaceHandler extends AbstractIntegrationNamespaceHandler { public void init() { this.registerBeanDefinitionParser("inbound-gateway", new RmiInboundGatewayParser()); diff --git a/org.springframework.integration.rmi/src/main/resources/org/springframework/integration/rmi/config/spring-integration-rmi-1.0.xsd b/org.springframework.integration.rmi/src/main/resources/org/springframework/integration/rmi/config/spring-integration-rmi-1.0.xsd index ccc4544d5b..a72dd2615f 100644 --- a/org.springframework.integration.rmi/src/main/resources/org/springframework/integration/rmi/config/spring-integration-rmi-1.0.xsd +++ b/org.springframework.integration.rmi/src/main/resources/org/springframework/integration/rmi/config/spring-integration-rmi-1.0.xsd @@ -10,7 +10,8 @@ - + + \ No newline at end of file diff --git a/org.springframework.integration.rmi/src/test/java/org/springframework/integration/rmi/config/DefaultConfigurationTests-context.xml b/org.springframework.integration.rmi/src/test/java/org/springframework/integration/rmi/config/DefaultConfigurationTests-context.xml new file mode 100644 index 0000000000..e611ac5a77 --- /dev/null +++ b/org.springframework.integration.rmi/src/test/java/org/springframework/integration/rmi/config/DefaultConfigurationTests-context.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/org.springframework.integration.rmi/src/test/java/org/springframework/integration/rmi/config/DefaultConfigurationTests.java b/org.springframework.integration.rmi/src/test/java/org/springframework/integration/rmi/config/DefaultConfigurationTests.java new file mode 100644 index 0000000000..41feea3c19 --- /dev/null +++ b/org.springframework.integration.rmi/src/test/java/org/springframework/integration/rmi/config/DefaultConfigurationTests.java @@ -0,0 +1,66 @@ +/* + * 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. + * 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.rmi.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.channel.NullChannel; +import org.springframework.integration.channel.PublishSubscribeChannel; +import org.springframework.integration.scheduling.SimpleTaskScheduler; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Mark Fisher + * @since 1.0.3 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class DefaultConfigurationTests { + + @Autowired + private ApplicationContext context; + + + @Test + public void verifyErrorChannel() { + Object errorChannel = context.getBean("errorChannel"); + assertNotNull(errorChannel); + assertEquals(PublishSubscribeChannel.class, errorChannel.getClass()); + } + + @Test + public void verifyNullChannel() { + Object nullChannel = context.getBean("nullChannel"); + assertNotNull(nullChannel); + assertEquals(NullChannel.class, nullChannel.getClass()); + } + + @Test + public void verifyTaskScheduler() { + Object taskScheduler = context.getBean("taskScheduler"); + assertNotNull(taskScheduler); + assertEquals(SimpleTaskScheduler.class, taskScheduler.getClass()); + } + +} diff --git a/org.springframework.integration.security/src/main/java/org/springframework/integration/security/config/IntegrationSecurityNamespaceHandler.java b/org.springframework.integration.security/src/main/java/org/springframework/integration/security/config/IntegrationSecurityNamespaceHandler.java index 1bada9ab22..d68671bf0e 100644 --- a/org.springframework.integration.security/src/main/java/org/springframework/integration/security/config/IntegrationSecurityNamespaceHandler.java +++ b/org.springframework.integration.security/src/main/java/org/springframework/integration/security/config/IntegrationSecurityNamespaceHandler.java @@ -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. @@ -16,14 +16,14 @@ package org.springframework.integration.security.config; -import org.springframework.beans.factory.xml.NamespaceHandlerSupport; +import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; /** * Namespace handler for the security namespace. * * @author Jonas Partner */ -public class IntegrationSecurityNamespaceHandler extends NamespaceHandlerSupport { +public class IntegrationSecurityNamespaceHandler extends AbstractIntegrationNamespaceHandler { public void init() { registerBeanDefinitionParser("secured-channels", new SecuredChannelsParser()); diff --git a/org.springframework.integration.security/src/test/java/org/springframework/integration/security/config/DefaultConfigurationTests-context.xml b/org.springframework.integration.security/src/test/java/org/springframework/integration/security/config/DefaultConfigurationTests-context.xml new file mode 100644 index 0000000000..955f077379 --- /dev/null +++ b/org.springframework.integration.security/src/test/java/org/springframework/integration/security/config/DefaultConfigurationTests-context.xml @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/org.springframework.integration.security/src/test/java/org/springframework/integration/security/config/DefaultConfigurationTests.java b/org.springframework.integration.security/src/test/java/org/springframework/integration/security/config/DefaultConfigurationTests.java new file mode 100644 index 0000000000..7cb4e1cee2 --- /dev/null +++ b/org.springframework.integration.security/src/test/java/org/springframework/integration/security/config/DefaultConfigurationTests.java @@ -0,0 +1,66 @@ +/* + * 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. + * 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.security.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.channel.NullChannel; +import org.springframework.integration.channel.PublishSubscribeChannel; +import org.springframework.integration.scheduling.SimpleTaskScheduler; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Mark Fisher + * @since 1.0.3 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class DefaultConfigurationTests { + + @Autowired + private ApplicationContext context; + + + @Test + public void verifyErrorChannel() { + Object errorChannel = context.getBean("errorChannel"); + assertNotNull(errorChannel); + assertEquals(PublishSubscribeChannel.class, errorChannel.getClass()); + } + + @Test + public void verifyNullChannel() { + Object nullChannel = context.getBean("nullChannel"); + assertNotNull(nullChannel); + assertEquals(NullChannel.class, nullChannel.getClass()); + } + + @Test + public void verifyTaskScheduler() { + Object taskScheduler = context.getBean("taskScheduler"); + assertNotNull(taskScheduler); + assertEquals(SimpleTaskScheduler.class, taskScheduler.getClass()); + } + +} diff --git a/org.springframework.integration.security/src/test/java/org/springframework/integration/security/config/commonSecurityConfiguration.xml b/org.springframework.integration.security/src/test/java/org/springframework/integration/security/config/commonSecurityConfiguration.xml index 571099b921..1202877a2e 100644 --- a/org.springframework.integration.security/src/test/java/org/springframework/integration/security/config/commonSecurityConfiguration.xml +++ b/org.springframework.integration.security/src/test/java/org/springframework/integration/security/config/commonSecurityConfiguration.xml @@ -8,8 +8,6 @@ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd - http://www.springframework.org/schema/integration - http://www.springframework.org/schema/integration/spring-integration-1.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> diff --git a/org.springframework.integration.stream/.classpath b/org.springframework.integration.stream/.classpath index bc5775b3b9..86c1d69f1c 100644 --- a/org.springframework.integration.stream/.classpath +++ b/org.springframework.integration.stream/.classpath @@ -9,6 +9,7 @@ + diff --git a/org.springframework.integration.stream/src/main/java/org/springframework/integration/stream/config/StreamNamespaceHandler.java b/org.springframework.integration.stream/src/main/java/org/springframework/integration/stream/config/StreamNamespaceHandler.java index a2aa7a0d8c..1adbcacdd3 100644 --- a/org.springframework.integration.stream/src/main/java/org/springframework/integration/stream/config/StreamNamespaceHandler.java +++ b/org.springframework.integration.stream/src/main/java/org/springframework/integration/stream/config/StreamNamespaceHandler.java @@ -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. @@ -16,12 +16,12 @@ package org.springframework.integration.stream.config; -import org.springframework.beans.factory.xml.NamespaceHandlerSupport; +import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; /** * @author Mark Fisher */ -public class StreamNamespaceHandler extends NamespaceHandlerSupport { +public class StreamNamespaceHandler extends AbstractIntegrationNamespaceHandler { public void init() { this.registerBeanDefinitionParser("stdin-channel-adapter", new ConsoleInboundChannelAdapterParser()); diff --git a/org.springframework.integration.stream/src/main/resources/org/springframework/integration/stream/config/spring-integration-stream-1.0.xsd b/org.springframework.integration.stream/src/main/resources/org/springframework/integration/stream/config/spring-integration-stream-1.0.xsd index b14225c3a3..0fbda8a059 100644 --- a/org.springframework.integration.stream/src/main/resources/org/springframework/integration/stream/config/spring-integration-stream-1.0.xsd +++ b/org.springframework.integration.stream/src/main/resources/org/springframework/integration/stream/config/spring-integration-stream-1.0.xsd @@ -10,7 +10,8 @@ - + + diff --git a/org.springframework.integration.stream/src/test/java/org/springframework/integration/stream/config/DefaultConfigurationTests-context.xml b/org.springframework.integration.stream/src/test/java/org/springframework/integration/stream/config/DefaultConfigurationTests-context.xml new file mode 100644 index 0000000000..8deca7afa1 --- /dev/null +++ b/org.springframework.integration.stream/src/test/java/org/springframework/integration/stream/config/DefaultConfigurationTests-context.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/org.springframework.integration.stream/src/test/java/org/springframework/integration/stream/config/DefaultConfigurationTests.java b/org.springframework.integration.stream/src/test/java/org/springframework/integration/stream/config/DefaultConfigurationTests.java new file mode 100644 index 0000000000..59f90ff159 --- /dev/null +++ b/org.springframework.integration.stream/src/test/java/org/springframework/integration/stream/config/DefaultConfigurationTests.java @@ -0,0 +1,66 @@ +/* + * 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. + * 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.stream.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.channel.NullChannel; +import org.springframework.integration.channel.PublishSubscribeChannel; +import org.springframework.integration.scheduling.SimpleTaskScheduler; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Mark Fisher + * @since 1.0.3 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class DefaultConfigurationTests { + + @Autowired + private ApplicationContext context; + + + @Test + public void verifyErrorChannel() { + Object errorChannel = context.getBean("errorChannel"); + assertNotNull(errorChannel); + assertEquals(PublishSubscribeChannel.class, errorChannel.getClass()); + } + + @Test + public void verifyNullChannel() { + Object nullChannel = context.getBean("nullChannel"); + assertNotNull(nullChannel); + assertEquals(NullChannel.class, nullChannel.getClass()); + } + + @Test + public void verifyTaskScheduler() { + Object taskScheduler = context.getBean("taskScheduler"); + assertNotNull(taskScheduler); + assertEquals(SimpleTaskScheduler.class, taskScheduler.getClass()); + } + +} diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WsNamespaceHandler.java b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WsNamespaceHandler.java index e4bf219c29..2d2b2cc0a0 100644 --- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WsNamespaceHandler.java +++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WsNamespaceHandler.java @@ -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. @@ -16,13 +16,13 @@ package org.springframework.integration.ws.config; -import org.springframework.beans.factory.xml.NamespaceHandlerSupport; +import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; /** * @author Mark Fisher * @author Iwein Fuld */ -public class WsNamespaceHandler extends NamespaceHandlerSupport { +public class WsNamespaceHandler extends AbstractIntegrationNamespaceHandler { public void init() { this.registerBeanDefinitionParser("outbound-gateway", new WebServiceOutboundGatewayParser()); diff --git a/org.springframework.integration.ws/src/main/resources/org/springframework/integration/ws/config/spring-integration-ws-1.0.xsd b/org.springframework.integration.ws/src/main/resources/org/springframework/integration/ws/config/spring-integration-ws-1.0.xsd index 17bf6b3b71..7a0469f903 100644 --- a/org.springframework.integration.ws/src/main/resources/org/springframework/integration/ws/config/spring-integration-ws-1.0.xsd +++ b/org.springframework.integration.ws/src/main/resources/org/springframework/integration/ws/config/spring-integration-ws-1.0.xsd @@ -10,7 +10,8 @@ - + - + @@ -221,4 +222,5 @@ + \ No newline at end of file diff --git a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/DefaultConfigurationTests-context.xml b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/DefaultConfigurationTests-context.xml new file mode 100644 index 0000000000..8e9ff73957 --- /dev/null +++ b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/DefaultConfigurationTests-context.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/DefaultConfigurationTests.java b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/DefaultConfigurationTests.java new file mode 100644 index 0000000000..785efaa871 --- /dev/null +++ b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/DefaultConfigurationTests.java @@ -0,0 +1,66 @@ +/* + * 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. + * 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.ws.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.channel.NullChannel; +import org.springframework.integration.channel.PublishSubscribeChannel; +import org.springframework.integration.scheduling.SimpleTaskScheduler; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Mark Fisher + * @since 1.0.3 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class DefaultConfigurationTests { + + @Autowired + private ApplicationContext context; + + + @Test + public void verifyErrorChannel() { + Object errorChannel = context.getBean("errorChannel"); + assertNotNull(errorChannel); + assertEquals(PublishSubscribeChannel.class, errorChannel.getClass()); + } + + @Test + public void verifyNullChannel() { + Object nullChannel = context.getBean("nullChannel"); + assertNotNull(nullChannel); + assertEquals(NullChannel.class, nullChannel.getClass()); + } + + @Test + public void verifyTaskScheduler() { + Object taskScheduler = context.getBean("taskScheduler"); + assertNotNull(taskScheduler); + assertEquals(SimpleTaskScheduler.class, taskScheduler.getClass()); + } + +} diff --git a/org.springframework.integration.xml/src/main/java/org/springframework/integration/xml/config/IntegrationXmlNamespaceHandler.java b/org.springframework.integration.xml/src/main/java/org/springframework/integration/xml/config/IntegrationXmlNamespaceHandler.java index 7157e9228e..3c41964d22 100644 --- a/org.springframework.integration.xml/src/main/java/org/springframework/integration/xml/config/IntegrationXmlNamespaceHandler.java +++ b/org.springframework.integration.xml/src/main/java/org/springframework/integration/xml/config/IntegrationXmlNamespaceHandler.java @@ -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. @@ -16,12 +16,12 @@ package org.springframework.integration.xml.config; -import org.springframework.beans.factory.xml.NamespaceHandlerSupport; +import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; /** * @author Jonas Partner */ -public class IntegrationXmlNamespaceHandler extends NamespaceHandlerSupport { +public class IntegrationXmlNamespaceHandler extends AbstractIntegrationNamespaceHandler { public void init() { registerBeanDefinitionParser("marshalling-transformer", new XmlMarshallingTransformerParser()); diff --git a/org.springframework.integration.xml/src/main/resources/org/springframework/integration/xml/config/spring-integration-xml-1.0.xsd b/org.springframework.integration.xml/src/main/resources/org/springframework/integration/xml/config/spring-integration-xml-1.0.xsd index 5f05a58394..9be36154a7 100644 --- a/org.springframework.integration.xml/src/main/resources/org/springframework/integration/xml/config/spring-integration-xml-1.0.xsd +++ b/org.springframework.integration.xml/src/main/resources/org/springframework/integration/xml/config/spring-integration-xml-1.0.xsd @@ -3,13 +3,14 @@ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:tool="http://www.springframework.org/schema/tool" - xmlns:si-core="http://www.springframework.org/schema/integration" + xmlns:integration="http://www.springframework.org/schema/integration" targetNamespace="http://www.springframework.org/schema/integration/xml" elementFormDefault="qualified" attributeFormDefault="unqualified"> - + @@ -157,7 +158,7 @@ - + @@ -292,11 +293,11 @@ - Defines an validating router. + Defines a validating router. - + @@ -321,19 +322,19 @@ - - - - - - - + + + + + + + - + diff --git a/org.springframework.integration.xml/src/test/java/org/springframework/integration/xml/config/DefaultConfigurationTests-context.xml b/org.springframework.integration.xml/src/test/java/org/springframework/integration/xml/config/DefaultConfigurationTests-context.xml new file mode 100644 index 0000000000..438be61a53 --- /dev/null +++ b/org.springframework.integration.xml/src/test/java/org/springframework/integration/xml/config/DefaultConfigurationTests-context.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/org.springframework.integration.xml/src/test/java/org/springframework/integration/xml/config/DefaultConfigurationTests.java b/org.springframework.integration.xml/src/test/java/org/springframework/integration/xml/config/DefaultConfigurationTests.java new file mode 100644 index 0000000000..ebf2b4f6dd --- /dev/null +++ b/org.springframework.integration.xml/src/test/java/org/springframework/integration/xml/config/DefaultConfigurationTests.java @@ -0,0 +1,66 @@ +/* + * 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. + * 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.xml.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.channel.NullChannel; +import org.springframework.integration.channel.PublishSubscribeChannel; +import org.springframework.integration.scheduling.SimpleTaskScheduler; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Mark Fisher + * @since 1.0.3 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class DefaultConfigurationTests { + + @Autowired + private ApplicationContext context; + + + @Test + public void verifyErrorChannel() { + Object errorChannel = context.getBean("errorChannel"); + assertNotNull(errorChannel); + assertEquals(PublishSubscribeChannel.class, errorChannel.getClass()); + } + + @Test + public void verifyNullChannel() { + Object nullChannel = context.getBean("nullChannel"); + assertNotNull(nullChannel); + assertEquals(NullChannel.class, nullChannel.getClass()); + } + + @Test + public void verifyTaskScheduler() { + Object taskScheduler = context.getBean("taskScheduler"); + assertNotNull(taskScheduler); + assertEquals(SimpleTaskScheduler.class, taskScheduler.getClass()); + } + +} diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/AbstractIntegrationNamespaceHandler.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/AbstractIntegrationNamespaceHandler.java new file mode 100644 index 0000000000..c40d90d881 --- /dev/null +++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/AbstractIntegrationNamespaceHandler.java @@ -0,0 +1,102 @@ +/* + * 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. + * 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.xml; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.config.BeanDefinitionHolder; +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.support.BeanDefinitionReaderUtils; +import org.springframework.beans.factory.xml.BeanDefinitionDecorator; +import org.springframework.beans.factory.xml.BeanDefinitionParser; +import org.springframework.beans.factory.xml.NamespaceHandler; +import org.springframework.beans.factory.xml.NamespaceHandlerSupport; +import org.springframework.beans.factory.xml.ParserContext; + +/** + * Base class for NamespaceHandlers that registers a BeanFactoryPostProcessor + * for configuring default bean definitions. + * + * @author Mark Fisher + */ +public abstract class AbstractIntegrationNamespaceHandler implements NamespaceHandler { + + private static final String DEFAULT_CONFIGURING_POSTPROCESSOR_SIMPLE_CLASS_NAME = + "DefaultConfiguringBeanFactoryPostProcessor"; + + private static final String DEFAULT_CONFIGURING_POSTPROCESSOR_BEAN_NAME = + IntegrationNamespaceUtils.BASE_PACKAGE + ".internal" + DEFAULT_CONFIGURING_POSTPROCESSOR_SIMPLE_CLASS_NAME; + + + private final NamespaceHandlerDelegate delegate = new NamespaceHandlerDelegate(); + + + public final BeanDefinition parse(Element element, ParserContext parserContext) { + this.registerDefaultConfiguringBeanFactoryPostProcessorIfNecessary(parserContext); + return this.delegate.parse(element, parserContext); + } + + public final BeanDefinitionHolder decorate(Node source, BeanDefinitionHolder definition, ParserContext parserContext) { + return this.delegate.decorate(source, definition, parserContext); + } + + private void registerDefaultConfiguringBeanFactoryPostProcessorIfNecessary(ParserContext parserContext) { + if (!parserContext.getRegistry().isBeanNameInUse(DEFAULT_CONFIGURING_POSTPROCESSOR_BEAN_NAME)) { + BeanDefinitionBuilder postProcessorBuilder = BeanDefinitionBuilder.genericBeanDefinition( + IntegrationNamespaceUtils.BASE_PACKAGE + ".config.xml." + DEFAULT_CONFIGURING_POSTPROCESSOR_SIMPLE_CLASS_NAME); + BeanDefinitionHolder postProcessorHolder = new BeanDefinitionHolder( + postProcessorBuilder.getBeanDefinition(), DEFAULT_CONFIGURING_POSTPROCESSOR_BEAN_NAME); + BeanDefinitionReaderUtils.registerBeanDefinition(postProcessorHolder, parserContext.getRegistry()); + } + } + + protected final void registerBeanDefinitionDecorator(String elementName, BeanDefinitionDecorator decorator) { + this.delegate.doRegisterBeanDefinitionDecorator(elementName, decorator); + } + + protected final void registerBeanDefinitionDecoratorForAttribute(String attributeName, BeanDefinitionDecorator decorator) { + this.delegate.doRegisterBeanDefinitionDecoratorForAttribute(attributeName, decorator); + } + + protected final void registerBeanDefinitionParser(String elementName, BeanDefinitionParser parser) { + this.delegate.doRegisterBeanDefinitionParser(elementName, parser); + } + + + private class NamespaceHandlerDelegate extends NamespaceHandlerSupport { + + public void init() { + AbstractIntegrationNamespaceHandler.this.init(); + } + + private void doRegisterBeanDefinitionDecorator(String elementName, BeanDefinitionDecorator decorator) { + super.registerBeanDefinitionDecorator(elementName, decorator); + } + + private void doRegisterBeanDefinitionDecoratorForAttribute(String attributeName, BeanDefinitionDecorator decorator) { + super.registerBeanDefinitionDecoratorForAttribute(attributeName, decorator); + } + + private void doRegisterBeanDefinitionParser(String elementName, BeanDefinitionParser parser) { + super.registerBeanDefinitionParser(elementName, parser); + } + + } + +} diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceHandler.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceHandler.java index edff86dd19..5b30f1bf1e 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceHandler.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceHandler.java @@ -16,17 +16,6 @@ package org.springframework.integration.config.xml; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.BeanDefinitionHolder; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.support.BeanDefinitionReaderUtils; -import org.springframework.beans.factory.xml.NamespaceHandler; -import org.springframework.beans.factory.xml.NamespaceHandlerSupport; -import org.springframework.beans.factory.xml.ParserContext; - /** * Namespace handler for the integration namespace. * @@ -34,74 +23,37 @@ import org.springframework.beans.factory.xml.ParserContext; * @author Marius Bogoevici * @author Oleg Zhurakousky */ -public class IntegrationNamespaceHandler implements NamespaceHandler { - - private static final String DEFAULT_CONFIGURING_POSTPROCESSOR_SIMPLE_CLASS_NAME = - "DefaultConfiguringBeanFactoryPostProcessor"; - - private static final String DEFAULT_CONFIGURING_POSTPROCESSOR_BEAN_NAME = - IntegrationNamespaceUtils.BASE_PACKAGE + ".internal" + DEFAULT_CONFIGURING_POSTPROCESSOR_SIMPLE_CLASS_NAME; - - - private final NamespaceHandlerSupport delegate = new NamespaceHandlerDelegate(); - +public class IntegrationNamespaceHandler extends AbstractIntegrationNamespaceHandler { public void init() { - this.delegate.init(); - } - - public BeanDefinition parse(Element element, ParserContext parserContext) { - this.registerDefaultConfiguringBeanFactoryPostProcessorIfNecessary(parserContext); - return this.delegate.parse(element, parserContext); - } - - public BeanDefinitionHolder decorate(Node source, BeanDefinitionHolder definition, ParserContext parserContext) { - return this.delegate.decorate(source, definition, parserContext); - } - - private void registerDefaultConfiguringBeanFactoryPostProcessorIfNecessary(ParserContext parserContext) { - if (!parserContext.getRegistry().isBeanNameInUse(DEFAULT_CONFIGURING_POSTPROCESSOR_BEAN_NAME)) { - BeanDefinitionBuilder postProcessorBuilder = BeanDefinitionBuilder.genericBeanDefinition( - IntegrationNamespaceUtils.BASE_PACKAGE + ".config.xml." + DEFAULT_CONFIGURING_POSTPROCESSOR_SIMPLE_CLASS_NAME); - BeanDefinitionHolder postProcessorHolder = new BeanDefinitionHolder( - postProcessorBuilder.getBeanDefinition(), DEFAULT_CONFIGURING_POSTPROCESSOR_BEAN_NAME); - BeanDefinitionReaderUtils.registerBeanDefinition(postProcessorHolder, parserContext.getRegistry()); - } - } - - - private static class NamespaceHandlerDelegate extends NamespaceHandlerSupport { - - public void init() { - registerBeanDefinitionParser("channel", new PointToPointChannelParser()); - registerBeanDefinitionParser("thread-local-channel", new ThreadLocalChannelParser()); - registerBeanDefinitionParser("publish-subscribe-channel", new PublishSubscribeChannelParser()); - registerBeanDefinitionParser("service-activator", new ServiceActivatorParser()); - registerBeanDefinitionParser("transformer", new TransformerParser()); - registerBeanDefinitionParser("filter", new FilterParser()); - registerBeanDefinitionParser("router", new DefaultRouterParser()); - registerBeanDefinitionParser("header-value-router", new HeaderValueRouterParser()); - registerBeanDefinitionParser("payload-type-router", new PayloadTypeRouterParser()); - registerBeanDefinitionParser("recipient-list-router", new RecipientListRouterParser()); - registerBeanDefinitionParser("splitter", new SplitterParser()); - registerBeanDefinitionParser("aggregator", new AggregatorParser()); - registerBeanDefinitionParser("resequencer", new ResequencerParser()); - registerBeanDefinitionParser("header-enricher", new StandardHeaderEnricherParser()); - registerBeanDefinitionParser("object-to-string-transformer", new ObjectToStringTransformerParser()); - registerBeanDefinitionParser("payload-serializing-transformer", new PayloadSerializingTransformerParser()); - registerBeanDefinitionParser("payload-deserializing-transformer", new PayloadDeserializingTransformerParser()); - registerBeanDefinitionParser("inbound-channel-adapter", new MethodInvokingInboundChannelAdapterParser()); - registerBeanDefinitionParser("outbound-channel-adapter", new MethodInvokingOutboundChannelAdapterParser()); - registerBeanDefinitionParser("logging-channel-adapter", new LoggingChannelAdapterParser()); - registerBeanDefinitionParser("gateway", new GatewayParser()); - registerBeanDefinitionParser("bridge", new BridgeParser()); - registerBeanDefinitionParser("chain", new ChainParser()); - registerBeanDefinitionParser("selector-chain", new SelectorChainParser()); - registerBeanDefinitionParser("poller", new PollerParser()); - registerBeanDefinitionParser("annotation-config", new AnnotationConfigParser()); - registerBeanDefinitionParser("application-event-multicaster", new ApplicationEventMulticasterParser()); - registerBeanDefinitionParser("thread-pool-task-executor", new ThreadPoolTaskExecutorParser()); - } + registerBeanDefinitionParser("channel", new PointToPointChannelParser()); + registerBeanDefinitionParser("thread-local-channel", new ThreadLocalChannelParser()); + registerBeanDefinitionParser("publish-subscribe-channel", new PublishSubscribeChannelParser()); + registerBeanDefinitionParser("service-activator", new ServiceActivatorParser()); + registerBeanDefinitionParser("transformer", new TransformerParser()); + registerBeanDefinitionParser("filter", new FilterParser()); + registerBeanDefinitionParser("router", new DefaultRouterParser()); + registerBeanDefinitionParser("header-value-router", new HeaderValueRouterParser()); + registerBeanDefinitionParser("payload-type-router", new PayloadTypeRouterParser()); + registerBeanDefinitionParser("recipient-list-router", new RecipientListRouterParser()); + registerBeanDefinitionParser("splitter", new SplitterParser()); + registerBeanDefinitionParser("aggregator", new AggregatorParser()); + registerBeanDefinitionParser("resequencer", new ResequencerParser()); + registerBeanDefinitionParser("header-enricher", new StandardHeaderEnricherParser()); + registerBeanDefinitionParser("object-to-string-transformer", new ObjectToStringTransformerParser()); + registerBeanDefinitionParser("payload-serializing-transformer", new PayloadSerializingTransformerParser()); + registerBeanDefinitionParser("payload-deserializing-transformer", new PayloadDeserializingTransformerParser()); + registerBeanDefinitionParser("inbound-channel-adapter", new MethodInvokingInboundChannelAdapterParser()); + registerBeanDefinitionParser("outbound-channel-adapter", new MethodInvokingOutboundChannelAdapterParser()); + registerBeanDefinitionParser("logging-channel-adapter", new LoggingChannelAdapterParser()); + registerBeanDefinitionParser("gateway", new GatewayParser()); + registerBeanDefinitionParser("bridge", new BridgeParser()); + registerBeanDefinitionParser("chain", new ChainParser()); + registerBeanDefinitionParser("selector-chain", new SelectorChainParser()); + registerBeanDefinitionParser("poller", new PollerParser()); + registerBeanDefinitionParser("annotation-config", new AnnotationConfigParser()); + registerBeanDefinitionParser("application-event-multicaster", new ApplicationEventMulticasterParser()); + registerBeanDefinitionParser("thread-pool-task-executor", new ThreadPoolTaskExecutorParser()); } }