You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2007/12/03 13:30:39 UTC

svn commit: r600507 - in /incubator/cxf/trunk: parent/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/core/src/test/java/org/apache/cxf/bus/extension/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/ rt/javascript/ rt/transp...

Author: ningjiang
Date: Mon Dec  3 04:30:38 2007
New Revision: 600507

URL: http://svn.apache.org/viewvc?rev=600507&view=rev
Log:
CXF-1187 CXF-1249 Fixed Several Spring2.5 related issues.
Added the profile spring2.5 which builds CXF with Spring 2.5

Added:
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MyResourceService.java   (with props)
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MySetterService.java   (with props)
Modified:
    incubator/cxf/trunk/parent/pom.xml
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionManagerTest.java
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MyService.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
    incubator/cxf/trunk/rt/javascript/pom.xml
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
    incubator/cxf/trunk/systests/pom.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ErrorContextSerletTest.java

Modified: incubator/cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/parent/pom.xml?rev=600507&r1=600506&r2=600507&view=diff
==============================================================================
--- incubator/cxf/trunk/parent/pom.xml (original)
+++ incubator/cxf/trunk/parent/pom.xml Mon Dec  3 04:30:38 2007
@@ -51,6 +51,7 @@
         <saaj.version>1.3</saaj.version>
         <saaj.impl.version>1.3</saaj.impl.version>
         <spring.version>2.0.6</spring.version>
+        <spring.mock>spring-mock</spring.mock>
         <wsdl4j.version>1.6.1</wsdl4j.version>
         <derby.version>10.2.2.0</derby.version>
         <activemq.version>4.1.1</activemq.version>
@@ -1001,7 +1002,16 @@
                 </plugins>
             </build>
         </profile>
+        <profile>
+            <id>spring2.5</id>
+            <properties>
+               <spring.version>2.5</spring.version>
+               <spring.mock>spring-test</spring.mock> 
+            </properties>
+        </profile>
     </profiles>
+
+
 
     <scm>
         <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/cxf/trunk/parent</connection>

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java?rev=600507&r1=600506&r2=600507&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java Mon Dec  3 04:30:38 2007
@@ -158,8 +158,7 @@
     public void setBus(Bus bus) {
         this.bus = bus;
     }
-
-    @Resource(name = "activationNamespaces")
+    
     public void setActivationNamespaces(Collection<String> ans) {
         activationNamespaces = ans;
     }

Modified: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionManagerTest.java?rev=600507&r1=600506&r2=600507&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionManagerTest.java (original)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionManagerTest.java Mon Dec  3 04:30:38 2007
@@ -77,11 +77,15 @@
     }
     
     @Test
-    public void testActivateViaNS() {        
+    public void testActivateViaNS() {
+        verifyActivateViaNS(MyResourceService.class.getName(), "http://cxf.apache.org/resource");
+        verifyActivateViaNS(MySetterService.class.getName(), "http://cxf.apache.org/setter");
+    }
+    
+    public void verifyActivateViaNS(String extensionClass, String ns) {        
         
         Extension e = new Extension();
-        e.setClassname(MyService.class.getName());
-        String ns = "http://cxf.apache.org/integer";
+        e.setClassname(MyResourceService.class.getName());       
         e.getNamespaces().add(ns);
         e.setDeferred(true);
         manager.processExtension(e);
@@ -96,6 +100,7 @@
         MyService first = myService;
         manager.activateViaNS(ns);
         assertSame(first, myService);
+        myService = null;
     }
     
     public void setMyService(MyService m) {

Added: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MyResourceService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MyResourceService.java?rev=600507&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MyResourceService.java (added)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MyResourceService.java Mon Dec  3 04:30:38 2007
@@ -0,0 +1,46 @@
+/**
+ * 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.bus.extension;
+
+import java.util.Collection;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+public class MyResourceService implements MyService {
+    @Resource(name = "activationNamespaces")
+    Collection<String> activationNamespaces;
+    
+    @Resource(name = "extensionManagerTest")
+    ExtensionManagerTest extensionManagerTest;
+    
+    
+    public MyResourceService() {
+    }
+    
+    public Collection<String> getActivationNamespaces() {
+        return activationNamespaces;
+    }
+    
+    @PostConstruct
+    public void registerMyselfAsExtension() {
+        extensionManagerTest.setMyService(this);
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MyResourceService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MyResourceService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MyService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MyService.java?rev=600507&r1=600506&r2=600507&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MyService.java (original)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MyService.java Mon Dec  3 04:30:38 2007
@@ -21,26 +21,10 @@
 
 import java.util.Collection;
 
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
 
-public class MyService {
-    @Resource(name = "activationNamespaces")
-    Collection<String> activationNamespaces;
+public interface MyService {
+        
+    Collection<String> getActivationNamespaces();
     
-    @Resource(name = "extensionManagerTest")
-    ExtensionManagerTest extensionManagerTest;
-    
-    
-    public MyService() {
-    }
-    
-    public Collection<String> getActivationNamespaces() {
-        return activationNamespaces;
-    }
-    
-    @PostConstruct
-    void registerMyselfAsExtension() {
-        extensionManagerTest.setMyService(this);
-    }
+    void registerMyselfAsExtension(); 
 }

Added: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MySetterService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MySetterService.java?rev=600507&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MySetterService.java (added)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MySetterService.java Mon Dec  3 04:30:38 2007
@@ -0,0 +1,50 @@
+/**
+ * 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.bus.extension;
+
+import java.util.Collection;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+public class MySetterService implements MyService {
+    
+    Collection<String> activationNamespaces;
+    
+    @Resource(name = "extensionManagerTest")
+    ExtensionManagerTest extensionManagerTest;
+    
+    
+    public MySetterService() {
+    }
+    
+    public void setActivationNamespaces(Collection<String> avNamespaces) {
+        activationNamespaces = avNamespaces;
+    }
+    
+    public Collection<String> getActivationNamespaces() {
+        return activationNamespaces;
+    }
+    
+    @PostConstruct
+    public void registerMyselfAsExtension() {
+        extensionManagerTest.setMyService(this);
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MySetterService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/MySetterService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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=600507&r1=600506&r2=600507&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 Mon Dec  3 04:30:38 2007
@@ -57,6 +57,7 @@
 
     @Override
     protected void doParse(Element element, ParserContext ctx, BeanDefinitionBuilder bean) {
+        boolean isAbstract = false;
         NamedNodeMap atts = element.getAttributes();
         String bus = element.getAttribute("bus");
         if (StringUtils.isEmpty(bus)) {
@@ -76,6 +77,7 @@
 
             if ("createdFromAPI".equals(name)) {
                 bean.setAbstract(true);
+                isAbstract = true;
             } else if (isAttribute(pre, name) && !"publish".equals(name) && !"bus".equals(name)) {
                 if ("endpointName".equals(name) || "serviceName".equals(name)) {
                     QName q = parseQName(element, val);
@@ -89,6 +91,7 @@
                 }
             } else if ("abstract".equals(name)) {
                 bean.setAbstract(true);
+                isAbstract = true;
             }
         }
         
@@ -115,10 +118,10 @@
                 }
             }
         }
-
-        bean.setInitMethodName("publish");
-        bean.setDestroyMethodName("stop");
-
+        if (!isAbstract) {
+            bean.setInitMethodName("publish");
+            bean.setDestroyMethodName("stop");
+        }
         // We don't want to delay the registration of our Server
         bean.setLazyInit(false);
     }

Modified: incubator/cxf/trunk/rt/javascript/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/pom.xml?rev=600507&r1=600506&r2=600507&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/pom.xml (original)
+++ incubator/cxf/trunk/rt/javascript/pom.xml Mon Dec  3 04:30:38 2007
@@ -131,7 +131,7 @@
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
-            <artifactId>spring-mock</artifactId>
+            <artifactId>${spring.mock}</artifactId>
             <version>${spring.version}</version>
             <scope>test</scope>
         </dependency>

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java?rev=600507&r1=600506&r2=600507&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java Mon Dec  3 04:30:38 2007
@@ -78,9 +78,7 @@
   
     /**
      * This collection contains "activationNamespaces" which is synominous
-     * with "transportId"s. TransportIds are already part of 
-     * AbstractTransportFactory.
-     * TODO: Change these to "transportIds"?
+     * with "transportId"s. 
      */
     protected Collection<String> activationNamespaces;
 
@@ -102,11 +100,10 @@
     }
 
     /**
-     * This call is used by spring to "inject" the transport ids.
-     * TODO: Change this to "setTransportIds"?
+     * This call is used by CXF ExtensionManager to inject the activationNamespaces
      * @param ans The transport ids.
      */
-    @Resource(name = "activationNamespaces")
+    
     public void setActivationNamespaces(Collection<String> ans) {
         activationNamespaces = ans;
     }

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java?rev=600507&r1=600506&r2=600507&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java Mon Dec  3 04:30:38 2007
@@ -72,6 +72,9 @@
         if (null == bus) {
             return;
         }
+        if (activationNamespaces == null) {
+            activationNamespaces = getTransportIds();
+        }
         DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
         if (null != dfm && null != activationNamespaces) {
             for (String ns : activationNamespaces) {

Modified: incubator/cxf/trunk/systests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/pom.xml?rev=600507&r1=600506&r2=600507&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/pom.xml (original)
+++ incubator/cxf/trunk/systests/pom.xml Mon Dec  3 04:30:38 2007
@@ -357,7 +357,7 @@
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
-            <artifactId>spring-mock</artifactId>
+            <artifactId>${spring.mock}</artifactId>
             <version>${spring.version}</version>
         </dependency>
         <dependency>

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ErrorContextSerletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ErrorContextSerletTest.java?rev=600507&r1=600506&r2=600507&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ErrorContextSerletTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ErrorContextSerletTest.java Mon Dec  3 04:30:38 2007
@@ -47,11 +47,12 @@
         try {
             sr = new ServletRunner(getResourceAsStream(getConfiguration()), CONTEXT);
             sr.newClient().getResponse(CONTEXT_URL + "/services");
-            // there expect a class not found exception
-            fail("we expect a CannotLoadBeanClassException here");
+            // there expect a spring bean exception
+            fail("we expect a spring bean Exception here");
         } catch (Exception ex) {
-            assertTrue("we expect a CannotLoadBeanClassException here",
-                      ex instanceof org.springframework.beans.factory.CannotLoadBeanClassException);
+            // supprot spring 2.0.x and sping 2.5
+            assertTrue("we expect a Bean Exception here",
+                      ex instanceof org.springframework.beans.FatalBeanException);
         } 
     }