You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by jl...@apache.org on 2007/02/06 07:01:32 UTC

svn commit: r504004 - in /incubator/cxf/trunk: systests/src/test/java/org/apache/cxf/systest/jaxws/ testutils/ testutils/src/main/java/org/apache/hello_world_xml_http/mixed/ testutils/src/main/resources/wsdl/

Author: jliu
Date: Mon Feb  5 22:01:30 2007
New Revision: 504004

URL: http://svn.apache.org/viewvc?view=rev&rev=504004
Log:
Added system test for mixed style XML binding.

Added:
    incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_xml_http/mixed/
    incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_xml_http/mixed/GreeterImpl.java   (with props)
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_xml_mixed.wsdl   (with props)
Modified:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerXMLBinding.java
    incubator/cxf/trunk/testutils/pom.xml

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java?view=diff&rev=504004&r1=504003&r2=504004
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java Mon Feb  5 22:01:30 2007
@@ -53,6 +53,8 @@
 import org.apache.hello_world_xml_http.bare.Greeter;
 import org.apache.hello_world_xml_http.bare.XMLService;
 import org.apache.hello_world_xml_http.bare.types.MyComplexStructType;
+import org.apache.hello_world_xml_http.mixed.types.SayHi;
+import org.apache.hello_world_xml_http.mixed.types.SayHiResponse;
 import org.apache.hello_world_xml_http.wrapped.GreeterFaultImpl;
 import org.apache.hello_world_xml_http.wrapped.PingMeFault;
 
@@ -63,8 +65,13 @@
     private final QName wrapServiceName = new QName("http://apache.org/hello_world_xml_http/wrapped",
             "XMLService");
 
+    private final QName mixedServiceName = new QName("http://apache.org/hello_world_xml_http/mixed",
+                                                     "XMLService");
+
     private final QName wrapPortName = new QName("http://apache.org/hello_world_xml_http/wrapped", "XMLPort");
 
+    private final QName mixedPortName = new QName("http://apache.org/hello_world_xml_http/mixed", "XMLPort");
+
     private final QName wrapFakePortName = new QName("http://apache.org/hello_world_xml_http/wrapped",
             "FakePort");
 
@@ -160,6 +167,37 @@
             reply = greeter.sayHi();
             assertNotNull("no response received from service", reply);
             assertEquals(response2, reply);
+
+            greeter.greetMeOneWay(System.getProperty("user.name"));
+
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception) ex.getCause();
+        }
+    }
+
+    public void testMixedConnection() throws Exception {
+
+        org.apache.hello_world_xml_http.mixed.XMLService service =
+            new org.apache.hello_world_xml_http.mixed.XMLService(
+                this.getClass().getResource("/wsdl/hello_world_xml_mixed.wsdl"), mixedServiceName);
+        assertNotNull(service);
+
+        String response1 = new String("Hello ");
+        String response2 = new String("Bonjour");
+        try {
+            org.apache.hello_world_xml_http.mixed.Greeter greeter = service.getPort(mixedPortName,
+                    org.apache.hello_world_xml_http.mixed.Greeter.class);
+            String username = System.getProperty("user.name");
+            String reply = greeter.greetMe(username);
+
+            assertNotNull("no response received from service", reply);
+            assertEquals(response1 + username, reply);
+            
+            SayHi request = new SayHi();
+
+            SayHiResponse response = greeter.sayHi1(request);
+            assertNotNull("no response received from service", response);
+            assertEquals(response2, response.getResponseType());
 
             greeter.greetMeOneWay(System.getProperty("user.name"));
 

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerXMLBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerXMLBinding.java?view=diff&rev=504004&r1=504003&r2=504004
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerXMLBinding.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerXMLBinding.java Mon Feb  5 22:01:30 2007
@@ -45,6 +45,10 @@
         Object implementor2 = new HeaderTesterImpl();
         address = "http://localhost:9034/XMLContext/XMLPort";
         Endpoint.publish(address, implementor2);
+        
+        Object implementor3 = new org.apache.hello_world_xml_http.mixed.GreeterImpl();
+        address = "http://localhost:9028/XMLService/XMLPort";
+        Endpoint.publish(address, implementor3);
     }
 
     public static void main(String[] args) {

Modified: incubator/cxf/trunk/testutils/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/pom.xml?view=diff&rev=504004&r1=504003&r2=504004
==============================================================================
--- incubator/cxf/trunk/testutils/pom.xml (original)
+++ incubator/cxf/trunk/testutils/pom.xml Mon Feb  5 22:01:30 2007
@@ -209,6 +209,9 @@
                                     <wsdl>${basedir}/src/main/resources/wsdl/swa-mime.wsdl</wsdl>
                                 </wsdlOption>
                                 <wsdlOption>
+                                    <wsdl>${basedir}/src/main/resources/wsdl/hello_world_xml_mixed.wsdl</wsdl>
+                                </wsdlOption>
+                                <wsdlOption>
                                     <wsdl>${basedir}/src/main/resources/wsdl/hello_world_xml_bare.wsdl</wsdl>
                                 </wsdlOption>
                                 <wsdlOption>

Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_xml_http/mixed/GreeterImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_xml_http/mixed/GreeterImpl.java?view=auto&rev=504004
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_xml_http/mixed/GreeterImpl.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_xml_http/mixed/GreeterImpl.java Mon Feb  5 22:01:30 2007
@@ -0,0 +1,59 @@
+/**
+ * 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.hello_world_xml_http.mixed;
+
+import org.apache.hello_world_xml_http.mixed.types.FaultDetail;
+import org.apache.hello_world_xml_http.mixed.types.SayHi;
+import org.apache.hello_world_xml_http.mixed.types.SayHiResponse;
+
+@javax.jws.WebService(serviceName = "XMLService",
+                      portName = "XMLPort",
+                      endpointInterface = "org.apache.hello_world_xml_http.mixed.Greeter",
+                      targetNamespace = "http://apache.org/hello_world_xml_http/mixed")
+
+@javax.xml.ws.BindingType(value = "http://cxf.apache.org/bindings/xformat")
+
+public class GreeterImpl implements Greeter {
+
+    public String greetMe(String me) {
+        System.out.println("Executing operation greetMe\n");
+        return "Hello " + me;
+    }
+
+    public void greetMeOneWay(String me) {
+        System.out.println("Executing operation greetMeOneWay\n");
+        System.out.println("Hello there " + me);
+    }
+
+    public SayHiResponse sayHi1(SayHi in) {
+        System.out.println("Executing operation sayHi1\n");
+        SayHiResponse response = new SayHiResponse();
+        response.setResponseType("Bonjour");
+        return response;
+
+    }
+
+    public void pingMe() throws PingMeFault {
+        FaultDetail faultDetail = new FaultDetail();
+        faultDetail.setMajor((short)2);
+        faultDetail.setMinor((short)1);
+        throw new PingMeFault("PingMeFault raised by server", faultDetail);
+    }
+}

Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_xml_http/mixed/GreeterImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_xml_http/mixed/GreeterImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_xml_mixed.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_xml_mixed.wsdl?view=auto&rev=504004
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_xml_mixed.wsdl (added)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_xml_mixed.wsdl Mon Feb  5 22:01:30 2007
@@ -0,0 +1,169 @@
+<?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.
+-->
+<wsdl:definitions name="HelloWorld"
+	targetNamespace="http://apache.org/hello_world_xml_http/mixed"
+	xmlns="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+	xmlns:tns="http://apache.org/hello_world_xml_http/mixed"
+	xmlns:x1="http://apache.org/hello_world_xml_http/mixed/types"
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:xformat="http://cxf.apache.org/bindings/xformat"
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<wsdl:types>
+		<schema
+			targetNamespace="http://apache.org/hello_world_xml_http/mixed/types"
+			xmlns="http://www.w3.org/2001/XMLSchema"
+			elementFormDefault="qualified">
+			<element name="sayHi">
+				<complexType />
+			</element>
+			<element name="sayHiResponse">
+				<complexType>
+					<sequence>
+						<element name="responseType" type="xsd:string" />
+					</sequence>
+				</complexType>
+			</element>
+
+			<element name="greetMe">
+				<complexType>
+					<sequence>
+						<element name="requestType" type="xsd:string" />
+					</sequence>
+				</complexType>
+			</element>
+			<element name="greetMeResponse">
+				<complexType>
+					<sequence>
+						<element name="responseType" type="xsd:string" />
+					</sequence>
+				</complexType>
+			</element>
+			<element name="greetMeOneWay">
+				<complexType>
+					<sequence>
+						<element name="requestType" type="xsd:string" />
+					</sequence>
+				</complexType>
+			</element>
+
+			<element name="pingMe">
+				<complexType />
+			</element>
+			<element name="pingMeResponse">
+				<complexType />
+			</element>
+			<element name="faultDetail">
+				<complexType>
+					<sequence>
+						<element name="minor" type="xsd:short" />
+						<element name="major" type="xsd:short" />
+					</sequence>
+				</complexType>
+			</element>
+		</schema>
+	</wsdl:types>
+	<wsdl:message name="sayHiRequest">
+		<wsdl:part element="x1:sayHi" name="in" />
+	</wsdl:message>
+	<wsdl:message name="sayHiResponse">
+		<wsdl:part element="x1:sayHiResponse" name="out" />
+	</wsdl:message>
+	<wsdl:message name="greetMeRequest">
+		<wsdl:part element="x1:greetMe" name="in" />
+	</wsdl:message>
+	<wsdl:message name="greetMeResponse">
+		<wsdl:part element="x1:greetMeResponse" name="out" />
+	</wsdl:message>
+	<wsdl:message name="greetMeOneWayRequest">
+		<wsdl:part element="x1:greetMeOneWay" name="in" />
+	</wsdl:message>
+
+	<wsdl:message name="pingMeRequest">
+		<wsdl:part name="in" element="x1:pingMe" />
+	</wsdl:message>
+	<wsdl:message name="pingMeResponse">
+		<wsdl:part name="out" element="x1:pingMeResponse" />
+	</wsdl:message>
+	<wsdl:message name="pingMeFault">
+		<wsdl:part name="faultDetail" element="x1:faultDetail" />
+	</wsdl:message>
+
+	<wsdl:portType name="Greeter">
+		<wsdl:operation name="sayHi1">
+			<wsdl:input message="tns:sayHiRequest" name="sayHiRequest" />
+			<wsdl:output message="tns:sayHiResponse"
+				name="sayHiResponse" />
+		</wsdl:operation>
+
+		<wsdl:operation name="greetMe">
+			<wsdl:input message="tns:greetMeRequest"
+				name="greetMeRequest" />
+			<wsdl:output message="tns:greetMeResponse"
+				name="greetMeResponse" />
+		</wsdl:operation>
+
+		<wsdl:operation name="greetMeOneWay">
+			<wsdl:input message="tns:greetMeOneWayRequest"
+				name="greetMeOneWayRequest" />
+		</wsdl:operation>
+
+		<wsdl:operation name="pingMe">
+			<wsdl:input name="pingMeRequest"
+				message="tns:pingMeRequest" />
+			<wsdl:output name="pingMeResponse"
+				message="tns:pingMeResponse" />
+			<wsdl:fault name="pingMeFault" message="tns:pingMeFault" />
+		</wsdl:operation>
+
+	</wsdl:portType>
+	<wsdl:binding name="Greeter_XMLBinding" type="tns:Greeter">
+		<xformat:binding />
+
+		<wsdl:operation name="sayHi1">
+			<wsdl:input name="sayHiRequest" />
+			<wsdl:output name="sayHiResponse" />
+		</wsdl:operation>
+
+		<wsdl:operation name="greetMe">
+			<wsdl:input name="greetMeRequest" />
+			<wsdl:output name="greetMeResponse" />
+		</wsdl:operation>
+
+		<wsdl:operation name="greetMeOneWay">
+			<wsdl:input name="greetMeOneWayRequest" />
+		</wsdl:operation>
+
+		<wsdl:operation name="pingMe">
+			<wsdl:input />
+			<wsdl:output />
+			<wsdl:fault name="pingMeFault" />
+		</wsdl:operation>
+	</wsdl:binding>
+
+	<wsdl:service name="XMLService">
+		<wsdl:port binding="tns:Greeter_XMLBinding" name="XMLPort">
+			<http:address
+				location="http://localhost:9028/XMLService/XMLPort" />
+		</wsdl:port>
+	</wsdl:service>
+
+</wsdl:definitions>
+

Propchange: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_xml_mixed.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_xml_mixed.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_xml_mixed.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml