axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject cvs commit: xml-axis/java/test/wsdl/types ComprehensiveTypes.wsdl
Date Thu, 13 Dec 2001 20:54:01 GMT
scheu       01/12/13 12:54:01

  Modified:    java/src/org/apache/axis/utils JavaUtils.java
               java/src/org/apache/axis/wsdl/toJava JavaTestCaseWriter.java
                        TypeEntry.java UndefinedDelegate.java Utils.java
               java/test build_functional_tests.xml
               java/test/wsdl/types ComprehensiveTypes.wsdl
  Log:
  Added more complicated forward reference testing to Comprehensive Tests.
  This resulted in a couple of fixes to WSDL2Java.
  
  Revision  Changes    Path
  1.14      +36 -0     xml-axis/java/src/org/apache/axis/utils/JavaUtils.java
  
  Index: JavaUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/JavaUtils.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- JavaUtils.java	2001/12/07 16:33:03	1.13
  +++ JavaUtils.java	2001/12/13 20:54:00	1.14
  @@ -243,4 +243,40 @@
           messages = ResourceBundle.getBundle("org.apache.axis.utils.resources");
       } // initializeMessages
   
  +    /**
  +     * replace:
  +     * Like String.replace except that the old new items are strings.
  +     *
  +     * @param name string 
  +     * @param oldt old text to replace
  +     * @param newt new text to use
  +     * @return replacement string
  +     **/
  +    public static final String replace (String name,
  +                                        String oldT, String newT) {
  +
  +        if (name == null) return "";
  +
  +        // Create a string buffer that is twice initial length.
  +        // This is a good starting point.
  +        StringBuffer sb = new StringBuffer(name.length()* 2); 
  +
  +        int len = oldT.length ();
  +        try {
  +            int start = 0;
  +            int i = name.indexOf (oldT, start);
  +            
  +            while (i >= 0) {
  +                sb.append(name.substring(start, i));
  +                sb.append(newT);
  +                start = i+len;
  +                i = name.indexOf(oldT, start);
  +            }
  +            if (start < name.length())
  +                sb.append(name.substring(start));
  +        } catch (NullPointerException e) {
  +        }
  +
  +        return new String(sb);
  +    }
   }
  
  
  
  1.4       +1 -2      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java
  
  Index: JavaTestCaseWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JavaTestCaseWriter.java	2001/12/13 17:11:56	1.3
  +++ JavaTestCaseWriter.java	2001/12/13 20:54:00	1.4
  @@ -241,8 +241,7 @@
                           pw.print("new byte[0]");
                       } else if (paramType.endsWith("[]")) {
                           pw.print("new "
  -                                + paramType.substring(0, paramType.length() - 1)
  -                                + "0]");
  +                                 + JavaUtils.replace(paramType, "[]", "[0]"));
                       } else {
   
                           // We have some constructed type.
  
  
  
  1.3       +53 -28    xml-axis/java/src/org/apache/axis/wsdl/toJava/TypeEntry.java
  
  Index: TypeEntry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/TypeEntry.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TypeEntry.java	2001/12/13 18:25:48	1.2
  +++ TypeEntry.java	2001/12/13 20:54:00	1.3
  @@ -182,12 +182,63 @@
          
   
       /**
  +     * Query Java Mapping Name
  +     */
  +    public String getJavaName() {
  +        return name;
  +    }
  +
  +    /**
  +     * Query Java Mapping Name
  +     */
  +    public Node getNode() {
  +        return node;
  +    }
  +
  +    /**
  +     * Returns the Java Base Type Name.
  +     * For example if the Type represents a schema integer, "int" is returned.
  +     * If this is a user defined type, null is returned.
  +     */
  +    public String getBaseType() {
  +        if (isBaseType) {
  +            return name;
  +        }
  +        else {
  +            return null;
  +        }
  +    }
  +
  +    /**
  +     * getUndefinedTypeRef returns the Undefined TypeEntry that this entry depends on or
NULL.
  +     */
  +    protected TypeEntry getUndefinedTypeRef() {
  +        if (this instanceof Undefined) 
  +            return this;
  +        if (undefined && refType != null) {
  +            if (refType.undefined) {
  +                TypeEntry uType = refType;
  +                while (!(uType instanceof Undefined)) {
  +                    uType = uType.refType;
  +                }
  +                return uType;
  +            }
  +        }
  +        return null;
  +    }
  +
  +    /**
        * UpdateUndefined is called when the ref TypeEntry is finally known.
  +     * @param oldRef The TypeEntry representing the Undefined TypeEntry
  +     * @param newRef The replacement TypeEntry
  +     * @return true if TypeEntry is changed in any way.
        */
       protected boolean updateUndefined(TypeEntry oldRef, TypeEntry newRef) throws IOException
{
  +        boolean changedState = false;
           // Replace refType with the new one if applicable
           if (refType == oldRef) {
               refType = newRef;
  +            changedState = true;
               // Detect a loop
               TypeEntry te = refType;
               while(te != null && te != this) {
  @@ -206,39 +257,13 @@
           // Update information if refType is now defined
           if (refType != null && undefined && refType.undefined==false) {
               undefined = false;
  +            changedState = true;
               setName(refType.getName() + dims);             
               isBaseType = (refType.getBaseType() != null && dims.equals(""));
           }
  -        return undefined;
  -    }
  -
  -    /**
  -     * Query Java Mapping Name
  -     */
  -    public String getJavaName() {
  -        return name;
  -    }
  -
  -    /**
  -     * Query Java Mapping Name
  -     */
  -    public Node getNode() {
  -        return node;
  +        return changedState;
       }
   
  -    /**
  -     * Returns the Java Base Type Name.
  -     * For example if the Type represents a schema integer, "int" is returned.
  -     * If this is a user defined type, null is returned.
  -     */
  -    public String getBaseType() {
  -        if (isBaseType) {
  -            return name;
  -        }
  -        else {
  -            return null;
  -        }
  -    }
   
       /**
        * Get string representation.
  
  
  
  1.2       +12 -1     xml-axis/java/src/org/apache/axis/wsdl/toJava/UndefinedDelegate.java
  
  Index: UndefinedDelegate.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/UndefinedDelegate.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UndefinedDelegate.java	2001/12/13 17:33:17	1.1
  +++ UndefinedDelegate.java	2001/12/13 20:54:00	1.2
  @@ -89,16 +89,27 @@
        *  referrant TypeEntry's that were registered.
        */
       public void update(TypeEntry def) throws IOException {
  -        // Process list until every TypeEntry is defined
           boolean done = false;
           while (!done) {
               done = true;  // Assume this is the last pass
   
               // Call updatedUndefined for all items on the list
  +            // updateUndefined returns true if the state of the te TypeEntry
  +            // is changed.  The outer loop is traversed until there are no more
  +            // state changes.
               for (int i=0; i < list.size() ; i++) {
                   TypeEntry te = (TypeEntry) list.elementAt(i);
                   if (te.updateUndefined(undefinedType, def))
                       done = false;  // Items still undefined, need another pass
  +            }
  +        }
  +        // It is possible that the def TypeEntry depends on an Undefined type.
  +        // If so, register all of the entries with the undefined type.
  +        TypeEntry uType = def.getUndefinedTypeRef();
  +        if (uType != null) {
  +            for (int i=0; i < list.size() ; i++) {
  +                TypeEntry te = (TypeEntry) list.elementAt(i);
  +                ((Undefined)uType).register(te);
               }
           }
       }
  
  
  
  1.4       +5 -1      xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Utils.java	2001/12/13 17:33:17	1.3
  +++ Utils.java	2001/12/13 20:54:00	1.4
  @@ -308,9 +308,10 @@
           QName qName= getNodeTypeRefQName(node, "type");
   
           // If the node has "type" and "maxOccurs" then the type is really
  -        // a collection.  There is qname in the wsdl which we can use to represent
  +        // a collection.  There is no qname in the wsdl which we can use to represent
           // the collection, so we need to invent one.
           // The local part of the qname is changed to <local>[minOccurs, maxOccurs]
  +        // The namespace uri is changed to the targetNamespace of this node
           if (qName != null) {
               String maxOccursValue = getAttribute(node, "maxOccurs");
               String minOccursValue = getAttribute(node, "minOccurs");
  @@ -324,6 +325,9 @@
                   String localPart = qName.getLocalPart();
                   localPart += "[" + minOccursValue + "," + maxOccursValue + "]";
                   qName.setLocalPart(localPart);
  +                String namespace = getScopedAttribute(node, "targetNamespace");
  +                if (namespace != null)
  +                    qName.setNamespaceURI(namespace);
               }
           }
   
  
  
  
  1.27      +3 -2      xml-axis/java/test/build_functional_tests.xml
  
  Index: build_functional_tests.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/build_functional_tests.xml,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- build_functional_tests.xml	2001/12/11 13:16:38	1.26
  +++ build_functional_tests.xml	2001/12/13 20:54:01	1.27
  @@ -24,6 +24,7 @@
     <property name="test.functional.usefile" value="true"/>
     <property name="test.functional.reportdir" value="test-reports"/>
     <property name="test.functional.SimpleAxisPort" value="8080"/>
  +  <property name="test.functional.fail" value="yes"/>
   
     <path id="test-classpath">
       <pathelement location="${build.dest}" />
  @@ -84,7 +85,7 @@
       </java>
   
       <!-- now, run the actual test -->
  -    <junit dir="." printsummary="yes" haltonfailure="yes" fork="yes">
  +    <junit dir="." printsummary="yes" haltonfailure="${test.functional.fail}" fork="yes">
         <classpath refid="test-classpath" />
         <formatter type="xml" usefile="${test.functional.usefile}"/>
         <batchtest todir="${test.functional.reportdir}">
  @@ -207,7 +208,7 @@
     <!-- will find the classes in the IDE's build location.                  -->
     <!-- =================================================================== -->
     <target name="junit-functional-noserver" if="junit.present">
  -    <junit printsummary="yes" haltonfailure="yes" fork="yes">
  +    <junit printsummary="yes" haltonfailure="${test.functional.fail}" fork="yes">
         <classpath refid="test-classpath" />
         <formatter type="plain" />
         <batchtest>
  
  
  
  1.5       +112 -1    xml-axis/java/test/wsdl/types/ComprehensiveTypes.wsdl
  
  Index: ComprehensiveTypes.wsdl
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/types/ComprehensiveTypes.wsdl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ComprehensiveTypes.wsdl	2001/12/13 17:11:57	1.4
  +++ ComprehensiveTypes.wsdl	2001/12/13 20:54:01	1.5
  @@ -5,6 +5,7 @@
       targetNamespace="comprehensive.types.test"
       xmlns:tns="comprehensive.types.test"
       xmlns:typens="comprehensive.types"
  +    xmlns:typens2="comprehensive.types.test2"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
       xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  @@ -53,6 +54,8 @@
           <xsd:complexType>
             <xsd:all>
               <xsd:element name="one" type="xsd:string"/>
  +            <xsd:element name="two" type="typens2:fwd"/> <!-- Forward type use
to dif namespace -->
  +            <xsd:element ref="typens2:three"/>           <!-- Forward ref use
to a dif namespace -->
             </xsd:all>
           </xsd:complexType>
         </xsd:element>
  @@ -65,7 +68,7 @@
                   <xsd:element name="symbol" type="xsd:string"/>
                   <xsd:element name="time" type="xsd:string"/>
                   <xsd:element name="last" type="xsd:string"/>
  -                <xsd:element name="change" type="xsd:string"/>
  +                <xsd:element name="change" type="xsd:string"/>  
                   <xsd:element name="pctchange" type="xsd:string"/>
                   <xsd:element name="bid" type="xsd:string"/>
                   <xsd:element name="ask" type="xsd:string"/>
  @@ -76,7 +79,47 @@
           </xsd:sequence>
         </xsd:complexType>
   
  +
  +      <!-- The following definitions validate forward refs -->
  +      <xsd:complexType name="arrayM">
  +        <xsd:complexContent>
  +          <xsd:restriction base="soapenc:Array">
  +            <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:arrayM2[]"/>
  +          </xsd:restriction>
  +        </xsd:complexContent>
  +      </xsd:complexType>
  +      <xsd:complexType name="arrayM2">
  +        <xsd:complexContent>
  +          <xsd:restriction base="soapenc:Array">
  +            <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:arrayM3[]"/>
  +          </xsd:restriction>
  +        </xsd:complexContent>
  +      </xsd:complexType>
  +      <xsd:complexType name="arrayM3">
  +        <xsd:complexContent>
  +          <xsd:restriction base="soapenc:Array">
  +            <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:int[]"/>
  +          </xsd:restriction>
  +        </xsd:complexContent>
  +      </xsd:complexType>
  +
       </xsd:schema>
  +
  +    <xsd:schema 
  +        targetNamespace="comprehensive.types.test2"
  +        xmlns:xsd="http://www.w3.org/1999/XMLSchema">
  +        <xsd:complexType name="fwd">
  +          <xsd:complexContent>
  +            <xsd:restriction base="soapenc:Array">
  +              <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:QName[]"/>
  +            </xsd:restriction>
  +          </xsd:complexContent>
  +        </xsd:complexType>
  +
  +        <!-- Collection of enums -->
  +        <xsd:element name="three" type="typens:enum" maxOccurs="unbounded" />
  +    </xsd:schema>
  +
     </types>
   
     <!-- message declns -->
  @@ -115,6 +158,10 @@
       <part name="array" type="typens:array"/>
     </message>
   
  +  <message name="arrayM">
  +    <part name="arrayM" type="typens:arrayM"/>
  +  </message>
  +
     <message name="complexAll">
       <part name="complexAll" type="typens:complexAll"/>
     </message>
  @@ -169,6 +216,21 @@
         <input message="tns:empty"/>
         <output message="tns:array"/>
       </operation>
  +
  +    <!-- Multi-Dimensional Arrays currently don't work
  +    <operation name="arrayMIn">
  +      <input message="tns:arrayM"/>
  +      <output message="tns:empty"/>
  +    </operation>
  +    <operation name="arrayMInout">
  +      <input message="tns:arrayM"/>
  +      <output message="tns:arrayM"/>
  +    </operation>
  +    <operation name="arrayMOut">
  +      <input message="tns:emptyM"/>
  +      <output message="tns:arrayM"/>
  +    </operation>
  +     -->
       <operation name="complexAllIn">
         <input message="tns:complexAll"/>
         <output message="tns:empty"/>
  @@ -359,6 +421,55 @@
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
         </output>
       </operation>
  +
  +    <!-- Multi-Dimensional Arrays currently don't work
  +    <operation name="arrayMIn">
  +      <soap:operation soapAction=""/>
  +      <input>
  +        <soap:body
  +            use="encoded"
  +            namespace=""
  +            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +      </input>
  +      <output>
  +        <soap:body
  +            use="encoded"
  +            namespace=""
  +            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +      </output>
  +    </operation>
  +    <operation name="arrayMInout">
  +      <soap:operation soapAction=""/>
  +      <input>
  +        <soap:body
  +            use="encoded"
  +            namespace=""
  +            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +      </input>
  +      <output>
  +        <soap:body
  +            use="encoded"
  +            namespace=""
  +            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +      </output>
  +    </operation>
  +    <operation name="arrayMOut">
  +      <soap:operation soapAction=""/>
  +      <input>
  +        <soap:body
  +            use="encoded"
  +            namespace=""
  +            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +      </input>
  +      <output>
  +        <soap:body
  +            use="encoded"
  +            namespace=""
  +            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +      </output>
  +    </operation>
  +    -->
  +
       <operation name="complexAllIn">
         <soap:operation soapAction=""/>
         <input>
  
  
  

Mime
View raw message