diff --git a/core/src/test/java/org/springframework/ws/config/DummyInterceptor.java b/core/src/test/java/org/springframework/ws/config/DummyInterceptor.java new file mode 100644 index 00000000..4ced0386 --- /dev/null +++ b/core/src/test/java/org/springframework/ws/config/DummyInterceptor.java @@ -0,0 +1,60 @@ +/* + * Copyright 2005-2013 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.ws.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.ws.context.MessageContext; +import org.springframework.ws.server.EndpointInterceptor; + +public class DummyInterceptor implements EndpointInterceptor { + + @Autowired + private DummyInterceptorDependency autowiredDependency; + + private DummyInterceptorDependency propertyDependency; + + public void setPropertyDependency(DummyInterceptorDependency propertyDependency) { + this.propertyDependency = propertyDependency; + } + + public DummyInterceptorDependency getPropertyDependency() { + return propertyDependency; + } + + public DummyInterceptorDependency getAutowiredDependency() { + return autowiredDependency; + } + + public boolean handleRequest(MessageContext messageContext, Object endpoint) + throws Exception { + return true; + } + + public boolean handleResponse(MessageContext messageContext, Object endpoint) + throws Exception { + return true; + } + + public boolean handleFault(MessageContext messageContext, Object endpoint) + throws Exception { + return true; + } + + public void afterCompletion(MessageContext messageContext, Object endpoint, + Exception ex) throws Exception { + } +} diff --git a/core/src/test/java/org/springframework/ws/config/DummyInterceptorDependency.java b/core/src/test/java/org/springframework/ws/config/DummyInterceptorDependency.java new file mode 100644 index 00000000..37940c4b --- /dev/null +++ b/core/src/test/java/org/springframework/ws/config/DummyInterceptorDependency.java @@ -0,0 +1,21 @@ +/* + * Copyright 2002-2013 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.ws.config; + +public class DummyInterceptorDependency { + +} diff --git a/core/src/test/java/org/springframework/ws/config/InterceptorsBeanDefinitionParserTest.java b/core/src/test/java/org/springframework/ws/config/InterceptorsBeanDefinitionParserTest.java index 1d81896f..d054f049 100644 --- a/core/src/test/java/org/springframework/ws/config/InterceptorsBeanDefinitionParserTest.java +++ b/core/src/test/java/org/springframework/ws/config/InterceptorsBeanDefinitionParserTest.java @@ -20,16 +20,16 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import org.junit.Test; + import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ws.server.endpoint.interceptor.DelegatingSmartEndpointInterceptor; import org.springframework.ws.soap.server.endpoint.interceptor.PayloadRootSmartSoapEndpointInterceptor; import org.springframework.ws.soap.server.endpoint.interceptor.SoapActionSmartEndpointInterceptor; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - public class InterceptorsBeanDefinitionParserTest { @Test @@ -62,4 +62,19 @@ public class InterceptorsBeanDefinitionParserTest { } } + @Test + public void injection() throws Exception { + ApplicationContext applicationContext = + new ClassPathXmlApplicationContext("interceptorsBeanDefinitionParserInjectionTest.xml", getClass()); + + List interceptors = new ArrayList( + applicationContext.getBeansOfType(DelegatingSmartEndpointInterceptor.class).values()); + assertEquals("not enough smart interceptors found", 1, interceptors.size()); + + DummyInterceptor interceptor = + (DummyInterceptor) interceptors.get(0).getDelegate(); + assertNotNull(interceptor.getPropertyDependency()); + assertNotNull(interceptor.getAutowiredDependency()); + } + } diff --git a/core/src/test/resources/org/springframework/ws/config/interceptorsBeanDefinitionParserInjectionTest.xml b/core/src/test/resources/org/springframework/ws/config/interceptorsBeanDefinitionParserInjectionTest.xml new file mode 100644 index 00000000..0fa8b8b8 --- /dev/null +++ b/core/src/test/resources/org/springframework/ws/config/interceptorsBeanDefinitionParserInjectionTest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + +