svn commit: r713292 - in /activemq/camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/ test/java/org/apache/camel/component/cxf/ test/resources/org/apache/camel/component/cxf/

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r713292 - in /activemq/camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/ test/java/org/apache/camel/component/cxf/ test/resources/org/apache/camel/component/cxf/

ningjiang
Author: ningjiang
Date: Tue Nov 11 23:40:29 2008
New Revision: 713292

URL: http://svn.apache.org/viewvc?rev=713292&view=rev
Log:
CAMEL-1079 patch applied with thanks to William

Added:
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadWithFeatureRouterTest.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/TestCxfFeature.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointWithFeatureBeans.xml   (with props)
Modified:
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=713292&r1=713291&r2=713292&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java Tue Nov 11 23:40:29 2008
@@ -89,15 +89,7 @@
 
         boolean jsr181Enabled = CxfEndpointUtils.hasWebServiceAnnotation(serviceClass);
         cfb.setJSR181Enabled(jsr181Enabled);
-        dataFormat = CxfEndpointUtils.getDataFormat(endpoint);
-        if (dataFormat.equals(DataFormat.MESSAGE)) {
-            cfb.getFeatures().add(new MessageDataFormatFeature());
-            // features.add(new LoggingFeature());
-        } else if (dataFormat.equals(DataFormat.PAYLOAD)) {
-            cfb.getFeatures().add(new PayLoadDataFormatFeature());
-            // features.add(new LoggingFeature());
-        }
-
+        
         return createClientFromClientFactoryBean(cfb);
     }
 
@@ -153,6 +145,13 @@
                 cfb.setWsdlURL(endpoint.getWsdlURL());
             }
         }
+        
+        if (dataFormat.equals(DataFormat.MESSAGE)) {
+            cfb.getFeatures().add(new MessageDataFormatFeature());
+        } else if (dataFormat.equals(DataFormat.PAYLOAD)) {
+            cfb.getFeatures().add(new PayLoadDataFormatFeature());
+        }
+        
         cfb.setBus(bus);
         return cfb.create();
     }

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java?rev=713292&r1=713291&r2=713292&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java Tue Nov 11 23:40:29 2008
@@ -16,22 +16,18 @@
  */
 package org.apache.camel.component.cxf;
 
-import java.lang.reflect.UndeclaredThrowableException;
-
 import javax.xml.namespace.QName;
 import javax.xml.ws.Endpoint;
 import javax.xml.ws.Service;
 
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.spring.SpringCamelContext;
-import org.apache.camel.spring.processor.SpringTestHelper;
 import org.apache.cxf.jaxws.EndpointImpl;
 import org.apache.hello_world_soap_http.Greeter;
 import org.apache.hello_world_soap_http.GreeterImpl;
 import org.apache.hello_world_soap_http.NoSuchCodeLitFault;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 public class CXFGreeterRouterTest extends CxfRouterTestSupport {
     protected AbstractXmlApplicationContext applicationContext;

Added: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadWithFeatureRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadWithFeatureRouterTest.java?rev=713292&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadWithFeatureRouterTest.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadWithFeatureRouterTest.java Tue Nov 11 23:40:29 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.camel.component.cxf;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.processor.SpringTestHelper;
+
+/**
+ * The Greeter Payload mode test that is configured with CXF features.
+ */
+public class CxfGreeterPayLoadWithFeatureRouterTest  extends CXFGreeterRouterTest {
+
+    @Override
+    protected void setUp() throws Exception {
+        setUseRouteBuilder(false);
+        super.setUp();
+        
+        CxfEndpoint endpoint = getMandatoryEndpoint("cxf:bean:serviceEndpoint?dataFormat=PAYLOAD",
+                CxfEndpoint.class);
+        
+        assertEquals(TestCxfFeature.class, endpoint.getCxfEndpointBean().getFeatures().get(0).getClass());
+        assertEquals(DataFormat.PAYLOAD.toString(), endpoint.getDataFormat());
+    }  
+    
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return SpringTestHelper.createSpringCamelContext(this,
+                "org/apache/camel/component/cxf/GreeterEndpointWithFeatureBeans.xml");
+    }
+
+}

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

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

Added: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/TestCxfFeature.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/TestCxfFeature.java?rev=713292&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/TestCxfFeature.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/TestCxfFeature.java Tue Nov 11 23:40:29 2008
@@ -0,0 +1,23 @@
+/**
+ * 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;
+
+import org.apache.cxf.feature.AbstractFeature;
+
+public class TestCxfFeature extends AbstractFeature {
+
+}

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

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

Added: activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointWithFeatureBeans.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointWithFeatureBeans.xml?rev=713292&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointWithFeatureBeans.xml (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointWithFeatureBeans.xml Tue Nov 11 23:40:29 2008
@@ -0,0 +1,57 @@
+<?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://activemq.apache.org/camel/schema/cxfEndpoint"
+
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://activemq.apache.org/camel/schema/cxfEndpoint http://activemq.apache.org/camel/schema/cxfEndpoint/camel-cxf.xsd
+       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.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-jetty.xml" />
+   <!-- Added the import for testing the CAMEL-329 -->
+
+   <cxf:cxfEndpoint id="routerEndpoint" address="http://localhost:9003/CamelContext/RouterPort"
+     serviceClass="org.apache.hello_world_soap_http.GreeterImpl"/>
+
+
+   <cxf:cxfEndpoint id="serviceEndpoint" address="http://localhost:9000/SoapContext/SoapPort"
+     wsdlURL="testutils/hello_world.wsdl"
+     serviceClass="org.apache.hello_world_soap_http.Greeter"
+     endpointName="s:SoapPort"
+     serviceName="s:SOAPService"
+     xmlns:s="http://apache.org/hello_world_soap_http">
+       <cxf:features>
+           <bean class="org.apache.camel.component.cxf.TestCxfFeature"/>
+       </cxf:features>
+   </cxf:cxfEndpoint>
+
+   <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route errorHandlerRef="noErrorHandler">
+      <from uri="cxf:bean:routerEndpoint?dataFormat=PAYLOAD" />
+      <to uri="cxf:bean:serviceEndpoint?dataFormat=PAYLOAD" />
+    </route>
+   </camelContext>
+
+   <bean id="noErrorHandler" class="org.apache.camel.builder.NoErrorHandlerBuilder"/>
+
+</beans>
+

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

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

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