You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ay...@apache.org on 2013/08/13 16:13:31 UTC
git commit: CAMEL-6633: Add some ws-spec tests to blueprint cxf tests
Updated Branches:
refs/heads/master d9eb98ca8 -> 376d30152
CAMEL-6633: Add some ws-spec tests to blueprint cxf tests
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/376d3015
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/376d3015
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/376d3015
Branch: refs/heads/master
Commit: 376d301526b123c78c894fc40eadd1e5d16a2964
Parents: d9eb98c
Author: Akitoshi Yoshida <ay...@apache.org>
Authored: Tue Aug 13 16:11:26 2013 +0200
Committer: Akitoshi Yoshida <ay...@apache.org>
Committed: Tue Aug 13 16:13:14 2013 +0200
----------------------------------------------------------------------
tests/camel-blueprint-cxf-test/pom.xml | 30 ++++++
.../test/cxf/blueprint/CxfConsumerWSRMTest.java | 77 ++++++++++++++++
.../test/cxf/blueprint/CxfConsumerWSRMBeans.xml | 97 ++++++++++++++++++++
3 files changed, 204 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/376d3015/tests/camel-blueprint-cxf-test/pom.xml
----------------------------------------------------------------------
diff --git a/tests/camel-blueprint-cxf-test/pom.xml b/tests/camel-blueprint-cxf-test/pom.xml
index d717f75..a13eb5c 100644
--- a/tests/camel-blueprint-cxf-test/pom.xml
+++ b/tests/camel-blueprint-cxf-test/pom.xml
@@ -76,6 +76,11 @@
<groupId>org.apache.aries.quiesce</groupId>
<artifactId>org.apache.aries.quiesce.api</artifactId>
</exclusion>
+ <!-- exclude additional unneeded components -->
+ <exclusion>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
+ </exclusion>
</exclusions>
<scope>test</scope>
</dependency>
@@ -88,6 +93,12 @@
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-bindings-soap</artifactId>
+ <version>${cxf-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf-version}</version>
<scope>test</scope>
@@ -98,6 +109,25 @@
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
+ <!-- for ws-* tests -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-addr</artifactId>
+ <version>${cxf-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-policy</artifactId>
+ <version>${cxf-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-rm</artifactId>
+ <version>${cxf-version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- osgi -->
<dependency>
http://git-wip-us.apache.org/repos/asf/camel/blob/376d3015/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/test/cxf/blueprint/CxfConsumerWSRMTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/test/cxf/blueprint/CxfConsumerWSRMTest.java b/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/test/cxf/blueprint/CxfConsumerWSRMTest.java
new file mode 100644
index 0000000..47b3baa
--- /dev/null
+++ b/tests/camel-blueprint-cxf-test/src/test/java/org/apache/camel/test/cxf/blueprint/CxfConsumerWSRMTest.java
@@ -0,0 +1,77 @@
+/**
+ * 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 java.util.Properties;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.camel.component.cxf.CXFTestSupport;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.hello_world_soap_http.Greeter;
+import org.junit.Test;
+
+public class CxfConsumerWSRMTest extends CamelBlueprintTestSupport {
+ private static final QName SERVICE_NAME = new QName("http://apache.org/hello_world_soap_http",
+ "SOAPService");
+ private static final QName PORT_NAME = new QName("http://apache.org/hello_world_soap_http",
+ "SoapPort");
+
+ @Override
+ protected Properties useOverridePropertiesWithPropertiesComponent() {
+ Properties extra = new Properties();
+ extra.put("router.address", "http://localhost:" + CXFTestSupport.getPort1() + "/CxfConsumerWSRMTest/router");
+ return extra;
+ }
+
+ @Override
+ protected String getBlueprintDescriptor() {
+ return "org/apache/camel/test/cxf/blueprint/CxfConsumerWSRMBeans.xml";
+ }
+
+ public boolean isCreateCamelContextPerClass() {
+ return true;
+ }
+
+ @Test
+ public void testInvokeGreeter() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+
+ Bus clientBus = context.getRegistry().lookupByNameAndType("client-bus", Bus.class);
+ assertNotNull(clientBus);
+
+ BusFactory.setThreadDefaultBus(clientBus);
+ try {
+ Service service = Service.create(SERVICE_NAME);
+ service.addPort(PORT_NAME, "http://schemas.xmlsoap.org/soap/",
+ "http://localhost:" + CXFTestSupport.getPort1() + "/CxfConsumerWSRMTest/router");
+ Greeter greeter = service.getPort(PORT_NAME, Greeter.class);
+
+ greeter.greetMeOneWay("test");
+ } finally {
+ BusFactory.setThreadDefaultBus(null);
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/376d3015/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfConsumerWSRMBeans.xml
----------------------------------------------------------------------
diff --git a/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfConsumerWSRMBeans.xml b/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfConsumerWSRMBeans.xml
new file mode 100644
index 0000000..c7ac877
--- /dev/null
+++ b/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfConsumerWSRMBeans.xml
@@ -0,0 +1,97 @@
+<?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:cxf="http://camel.apache.org/schema/blueprint/cxf"
+ xmlns:cxf-core="http://cxf.apache.org/blueprint/core"
+ xmlns:soap="http://cxf.apache.org/blueprint/bindings/soap"
+ xmlns:wsa="http://cxf.apache.org/ws/addressing"
+ xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
+ xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager"
+ 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://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd
+ http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
+ http://cxf.apache.org/blueprint/bindings/soap http://cxf.apache.org/schemas/configuration/blueprint/soap.xsd
+ http://schemas.xmlsoap.org/ws/2005/02/rm/policy http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
+ http://cxf.apache.org/ws/rm/manager http://cxf.apache.org/schemas/configuration/wsrm-manager.xsd
+ http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-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">
+
+ <!-- blueprint property placeholders -->
+ <cm:property-placeholder persistent-id="my-placeholders">
+ <cm:default-properties>
+ <cm:property name="router.address" value="http://localhost:9000/routerEndpoint" />
+ </cm:default-properties>
+ </cm:property-placeholder>
+
+ <cxf-core:bus id="router-bus" bus="router-bus">
+ <cxf-core:features>
+ <cxf-core:logging />
+ <wsa:addressing/>
+ <wsrm-mgr:reliableMessaging>
+ <wsrm-policy:RMAssertion>
+ <wsrm-policy:BaseRetransmissionInterval Milliseconds="4000"/>
+ <wsrm-policy:AcknowledgementInterval Milliseconds="0"/>
+ </wsrm-policy:RMAssertion>
+ <wsrm-mgr:sourcePolicy>
+ </wsrm-mgr:sourcePolicy>
+ <wsrm-mgr:destinationPolicy>
+ <wsrm-mgr:acksPolicy intraMessageThreshold="0" />
+ </wsrm-mgr:destinationPolicy>
+ </wsrm-mgr:reliableMessaging>
+ </cxf-core:features>
+ </cxf-core:bus>
+
+ <cxf-core:bus id="client-bus" bus="client-bus">
+ <cxf-core:features>
+ <cxf-core:logging />
+ <wsa:addressing/>
+ <wsrm-mgr:reliableMessaging>
+ <wsrm-policy:RMAssertion>
+ <wsrm-policy:BaseRetransmissionInterval Milliseconds="4000"/>
+ <wsrm-policy:AcknowledgementInterval Milliseconds="0"/>
+ </wsrm-policy:RMAssertion>
+ <wsrm-mgr:sourcePolicy>
+ </wsrm-mgr:sourcePolicy>
+ <wsrm-mgr:destinationPolicy>
+ <wsrm-mgr:acksPolicy intraMessageThreshold="0" />
+ </wsrm-mgr:destinationPolicy>
+ </wsrm-mgr:reliableMessaging>
+ </cxf-core:features>
+ </cxf-core:bus>
+
+ <cxf:cxfEndpoint id="routerEndpoint" address="{{router.address}}"
+ serviceClass="org.apache.hello_world_soap_http.Greeter" bus="router-bus">
+ <cxf:properties>
+ <entry key="dataFormat" value="PAYLOAD"/>
+ </cxf:properties>
+ </cxf:cxfEndpoint>
+
+ <camel:camelContext id="camel">
+ <camel:route>
+ <camel:from uri="cxf:bean:routerEndpoint?synchronous=true" />
+ <camel:to uri="mock:result" />
+ </camel:route>
+ </camel:camelContext>
+
+</blueprint>