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 12:45:32 UTC

svn commit: r527456 - 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 03:45:27 2007
New Revision: 527456

URL: http://svn.apache.org/viewvc?view=rev&rev=527456
Log:
* Port JavaToWSDLNoAnnoTest
* Remove duplicate test

Added:
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_wrapped.wsdl
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=527456&r1=527455&r2=527456
==============================================================================
--- 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 03:45:27 2007
@@ -111,7 +111,7 @@
         return result;
     }
     
-    private static String normalizeCRLF(InputStream instream) {
+    private String normalizeCRLF(InputStream instream) {
         BufferedReader in = new BufferedReader(new InputStreamReader(instream));
         StringBuffer result = new StringBuffer();
         String line = null;

Added: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java?view=auto&rev=527456
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java (added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java Wed Apr 11 03:45:27 2007
@@ -0,0 +1,88 @@
+/**
+ * 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.java2wsdl.processor.internal.jaxws;
+
+import java.io.File;
+
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.ProcessorTestBase;
+import org.apache.cxf.tools.java2wsdl.generator.wsdl11.WSDL11Generator;
+
+public class JaxwsServiceBuilderNoAnnoTest extends ProcessorTestBase {
+    JaxwsServiceBuilder builder = new JaxwsServiceBuilder();
+    WSDL11Generator generator = new WSDL11Generator();
+    
+    public void setUp() throws Exception {
+        super.setUp();
+        builder.setBus(BusFactory.getDefaultBus());
+    }
+
+    public void tearDown() {
+    }
+
+    // Revisit:
+    // * Missing wsdl:types
+    // * getPrice MUST refeter to schema element
+    //     <wsdl:message name="getPrice">
+    //        <wsdl:part name="arg0" type="xsd:string"/>
+    //     </wsdl:message>
+    // CXF-521
+    public void testGeneratedWithElementryClass() throws Exception {
+        builder.setServiceClass(org.apache.cxf.tools.fortest.classnoanno.docbare.Stock.class);
+        ServiceInfo service =  builder.build();
+        generator.setServiceModel(service);
+        File output = getOutputFile("stock_noanno_bare.wsdl");
+        generator.generate(output);
+        assertTrue(output.exists());
+    }
+
+    // Passed
+    public void testGeneratedWithDocWrappedClass() throws Exception {
+        builder.setServiceClass(org.apache.cxf.tools.fortest.classnoanno.docwrapped.Stock.class);
+        ServiceInfo service =  builder.build();
+        generator.setServiceModel(service);
+        File output = getOutputFile("stock_noanno_wrapped.wsdl");
+        generator.generate(output);
+        assertTrue(output.exists());
+
+        String expectedFile = getClass().getResource("expected/stock_noanno_wrapped.wsdl").getFile();
+        assertFileEquals(expectedFile, output.getAbsolutePath());
+    }
+
+    // Revisit:
+    // * Missing wsdl:types
+    // * Binding style should be RPC not Document
+    // * input message of binding operation "getPrice" MUST specify a value for the "namespace" attribute
+    // * output message of binding operation "getPrice" MUST specify a value for the "namespace" attribute
+    // CXF-522
+    public void testGeneratedWithRPCClass() throws Exception {
+        builder.setServiceClass(org.apache.cxf.tools.fortest.classnoanno.rpc.Stock.class);
+        ServiceInfo service =  builder.build();
+        generator.setServiceModel(service);
+        File output = getOutputFile("stock_noanno_rpc.wsdl");
+        generator.generate(output);
+        assertTrue(output.exists());
+    }
+
+    private File getOutputFile(String fileName) {
+        return new File(output, fileName);
+    }
+}

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=527456&r1=527455&r2=527456
==============================================================================
--- 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 03:45:27 2007
@@ -49,19 +49,6 @@
         assertTrue(expected.equals(builder.getOutputFile()));
     }
 
-    public void testBare() {
-        builder.setServiceClass(Stock.class);
-        ServiceInfo service = builder.build();
-        generator.setServiceModel(service);
-        File output = getOutputFile("stock_bare.wsdl");
-        assertNotNull(output);
-        generator.generate(output);
-        assertTrue(output.exists());
-
-        String expectedFile = getClass().getResource("expected/expected_stock_bare.wsdl").getFile();
-        assertFileEquals(expectedFile, output.getAbsolutePath());
-    }
-
     public void xtestWrapped() {
         builder.setServiceClass(org.apache.cxf.tools.fortest.withannotation.doc.Hello.class);
         ServiceInfo service = builder.build();

Added: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_wrapped.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_wrapped.wsdl?view=auto&rev=527456
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_wrapped.wsdl (added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_wrapped.wsdl Wed Apr 11 03:45:27 2007
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="StockService" targetNamespace="http://docwrapped.classnoanno.fortest.tools.cxf.apache.org/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://docwrapped.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:types>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://docwrapped.classnoanno.fortest.tools.cxf.apache.org/" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://docwrapped.classnoanno.fortest.tools.cxf.apache.org/">
+<xsd:element name="getPrice">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="arg0" nillable="true" type="xsd:string"/>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="getPriceResponse">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="return" nillable="true" type="xsd:float"/>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+  </wsdl:types>
+  <wsdl:message name="getPriceResponse">
+    <wsdl:part name="getPriceResponse" element="ns1:getPriceResponse">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="getPrice">
+    <wsdl:part name="getPrice" element="ns1:getPrice">
+    </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>