axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bu...@apache.org
Subject cvs commit: xml-axis/java/test/wsdl Wsdl2javaTestSuite.xml
Date Mon, 10 Dec 2001 17:28:03 GMT
butek       01/12/10 09:28:03

  Modified:    java/src/javax/xml/rpc/namespace QName.java
               java/src/org/apache/axis SOAPPart.java
               java/src/org/apache/axis/encoding
                        SOAPTypeMappingRegistry.java
               java/src/org/apache/axis/wsdl JavaImplWriter.java
                        JavaTestCaseWriter.java
               java/test/wsdl Wsdl2javaTestSuite.xml
  Log:
  Second cut at a comprehensive XML schema types test.  Still just the primitive types,
  but now I turned test case generation on so that it is now a functional test using the
  generated TestCase and Impl.  I made some fixes in order to get this to work:
  
  - a number of code generation fixes, primarily to fill in holders where necessary.  I
  found out that empty holders don't work when something is expected to be in them.
  
  - QName didn't handle null namespaceURI and/or localPart.
  
  - SOAPTypeMappingRegistry was missing some serializers:  xsd:integer, xsd:QName.
  
  Revision  Changes    Path
  1.8       +23 -1     xml-axis/java/src/javax/xml/rpc/namespace/QName.java
  
  Index: QName.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/javax/xml/rpc/namespace/QName.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- QName.java	2001/10/30 16:46:34	1.7
  +++ QName.java	2001/12/10 17:28:03	1.8
  @@ -169,6 +169,15 @@
               }
           }
   
  +        if (localPart == null) {
  +            if (((QName) p1).localPart != null) {
  +                return false;
  +            }
  +            else {
  +                return true;
  +            }
  +        }
  +
           return localPart.equals(((QName) p1).localPart);
       }
   
  @@ -178,7 +187,20 @@
        * @return a hash code value for this Qname object
        */
       public int hashCode() {
  -        return namespaceURI.hashCode() ^ localPart.hashCode();
  +        if (namespaceURI == null) {
  +            if (localPart == null) {
  +                return 0;
  +            }
  +            else {
  +                return localPart.hashCode();
  +            }
  +        }
  +        else if (localPart == null) {
  +            return namespaceURI.hashCode();
  +        }
  +        else {
  +            return namespaceURI.hashCode() ^ localPart.hashCode();
  +        }
       }
   
       // temporary!!
  
  
  
  1.5       +1 -1      xml-axis/java/src/org/apache/axis/SOAPPart.java
  
  Index: SOAPPart.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/SOAPPart.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SOAPPart.java	2001/12/03 22:49:22	1.4
  +++ SOAPPart.java	2001/12/10 17:28:03	1.5
  @@ -269,7 +269,7 @@
   
           if ( currentForm == FORM_SOAPENVELOPE ||
                currentForm == FORM_FAULT )
  -            getAsString();
  +            return getAsString().getBytes();
   
           if ( currentForm == FORM_STRING ) {
               setCurrentMessage( ((String)currentMessage).getBytes(),
  
  
  
  1.49      +10 -1     xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java
  
  Index: SOAPTypeMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- SOAPTypeMappingRegistry.java	2001/11/15 20:31:38	1.48
  +++ SOAPTypeMappingRegistry.java	2001/12/10 17:28:03	1.49
  @@ -74,6 +74,7 @@
       public static final QName XSD_DOUBLE = new QName(Constants.URI_CURRENT_SCHEMA_XSD,
"double");
       public static final QName XSD_FLOAT = new QName(Constants.URI_CURRENT_SCHEMA_XSD, "float");
       public static final QName XSD_INT = new QName(Constants.URI_CURRENT_SCHEMA_XSD, "int");
  +    public static final QName XSD_INTEGER = new QName(Constants.URI_CURRENT_SCHEMA_XSD,
"integer");
       public static final QName XSD_LONG = new QName(Constants.URI_CURRENT_SCHEMA_XSD, "long");
       public static final QName XSD_SHORT = new QName(Constants.URI_CURRENT_SCHEMA_XSD, "short");
       public static final QName XSD_BYTE = new QName(Constants.URI_CURRENT_SCHEMA_XSD, "byte");
  @@ -81,6 +82,7 @@
       public static final QName XSD_BASE64 = new QName(Constants.URI_2001_SCHEMA_XSD, "base64Binary");
       public static final QName XSD_HEXBIN = new QName(Constants.URI_2001_SCHEMA_XSD, "hexBinary");
       public static final QName XSD_ANYTYPE = new QName(Constants.URI_2001_SCHEMA_XSD, "anyType");
  +    public static final QName XSD_QNAME = new QName(Constants.URI_2001_SCHEMA_XSD, "QName");
       public static final QName SOAP_BASE64 = new QName(Constants.URI_SOAP_ENC, "base64");
   
       public static final QName SOAP_STRING = new QName(Constants.URI_SOAP_ENC, "string");
  @@ -91,6 +93,7 @@
       public static final QName SOAP_LONG = new QName(Constants.URI_SOAP_ENC, "long");
       public static final QName SOAP_SHORT = new QName(Constants.URI_SOAP_ENC, "short");
       public static final QName SOAP_BYTE = new QName(Constants.URI_SOAP_ENC, "byte");
  +    public static final QName SOAP_INTEGER = new QName(Constants.URI_SOAP_ENC, "integer");
       public static final QName SOAP_ARRAY = new QName(Constants.URI_SOAP_ENC, "Array");
   
       public static final QName TYPE_MAP = new QName("http://xml.apache.org/xml-soap", "Map");
  @@ -249,9 +252,11 @@
           addSerializer(java.lang.Double.class, XSD_DOUBLE, new FloatSerializer());
           addSerializer(java.lang.Float.class, XSD_FLOAT, new FloatSerializer());
           addSerializer(java.lang.Integer.class, XSD_INT, se);
  +        addSerializer(java.math.BigInteger.class, XSD_INTEGER, se);
           addSerializer(java.lang.Long.class, XSD_LONG, se);
           addSerializer(java.lang.Short.class, XSD_SHORT, se);
  -        addSerializer(java.lang.Byte.TYPE, XSD_BYTE, se);
  +        addSerializer(java.lang.Byte.class, XSD_BYTE, se);
  +        addSerializer(javax.xml.rpc.namespace.QName.class, XSD_QNAME, new BeanSerializer(javax.xml.rpc.namespace.QName.class));
           addSerializer(java.util.Date.class, XSD_DATE, new DateSerializer());
           addSerializer(byte[].class, XSD_BASE64, new Base64Serializer());
           addSerializer(Hex.class, XSD_HEXBIN, new HexSerializer());
  @@ -259,6 +264,7 @@
           
           addDeserializersFor(XSD_STRING, java.lang.String.class, factory);    
           addDeserializersFor(XSD_INT, java.lang.Integer.class, factory);
  +        addDeserializersFor(XSD_INTEGER, java.math.BigInteger.class, factory);
           addDeserializersFor(XSD_LONG, java.lang.Long.class, factory);
           addDeserializersFor(XSD_SHORT, java.lang.Short.class, factory);
           addDeserializersFor(XSD_BYTE, java.lang.Byte.class, factory);
  @@ -270,6 +276,9 @@
               new FloatSerializer.FloatDeserializerFactory());
           addDeserializersFor(XSD_DOUBLE, java.lang.Double.class, 
               new FloatSerializer.FloatDeserializerFactory());
  +
  +        addDeserializerFactory(XSD_QNAME, javax.xml.rpc.namespace.QName.class,
  +                BeanSerializer.getFactory());
   
           // handle the various datetime QNames...
           addDeserializerFactory(
  
  
  
  1.10      +40 -1     xml-axis/java/src/org/apache/axis/wsdl/JavaImplWriter.java
  
  Index: JavaImplWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/JavaImplWriter.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JavaImplWriter.java	2001/12/06 13:11:53	1.9
  +++ JavaImplWriter.java	2001/12/10 17:28:03	1.10
  @@ -127,12 +127,51 @@
   
       private void writeOperation(Parameters parms) throws IOException {
           pw.println(parms.signature + " {");
  +
  +        // Fill in any out parameter holders
  +        Iterator iparam = parms.list.iterator();
  +        while (iparam.hasNext()) {
  +            Parameter param = (Parameter) iparam.next();
  +            String paramType = param.type.getName();
  +
  +            if (param.mode == Parameter.OUT) {
  +                pw.print("        " + Utils.xmlNameToJava(param.name)
  +                        + "._value = ");
  +                if ( isPrimitiveType(param.type) ) {
  +                    if ( "boolean".equals(paramType) ) {
  +                        pw.print("false");
  +                    } else if ("byte".equals(paramType)) {
  +                        pw.print("(byte)-3");
  +                    } else if ("short".equals(paramType)) {
  +                        pw.print("(short)-3");
  +                    } else {
  +                        pw.print("-3");
  +                    }
  +                } else if (paramType.equals("java.math.BigDecimal")) {
  +                    pw.print("new java.math.BigDecimal(-3)");
  +                } else if (paramType.equals("java.math.BigInteger")) {
  +                    pw.print("new java.math.BigInteger(\"-3\")");
  +                } else if (paramType.equals("byte[]")) {
  +                    pw.print("new byte[0]");
  +                } else {
  +                    pw.print("new " + paramType + "()");
  +                }
  +                pw.println(";");
  +            }
  +        }
  +
  +        // Print the return statement
           if (parms.returnType != null) {
               pw.print("        return ");
   
               if (isPrimitiveType(parms.returnType)) {
  -                if ("boolean".equals(parms.returnType.getName())) {
  +                String returnType = parms.returnType.getName();
  +                if ("boolean".equals(returnType)) {
                       pw.println("false;");
  +                } else if ("byte".equals(returnType)) {
  +                    pw.println("(byte)-3;");
  +                } else if ("short".equals(returnType)) {
  +                    pw.println("short)-3;");
                   } else {
                       pw.println("-3;");
                   }
  
  
  
  1.11      +25 -17    xml-axis/java/src/org/apache/axis/wsdl/JavaTestCaseWriter.java
  
  Index: JavaTestCaseWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/JavaTestCaseWriter.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- JavaTestCaseWriter.java	2001/12/05 21:45:09	1.10
  +++ JavaTestCaseWriter.java	2001/12/10 17:28:03	1.11
  @@ -212,28 +212,36 @@
                   }
   
                   Parameter param = (Parameter) iparam.next();
  -                String paramType = null;
  +                String paramType = param.type.getName();
  +                String suffix = "";
   
  -                switch (param.mode) {
  -                    case Parameter.IN:
  -                        paramType = param.type.getName();
  -                        break;
  -
  -                    default:
  -                        paramType = Utils.holder(param.type);
  +                if (param.mode != Parameter.IN) {
  +                    pw.print("new " + Utils.holder(param.type) + "(");
  +                    suffix = ")";
                   }
  -                
  -                if ( isPrimitiveType(param.type) ) {
  -                    if ( "boolean".equals(paramType) ) {
  -                        pw.print("true");
  +
  +                if (param.mode != Parameter.OUT) {
  +                    if ( isPrimitiveType(param.type) ) {
  +                        if ( "boolean".equals(paramType) ) {
  +                            pw.print("true");
  +                        } else if ("byte".equals(paramType)) {
  +                            pw.print("(byte)0");
  +                        } else if ("short".equals(paramType)) {
  +                            pw.print("(short)0");
  +                        } else {
  +                            pw.print("0");
  +                        }
  +                    } else if (paramType.equals("java.math.BigDecimal")) {
  +                        pw.print("new java.math.BigDecimal(0)");
  +                    } else if (paramType.equals("java.math.BigInteger")) {
  +                        pw.print("new java.math.BigInteger(\"0\")");
  +                    } else if (paramType.equals("byte[]")) {
  +                        pw.print("new byte[0]");
                       } else {
  -                        pw.print("0");
  +                        pw.print("new " + paramType + "()");
                       }
  -                } else {
  -                    pw.print("new ");
  -                    pw.print(paramType);
  -                    pw.print("()");
                   }
  +                pw.print(suffix);
               }
   
               pw.println(");");
  
  
  
  1.43      +1 -1      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.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- Wsdl2javaTestSuite.xml	2001/12/08 04:23:38	1.42
  +++ Wsdl2javaTestSuite.xml	2001/12/10 17:28:03	1.43
  @@ -349,7 +349,7 @@
       <wsdl2java url="test/wsdl/types/ComprehensiveTypes.wsdl"
                  output="build/work"
                  skeleton="yes"
  -               testcase="no">
  +               testcase="yes">
       </wsdl2java>
   
       <!--
  
  
  

Mime
View raw message