Author: ningjiang
Date: Sun Nov  7 11:16:36 2010
New Revision: 1032256

URL: http://svn.apache.org/viewvc?rev=1032256&view=rev
Log:
CAMEL-3319 fixed the schemaLocations setting issue of camel-cxf

Added:
    
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterTest.java
   (with props)
    
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfEndpointBeans.xml
   (with props)
Modified:
    
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java
    
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/NamespaceHandler.java
    
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java
    
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
    
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java
    
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml

Modified: 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java?rev=1032256&r1=1032255&r2=1032256&view=diff
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java
 Sun Nov  7 11:16:36 2010
@@ -18,6 +18,8 @@ package org.apache.camel.component.cxf.s
 
 import java.util.List;
 
+import javax.xml.ws.handler.Handler;
+
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.frontend.AbstractServiceFactory;
 import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
@@ -31,7 +33,8 @@ import org.springframework.beans.factory
 public class CxfEndpointBean extends AbstractServiceFactory
     implements DisposableBean, BeanNameAware, NamedBean {
     
-    private List handlers;
+    private List<Handler> handlers;
+    private List<String> schemaLocations;
     private String beanName;
 
     public CxfEndpointBean() {
@@ -42,11 +45,11 @@ public class CxfEndpointBean extends Abs
         setServiceFactory(factory);
     }
     
-    public List getHandlers() {
+    public List<Handler> getHandlers() {
         return handlers;
     }
     
-    public void setHandlers(List handlers) {
+    public void setHandlers(List<Handler> handlers) {
         this.handlers = handlers;
     }
 
@@ -65,4 +68,12 @@ public class CxfEndpointBean extends Abs
         return beanName;
     }
 
+    public void setSchemaLocations(List<String> schemaLocations) {
+        this.schemaLocations = schemaLocations;
+    }
+
+    public List<String> getSchemaLocations() {
+        return schemaLocations;
+    }
+
 }

Modified: 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/NamespaceHandler.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/NamespaceHandler.java?rev=1032256&r1=1032255&r2=1032256&view=diff
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/NamespaceHandler.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/NamespaceHandler.java
 Sun Nov  7 11:16:36 2010
@@ -16,12 +16,14 @@
  */
 package org.apache.camel.component.cxf.spring;
 
+import org.apache.cxf.configuration.spring.StringBeanDefinitionParser;
 import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
 
 public class NamespaceHandler extends NamespaceHandlerSupport {
 
     public void init() {
         registerBeanDefinitionParser("cxfEndpoint", new 
CxfEndpointBeanDefinitionParser());
+        registerBeanDefinitionParser("schemaLocation", new 
StringBeanDefinitionParser());
         registerBeanDefinitionParser("rsServer", new 
CxfRsServerFactoryBeanDefinitionParser());
         registerBeanDefinitionParser("rsClient", new 
CxfRsClientFactoryBeanDefinitionParser());
     }

Modified: 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java?rev=1032256&r1=1032255&r2=1032256&view=diff
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java
 Sun Nov  7 11:16:36 2010
@@ -61,7 +61,7 @@ public class CxfSpringRouterTest extends
 
 
     protected ClassPathXmlApplicationContext createApplicationContext() {
-        return new 
ClassPathXmlApplicationContext("org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml");
+        return new 
ClassPathXmlApplicationContext("org/apache/camel/component/cxf/CxfEndpointBeans.xml");
     }
 
 }

Modified: 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java?rev=1032256&r1=1032255&r2=1032256&view=diff
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
 Sun Nov  7 11:16:36 2010
@@ -29,33 +29,17 @@ import org.junit.Test;
 public class CxfEndpointBeanTest extends AbstractSpringBeanTestSupport {
 
     protected String[] getApplicationContextFiles() {
-        return new 
String[]{"org/apache/camel/component/cxf/spring/CxfEndpointBeansRouter.xml"};
+        return new 
String[]{"org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml"};
     }
 
     @Test
     public void testCxfEndpointBeanDefinitionParser() {
         CxfEndpointBean routerEndpoint = 
(CxfEndpointBean)ctx.getBean("routerEndpoint");
-        assertEquals("Got the wrong endpoint address", 
routerEndpoint.getAddress(), "http://localhost:9000/router";);
-        assertEquals("Got the wrong endpont service class", 
routerEndpoint.getServiceClass().getCanonicalName(), 
"org.apache.camel.component.cxf.HelloService");
-    }
-
-    @Test
-    public void testCxfBusConfiguration() throws Exception {
-        // get the camelContext from application context
-        CamelContext camelContext = (CamelContext) ctx.getBean("camel");
-        ProducerTemplate template = camelContext.createProducerTemplate();
-
-        Exchange reply = template.request("cxf:bean:serviceEndpoint", new 
Processor() {
-            public void process(final Exchange exchange) {
-                final List<String> params = new ArrayList<String>();
-                params.add("hello");
-                exchange.getIn().setBody(params);
-                exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, 
"echo");
-            }
-        });
-
-        Exception ex = reply.getException();
-        assertTrue("Should get the fault here", ex instanceof 
org.apache.cxf.interceptor.Fault);
+        assertEquals("Got the wrong endpoint address", 
"http://localhost:9000/router";, routerEndpoint.getAddress());
+        assertEquals("Got the wrong endpont service class", 
"org.apache.camel.component.cxf.HelloService", 
routerEndpoint.getServiceClass().getCanonicalName());
+        assertEquals("Got the wrong handlers size", 1, 
routerEndpoint.getHandlers().size());
+        assertEquals("Got the wrong schemalocations size", 1, 
routerEndpoint.getSchemaLocations().size());
+        assertEquals("Got the wrong schemalocation", 
"classpath:wsdl/Message.xsd", routerEndpoint.getSchemaLocations().get(0));
     }
    
 }

Modified: 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java?rev=1032256&r1=1032255&r2=1032256&view=diff
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java
 Sun Nov  7 11:16:36 2010
@@ -46,5 +46,13 @@ public class CxfEndpointBeanWithBusTest 
         assertTrue(endpoint.getBus().getInInterceptors().size() >= 1);
         assertEquals(LoggingInInterceptor.class, 
endpoint.getBus().getInInterceptors().get(0).getClass());
     }
+    
+    @Test
+    public void testCxfEndpointBeanDefinitionParser() {
+        CxfEndpointBean routerEndpoint = 
(CxfEndpointBean)ctx.getBean("routerEndpoint");
+        assertEquals("Got the wrong endpoint address", 
"http://localhost:9000/router";, routerEndpoint.getAddress());
+        assertEquals("Got the wrong endpont service class", 
"org.apache.camel.component.cxf.HelloService", 
routerEndpoint.getServiceClass().getCanonicalName());
+        
+    }
 
 }

Added: 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterTest.java?rev=1032256&view=auto
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterTest.java
 (added)
+++ 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterTest.java
 Sun Nov  7 11:16:36 2010
@@ -0,0 +1,61 @@
+/**
+ * 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.camel.component.cxf.spring;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.cxf.CxfConstants;
+import org.junit.Test;
+
+public class CxfEndpointBeansRouterTest extends AbstractSpringBeanTestSupport {
+
+    protected String[] getApplicationContextFiles() {
+        return new 
String[]{"org/apache/camel/component/cxf/spring/CxfEndpointBeansRouter.xml"};
+    }
+
+    @Test
+    public void testCxfEndpointBeanDefinitionParser() {
+        CxfEndpointBean routerEndpoint = 
(CxfEndpointBean)ctx.getBean("routerEndpoint");
+        assertEquals("Got the wrong endpoint address", 
routerEndpoint.getAddress(), "http://localhost:9000/router";);
+        assertEquals("Got the wrong endpont service class", 
routerEndpoint.getServiceClass().getCanonicalName(), 
"org.apache.camel.component.cxf.HelloService");
+    }
+
+    @Test
+    public void testCxfBusConfiguration() throws Exception {
+        // get the camelContext from application context
+        CamelContext camelContext = (CamelContext) ctx.getBean("camel");
+        ProducerTemplate template = camelContext.createProducerTemplate();
+
+        Exchange reply = template.request("cxf:bean:serviceEndpoint", new 
Processor() {
+            public void process(final Exchange exchange) {
+                final List<String> params = new ArrayList<String>();
+                params.add("hello");
+                exchange.getIn().setBody(params);
+                exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, 
"echo");
+            }
+        });
+
+        Exception ex = reply.getException();
+        assertTrue("Should get the fault here", ex instanceof 
org.apache.cxf.interceptor.Fault);
+    }
+   
+}

Propchange: 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfEndpointBeans.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfEndpointBeans.xml?rev=1032256&view=auto
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfEndpointBeans.xml
 (added)
+++ 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfEndpointBeans.xml
 Sun Nov  7 11:16:36 2010
@@ -0,0 +1,37 @@
+<?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:cxf="http://camel.apache.org/schema/cxf";
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/cxf 
http://camel.apache.org/schema/cxf/camel-cxf.xsd
+       http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <bean id="fromEndpointJaxwsHandler" 
class="org.apache.camel.wsdl_first.JaxwsTestHandler"/>
+
+  <cxf:cxfEndpoint id="routerEndpoint" address="http://localhost:9000/router";
+    serviceClass="org.apache.camel.component.cxf.HelloService">
+  </cxf:cxfEndpoint>
+
+
+  <cxf:cxfEndpoint id="serviceEndpoint" 
address="http://localhost:9002/helloworld";
+    serviceClass="org.apache.camel.component.cxf.HelloService"/>
+
+</beans>

Propchange: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfEndpointBeans.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfEndpointBeans.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfEndpointBeans.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml?rev=1032256&r1=1032255&r2=1032256&view=diff
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml
 (original)
+++ 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml
 Sun Nov  7 11:16:36 2010
@@ -24,9 +24,15 @@
        http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
+  <bean id="fromEndpointJaxwsHandler" 
class="org.apache.camel.wsdl_first.JaxwsTestHandler"/>
 
   <cxf:cxfEndpoint id="routerEndpoint" address="http://localhost:9000/router";
-    serviceClass="org.apache.camel.component.cxf.HelloService"/>
+    serviceClass="org.apache.camel.component.cxf.HelloService">
+    <cxf:schemaLocations>
+       <cxf:schemaLocation>classpath:wsdl/Message.xsd</cxf:schemaLocation>
+    </cxf:schemaLocations>
+    <cxf:handlers><ref bean="fromEndpointJaxwsHandler"/></cxf:handlers>
+  </cxf:cxfEndpoint>
 
 
   <cxf:cxfEndpoint id="serviceEndpoint" 
address="http://localhost:9002/helloworld";


Reply via email to