You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by mm...@apache.org on 2007/04/11 10:29:43 UTC

svn commit: r527410 - 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: mmao
Date: Wed Apr 11 01:29:40 2007
New Revision: 527410

URL: http://svn.apache.org/viewvc?view=rev&rev=527410
Log:
* Move file compile from JaxwsServiceBuilderTest to ProcessorTestBase to be shared by other tests.
* Rename the resources to expected, because after the test finished, we removed the resources dir.


Added:
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/
    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
Removed:
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/resources/
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

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=527410&r1=527409&r2=527410
==============================================================================
--- 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 01:29:40 2007
@@ -19,13 +19,17 @@
 
 package org.apache.cxf.tools.common;
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.StringTokenizer;
 
 import junit.framework.TestCase;
-
 import org.apache.cxf.helpers.FileUtils;
 
 public class ProcessorTestBase extends TestCase {
@@ -66,5 +70,74 @@
     
     protected String getLocation(String wsdlFile) throws URISyntaxException {
         return getClass().getResource(wsdlFile).toString();
+    }
+
+    protected void compareTextFile(String location1, String location2) {
+        String str1 = getStringFromFile(location1);
+        String str2 = getStringFromFile(location2);
+
+        StringTokenizer st1 = new StringTokenizer(str1);
+        StringTokenizer st2 = new StringTokenizer(str2);
+
+        while (st1.hasMoreTokens() && st2.hasMoreTokens()) {
+            String tok1 = st1.nextToken();
+            String tok2 = st2.nextToken();
+
+            assertEquals("Compare failed", tok1, tok2);
+        }
+
+        assertTrue(!st1.hasMoreTokens());
+    }
+
+    private String getStringFromFile(String location) {
+        InputStream is = null;
+        String result = null;
+
+        try {
+            is = new FileInputStream(new File(location));
+            result = normalizeCRLF(is);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (is != null) {
+                try {
+                    is.close();
+                } catch (Exception e) {
+                    //do nothing
+                }
+            }
+        }
+
+        return result;
+    }
+    
+    private 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);
+
+                while (tok.hasMoreTokens()) {
+                    String token = tok.nextToken();
+                    result.append("  " + token);
+                }
+                line = in.readLine();
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+
+        return result.toString();
     }
 }

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=527410&r1=527409&r2=527410
==============================================================================
--- 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 01:29:40 2007
@@ -19,12 +19,7 @@
 
 package org.apache.cxf.tools.java2wsdl.processor.internal.jaxws;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.StringTokenizer;
 
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.service.model.ServiceInfo;
@@ -42,9 +37,6 @@
         builder.setBus(BusFactory.getDefaultBus());
     }
 
-    public void tearDown() {
-    }
-    
     public void testGetOutputFile() {
         builder.setServiceClass(Stock.class);
         assertNull(builder.getOutputFile());
@@ -64,7 +56,7 @@
         generator.generate(output);
         assertTrue(output.exists());
         
-        String expectedFile = this.getClass().getResource("resources/expected_stock_bare.wsdl").getFile();
+        String expectedFile = getClass().getResource("expected/expected_stock_bare.wsdl").getFile();
         compareTextFile(expectedFile, output.getAbsolutePath());
     }
 
@@ -88,7 +80,7 @@
         generator.generate(output);
         assertTrue(output.exists());   
 
-        String expectedFile = this.getClass().getResource("resources/expected_hello_world_async.wsdl")
+        String expectedFile = this.getClass().getResource("expected/expected_hello_world_async.wsdl")
             .getFile();
         compareTextFile(expectedFile, output.getAbsolutePath());
     }
@@ -97,72 +89,4 @@
         return new File(output, fileName);
     }
     
-    public static void compareTextFile(String location1, String location2) {
-        String str1 = getStringFromFile(location1);
-        String str2 = getStringFromFile(location2);
-
-        StringTokenizer st1 = new StringTokenizer(str1);
-        StringTokenizer st2 = new StringTokenizer(str2);
-
-        while (st1.hasMoreTokens() && st2.hasMoreTokens()) {
-            String tok1 = st1.nextToken();
-            String tok2 = st2.nextToken();
-
-            assertEquals("Compare failed", tok1, tok2);
-        }
-
-        assertTrue(!st1.hasMoreTokens());
-    }
-
-    private static String getStringFromFile(String location) {
-        InputStream is = null;
-        String result = null;
-
-        try {
-            is = new FileInputStream(new File(location));
-            result = normalizeCRLF(is);
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            if (is != null) {
-                try {
-                    is.close();
-                } catch (Exception e) {
-                    //do nothing
-                }
-            }
-        }
-
-        return result;
-    }
-    
-    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);
-
-                while (tok.hasMoreTokens()) {
-                    String token = tok.nextToken();
-                    result.append("  " + token);
-                }
-                line = in.readLine();
-            }
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-
-        return result.toString();
-    }
 }

Added: 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=auto&rev=527410
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_async.wsdl (added)
+++ 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 01:29:40 2007
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions 
+    xmlns="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:http-conf="http://schemas.iona.com/transports/http/configuration" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:tns="http://apache.org/hello_world_async_soap_http" 
+    xmlns:x1="http://apache.org/hello_world_async_soap_http/types" 
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
+    targetNamespace="http://apache.org/hello_world_async_soap_http" 
+    name="HelloWorld">
+    <jaxws:bindings>
+	<enableAsyncMapping>true</enableAsyncMapping>
+    </jaxws:bindings>
+    <wsdl:types>
+	<schema 
+	    targetNamespace="http://apache.org/hello_world_async_soap_http/types" 
+	    xmlns="http://www.w3.org/2001/XMLSchema" 
+	    xmlns:x1="http://apache.org/hello_world_async_soap_http/types" 
+	    elementFormDefault="qualified">
+	    <element name="greetMeSometime">
+		<complexType>
+		    <sequence>
+			<element name="requestType" type="xsd:string"/>
+		    </sequence>
+		</complexType>
+	    </element>
+	    <element name="greetMeSometimeResponse">
+		<complexType>
+		    <sequence>
+			<element name="responseType" type="xsd:string"/>
+		    </sequence>
+		</complexType>
+	    </element>		
+	</schema>
+    </wsdl:types>
+    <wsdl:message name="greetMeSometimeRequest">
+	<wsdl:part name="in" element="x1:greetMeSometime"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeSometimeResponse">
+	<wsdl:part name="out" element="x1:greetMeSometimeResponse"/>
+    </wsdl:message>
+    <wsdl:portType name="GreeterAsync">
+	<wsdl:operation name="greetMeSometime">
+	    <wsdl:input name="greetMeSometimeRequest" message="tns:greetMeSometimeRequest"/>
+	    <wsdl:output name="greetMeSometimeResponse" message="tns:greetMeSometimeResponse"/>
+	</wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="GreeterAsync_SOAPBinding" type="tns:GreeterAsync">
+	<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+	<wsdl:operation name="greetMeSometime">
+	    <soap:operation style="document"/>
+	    <wsdl:input>
+		<soap:body use="literal"/>
+	    </wsdl:input>
+	    <wsdl:output>
+		<soap:body use="literal"/>
+	    </wsdl:output>
+	</wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="SOAPService">
+	<wsdl:port name="SoapPort" binding="tns:GreeterAsync_SOAPBinding">
+	    <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+	    <http-conf:client/>
+	    <http-conf:server/>
+	</wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>

Added: 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=auto&rev=527410
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_stock_bare.wsdl (added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_stock_bare.wsdl Wed Apr 11 01:29:40 2007
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="getPrice">
+    <wsdl:part name="arg0" type="xsd:string">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="Stock">
+    <wsdl:operation name="getPrice">
+      <wsdl:input name="getPrice" message="ns1:getPrice">
+    </wsdl:input>
+      <wsdl:output name="getPriceResponse" message="ns1:getPriceResponse">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="StockServiceSoapBinding" type="ns1:Stock">
+    <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="getPrice">
+      <wsdlsoap:operation soapAction="" style="document"/>
+      <wsdl:input name="getPrice">
+        <wsdlsoap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="getPriceResponse">
+        <wsdlsoap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="StockService">
+    <wsdl:port name="StockPort" binding="ns1:StockServiceSoapBinding">
+      <wsdlsoap:address/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>