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 2010/11/11 12:17:01 UTC

svn commit: r1033890 - in /camel/trunk/tests/camel-itest-osgi: ./ src/main/resources/ src/test/java/org/apache/camel/itest/osgi/bean/validator/ src/test/java/org/apache/camel/itest/osgi/cxf/ src/test/resources/ src/test/resources/org/apache/camel/itest...

Author: ningjiang
Date: Thu Nov 11 11:17:00 2010
New Revision: 1033890

URL: http://svn.apache.org/viewvc?rev=1033890&view=rev
Log:
CAMEL-3126 Got the cxf osgi test work with JDK 1.5.0

Added:
    camel/trunk/tests/camel-itest-osgi/src/test/resources/report_incident.wsdl   (with props)
Removed:
    camel/trunk/tests/camel-itest-osgi/src/main/resources/report_incident.wsdl
Modified:
    camel/trunk/tests/camel-itest-osgi/pom.xml
    camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java
    camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/camel-config.xml

Modified: camel/trunk/tests/camel-itest-osgi/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/pom.xml?rev=1033890&r1=1033889&r2=1033890&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/pom.xml (original)
+++ camel/trunk/tests/camel-itest-osgi/pom.xml Thu Nov 11 11:17:00 2010
@@ -297,7 +297,7 @@
                         <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
                         <wsdlOptions>
                             <wsdlOption>
-                                <wsdl>${basedir}/src/main/resources/report_incident.wsdl</wsdl>
+                                <wsdl>${basedir}/src/test/resources/report_incident.wsdl</wsdl>
                             </wsdlOption>
                         </wsdlOptions>
                     </configuration>

Modified: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java?rev=1033890&r1=1033889&r2=1033890&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java Thu Nov 11 11:17:00 2010
@@ -77,7 +77,7 @@ public class BeanValidatorTest extends O
                 // using the features to install the camel components
                 scanFeatures(getCamelKarafFeatureUrl(), "camel-core", "camel-test", "camel-bean-validator"),
 
-                //workingDirectory("target/paxrunner/"),
+                workingDirectory("target/paxrunner/"),
                 //provision(newBundle()
                 //        .add("META-INF/validation.xml", BeanValidatorTest.class.getClassLoader().getResource("META-INF/validation.xml"))
                 //        .add("constraints-car.xml", BeanValidatorTest.class.getClassLoader().getResource("constraints-car.xml"))

Modified: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java?rev=1033890&r1=1033889&r2=1033890&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java Thu Nov 11 11:17:00 2010
@@ -29,14 +29,21 @@ import org.ops4j.pax.exam.junit.Configur
 import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
 
+import static org.ops4j.pax.exam.CoreOptions.bootClasspathLibrary;
 import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.felix;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.provision;
+import static org.ops4j.pax.exam.CoreOptions.systemPackage;
 import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.profile;
 import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
 import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
 
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
+
 @RunWith(JUnit4TestRunner.class)
-@Ignore
 public class CxfProxyExampleTest extends OSGiIntegrationSpringTestSupport {
 
     protected static ReportIncidentEndpoint createCXFClient() {
@@ -72,6 +79,10 @@ public class CxfProxyExampleTest extends
     protected OsgiBundleXmlApplicationContext createApplicationContext() {
         return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/cxf/camel-config.xml"});
     }
+    
+    protected void setThreadContextClassLoader() {
+        // do nothing here
+    }
 
     // TODO: CxfConsumer should use OSGi http service (no embedded Jetty)
     // TODO: Make this test work with OSGi
@@ -79,21 +90,36 @@ public class CxfProxyExampleTest extends
     @Configuration
     public static Option[] configure() {
         Option[] options = options(
-            // install the spring dm profile
-            profile("spring.dm").version("1.2.0"),
+            
+            profile("log"),
             profile("compendium"),
-            profile("web"),
-
+            
+            systemPackage("com.sun.xml.bind.marshaller"),
+            systemPackage("com.sun.org.apache.xerces.internal.dom"),
+            systemPackage("com.sun.org.apache.xerces.internal.jaxp"),
+         
             // this is how you set the default log level when using pax logging (logProfile)
             org.ops4j.pax.exam.CoreOptions.systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
 
+            // need to install some karaf features
+            scanFeatures(getKarafFeatureUrl(), "http"),
+            
             // using the features to install the camel components
             scanFeatures(getCamelKarafFeatureUrl(),
-                          "camel-core", "camel-spring", "camel-test", "camel-cxf"),
-
+                          "spring", "spring-dm", "camel-core", "camel-spring", "camel-http", "camel-test", "camel-cxf"),
+                                  
+            // need to install the generated src as the pax-exam doesn't wrap this bundles
+            provision(newBundle()
+                      .add(org.apache.camel.example.reportincident.InputReportIncident.class)
+                      .add(org.apache.camel.example.reportincident.OutputReportIncident.class)
+                      .add(org.apache.camel.example.reportincident.ReportIncidentEndpoint.class)
+                      .add(org.apache.camel.example.reportincident.ReportIncidentEndpointService.class)
+                      .add(org.apache.camel.example.reportincident.ObjectFactory.class)
+                      .build(withBnd())),
+                      
             workingDirectory("target/paxrunner/"),
-
-            equinox());
+            
+            felix());
 
         return options;
     }

Modified: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/camel-config.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/camel-config.xml?rev=1033890&r1=1033889&r2=1033890&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/camel-config.xml (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/camel-config.xml Thu Nov 11 11:17:00 2010
@@ -40,12 +40,12 @@
     </bean>
 
     <!-- a bean to enrich the input -->
-    <bean id="enrichBean" class="org.apache.camel.example.cxf.proxy.EnrichBean"/>
+    <bean id="enrichBean" class="org.apache.camel.itest.osgi.cxf.EnrichBean"/>
 
     <!-- this is the CXF webservice we use as front end -->
     <cxf:cxfEndpoint id="reportIncident"
                      address="http://localhost:9080/camel-itest-osgi/webservices/incident"
-                     serviceClass="org.apache.camel.itest.osgi.cxf.ReportIncidentEndpoint"
+                     serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
                      wsdlURL="report_incident.wsdl"/>
 
     <!-- this is the camel route which proxy the web service and forward it to the real web service -->
@@ -53,7 +53,7 @@
 
         <route>
             <!-- cxf consumer using MESSAGE format -->
-            <from uri="cxf:bean:reportIncident?dataFormat=MESSAGE"/>
+            <from uri="cxf:bean:reportIncident?dataFormat=MESSAGE&amp;synchronous=true"/>
             <!-- log input received -->
             <to uri="log:input"/>
             <!-- enrich the input by ensure the incidentId parameter is set -->

Added: camel/trunk/tests/camel-itest-osgi/src/test/resources/report_incident.wsdl
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/report_incident.wsdl?rev=1033890&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/report_incident.wsdl (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/report_incident.wsdl Thu Nov 11 11:17:00 2010
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    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.
+-->
+
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+	xmlns:tns="http://reportincident.example.camel.apache.org"
+	xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+	targetNamespace="http://reportincident.example.camel.apache.org">
+
+    <!-- Type definitions for input- and output parameters for webservice -->
+    <wsdl:types>
+        <xs:schema targetNamespace="http://reportincident.example.camel.apache.org">
+            <xs:element name="inputReportIncident">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element type="xs:string" name="incidentId"/>
+                        <xs:element type="xs:string" name="incidentDate"/>
+                        <xs:element type="xs:string" name="givenName"/>
+                        <xs:element type="xs:string" name="familyName"/>
+                        <xs:element type="xs:string" name="summary"/>
+                        <xs:element type="xs:string" name="details"/>
+                        <xs:element type="xs:string" name="email"/>
+                        <xs:element type="xs:string" name="phone"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="outputReportIncident">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element type="xs:string" name="code"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+        </xs:schema>
+    </wsdl:types>
+
+    <!-- Message definitions for input and output -->
+    <wsdl:message name="inputReportIncident">
+        <wsdl:part name="in" element="tns:inputReportIncident"/>
+    </wsdl:message>
+    <wsdl:message name="outputReportIncident">
+        <wsdl:part name="out" element="tns:outputReportIncident"/>
+    </wsdl:message>
+
+    <!-- Port (interface) definitions -->
+    <wsdl:portType name="ReportIncidentEndpoint">
+        <wsdl:operation name="ReportIncident">
+            <wsdl:input message="tns:inputReportIncident"/>
+            <wsdl:output message="tns:outputReportIncident"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+    <!-- Port bindings to transports and encoding - HTTP, document literal encoding is used -->
+    <wsdl:binding name="ReportIncidentBinding" type="tns:ReportIncidentEndpoint">
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="ReportIncident">
+            <soap:operation
+                    soapAction="http://reportincident.example.camel.apache.org/ReportIncident"
+                    style="document"/>
+            <wsdl:input>
+                <soap:body parts="in" use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body parts="out" use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <!-- Service definition -->
+    <wsdl:service name="ReportIncidentEndpointService">
+        <wsdl:port name="ReportIncidentService" binding="tns:ReportIncidentBinding">
+            <soap:address location="http://localhost:9080/camel-itest-osgi/webservices/incident"/>
+        </wsdl:port>
+    </wsdl:service>
+
+</wsdl:definitions>

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/report_incident.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/report_incident.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/report_incident.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml