cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r636821 - in /incubator/cxf/trunk: rt/core/src/main/java/org/apache/cxf/test/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/ rt/frontend/jaxws/src/main/resources/schemas/ r...
Date Thu, 13 Mar 2008 18:27:56 GMT
Author: dkulp
Date: Thu Mar 13 11:27:48 2008
New Revision: 636821

URL: http://svn.apache.org/viewvc?rev=636821&view=rev
Log:
[CXF-1293] Add ability to add handlers to jaxws:[client|endpoint|server] stuff via spring
config

Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/AddNumbersNoHandlers.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/ModifyNumberHandler.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/beans.xml 
 (with props)
Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFSpringTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/schemas/jaxws.xsd
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFSpringTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFSpringTest.java?rev=636821&r1=636820&r2=636821&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFSpringTest.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFSpringTest.java
Thu Mar 13 11:27:48 2008
@@ -44,7 +44,7 @@
      * Load up all the beans from the XML files returned by the getConfigLocations method.
      * @throws Exception 
      */
-    protected AbstractCXFSpringTest() throws Exception {
+    protected AbstractCXFSpringTest() {
     }
     
     @Before
@@ -96,7 +96,9 @@
      * @param context
      * @throws Exception 
      */
-    protected abstract void additionalSpringConfiguration(GenericApplicationContext context)
throws Exception;
+    protected void additionalSpringConfiguration(GenericApplicationContext context) throws
Exception {
+        //default - do nothing
+    }
 
     /**
      * Convenience method for the common case of retrieving a bean from the context.

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java?rev=636821&r1=636820&r2=636821&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
Thu Mar 13 11:27:48 2008
@@ -32,6 +32,7 @@
 import javax.xml.ws.EndpointReference;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.WebServicePermission;
+import javax.xml.ws.handler.Handler;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
 import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
 
@@ -96,6 +97,7 @@
     private List<Interceptor> out = new ModCountCopyOnWriteArrayList<Interceptor>();
     private List<Interceptor> outFault  = new ModCountCopyOnWriteArrayList<Interceptor>();
     private List<Interceptor> inFault  = new ModCountCopyOnWriteArrayList<Interceptor>();
+    private List<Handler> handlers = new ModCountCopyOnWriteArrayList<Handler>();
 
     public EndpointImpl(Object implementor) {
         this(BusFactory.getThreadDefaultBus(), implementor);
@@ -304,7 +306,10 @@
             if (executor != null) {
                 serverFactory.getServiceFactory().setExecutor(executor);
             }
-            
+            if (handlers.size() > 0) {
+                serverFactory.addHandlers(handlers);
+            }
+
             configureObject(serverFactory);
             
             server = serverFactory.create();
@@ -451,6 +456,13 @@
 
     public void setOutFaultInterceptors(List<Interceptor> interceptors) {
         outFault = interceptors;
+    }
+    public void setHandlers(List<Handler> h) {
+        handlers.clear();
+        handlers.addAll(h);
+    }
+    public List<Handler> getHandlers() {
+        return handlers;
     }
 
     public List<AbstractFeature> getFeatures() {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java?rev=636821&r1=636820&r2=636821&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
Thu Mar 13 11:27:48 2008
@@ -18,32 +18,56 @@
  */
 package org.apache.cxf.jaxws;
 
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
 import java.util.List;
 
 import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.Handler;
 
+import org.apache.cxf.common.injection.ResourceInjector;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.jaxws.context.WebServiceContextResourceResolver;
+import org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilder;
 import org.apache.cxf.jaxws.interceptors.HolderInInterceptor;
 import org.apache.cxf.jaxws.interceptors.HolderOutInterceptor;
 import org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor;
 import org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
+import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
+import org.apache.cxf.resource.DefaultResourceManager;
+import org.apache.cxf.resource.ResourceManager;
+import org.apache.cxf.resource.ResourceResolver;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 
 public class JaxWsProxyFactoryBean extends ClientProxyFactoryBean {
+    List<Handler> handlers = new ArrayList<Handler>();
+    
     public JaxWsProxyFactoryBean() {
         super(new JaxWsClientFactoryBean());
     }
 
+    public void setHandlers(List<Handler> h) {
+        handlers.clear();
+        handlers.addAll(h);
+    }
+    public List<Handler> getHandlers() {
+        return handlers;
+    }
+
+    
     @Override
     protected ClientProxy clientClientProxy(Client c) {
-        return new JaxWsClientProxy(c, ((JaxWsEndpointImpl)  c.getEndpoint()).getJaxwsBinding());
+        JaxWsClientProxy cp = new JaxWsClientProxy(c, 
+                                                   ((JaxWsEndpointImpl)c.getEndpoint()).getJaxwsBinding());
+        buildHandlerChain(cp);
+        return cp;
     }
 
     protected Class[] getImplementingClasses() {
@@ -82,5 +106,32 @@
         return false;
     }
    
+    private void buildHandlerChain(JaxWsClientProxy cp) {
+        AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder();
+        JaxWsServiceFactoryBean sf = (JaxWsServiceFactoryBean)getServiceFactory(); 
+        List<Handler> chain = new ArrayList<Handler>(handlers);
+        chain.addAll(builder.buildHandlerChainFromClass(sf.getServiceClass(), sf.getEndpointInfo()
+            .getName(), sf.getServiceQName(), this.getBindingId()));
+        
+
+        if (!chain.isEmpty()) {
+            ResourceManager resourceManager = getBus().getExtension(ResourceManager.class);
+            List<ResourceResolver> resolvers = resourceManager.getResourceResolvers();
+            resourceManager = new DefaultResourceManager(resolvers); 
+            resourceManager.addResourceResolver(new WebServiceContextResourceResolver());
+            ResourceInjector injector = new ResourceInjector(resourceManager);
+            for (Handler h : chain) {
+                if (Proxy.isProxyClass(h.getClass()) && getServiceClass() != null)
{
+                    injector.inject(h, getServiceClass());
+                    injector.construct(h, getServiceClass());
+                } else {
+                    injector.inject(h);
+                    injector.construct(h);
+                }
+            }
+        }
+        
+        cp.getBinding().setHandlerChain(chain);
+    }
     
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?rev=636821&r1=636820&r2=636821&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
Thu Mar 13 11:27:48 2008
@@ -21,6 +21,7 @@
 
 
 import java.lang.reflect.Proxy;
+import java.util.ArrayList;
 import java.util.List;
 
 import javax.xml.ws.WebServiceException;
@@ -58,6 +59,7 @@
  */
 public class JaxWsServerFactoryBean extends ServerFactoryBean {
     protected boolean doInit;
+    protected List<Handler> handlers = new ArrayList<Handler>();
     
     public JaxWsServerFactoryBean() {
         this(new JaxWsServiceFactoryBean());
@@ -71,6 +73,17 @@
         setBindingConfig(defConfig);
         doInit = true;
     }
+    
+    public void setHandlers(List<Handler> h) {
+        handlers.clear();
+        handlers.addAll(h);
+    }
+    public void addHandlers(List<Handler> h) {
+        handlers.addAll(h);
+    }
+    public List<Handler> getHandlers() {
+        return handlers;
+    }
 
     /**
      * Add annotated Interceptors and Features to the Endpoint
@@ -172,13 +185,13 @@
     private void buildHandlerChain() {
         AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder();
         JaxWsServiceFactoryBean sf = (JaxWsServiceFactoryBean)getServiceFactory(); 
+        List<Handler> chain = new ArrayList<Handler>(handlers);
         
-        List<Handler> chain = builder.buildHandlerChainFromClass(getServiceBeanClass(),
sf.getEndpointInfo()
-            .getName(), sf.getServiceQName(), this.getBindingId());
+        chain.addAll(builder.buildHandlerChainFromClass(getServiceBeanClass(), sf.getEndpointInfo()
+            .getName(), sf.getServiceQName(), this.getBindingId()));
         for (Handler h : chain) {
             injectResources(h);
         }
-        
         ((JaxWsEndpointImpl)getServer().getEndpoint()).getJaxwsBinding().setHandlerChain(chain);
     }
     

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java?rev=636821&r1=636820&r2=636821&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
Thu Mar 13 11:27:48 2008
@@ -107,7 +107,8 @@
                     setFirstChildAsProperty((Element) n, ctx, bean, "bindingConfig");
                 } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
                     || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name)
-                    || "features".equals(name) || "schemaLocations".equals(name)) {
+                    || "features".equals(name) || "schemaLocations".equals(name)
+                    || "handlers".equals(name)) {
                     List list = ctx.getDelegate().parseListElement((Element) n, bean.getBeanDefinition());
                     bean.addPropertyValue(name, list);
                 } else if (IMPLEMENTOR.equals(name)) {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/schemas/jaxws.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/schemas/jaxws.xsd?rev=636821&r1=636820&r2=636821&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/schemas/jaxws.xsd (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/schemas/jaxws.xsd Thu Mar 13
11:27:48 2008
@@ -38,6 +38,7 @@
             <xsd:element name="dataBinding" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="executor" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="features" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="handlers" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="implementor" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="inInterceptors" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="inFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
@@ -73,6 +74,7 @@
             <xsd:element name="dataBinding" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="executor" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="features" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="handlers" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="inInterceptors" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="inFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="invoker" type="xsd:anyType" minOccurs="0"/>
@@ -107,6 +109,7 @@
             <xsd:element name="binding" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="dataBinding" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="features" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="handlers" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="inInterceptors" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="inFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="outInterceptors" type="xsd:anyType" minOccurs="0"/>

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java?rev=636821&r1=636820&r2=636821&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java
Thu Mar 13 11:27:48 2008
@@ -72,7 +72,7 @@
             setFirstChildAsProperty(e, ctx, bean, "bindingConfig");
         } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
             || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name)
-            || "features".equals(name)) {
+            || "features".equals(name) || "handlers".equals(name)) {
             List list = ctx.getDelegate().parseListElement(e, bean.getBeanDefinition());
             bean.addPropertyValue(name, list);
         } else {

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/AddNumbersNoHandlers.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/AddNumbersNoHandlers.java?rev=636821&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/AddNumbersNoHandlers.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/AddNumbersNoHandlers.java
Thu Mar 13 11:27:48 2008
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.cxf.systest.handlers;
+
+import javax.jws.WebService;
+
+
+import org.apache.handlers.AddNumbers;
+import org.apache.handlers.AddNumbersFault;
+
+@WebService(name = "AddNumbers", 
+            targetNamespace = "http://apache.org/handlers", 
+            portName = "AddNumbersPort", 
+            endpointInterface = "org.apache.handlers.AddNumbers", 
+            serviceName = "AddNumbersService")
+public class AddNumbersNoHandlers implements AddNumbers {
+
+    /**
+     * @param number1
+     * @param number2
+     * @return The sum
+     * @throws AddNumbersException
+     *             if any of the numbers to be added is negative.
+     */
+    public int addNumbers(int number1, int number2) throws AddNumbersFault {
+        return number1 + number2;
+    }
+
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/AddNumbersNoHandlers.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/AddNumbersNoHandlers.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/AddNumbersNoHandlers.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/ModifyNumberHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/ModifyNumberHandler.java?rev=636821&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/ModifyNumberHandler.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/ModifyNumberHandler.java
Thu Mar 13 11:27:48 2008
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.cxf.systest.handlers;
+
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.ProtocolException;
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.handlers.types.AddNumbers;
+import org.apache.handlers.types.ObjectFactory;
+
+
+/**
+ * handles addition of small numbers.
+ */
+public class ModifyNumberHandler implements LogicalHandler<LogicalMessageContext> {
+    
+    public final boolean handleMessage(LogicalMessageContext messageContext) {
+        //System.out.println("LogicalMessageHandler handleMessage called");
+
+        try {
+            // get the LogicalMessage from our context
+            LogicalMessage msg = messageContext.getMessage();
+
+            // check the payload, if its an AddNumbers request, we'll intervene
+            JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
+            Object payload = msg.getPayload(jaxbContext);
+            Object value = payload;
+            if (payload instanceof JAXBElement) {
+                value = ((JAXBElement)payload).getValue();
+            }
+
+            if (value instanceof AddNumbers) {
+                AddNumbers req = (AddNumbers)value;
+
+                int a = req.getArg0();
+                req.setArg0(a * 10);
+                msg.setPayload(payload, jaxbContext);
+            }
+            return true;
+        } catch (JAXBException ex) {
+            throw new ProtocolException(ex);
+        }
+
+    }
+
+    public final boolean handleFault(LogicalMessageContext messageContext) {
+        return true;
+    }
+
+    public void close(MessageContext ctx) {
+    }
+
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/ModifyNumberHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/ModifyNumberHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/ModifyNumberHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java?rev=636821&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java
Thu Mar 13 11:27:48 2008
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.cxf.systest.handlers;
+
+import org.apache.cxf.test.AbstractCXFSpringTest;
+import org.apache.handlers.AddNumbers;
+import org.junit.Test;
+
+/**
+ * 
+ */
+public class SpringConfiguredHandlerTest extends AbstractCXFSpringTest {
+
+    @Override
+    protected String[] getConfigLocations() {
+        return new String[] {"classpath:/org/apache/cxf/systest/handlers/beans.xml" };
+    }
+
+    @Test
+    public void testSpringConfiguresHandlers() throws Exception {
+        AddNumbers addNumbers = (AddNumbers)getApplicationContext().getBean("cxfHandlerTestClientEndpoint",
+                                                                   AddNumbers.class);
+
+        int r = addNumbers.addNumbers(10, 15);
+        assertEquals(1015, r);
+
+    
+        addNumbers = (AddNumbers)getApplicationContext().getBean("cxfHandlerTestClientEndpointNoHandler",
+                                                                 AddNumbers.class);
+
+        r = addNumbers.addNumbers(10, 15);
+        assertEquals(115, r);
+
+        addNumbers = (AddNumbers)getApplicationContext().getBean("cxfHandlerTestClientServer",
+                                                                 AddNumbers.class);
+
+        r = addNumbers.addNumbers(10, 15);
+        assertEquals(1015, r);
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/beans.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/beans.xml?rev=636821&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/beans.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/beans.xml Thu
Mar 13 11:27:48 2008
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" 
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+xmlns:jaxws="http://cxf.apache.org/jaxws" 
+xmlns:cxf="http://cxf.apache.org/core" 
+xsi:schemaLocation=" 
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

+http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd 
+http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> 
+<import resource="classpath:META-INF/cxf/cxf.xml" /> 
+<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> 
+<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" /> 
+<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" /> 
+<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" /> 
+
+	<jaxws:endpoint id="cxfHandlerTestEndpoint"
+		implementor="org.apache.cxf.systest.handlers.AddNumbersNoHandlers"
+		address="http://localhost:9025/SpringEndpoint">
+    	<jaxws:handlers>
+    		<bean class="org.apache.cxf.systest.handlers.ModifyNumberHandler"/>
+    	</jaxws:handlers>
+    </jaxws:endpoint> 
+	<jaxws:server id="cxfHandlerTestServer"
+		serviceClass="org.apache.handlers.AddNumbers"
+		address="http://localhost:9025/SpringServer">
+		<jaxws:serviceBean>
+                <bean class="org.apache.cxf.systest.handlers.AddNumbersNoHandlers" />
+        </jaxws:serviceBean>
+		
+    	<jaxws:handlers>
+    		<bean class="org.apache.cxf.systest.handlers.ModifyNumberHandler"/>
+    	</jaxws:handlers>
+    </jaxws:server>
+
+    <jaxws:client id="cxfHandlerTestClientEndpoint"
+    	serviceClass="org.apache.handlers.AddNumbers"
+    	address="http://localhost:9025/SpringEndpoint">
+    	<jaxws:handlers>
+    		<bean class="org.apache.cxf.systest.handlers.ModifyNumberHandler"/>
+    	</jaxws:handlers>
+    </jaxws:client> 
+    <jaxws:client id="cxfHandlerTestClientEndpointNoHandler"
+    	serviceClass="org.apache.handlers.AddNumbers"
+    	address="http://localhost:9025/SpringEndpoint">
+    </jaxws:client> 
+    <jaxws:client id="cxfHandlerTestClientServer"
+    	serviceClass="org.apache.handlers.AddNumbers"
+    	address="http://localhost:9025/SpringServer">
+    	<jaxws:handlers>
+    		<bean class="org.apache.cxf.systest.handlers.ModifyNumberHandler"/>
+    	</jaxws:handlers>
+    </jaxws:client> 
+    
+</beans> 

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/beans.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/beans.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/beans.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message