axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: xml-axis/java/test/wsdl/filegen FileGenTestCase.java FileGen.wsdl
Date Mon, 10 Dec 2001 21:19:04 GMT
tomj        01/12/10 13:19:04

  Modified:    java/test/wsdl Wsdl2javaTestSuite.xml
  Added:       java/test/wsdl/filegen FileGenTestCase.java FileGen.wsdl
  Removed:     java/test/filegen FileGenTestCase.java FileGen.wsdl
  Log:
  Move the WSDL file generation test from test to test/wsdl.
  
  Revision  Changes    Path
  1.44      +2 -2      xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml
  
  Index: Wsdl2javaTestSuite.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- Wsdl2javaTestSuite.xml	2001/12/10 17:28:03	1.43
  +++ Wsdl2javaTestSuite.xml	2001/12/10 21:19:04	1.44
  @@ -324,14 +324,14 @@
       -->
   
       <!-- Verify files generated based on what is referenced in WSDL -->
  -    <wsdl2java url="test/filegen/FileGen.wsdl"
  +    <wsdl2java url="test/wsdl/filegen/FileGen.wsdl"
                  output="build/work"
                  deployscope="none"
                  skeleton="no"
                  noimports="no"
                  verbose="no"
                  testcase="no">
  -        <mapping namespace="http://test.com/reference" package="test.filegen"/>
  +        <mapping namespace="http://test.com/reference" package="test.wsdl.filegen"/>
       </wsdl2java>
       
       <!-- Check to make sure we map XML names that are illegal Java correctly -->
  
  
  
  1.1                  xml-axis/java/test/wsdl/filegen/FileGenTestCase.java
  
  Index: FileGenTestCase.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /**
   * This tests the file generation of only the items that are referenced in WSDL
   * 
   * @author Tom Jordahl (tomj@macromedia.com)
   */ 
  package test.wsdl.filegen;
  
  import junit.framework.Assert;
  import junit.framework.TestCase;
  
  import java.io.File;
  import java.io.IOException;
  
  
  public class FileGenTestCase extends junit.framework.TestCase {
      public FileGenTestCase(String name) {
          super(name);
      }
  
      // List of files which should be generated
      private static String[] shouldExist= new String[] {
          "PortTypeSoap.java",
          "ReferenceService.java",
          "ReferenceSoapBindingStub.java",
          "OpFault.java"
      };
      
      // List of files which should NOT be generated
      private static String[] shouldNotExist= new String[] {
          "InvalidTickerFaultMessage.java",
          "PortTypeNotSoap.java",
          "ReferenceHttpGetStub.java",
          "Address.java",
          "AddressHolder.java",
          "StateType.java",
          "StateTypeHolder.java"
      };
  
      public void testFileGen() throws IOException {
          String rootDir = "build"+ File.separator + "work" + File.separator + 
                  "test" + File.separator + "wsdl" + File.separator + "filegen";
          // open up the output directory and check what files exist.
          File outputDir = new File(rootDir);
          
          String[] files = outputDir.list();
          
          for (int i=0; i < shouldExist.length; i++) {
              File f = new File(rootDir, shouldExist[i]);
              //System.out.println(shouldExist[i] + " : " +  f.exists());
              assertTrue("File does not exist (and it should): " + shouldExist[i], f.exists());

          }
          
          for (int i=0; i < shouldNotExist.length; i++) {
              File f = new File(rootDir, shouldNotExist[i]);
              //System.out.println(shouldNotExist[i] + " : " +  f.exists());
              assertTrue("File exist (and it should NOT): " + shouldNotExist[i], !f.exists());

          }
      }
  }
  
  
  
  
  1.1                  xml-axis/java/test/wsdl/filegen/FileGen.wsdl
  
  Index: FileGen.wsdl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <definitions targetNamespace="http://test.com/reference" 
      xmlns:tns="http://test.com/reference"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
      xmlns:serviceNS="http://test.com/reference" 
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
      xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
      xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
      xmlns="http://schemas.xmlsoap.org/wsdl/">
   
    <!-- type defs -->
    <!-- None of these types are referenced, so there shuold be no code emitted -->
    <types>
      <xsd:schema targetNamespace="http://test.com/reference"
                  xmlns:xsd="http://www.w3.org/1999/XMLSchema">
  
        <xsd:simpleType name="stateType">
          <xsd:restriction base="xsd:string">
              <xsd:enumeration value="TX"/>                      
              <xsd:enumeration value="IN"/>                    
              <xsd:enumeration value="OH"/>                    
          </xsd:restriction>
        </xsd:simpleType>
  
        <xsd:complexType name="address">
          <xsd:all>
              <xsd:element name="streetNum" type="xsd:int"/>
              <xsd:element name="streetName" type="xsd:string"/>
              <xsd:element name="city" type="xsd:string"/>
              <xsd:element name="state" type="tns:stateType"/>
              <xsd:element name="zip" type="xsd:int"/>
          </xsd:all>
        </xsd:complexType>
      </xsd:schema>
    </types>
    
    <!-- Messages for the SOAP operation -->
    <message name="myopRequest">
      <part name="argument" type="xsd:string"/>
    </message>
    <message name="myopResponse">
      <part name="myopResult" type="xsd:float"/>
    </message>
    <!-- We should Emit an opFault Exception class -->
    <message name="opFault">
      <part name="info" type="xsd:string"/>
    </message>
  
    <!-- messages for the HTTP operation -->
    <message name="otheropHttpGetIn">
      <part name="ISBN" type="xsd:string" />
    </message>
    <message name="otheropHttpGetOut">
      <part name="Body" element="xsd:string" />
    </message>
  
    <!-- unused fault, should not be emitted -->
    <message name="InvalidTickerFaultMessage">
      <part name="tickerSymbol" type="xsd:string"/>
    </message>
  
  
    <!-- SOAP portType -->
    <portType name="PortTypeSoap">
      <operation name="myop">
        <input message="serviceNS:myopRequest"/>
        <output message="serviceNS:myopResponse"/>
        <fault message="serviceNS:opFault"/>
      </operation>
    </portType>
  
    <!-- non-Soap portType, code should not be emitted for it -->
    <portType name="PortTypeNotSoap">
      <operation name="otherop">
        <input message="serviceNS:otheropHttpGetIn"/>
        <output message="serviceNS:otheropHttpGetOut"/>
        <fault message="serviceNS:InvalidTickerFaultMessage"/>
      </operation>
    </portType>
  
    <!-- SOAP binding -->
    <binding name="ReferenceSoapBinding" type="serviceNS:PortTypeSoap">
      <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="myop">
        <soap:operation soapAction="" style="rpc"/>
        <input>
          <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace=""/>
        </input>
        <output>
          <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace=""/>
        </output>
        <fault>
          <soap:fault name="opFault" use="encoded"/>
        </fault>
      </operation>
    </binding>
  
    <!-- Non-soap binding, no code should be emitted for it -->
    <binding name="ReferenceHttpGet" type="serviceNS:PortTypeNotSoap">
      <http:binding verb="GET" />
      <operation name="myop">
        <http:operation location="/GetReference" />
        <input>
          <http:urlEncoded />
        </input>
        <output>
          <mime:mimeXml part="Body" />
        </output>
      </operation>
     </binding>
  
  
    <service name="ReferenceService">
      <!-- SOAP port -->
      <port name="ReferenceService" binding="serviceNS:ReferenceSoapBinding">
        <soap:address location="http://localhost:8080/axis/services/ReferenceService"/>
      </port>
  
      <!-- non-Soap port, no code should be emitted for it -->
      <port name="ReferenceHttpGet" binding="serviceNS:ReferenceHttpGet">
        <http:address location="http://test.com/foo/bar" />
      </port>
  
    </service>
  </definitions>
  
  
  

Mime
View raw message