You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ay...@apache.org on 2015/12/03 14:15:08 UTC

cxf git commit: add another wsdl generation test case for parameters with multiple headers

Repository: cxf
Updated Branches:
  refs/heads/master 3a6981463 -> 1f608e3e3


add another wsdl generation test case for parameters with multiple headers


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1f608e3e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1f608e3e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1f608e3e

Branch: refs/heads/master
Commit: 1f608e3e36270aef1873cb57d2b63abb5a3df951
Parents: 3a69814
Author: Akitoshi Yoshida <ay...@apache.org>
Authored: Thu Dec 3 12:37:26 2015 +0100
Committer: Akitoshi Yoshida <ay...@apache.org>
Committed: Thu Dec 3 14:13:30 2015 +0100

----------------------------------------------------------------------
 .../cxf/tools/fortest/headers/SomeHeaders.java  | 39 ++++++++++++
 .../internal/jaxws/JaxwsServiceBuilderTest.java | 15 +++++
 .../jaxws/expected/expected_someheaders.wsdl    | 63 ++++++++++++++++++++
 3 files changed, 117 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/1f608e3e/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/headers/SomeHeaders.java
----------------------------------------------------------------------
diff --git a/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/headers/SomeHeaders.java b/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/headers/SomeHeaders.java
new file mode 100644
index 0000000..acf879d
--- /dev/null
+++ b/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/headers/SomeHeaders.java
@@ -0,0 +1,39 @@
+/**
+ * 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.cxf.tools.fortest.headers;
+
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+
+@WebService(targetNamespace = "http://apache.org/cxf/test", name = "SomeHeaders")
+public interface SomeHeaders {
+
+    // using four parameters where two being headers
+    @WebMethod()
+    @WebResult (name = "someHeadersResponse") 
+    String hello(
+                 @WebParam(name = "body1") String body1,
+                 @WebParam(name = "body2") String body2,
+                 @WebParam(header = true, name = "header1") String header1,
+                 @WebParam(header = true, name = "header2") String header2);
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/1f608e3e/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
----------------------------------------------------------------------
diff --git a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
index f49aaae..a97c3ea 100644
--- a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
+++ b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
@@ -259,6 +259,21 @@ public class JaxwsServiceBuilderTest extends ProcessorTestBase {
         assertWsdlEquals(new File(expectedFile), file);
     }
 
+    @Test
+    public void testMultipleHeaders() throws Exception {
+        builder.setServiceClass(org.apache.cxf.tools.fortest.headers.SomeHeaders.class);
+        ServiceInfo service = builder.createService();
+
+        generator.setServiceModel(service);
+        File output = getOutputFile("someheaders.wsdl");
+        assertNotNull(output);
+        generator.generate(output);
+        assertTrue(output.exists());
+
+        URI expectedFile = this.getClass().getResource("expected/expected_someheaders.wsdl").toURI();
+        assertWsdlEquals(new File(expectedFile), output);
+    }
+    
     // TODO: assertFileEquals
     @Test
     public void testCXF188() throws Exception {

http://git-wip-us.apache.org/repos/asf/cxf/blob/1f608e3e/tools/javato/ws/src/test/resources/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_someheaders.wsdl
----------------------------------------------------------------------
diff --git a/tools/javato/ws/src/test/resources/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_someheaders.wsdl b/tools/javato/ws/src/test/resources/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_someheaders.wsdl
new file mode 100644
index 0000000..6c8af23
--- /dev/null
+++ b/tools/javato/ws/src/test/resources/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_someheaders.wsdl
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="SomeHeadersService" targetNamespace="http://apache.org/cxf/test" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://apache.org/cxf/test" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+  <wsdl:types>
+<xs:schema xmlns:tns="http://apache.org/cxf/test" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://apache.org/cxf/test">
+  <xs:element name="hello" type="tns:hello"/>
+  <xs:element name="helloResponse" type="tns:helloResponse"/>
+  <xs:complexType name="hello">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="body1" type="xs:string"/>
+      <xs:element minOccurs="0" name="body2" type="xs:string"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="helloResponse">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="someHeadersResponse" type="xs:string"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:element name="header1" nillable="true" type="xs:string"/>
+  <xs:element name="header2" nillable="true" type="xs:string"/>
+</xs:schema>
+  </wsdl:types>
+  <wsdl:message name="helloResponse">
+    <wsdl:part name="parameters" element="tns:helloResponse">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="hello">
+    <wsdl:part name="parameters" element="tns:hello">
+    </wsdl:part>
+    <wsdl:part name="header1" element="tns:header1">
+    </wsdl:part>
+    <wsdl:part name="header2" element="tns:header2">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="SomeHeaders">
+    <wsdl:operation name="hello">
+      <wsdl:input name="hello" message="tns:hello">
+    </wsdl:input>
+      <wsdl:output name="helloResponse" message="tns:helloResponse">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="SomeHeadersServiceSoapBinding" type="tns:SomeHeaders">
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="hello">
+      <soap:operation soapAction="" style="document"/>
+      <wsdl:input name="hello">
+        <soap:header message="tns:hello" part="header1" use="literal">
+        </soap:header>
+        <soap:header message="tns:hello" part="header2" use="literal">
+        </soap:header>
+        <soap:body parts="parameters" use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="helloResponse">
+        <soap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="SomeHeadersService">
+    <wsdl:port name="SomeHeadersPort" binding="tns:SomeHeadersServiceSoapBinding">
+      <soap:address location="http://localhost:9090"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>