From f242075a734da6fd733047adfc64d81c77923266 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Wed, 28 May 2008 15:37:13 +0000 Subject: [PATCH] SimpleWebServiceTargetAdapter is now SimpleWebServiceHandler, and MarshallingWebServiceTargetAdapter is now MarshallingWebServiceHandler. The "ws-target" element is now "ws-handler", and the WebServiceHandlerParser (formerly WebServiceTargetAdapterParser) now creates a MessageHandler instance only - rather than creating the HandlerEndpoint itself. Therefore, the "ws-handler" should be referenced from the "handler" attribute of a element. See the modified WebServiceDemo (and its configuration file: "temperatureConversion.xml") in the "org.springframework.integration.samples" module for an example. --- .../samples/ws/WebServiceDemo.java | 41 ++++---- .../samples/ws/temperatureConversion.xml | 37 ++++---- .../ws/config/WebServiceHandlerParser.java | 75 +++++++++++++++ .../config/WebServiceTargetAdapterParser.java | 94 ------------------- .../ws/config/spring-integration-ws-1.0.xsd | 5 +- .../AbstractWebServiceHandler.java} | 12 +-- .../MarshallingWebServiceHandler.java} | 10 +- .../SimpleWebServiceHandler.java} | 12 +-- .../META-INF/spring-integration.parsers | 2 +- ...java => WebServiceHandlerParserTests.java} | 50 +++++----- ...rshallingWebServiceHandlerParserTests.xml} | 15 ++- ...=> simpleWebServiceHandlerParserTests.xml} | 12 +-- 12 files changed, 170 insertions(+), 195 deletions(-) create mode 100644 org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceHandlerParser.java delete mode 100644 org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceTargetAdapterParser.java rename org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/{adapter/AbstractWebServiceTargetAdapter.java => handler/AbstractWebServiceHandler.java} (88%) rename org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/{adapter/MarshallingWebServiceTargetAdapter.java => handler/MarshallingWebServiceHandler.java} (83%) rename org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/{adapter/SimpleWebServiceTargetAdapter.java => handler/SimpleWebServiceHandler.java} (85%) rename org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/{WebServiceTargetAdapterParserTests.java => WebServiceHandlerParserTests.java} (60%) rename org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/{marshallingWebServiceTargetAdapterParserTests.xml => marshallingWebServiceHandlerParserTests.xml} (68%) rename org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/{simpleWebServiceTargetAdapterParserTests.xml => simpleWebServiceHandlerParserTests.xml} (66%) diff --git a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/WebServiceDemo.java b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/WebServiceDemo.java index 5abfc8eb1f..7af7bd2353 100644 --- a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/WebServiceDemo.java +++ b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/WebServiceDemo.java @@ -20,34 +20,33 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.channel.MessageChannel; import org.springframework.integration.message.GenericMessage; import org.springframework.integration.message.Message; -import org.springframework.integration.ws.adapter.AbstractWebServiceTargetAdapter; +import org.springframework.integration.ws.handler.AbstractWebServiceHandler; /** - * Demonstrating a web service invocation through a Web Service Target. + * Demonstrating a web service invocation through a Web Service MessageHandler. * * @author Marius Bogoevici */ public class WebServiceDemo { public static void main(String[] args) { - ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("temperatureConversion.xml", - WebServiceDemo.class); + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("temperatureConversion.xml", WebServiceDemo.class); context.start(); - - // Compose the XML message according to the server's schema - String requestMessage = "" + - " 90.0" + - " "; - - // Prepare the Message object - Message message = new GenericMessage(requestMessage); - // In this case the service expects a SoapAction header - message.getHeader().setProperty(AbstractWebServiceTargetAdapter.SOAP_ACTION_PROPERTY_KEY, "http://tempuri.org/FahrenheitToCelsius"); - // Set the return address for the message - the response message will be returned on this channel - message.getHeader().setReturnAddress("celsiusChannel"); - - ((MessageChannel)context.getBean("fahrenheitChannel")).send(message); - } - -} + // Compose the XML message according to the server's schema + String requestMessage = + "" + + " 90.0" + + ""; + + // Create the Message object + Message message = new GenericMessage(requestMessage); + + // In this case the service expects a SoapAction header + message.getHeader().setProperty(AbstractWebServiceHandler.SOAP_ACTION_PROPERTY_KEY, "http://tempuri.org/FahrenheitToCelsius"); + + // Send the Message to the handler's input channel + ((MessageChannel) context.getBean("fahrenheitChannel")).send(message); + } + +} diff --git a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/temperatureConversion.xml b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/temperatureConversion.xml index 1f5d21129a..fb23cdac85 100644 --- a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/temperatureConversion.xml +++ b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/temperatureConversion.xml @@ -1,27 +1,30 @@ - - + - - - - + + - + + - - - - - - + + + + + + + + + diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceHandlerParser.java b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceHandlerParser.java new file mode 100644 index 0000000000..7c9b905900 --- /dev/null +++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceHandlerParser.java @@ -0,0 +1,75 @@ +/* + * 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.ws.config; + +import org.w3c.dom.Element; + +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; +import org.springframework.beans.factory.xml.ParserContext; +import org.springframework.integration.ConfigurationException; +import org.springframework.integration.ws.handler.MarshallingWebServiceHandler; +import org.springframework.integration.ws.handler.SimpleWebServiceHandler; +import org.springframework.util.StringUtils; + +/** + * Parser for the <ws-handler/> element. + * + * @author Mark Fisher + */ +public class WebServiceHandlerParser extends AbstractSingleBeanDefinitionParser { + + @Override + protected Class getBeanClass(Element element) { + return (StringUtils.hasText(element.getAttribute("marshaller"))) ? + MarshallingWebServiceHandler.class : SimpleWebServiceHandler.class; + } + + @Override + protected boolean shouldGenerateId() { + return false; + } + + @Override + protected boolean shouldGenerateIdAsFallback() { + return true; + } + + @Override + protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { + String uri = element.getAttribute("uri"); + if (!StringUtils.hasText(uri)) { + throw new ConfigurationException("The 'uri' attribute is required."); + } + builder.addConstructorArgValue(uri); + String marshallerRef = element.getAttribute("marshaller"); + if (StringUtils.hasText(marshallerRef)) { + builder.addConstructorArgReference(marshallerRef); + String unmarshallerRef = element.getAttribute("unmarshaller"); + if (StringUtils.hasText(unmarshallerRef)) { + builder.addConstructorArgReference(unmarshallerRef); + } + } + else { + String sourceExtractorRef = element.getAttribute("source-extractor"); + if (StringUtils.hasText(sourceExtractorRef)) { + builder.addConstructorArgReference(sourceExtractorRef); + } + } + } + +} diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceTargetAdapterParser.java b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceTargetAdapterParser.java deleted file mode 100644 index 154f95438c..0000000000 --- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceTargetAdapterParser.java +++ /dev/null @@ -1,94 +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.ws.config; - -import org.w3c.dom.Element; - -import org.springframework.beans.factory.config.RuntimeBeanReference; -import org.springframework.beans.factory.parsing.BeanComponentDefinition; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.support.RootBeanDefinition; -import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; -import org.springframework.beans.factory.xml.ParserContext; -import org.springframework.integration.ConfigurationException; -import org.springframework.integration.endpoint.HandlerEndpoint; -import org.springframework.integration.scheduling.Subscription; -import org.springframework.integration.ws.adapter.MarshallingWebServiceTargetAdapter; -import org.springframework.integration.ws.adapter.SimpleWebServiceTargetAdapter; -import org.springframework.util.StringUtils; - -/** - * Parser for the <ws-target/> element. - * - * @author Mark Fisher - */ -public class WebServiceTargetAdapterParser extends AbstractSingleBeanDefinitionParser { - - protected Class getBeanClass(Element element) { - return HandlerEndpoint.class; - } - - protected boolean shouldGenerateId() { - return false; - } - - protected boolean shouldGenerateIdAsFallback() { - return true; - } - - protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { - String channel = element.getAttribute("channel"); - String uri = element.getAttribute("uri"); - if (!StringUtils.hasText(channel)) { - throw new ConfigurationException("The 'channel' attribute is required."); - } - if (!StringUtils.hasText(uri)) { - throw new ConfigurationException("The 'uri' attribute is required."); - } - String marshallerRef = element.getAttribute("marshaller"); - String unmarshallerRef = element.getAttribute("unmarshaller"); - String sourceExtractorRef = element.getAttribute("source-extractor"); - RootBeanDefinition adapterDef = (StringUtils.hasText(marshallerRef)) ? - this.parseMarshallingAdapter(uri, marshallerRef, unmarshallerRef) : - this.parseSimpleAdapter(uri, sourceExtractorRef); - String adapterBeanName = parserContext.getReaderContext().generateBeanName(adapterDef); - parserContext.registerBeanComponent(new BeanComponentDefinition(adapterDef, adapterBeanName)); - builder.addConstructorArgReference(adapterBeanName); - Subscription subscription = new Subscription(channel); - builder.addPropertyValue("subscription", subscription); - } - - private RootBeanDefinition parseMarshallingAdapter(String uri, String marshallerRef, String unmarshallerRef) { - RootBeanDefinition beanDefinition = new RootBeanDefinition(MarshallingWebServiceTargetAdapter.class); - beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(uri); - beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(marshallerRef)); - if (StringUtils.hasText(unmarshallerRef)) { - beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(unmarshallerRef)); - } - return beanDefinition; - } - - private RootBeanDefinition parseSimpleAdapter(String uri, String sourceExtrractorRef) { - RootBeanDefinition beanDefinition = new RootBeanDefinition(SimpleWebServiceTargetAdapter.class); - beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(uri); - if (StringUtils.hasText(sourceExtrractorRef)) { - beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(sourceExtrractorRef)); - } - return beanDefinition; - } - -} diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/spring-integration-ws-1.0.xsd b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/spring-integration-ws-1.0.xsd index 3f50a8ce18..421e68ce4e 100644 --- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/spring-integration-ws-1.0.xsd +++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/spring-integration-ws-1.0.xsd @@ -19,16 +19,15 @@ ]]> - + - Defines a Web Service target channel adapter. + Defines a Web Service MessageHandler adapter. - diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/adapter/AbstractWebServiceTargetAdapter.java b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/AbstractWebServiceHandler.java similarity index 88% rename from org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/adapter/AbstractWebServiceTargetAdapter.java rename to org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/AbstractWebServiceHandler.java index 54980af44c..3330833e82 100644 --- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/adapter/AbstractWebServiceTargetAdapter.java +++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/AbstractWebServiceHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.ws.adapter; +package org.springframework.integration.ws.handler; import java.io.IOException; import java.net.URI; @@ -32,11 +32,11 @@ import org.springframework.ws.soap.SoapMessage; import org.springframework.ws.soap.client.core.SoapActionCallback; /** - * Base class for Web Service target channel adapters. + * Base class for Web Service {@link MessageHandler} adapters. * * @author Mark Fisher */ -public abstract class AbstractWebServiceTargetAdapter implements MessageHandler { +public abstract class AbstractWebServiceHandler implements MessageHandler { public static final String SOAP_ACTION_PROPERTY_KEY = "_ws.soapAction"; @@ -46,8 +46,8 @@ public abstract class AbstractWebServiceTargetAdapter implements MessageHandler private volatile WebServiceMessageCallback requestCallback; - public AbstractWebServiceTargetAdapter(URI uri) { - Assert.notNull(uri, "'uri' must not be null"); + public AbstractWebServiceHandler(URI uri) { + Assert.notNull(uri, "URI must not be null"); this.webServiceTemplate.setDefaultUri(uri.toString()); } @@ -70,7 +70,7 @@ public abstract class AbstractWebServiceTargetAdapter implements MessageHandler public final Message handle(Message message) { Object responsePayload = this.doHandle(message.getPayload(), this.getRequestCallback(message)); - return (responsePayload != null ? new GenericMessage(responsePayload, message.getHeader()) : null); + return responsePayload != null ? new GenericMessage(responsePayload, message.getHeader()) : null; } protected abstract Object doHandle(Object requestPayload, WebServiceMessageCallback requestCallback); diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/adapter/MarshallingWebServiceTargetAdapter.java b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/MarshallingWebServiceHandler.java similarity index 83% rename from org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/adapter/MarshallingWebServiceTargetAdapter.java rename to org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/MarshallingWebServiceHandler.java index c653d7807f..44b8b8c445 100644 --- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/adapter/MarshallingWebServiceTargetAdapter.java +++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/MarshallingWebServiceHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.ws.adapter; +package org.springframework.integration.ws.handler; import java.net.URI; @@ -24,15 +24,15 @@ import org.springframework.util.Assert; import org.springframework.ws.client.core.WebServiceMessageCallback; /** - * A marshalling Web Service target channel adapter. + * A marshalling Web Service MessageHandler adapter. * * @author Mark Fisher * @see Marshaller * @see Unmarshaller */ -public class MarshallingWebServiceTargetAdapter extends AbstractWebServiceTargetAdapter { +public class MarshallingWebServiceHandler extends AbstractWebServiceHandler { - public MarshallingWebServiceTargetAdapter(URI uri, Marshaller marshaller, Unmarshaller unmarshaller) { + public MarshallingWebServiceHandler(URI uri, Marshaller marshaller, Unmarshaller unmarshaller) { super(uri); Assert.notNull(marshaller, "marshaller must not be null"); Assert.notNull(unmarshaller, "unmarshaller must not be null"); @@ -40,7 +40,7 @@ public class MarshallingWebServiceTargetAdapter extends AbstractWebServiceTarget this.getWebServiceTemplate().setUnmarshaller(unmarshaller); } - public MarshallingWebServiceTargetAdapter(URI uri, Marshaller marshaller) { + public MarshallingWebServiceHandler(URI uri, Marshaller marshaller) { super(uri); Assert.notNull(marshaller, "marshaller must not be null"); Assert.isInstanceOf(Unmarshaller.class, marshaller, diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/adapter/SimpleWebServiceTargetAdapter.java b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/SimpleWebServiceHandler.java similarity index 85% rename from org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/adapter/SimpleWebServiceTargetAdapter.java rename to org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/SimpleWebServiceHandler.java index df0bf25389..72da58be61 100644 --- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/adapter/SimpleWebServiceTargetAdapter.java +++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/SimpleWebServiceHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.ws.adapter; +package org.springframework.integration.ws.handler; import java.io.IOException; import java.net.URI; @@ -32,20 +32,20 @@ import org.springframework.xml.transform.StringSource; import org.springframework.xml.transform.TransformerObjectSupport; /** - * A target channel adapter for calling out to a Web Service. + * A MessageHandler adapter for invoking a Web Service. * * @author Mark Fisher */ -public class SimpleWebServiceTargetAdapter extends AbstractWebServiceTargetAdapter { +public class SimpleWebServiceHandler extends AbstractWebServiceHandler { private final SourceExtractor sourceExtractor; - public SimpleWebServiceTargetAdapter(URI uri) { + public SimpleWebServiceHandler(URI uri) { this(uri, null); } - public SimpleWebServiceTargetAdapter(URI uri, SourceExtractor sourceExtractor) { + public SimpleWebServiceHandler(URI uri, SourceExtractor sourceExtractor) { super(uri); this.sourceExtractor = (sourceExtractor != null) ? sourceExtractor : new DefaultSourceExtractor(); } @@ -65,7 +65,7 @@ public class SimpleWebServiceTargetAdapter extends AbstractWebServiceTargetAdapt } throw new MessagingException("Unsupported payload type '" + requestPayload.getClass() + "'. " + this.getClass().getName() + " only supports 'java.lang.String' and '" + Source.class.getName() + - "'. Consider using the '" + MarshallingWebServiceTargetAdapter.class.getName() + "' instead."); + "'. Consider using the '" + MarshallingWebServiceHandler.class.getName() + "' instead."); } diff --git a/org.springframework.integration.ws/src/main/resources/META-INF/spring-integration.parsers b/org.springframework.integration.ws/src/main/resources/META-INF/spring-integration.parsers index 389ffb1350..091f968c3e 100644 --- a/org.springframework.integration.ws/src/main/resources/META-INF/spring-integration.parsers +++ b/org.springframework.integration.ws/src/main/resources/META-INF/spring-integration.parsers @@ -1 +1 @@ -ws-target=org.springframework.integration.ws.config.WebServiceTargetAdapterParser \ No newline at end of file +ws-handler=org.springframework.integration.ws.config.WebServiceHandlerParser \ No newline at end of file diff --git a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/WebServiceTargetAdapterParserTests.java b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/WebServiceHandlerParserTests.java similarity index 60% rename from org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/WebServiceTargetAdapterParserTests.java rename to org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/WebServiceHandlerParserTests.java index a0f0258671..34582569fa 100644 --- a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/WebServiceTargetAdapterParserTests.java +++ b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/WebServiceHandlerParserTests.java @@ -23,9 +23,9 @@ import org.junit.Test; import org.springframework.beans.DirectFieldAccessor; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.integration.endpoint.HandlerEndpoint; -import org.springframework.integration.ws.adapter.MarshallingWebServiceTargetAdapter; -import org.springframework.integration.ws.adapter.SimpleWebServiceTargetAdapter; +import org.springframework.integration.handler.MessageHandler; +import org.springframework.integration.ws.handler.MarshallingWebServiceHandler; +import org.springframework.integration.ws.handler.SimpleWebServiceHandler; import org.springframework.oxm.Marshaller; import org.springframework.oxm.Unmarshaller; import org.springframework.ws.client.core.SourceExtractor; @@ -33,39 +33,36 @@ import org.springframework.ws.client.core.SourceExtractor; /** * @author Mark Fisher */ -public class WebServiceTargetAdapterParserTests { +public class WebServiceHandlerParserTests { @Test - public void testSimpleWebServiceTargetAdapterWithDefaultSourceExtractor() { + public void testSimpleWebServiceHandlerWithDefaultSourceExtractor() { ApplicationContext context = new ClassPathXmlApplicationContext( - "simpleWebServiceTargetAdapterParserTests.xml", this.getClass()); - HandlerEndpoint endpoint = - (HandlerEndpoint) context.getBean("adapterWithDefaultSourceExtractor"); - assertEquals(SimpleWebServiceTargetAdapter.class, endpoint.getHandler().getClass()); - DirectFieldAccessor accessor = new DirectFieldAccessor(endpoint.getHandler()); + "simpleWebServiceHandlerParserTests.xml", this.getClass()); + MessageHandler handler = (MessageHandler) context.getBean("handlerWithDefaultSourceExtractor"); + assertEquals(SimpleWebServiceHandler.class, handler.getClass()); + DirectFieldAccessor accessor = new DirectFieldAccessor(handler); assertEquals("DefaultSourceExtractor", accessor.getPropertyValue("sourceExtractor").getClass().getSimpleName()); } @Test - public void testSimpleWebServiceTargetAdapterWithCustomSourceExtractor() { + public void testSimpleWebServiceHandlerWithCustomSourceExtractor() { ApplicationContext context = new ClassPathXmlApplicationContext( - "simpleWebServiceTargetAdapterParserTests.xml", this.getClass()); - HandlerEndpoint endpoint = - (HandlerEndpoint) context.getBean("adapterWithCustomSourceExtractor"); - assertEquals(SimpleWebServiceTargetAdapter.class, endpoint.getHandler().getClass()); - DirectFieldAccessor accessor = new DirectFieldAccessor(endpoint.getHandler()); + "simpleWebServiceHandlerParserTests.xml", this.getClass()); + MessageHandler handler = (MessageHandler) context.getBean("handlerWithCustomSourceExtractor"); + assertEquals(SimpleWebServiceHandler.class, handler.getClass()); + DirectFieldAccessor accessor = new DirectFieldAccessor(handler); SourceExtractor sourceExtractor = (SourceExtractor) context.getBean("sourceExtractor"); assertEquals(sourceExtractor, accessor.getPropertyValue("sourceExtractor")); } @Test - public void testWebServiceTargetAdapterWithAllInOneMarshaller() { + public void testWebServiceHandlerWithAllInOneMarshaller() { ApplicationContext context = new ClassPathXmlApplicationContext( - "marshallingWebServiceTargetAdapterParserTests.xml", this.getClass()); - HandlerEndpoint endpoint = - (HandlerEndpoint) context.getBean("adapterWithAllInOneMarshaller"); - assertEquals(MarshallingWebServiceTargetAdapter.class, endpoint.getHandler().getClass()); - DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(endpoint.getHandler()); + "marshallingWebServiceHandlerParserTests.xml", this.getClass()); + MessageHandler handler = (MessageHandler) context.getBean("handlerWithAllInOneMarshaller"); + assertEquals(MarshallingWebServiceHandler.class, handler.getClass()); + DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(handler); DirectFieldAccessor templateAccessor = new DirectFieldAccessor( handlerAccessor.getPropertyValue("webServiceTemplate")); Marshaller marshaller = (Marshaller) context.getBean("marshallerAndUnmarshaller"); @@ -76,11 +73,10 @@ public class WebServiceTargetAdapterParserTests { @Test public void testWebServiceTargetAdapterWithSeparateMarshallerAndUnmarshaller() { ApplicationContext context = new ClassPathXmlApplicationContext( - "marshallingWebServiceTargetAdapterParserTests.xml", this.getClass()); - HandlerEndpoint endpoint = - (HandlerEndpoint) context.getBean("adapterWithSeparateMarshallerAndUnmarshaller"); - assertEquals(MarshallingWebServiceTargetAdapter.class, endpoint.getHandler().getClass()); - DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(endpoint.getHandler()); + "marshallingWebServiceHandlerParserTests.xml", this.getClass()); + MessageHandler handler = (MessageHandler) context.getBean("handlerWithSeparateMarshallerAndUnmarshaller"); + assertEquals(MarshallingWebServiceHandler.class, handler.getClass()); + DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(handler); DirectFieldAccessor templateAccessor = new DirectFieldAccessor( handlerAccessor.getPropertyValue("webServiceTemplate")); Marshaller marshaller = (Marshaller) context.getBean("marshaller"); diff --git a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceTargetAdapterParserTests.xml b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceHandlerParserTests.xml similarity index 68% rename from org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceTargetAdapterParserTests.xml rename to org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceHandlerParserTests.xml index 4924766c25..3d25f733b3 100644 --- a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceTargetAdapterParserTests.xml +++ b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceHandlerParserTests.xml @@ -7,15 +7,14 @@ http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-ws-1.0.xsd"> - + - - - - - + diff --git a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceTargetAdapterParserTests.xml b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceHandlerParserTests.xml similarity index 66% rename from org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceTargetAdapterParserTests.xml rename to org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceHandlerParserTests.xml index 1aa5b2b4b7..5ee5dffd9c 100644 --- a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceTargetAdapterParserTests.xml +++ b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceHandlerParserTests.xml @@ -7,14 +7,12 @@ http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-ws-1.0.xsd"> - + - - - - - +