You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/01/14 07:56:36 UTC

svn commit: r1432814 - in /camel/trunk/tests/camel-blueprint-cxf-test/src/test: java/org/apache/camel/component/cxf/ java/org/apache/camel/test/cxf/blueprint/ resources/org/apache/camel/test/cxf/blueprint/

Author: ningjiang
Date: Mon Jan 14 06:56:36 2013
New Revision: 1432814

URL: http://svn.apache.org/viewvc?rev=1432814&view=rev
Log:
CAMEL-5933 Added an unit test in camel-blueprint-cxf-test

Added:
    camel/trunk/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java
    camel/trunk/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/test/cxf/blueprint/CxfTransportBlueprintTest.java
    camel/trunk/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfTransportBeans.xml

Added: camel/trunk/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java?rev=1432814&view=auto
==============================================================================
--- camel/trunk/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java (added)
+++ camel/trunk/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java Mon Jan 14 06:56:36 2013
@@ -0,0 +1,56 @@
+/**
+ * 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 java.util.List;
+
+public class HelloServiceImpl implements HelloService {
+    int count;
+
+    @Override
+    public String sayHello() {
+        return "Hello";
+    }
+
+    @Override
+    public void ping() {
+        count++;
+        
+    }
+
+    @Override
+    public int getInvocationCount() {
+        return count;
+    }
+
+    @Override
+    public String echo(String text) throws Exception {
+        return text;
+    }
+
+    @Override
+    public Boolean echoBoolean(Boolean bool) {
+        return bool;
+    }
+
+    @Override
+    public String complexParameters(List<String> par1, List<String> par2) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Added: camel/trunk/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/test/cxf/blueprint/CxfTransportBlueprintTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/test/cxf/blueprint/CxfTransportBlueprintTest.java?rev=1432814&view=auto
==============================================================================
--- camel/trunk/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/test/cxf/blueprint/CxfTransportBlueprintTest.java (added)
+++ camel/trunk/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/test/cxf/blueprint/CxfTransportBlueprintTest.java Mon Jan 14 06:56:36 2013
@@ -0,0 +1,48 @@
+/**
+ * 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.test.cxf.blueprint;
+
+import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
+import org.junit.Test;
+
+public class CxfTransportBlueprintTest extends CamelBlueprintTestSupport {
+    
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/test/cxf/blueprint/CxfTransportBeans.xml";
+    }
+    
+    @Override
+    // camel-cxf blueprint schema doesn't publihsed yet
+    protected String getBundleDirectives() {
+        return "blueprint.aries.xml-validation:=false";
+    }
+    
+    @Test
+    public void testPublishEndpointUrl() throws Exception {
+        final String request = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+            + "<soap:Body>"
+            + "<ns1:echo xmlns:ns1=\"http://cxf.component.camel.apache.org/\">"
+            + "<arg0 xmlns=\"http://cxf.component.camel.apache.org/\">hello world</arg0>"
+            + "</ns1:echo></soap:Body></soap:Envelope>";
+        String response = template.requestBody("direct:client", request, String.class);
+        assertNotNull("We should get some response here", response);
+        assertTrue("Get a wrong response.", response.indexOf("hello world") > 0 && response.indexOf("echoResponse") > 0);
+    }
+
+
+}

Added: camel/trunk/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfTransportBeans.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfTransportBeans.xml?rev=1432814&view=auto
==============================================================================
--- camel/trunk/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfTransportBeans.xml (added)
+++ camel/trunk/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfTransportBeans.xml Mon Jan 14 06:56:36 2013
@@ -0,0 +1,50 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns:camel="http://camel.apache.org/schema/blueprint"
+           xmlns:transport="http://cxf.apache.org/transports/camel/blueprint"
+           xmlns:simple="http://cxf.apache.org/blueprint/simple"
+           xmlns:core="http://cxf.apache.org/blueprint/core"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
+           xmlns:s="http://cxf.apache.org/hello_world_soap_http"
+           xsi:schemaLocation="
+             http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
+             http://cxf.apache.org/blueprint/simple http://cxf.apache.org/schemas/blueprint/simple.xsd
+             http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
+             http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+  
+  <!-- make sure the destination is injected with the right camel context -->
+  <transport:destination id="*.camel-destination" camelContext="camel1" />
+  
+  <simple:server serviceClass="org.apache.camel.component.cxf.HelloService" address="camel://direct:server">
+    <simple:serviceBean>
+        <bean class="org.apache.camel.component.cxf.HelloServiceImpl"/>
+    </simple:serviceBean>
+  </simple:server>
+
+   <camel:camelContext id="camel1">
+    <camel:route>
+      <camel:from uri="direct:client" />
+      <camel:to uri="direct:server" />
+    </camel:route>
+   </camel:camelContext>
+
+</blueprint>