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/04/11 11:20:46 UTC

svn commit: r527428 - in /incubator/cxf/trunk/tools: common/src/main/java/org/apache/cxf/tools/common/ javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/...

Author: jliu
Date: Wed Apr 11 02:20:45 2007
New Revision: 527428

URL: http://svn.apache.org/viewvc?view=rev&rev=527428
Log:
Added Apache header into test resources. Added more test cases.

Added:
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl   (with props)
Modified:
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_async.wsdl
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_stock_bare.wsdl

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java?view=diff&rev=527428&r1=527427&r2=527428
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java Wed Apr 11 02:20:45 2007
@@ -111,25 +111,18 @@
         return result;
     }
     
-    private String normalizeCRLF(InputStream instream) {
+    private static String normalizeCRLF(InputStream instream) {
         BufferedReader in = new BufferedReader(new InputStreamReader(instream));
         StringBuffer result = new StringBuffer();
         String line = null;
-        boolean commentChecked = false;
-        String comment = "<!-- Generated by <javatowsdl>";
 
         try {
             line = in.readLine();
             while (line != null) {
-                if (!commentChecked && line.startsWith(comment)) {
-                    commentChecked = true;
-                    continue;
-                }
-
-                StringTokenizer tok = new StringTokenizer(line);
+                String[] tok = line.split("\\s");
 
-                while (tok.hasMoreTokens()) {
-                    String token = tok.nextToken();
+                for (int x = 0; x < tok.length; x++) {
+                    String token = tok[x];
                     result.append("  " + token);
                 }
                 line = in.readLine();
@@ -138,6 +131,15 @@
             ex.printStackTrace();
         }
 
-        return result.toString();
+        String rtn = result.toString();
+
+        //remove Apache header
+        int headerIndexStart = rtn.indexOf("<!--");
+        int headerIndexEnd = rtn.indexOf("-->");
+        if (headerIndexStart != -1 && headerIndexEnd != -1 && headerIndexStart < headerIndexEnd) {
+            rtn = rtn.substring(0, headerIndexStart - 1) + rtn.substring(headerIndexEnd + 4);
+        }
+
+        return rtn;
     }
 }

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java?view=diff&rev=527428&r1=527427&r2=527428
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java Wed Apr 11 02:20:45 2007
@@ -72,7 +72,7 @@
         assertTrue(output.exists());
     }
 
-    // TODO: CXF-519
+    //FIXME: CXF-519
     public void xtestAsyn() throws Exception {
         builder.setServiceClass(org.apache.hello_world_async_soap_http.GreeterAsync.class);
         ServiceInfo service = builder.build();
@@ -115,17 +115,20 @@
         assertTrue(output.exists());
 
     }
-
-    // TODO:
-    public void xtestDocLitUseClassPathFlag() throws Exception {
+    
+    //FIXME: CXF-519
+    public void xtestDocLit() throws Exception {
         builder.setServiceClass(org.apache.hello_world_doc_lit.Greeter.class);
         ServiceInfo service = builder.build();
-
         generator.setServiceModel(service);
-        File file = getOutputFile("doc_lit.wsdl");
+        File output = getOutputFile("hello_doc_lit.wsdl");
         assertNotNull(output);
-        generator.generate(file);
+        generator.generate(output);
         assertTrue(output.exists());
+
+        String expectedFile = this.getClass().getResource("expected/expected_hello_world_doc_lit.wsdl")
+            .getFile();
+        assertFileEquals(expectedFile, output.getAbsolutePath());
     }
 
     // TODO:

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_async.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_async.wsdl?view=diff&rev=527428&r1=527427&r2=527428
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_async.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_async.wsdl Wed Apr 11 02:20:45 2007
@@ -1,4 +1,22 @@
 <?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 
     xmlns="http://schemas.xmlsoap.org/wsdl/" 
     xmlns:http-conf="http://schemas.iona.com/transports/http/configuration" 

Added: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl?view=auto&rev=527428
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl (added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl Wed Apr 11 02:20:45 2007
@@ -0,0 +1,172 @@
+<?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_doc_lit" 
+    xmlns="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:tns="http://apache.org/hello_world_doc_lit"
+    xmlns:x1="http://apache.org/hello_world_doc_lit/types"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    <wsdl:types>
+        <schema targetNamespace="http://apache.org/hello_world_doc_lit/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="sayHi">
+            <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_SOAPBinding" type="tns:Greeter">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        
+        <wsdl:operation name="sayHi">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="sayHiRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="sayHiResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="greetMeResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMeOneWay">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeOneWayRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+        </wsdl:operation>
+
+			<wsdl:operation name="pingMe">
+			<soap:operation style="document"/>
+			<wsdl:input>
+				<soap:body use="literal"/>
+			</wsdl:input>
+			<wsdl:output>
+				<soap:body use="literal"/>
+			</wsdl:output>
+			<wsdl:fault name="pingMeFault">
+				<soap:fault name="pingMeFault" use="literal"/>
+			</wsdl:fault>
+		</wsdl:operation>
+        
+    </wsdl:binding>
+    <wsdl:service name="SOAPService">
+        <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+            <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file

Propchange: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_stock_bare.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_stock_bare.wsdl?view=diff&rev=527428&r1=527427&r2=527428
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_stock_bare.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_stock_bare.wsdl Wed Apr 11 02:20:45 2007
@@ -1,4 +1,22 @@
 <?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="StockService" targetNamespace="http://docbare.classnoanno.fortest.tools.cxf.apache.org/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://docbare.classnoanno.fortest.tools.cxf.apache.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
   <wsdl:message name="getPriceResponse">
     <wsdl:part name="return" type="xsd:float">