[jboss-svn-commits] JBossWS SVN: r947 - in branches/tdiesler/jbossws-1.0/src: main/java/org/jboss/ws/tools test/java/org/jboss/test/ws/tools test/java/org/jboss/test/ws/tools/fixture test/java/org/jboss/test/ws/tools/jbws_206/tests/UserException test/java/org/jboss/test/ws/tools/validation test/java/org/jboss/test/ws/tools/xmlschema test/resources/tools/jbws-206/wscompileArtifacts/UserException/sei test/resources/tools/jbws-206/wscompileArtifacts/UserException/usertypes test/resources/tools/jbws-206/wsdlFixture/UserException

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Sep 13 04:48:17 EDT 2006


Author: thomas.diesler at jboss.com
Date: 2006-09-13 04:48:05 -0400 (Wed, 13 Sep 2006)
New Revision: 947

Added:
   branches/tdiesler/jbossws-1.0/src/test/resources/tools/jbws-206/wscompileArtifacts/UserException/usertypes/MyFaultType.java
Modified:
   branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/WSDLToJava.java
   branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/SchemaGeneratorTestCase.java
   branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/fixture/JBossSourceComparator.java
   branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/jbws_206/tests/UserException/UserExceptionWSDL2JavaTestCase.java
   branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/validation/WSDL11Validator.java
   branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/validation/WSDLValidator.java
   branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/xmlschema/WSDLTypesTestCase.java
   branches/tdiesler/jbossws-1.0/src/test/resources/tools/jbws-206/wscompileArtifacts/UserException/sei/UserExceptionSEI.java
   branches/tdiesler/jbossws-1.0/src/test/resources/tools/jbws-206/wsdlFixture/UserException/UserExceptionService_RPC_11.wsdl
Log:
sync with -r945

Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/WSDLToJava.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/WSDLToJava.java	2006-09-12 21:56:58 UTC (rev 946)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/WSDLToJava.java	2006-09-13 08:48:05 UTC (rev 947)
@@ -36,7 +36,6 @@
 import org.apache.xerces.xs.XSComplexTypeDefinition;
 import org.apache.xerces.xs.XSElementDeclaration;
 import org.apache.xerces.xs.XSModelGroup;
-import org.apache.xerces.xs.XSObject;
 import org.apache.xerces.xs.XSObjectList;
 import org.apache.xerces.xs.XSParticle;
 import org.apache.xerces.xs.XSSimpleTypeDefinition;
@@ -196,7 +195,7 @@
    public void setPackageNamespaceMap(Map<String, String> map)
    {
      //Lets convert the package->namespace map to namespace->package map
-     Set keys = map.keySet();
+     Set<String> keys = map.keySet();
      Iterator<String> iter = keys.iterator();
      while(iter != null && iter.hasNext())
      {
@@ -410,14 +409,12 @@
                XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI());
 
                boolean primitive = true;
-               WrappedArray wrappedArray = new WrappedArray(xt);
-               String arraySuffix = "";
+               WrappedArray wrappedArray = new WrappedArray(xt);               
                if (wrappedArray.unwrap())
                {
                   xt = wrappedArray.xt;
                   xmlType = wrappedArray.xmlType;
-                  primitive = !wrappedArray.nillable;
-                  arraySuffix = wrappedArray.suffix;
+                  primitive = !wrappedArray.nillable;                  
                }
 
                if (xt instanceof XSSimpleTypeDefinition)
@@ -451,7 +448,14 @@
 
             Class cl = getJavaType(faultXMLType, false);
             if (cl == null)
-               buf.append(seiPkgName + "." + cleanUpFaultName(faultXMLName.getLocalPart()));
+            {
+               String exceptionName = xt.getName();
+               if (exceptionName==null)
+               {
+                  exceptionName = faultXMLName.getLocalPart();
+               }
+               buf.append(seiPkgName + "." + utils.firstLetterUpperCase(exceptionName));
+            }
             else
                buf.append( cl.getName());
             buf.append( "," );
@@ -594,36 +598,6 @@
    }
 
    /**
-    * WSDL may have appended the Faults with 'Fault' or 'Error'
-    * @param faultname
-    * @return
-    */
-   private String cleanUpFaultName(String faultname)
-   {
-      //Clean up the faultname from Error and Fault
-      boolean endsfault = faultname.endsWith("Fault");
-
-      if (endsfault)
-      {
-         int index = faultname.lastIndexOf("Fault");
-         faultname = faultname.substring(0, index);
-      }
-      else
-      {
-         boolean endsError = faultname.endsWith("Error");
-         if (endsError)
-         {
-            int index = faultname.lastIndexOf("Error");
-            faultname = faultname.substring(0, index);
-         }
-      }
-      
-      faultname = utils.firstLetterUpperCase(faultname);
-      
-      return faultname;
-   }
-
-   /**
     * Check if an holder is required for the input type
     * @param wout
     * @param cls

Modified: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/SchemaGeneratorTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/SchemaGeneratorTestCase.java	2006-09-12 21:56:58 UTC (rev 946)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/SchemaGeneratorTestCase.java	2006-09-13 08:48:05 UTC (rev 947)
@@ -146,4 +146,4 @@
       Element wasElement = DOMUtils.parse(xsdSchema);
       assertEquals(expElement, wasElement);
    }
-}
+}
\ No newline at end of file

Modified: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/fixture/JBossSourceComparator.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/fixture/JBossSourceComparator.java	2006-09-12 21:56:58 UTC (rev 946)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/fixture/JBossSourceComparator.java	2006-09-13 08:48:05 UTC (rev 947)
@@ -1,24 +1,24 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.test.ws.tools.fixture;
 
 import java.io.File;
@@ -36,7 +36,9 @@
 import com.thoughtworks.qdox.model.AbstractJavaEntity;
 import com.thoughtworks.qdox.model.JavaClass;
 import com.thoughtworks.qdox.model.JavaField;
+import com.thoughtworks.qdox.model.JavaMethod;
 import com.thoughtworks.qdox.model.JavaSource;
+import com.thoughtworks.qdox.model.Type;
 
 /**
  *  Compares whether two Java source files are identical
@@ -57,8 +59,7 @@
     * don't implement Comparable
     */
 
-   private static Comparator ENTITY_COMPARATOR = new Comparator()
-   {
+   private static Comparator ENTITY_COMPARATOR = new Comparator() {
       public int compare(Object obj1, Object obj2)
       {
          AbstractJavaEntity entity1 = (AbstractJavaEntity)obj1;
@@ -69,7 +70,8 @@
 
    public JBossSourceComparator()
    {
-      if (builder == null) builder = new JavaDocBuilder();
+      if (builder == null)
+         builder = new JavaDocBuilder();
    }
 
    public JBossSourceComparator(File dir)
@@ -79,8 +81,7 @@
 
    }
 
-   public JBossSourceComparator(String file1, String file2)
-           throws Exception
+   public JBossSourceComparator(String file1, String file2) throws Exception
    {
       this();
       try
@@ -95,8 +96,7 @@
       }
    }
 
-   public JBossSourceComparator(File file1, File file2)
-           throws Exception
+   public JBossSourceComparator(File file1, File file2) throws Exception
    {
       this();
       try
@@ -123,13 +123,13 @@
     * java.util.* and java.util.Vector are not exact types.
     * @throws Exception
     */
-   public void validateImports()
-           throws Exception
+   public void validateImports() throws Exception
    {
       String[] imp1 = source1.getImports();
       String[] imp2 = source2.getImports();
 
-      if (imp1 == null && imp2 == null) return;
+      if (imp1 == null && imp2 == null)
+         return;
       if (imp1 == null && imp2 != null)
          throw new Exception("Imports are not equal");
       if (imp1 != null && imp2 == null)
@@ -149,8 +149,7 @@
     * @return
     * @throws Exception
     */
-   public boolean validate()
-           throws Exception
+   public boolean validate() throws Exception
    {
       boolean result = true;
       if (source1 == null)
@@ -164,16 +163,15 @@
          validateAPI(source1, source2);
       }
       catch (Exception e)
-      { 
-         log.error("Validation Failed:", e); 
+      {
+         log.error("Validation Failed:", e);
          result = false;
          throw e;
       }
       return result;
    }
 
-   public boolean validateAPI(JavaSource expected, JavaSource actual)
-           throws Exception
+   public boolean validateAPI(JavaSource expected, JavaSource actual) throws Exception
    {
       boolean result = false;
       List expectedClasses = Arrays.asList(expected.getClasses());
@@ -187,31 +185,25 @@
 
       for (int i = 0; i < expectedClasses.size(); i++)
       {
-         checkClassesEqual((JavaClass)expectedClasses.get(i),
-                 (JavaClass)actualClasses.get(i));
+         checkClassesEqual((JavaClass)expectedClasses.get(i), (JavaClass)actualClasses.get(i));
       }
 
       return result;
    }
 
-   private void checkClassesEqual(JavaClass expected,
-                                  JavaClass actual)
-           throws Exception
+   private void checkClassesEqual(JavaClass expected, JavaClass actual) throws Exception
    {
       if (!expected.getPackage().equals(actual.getPackage()))
          throw new Exception("Package names should be equal");
-      checkModifiersEquals("Class modifiers should be equal", expected,
-              actual);
+      checkModifiersEquals("Class modifiers should be equal", expected, actual);
       if (!expected.getName().equals(actual.getName()))
          throw new Exception("Class names should be equal");
-      if ((expected.getSuperJavaClass() != null)
-              && (actual.getSuperJavaClass() != null))
+      if ((expected.getSuperJavaClass() != null) && (actual.getSuperJavaClass() != null))
       {
          if (!expected.getSuperJavaClass().getName().equals(actual.getSuperJavaClass().getName()))
             throw new Exception("Super class should be equal");
       }
-      if ((expected.getSuperJavaClass() == null)
-              ^ (actual.getSuperJavaClass() == null))
+      if ((expected.getSuperJavaClass() == null) ^ (actual.getSuperJavaClass() == null))
       {
          throw new Exception("Super class should be equal");
       }
@@ -222,10 +214,7 @@
 
    }
 
-
-   private void checkFieldEquals(JavaField expected,
-                                 JavaField actual)
-           throws Exception
+   private void checkFieldEquals(JavaField expected, JavaField actual) throws Exception
    {
       StringBuffer message = new StringBuffer("-> checkFieldEquals");
       message.append(" Expected : ");
@@ -242,8 +231,7 @@
       checkModifiersEquals(message.toString() + "Field modifiers should be equal", expected, actual);
    }
 
-   private void checkFieldsEqual(JavaClass expected, JavaClass actual)
-           throws Exception
+   private void checkFieldsEqual(JavaClass expected, JavaClass actual) throws Exception
    {
       List expectedFields = Arrays.asList(expected.getFields());
       Collections.sort(expectedFields, ENTITY_COMPARATOR);
@@ -261,15 +249,11 @@
 
       for (int i = 0; i < expectedFields.size(); i++)
       {
-         checkFieldEquals((JavaField)expectedFields.get(i),
-                 (JavaField)actualFields.get(i));
+         checkFieldEquals((JavaField)expectedFields.get(i), (JavaField)actualFields.get(i));
       }
    }
 
-
-   private void checkInnerClassesEquals(JavaClass expected,
-                                        JavaClass actual)
-           throws Exception
+   private void checkInnerClassesEquals(JavaClass expected, JavaClass actual) throws Exception
    {
       List expectedInnerClasses = Arrays.asList(expected.getInnerClasses());
       Collections.sort(expectedInnerClasses, ENTITY_COMPARATOR);
@@ -286,15 +270,12 @@
          throw new Exception(message.toString() + "Number of inner classes should be equal");
       for (int i = 0; i < expectedInnerClasses.size(); i++)
       {
-         checkClassesEqual((JavaClass)expectedInnerClasses.get(i),
-                 (JavaClass)actualInnerClasses.get(i));
+         checkClassesEqual((JavaClass)expectedInnerClasses.get(i), (JavaClass)actualInnerClasses.get(i));
       }
 
    }
 
-   private void checkInterfacesEqual(JavaClass expected,
-                                     JavaClass actual)
-           throws Exception
+   private void checkInterfacesEqual(JavaClass expected, JavaClass actual) throws Exception
    {
       List expectedImplements = Arrays.asList(expected.getImplements());
       Collections.sort(expectedImplements);
@@ -316,8 +297,7 @@
       }
    }
 
-   private void checkMethodsEqual(JavaClass expected, JavaClass actual)
-           throws Exception
+   private void checkMethodsEqual(JavaClass expected, JavaClass actual) throws Exception
    {
       List expectedMethods = Arrays.asList(expected.getMethods());
       Collections.sort(expectedMethods, ENTITY_COMPARATOR);
@@ -334,17 +314,49 @@
          throw new Exception(message.toString() + "Number of methods should be equal");
       for (int i = 0; i < expectedMethods.size(); i++)
       {
-         if (!expectedMethods.get(i).equals(actualMethods.get(i)))
-            throw new Exception("Method "  + expectedMethods.get(i) +  
-                  "and " + actualMethods.get(i) + " should be equal");
+         JavaMethod expectedMethod = (JavaMethod)expectedMethods.get(i);
+         JavaMethod actualMethod = (JavaMethod)actualMethods.get(i);
+
+         if (expectedMethod.equals(actualMethod) == false)
+         {
+            throw new Exception("Method " + expectedMethod + "and " + actualMethod + " should be equal");
+         }
+
+         checkExceptionsEqual(expectedMethod, actualMethod);
       }
+   }
 
+   private void checkExceptionsEqual(JavaMethod expected, JavaMethod actual) throws Exception
+   {
+      List expectedExceptions = Arrays.asList(expected.getExceptions());
+      Collections.sort(expectedExceptions);
+      List actualExceptions = Arrays.asList(actual.getExceptions());
+      Collections.sort(actualExceptions);
+
+      StringBuffer message = new StringBuffer("-> checkExceptionsEqual");
+      message.append(" Expected : ");
+      message.append(expectedExceptions);
+      message.append(" Actual : ");
+      message.append(actualExceptions);
+
+      if (expectedExceptions.size() != actualExceptions.size())
+      {
+         throw new Exception(message + " Number of exceptions should be equal");
+      }
+
+      for (int j = 0; j < expectedExceptions.size(); j++)
+      {
+         Type expectedException = (Type)expectedExceptions.get(j);
+         Type actualException = (Type)actualExceptions.get(j);
+
+         if (expectedException.equals(actualException) == false)
+         {
+            throw new Exception("Exception " + expectedException + " and " + actualException + " should be equal for method " + expected);
+         }
+      }
    }
 
-   private void checkModifiersEquals(String msg,
-                                     AbstractJavaEntity expected,
-                                     AbstractJavaEntity actual)
-           throws Exception
+   private void checkModifiersEquals(String msg, AbstractJavaEntity expected, AbstractJavaEntity actual) throws Exception
    {
 
       List expectedModifiers = Arrays.asList(expected.getModifiers());

Modified: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/jbws_206/tests/UserException/UserExceptionWSDL2JavaTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/jbws_206/tests/UserException/UserExceptionWSDL2JavaTestCase.java	2006-09-12 21:56:58 UTC (rev 946)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/jbws_206/tests/UserException/UserExceptionWSDL2JavaTestCase.java	2006-09-13 08:48:05 UTC (rev 947)
@@ -55,5 +55,6 @@
       checkUserType( "CustomException.java");
       checkUserType( "MyException.java"); 
       checkUserType( "AnonymousException.java");
+      checkUserType( "MyFaultType.java");
    } 
 }

Modified: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/validation/WSDL11Validator.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/validation/WSDL11Validator.java	2006-09-12 21:56:58 UTC (rev 946)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/validation/WSDL11Validator.java	2006-09-13 08:48:05 UTC (rev 947)
@@ -19,7 +19,7 @@
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
-package org.jboss.test.ws.tools.validation; 
+package org.jboss.test.ws.tools.validation;
 
 import java.util.StringTokenizer;
 
@@ -51,18 +51,18 @@
 /**
  *  WSDL 11 Validator
  *  @author <mailto:Anil.Saldhana at jboss.org>Anil Saldhana
- *  @since   Jul 22, 2005 
+ *  @since   Jul 22, 2005
  */
 
 public class WSDL11Validator extends WSDLValidator
-{ 
+{
    private static Logger log = Logger.getLogger(WSDL11Validator.class);
    /**
-    * 
+    *
     */
    public WSDL11Validator()
    {
-      super(); 
+      super();
    }
    /**
     * Validates that two wsdl files represented by their WSDLDefinition objects
@@ -76,43 +76,43 @@
    {
       boolean bool = super.validate(wsdlExp,wsdlAct);
       if( bool)
-         bool =  validateMessages(wsdlExp,wsdlAct); 
+         bool =  validateMessages(wsdlExp,wsdlAct);
       if(!bool) log.error("Message Validation Failed");
       return bool;
    }
-   
+
    //**************************************************************************
    //
    //                   PRIVATE METHODS
    //
    //**************************************************************************
-   public boolean validateMessages(WSDLDefinitions w1, WSDLDefinitions w2) 
+   public boolean validateMessages(WSDLDefinitions w1, WSDLDefinitions w2)
    throws JBossWSToolsException
-   { 
+   {
       WSDLInterface[] intf1 = w1.getInterfaces();
       WSDLInterface[] intf2 = w2.getInterfaces();
-      
+
       if(intf1.length != intf2.length)
          throw new JBossWSToolsException("Number of portType operations in wsdl mismatch");
-      
+
       int len = intf1.length;
       for (int i = 0; i < len; i++)
       {
          WSDLInterface i1 = intf1[i];
          WSDLInterface i2 = intf2[i];
-         WSDLInterfaceOperation[] ops1 = i1.getSortedOperations(); 
+         WSDLInterfaceOperation[] ops1 = i1.getSortedOperations();
          WSDLInterfaceOperation[] ops2 = i2.getSortedOperations();
-         
+
          int lenOps = ops1.length;
          for (int j = 0; j < lenOps; j++)
          {
-            if(validateMessage(ops1[j],ops2[j]) == false) 
+            if(validateMessage(ops1[j],ops2[j]) == false)
             {
                log.error("Validation of Messages failed");
-               throw new JBossWSToolsException("Validation of messages failed"); 
+               throw new JBossWSToolsException("Validation of messages failed");
             }
          }//end for
-         
+
          // Append the Faults
          WSDLInterfaceFault[] faults1 = i1.getFaults();
          WSDLInterfaceFault[] faults2 = i2.getFaults();
@@ -123,18 +123,18 @@
             WSDLInterfaceFault flt2 = faults2[k];
             QName elt = flt1.getXmlName();
             QName elt2 = flt2.getXmlName();
-            if(!(elt.getLocalPart().equals(elt2.getLocalPart()) && 
+            if(!(elt.getLocalPart().equals(elt2.getLocalPart()) &&
                   elt.getNamespaceURI().equals(elt2.getNamespaceURI())))
             {
                log.error("Faults do not match");
-               throw new JBossWSToolsException("Validation of faults failed:"+elt.getLocalPart()); 
+               throw new JBossWSToolsException("Validation of faults failed:"+elt.getLocalPart());
             }
-               
-         } 
-      }//end for 
+
+         }
+      }//end for
       return true;
    }
-   
+
    //*********************************************************************************
    //
    //                                PRIVATE METHODS
@@ -144,10 +144,10 @@
    {
       WSDLUtils utils = WSDLUtils.getInstance();
       if((o1 == null && o2 != null) || (o1 != null && o2 == null) )
-         throw new IllegalStateException(utils.getJustClassName(c) + " does not match"); 
+         throw new IllegalStateException(utils.getJustClassName(c) + " does not match");
    }
-   
-   private boolean validateMessage(WSDLInterfaceOperation op1, 
+
+   private boolean validateMessage(WSDLInterfaceOperation op1,
                            WSDLInterfaceOperation op2 ) throws JBossWSToolsException
    {
       String op1name = op1.getName().toString();
@@ -157,7 +157,7 @@
       if(op1name.equals(op2name) == false)
          throw new JBossWSToolsException(op1name + " does not match with " + op2name);
       if( intf1name.equals(intf2name) == false)
-         throw new JBossWSToolsException(intf1name + " does not match with " + intf2name); 
+         throw new JBossWSToolsException(intf1name + " does not match with " + intf2name);
 
       WSDLInterfaceOperationInput[] inputs1 = op1.getInputs();
       WSDLInterfaceOperationInput[] inputs2 = op2.getInputs();
@@ -166,15 +166,15 @@
       {
          WSDLInterfaceOperationInput input1 = inputs1[i];
          WSDLInterfaceOperationInput input2 = inputs2[i];
-         if(validateInputParts(input1, input2) == false) 
+         if(validateInputParts(input1, input2) == false)
             throw new JBossWSToolsException("Validation of input parts failed:" + input1.getElement());
-      } 
+      }
 
       //Now the return type
       WSDLInterfaceOperationOutput[] outputs1 = op1.getOutputs();
       WSDLInterfaceOperationOutput[] outputs2 = op2.getOutputs();
       int lenout = outputs1.length;
-      
+
       if(lenout != outputs2.length)
          throw new JBossWSToolsException("Length of operation outputs do not match");
 
@@ -182,13 +182,13 @@
       {
             WSDLInterfaceOperationOutput out1 = outputs1[i];
             WSDLInterfaceOperationOutput out2 = outputs2[i];
-            if(validateOutputParts(out1, out2) == false) 
+            if(validateOutputParts(out1, out2) == false)
                throw new JBossWSToolsException("Validation of output parts failed:" + out1);
-      } 
+      }
       return true;
    }
 
-   private boolean validateInputParts(WSDLInterfaceOperationInput in1, 
+   private boolean validateInputParts(WSDLInterfaceOperationInput in1,
          WSDLInterfaceOperationInput in2) throws JBossWSToolsException
    {
       //Check if there are any custom properties
@@ -206,11 +206,11 @@
          return false;
       if (zeroarg1 != null && "true".equals(zeroarg1))
          return true;
-      
+
       //Check if there is a property
       WSDLProperty wprop1 = in1.getProperty(Constants.WSDL_PROPERTY_RPC_XMLTYPE);
       WSDLProperty wprop2 = in2.getProperty(Constants.WSDL_PROPERTY_RPC_XMLTYPE);
-      
+
       QName el1 = in1.getElement();
       QName el2 = in2.getElement();
       WSDLDefinitions w1 = in1.getWsdlOperation().getWsdlInterface().getWsdlDefinitions();
@@ -218,14 +218,14 @@
       if(wprop1 != null) el1 = parseQName(wprop1.getValue(),w1);
       if(wprop2 != null) el2 = parseQName(wprop2.getValue(),w2);
       //Validate the QNames by using types
-     
+
       XSTypeDefinition x1 = getTypeDefinition(el1,w1);
-      XSTypeDefinition x2 = getTypeDefinition(el2,w2);      
+      XSTypeDefinition x2 = getTypeDefinition(el2,w2);
       boolean bool = validateType(x1,x2);
-      
+
       return bool;
    }
-   
+
    private boolean validateOutputParts(WSDLInterfaceOperationOutput out1,
          WSDLInterfaceOperationOutput out2) throws JBossWSToolsException
    {
@@ -239,41 +239,41 @@
 
       if(prop1 != null ) voidreturn1 = prop1.getValue();
       if(prop2 != null ) voidreturn2 = prop2.getValue();
-      if(voidreturn1 != null && 
-            voidreturn2 != null && 
+      if(voidreturn1 != null &&
+            voidreturn2 != null &&
             voidreturn1.equals(voidreturn2) == false) return false;
       if(voidreturn1 != null && "true".equals(voidreturn1)) return true;
-      
-      QName el1 = out1.getElement(); 
+
+      QName el1 = out1.getElement();
       QName el2 = out2.getElement();
       WSDLDefinitions w1 = out1.getWsdlOperation().getWsdlInterface().getWsdlDefinitions();
       WSDLDefinitions w2 = out2.getWsdlOperation().getWsdlInterface().getWsdlDefinitions();
       if( prop1 != null) el1 = parseQName( prop1.getValue(),w1);
       if( prop2 != null) el2 = parseQName( prop2.getValue(),w2);
-      //Validate the QNames by using types 
+      //Validate the QNames by using types
       XSTypeDefinition x1 = getTypeDefinition(el1,w1);
-      XSTypeDefinition x2 = getTypeDefinition(el2,w2);      
+      XSTypeDefinition x2 = getTypeDefinition(el2,w2);
       boolean bool = validateType(x1,x2);
-      
+
       return bool;
    }
-   
+
    private XSTypeDefinition getTypeDefinition(QName xmlType, WSDLDefinitions wsdl)
    {
-      WSDLTypes types = wsdl.getWsdlTypes(); 
+      WSDLTypes types = wsdl.getWsdlTypes();
       JBossXSModel xsmodel = WSDLUtils.getSchemaModel(types);
       return xsmodel.getTypeDefinition(xmlType.getLocalPart(),xmlType.getNamespaceURI());
    }
-   
+
    private boolean validateType(XSTypeDefinition x1, XSTypeDefinition x2) throws JBossWSToolsException
    {
       boolean bool = false;
       if(x1==null && x2 == null) return true;
       this.checkNullParametersInconsistency(x1,x2,XSTypeDefinition.class);
- 
+
       if(x1.getName().equals(x2.getName()) == false)
-         throw new JBossWSToolsException("Validation of XSType failed:" 
-                     + x1.getName() + ":" + x2.getName()); 
+         throw new JBossWSToolsException("Validation of XSType failed:"
+                     + x1.getName() + ":" + x2.getName());
       //TODO: Expand comparison of types to include attributes/elements
       if(x1 instanceof XSComplexTypeDefinition &&
             x2 instanceof XSComplexTypeDefinition)
@@ -284,7 +284,7 @@
       }
       return bool;
    }
-   
+
    private QName parseQName( String qnamestr, WSDLDefinitions wsdl)
    {
       QName qn = null;
@@ -297,16 +297,16 @@
          qn = new QName(ns,localpart,prefix);
       }
       return qn;
-   } 
-   
-   private boolean checkXSAttributesEquality(XSAttributeDeclaration x1, 
+   }
+
+   private boolean checkXSAttributesEquality(XSAttributeDeclaration x1,
                         XSAttributeDeclaration x2)
    {
       boolean bool = true;
       if(x1.getName().equals(x2.getName())) return false;
       XSTypeDefinition xt1 = x1.getTypeDefinition();
       XSTypeDefinition xt2 = x2.getTypeDefinition();
-      this.checkNullParametersInconsistency(xt1,xt2,XSTypeDefinition.class); 
+      this.checkNullParametersInconsistency(xt1,xt2,XSTypeDefinition.class);
       if( xt1 != null && xt2 != null)
       {
          if(xt1.getName().equals(xt2.getName()) == false)
@@ -314,18 +314,18 @@
       }
       return bool;
    }
-   
+
    private boolean validateXSComplexTypeDefinitions(XSComplexTypeDefinition xc1,
-         XSComplexTypeDefinition xc2 ) 
-   {  
+         XSComplexTypeDefinition xc2 )
+   {
       //First lets validate the attributes
       boolean bool = true;
       XSObjectList xobj1 = xc1.getAttributeUses();
       XSObjectList xobj2 = xc2.getAttributeUses();
       this.checkNullParametersInconsistency(xobj1,xobj2,XSObjectList.class);
-      if(xobj1 == null && xobj2 == null) 
+      if(xobj1 == null && xobj2 == null)
          return true;
-      if(xobj1.getLength() != xobj2.getLength()) 
+      if(xobj1.getLength() != xobj2.getLength())
          return false;
       int len = xobj1.getLength();
       for(int i=0; i<len ; i++)
@@ -334,7 +334,7 @@
          XSAttributeDeclaration xat2 = (XSAttributeDeclaration)xobj1.item(i);
          bool =  checkXSAttributesEquality(xat1,xat2);
       }
-      
+
       //Validate the particles
       XSParticle xspart1 = xc1.getParticle();
       XSParticle xspart2 = xc2.getParticle();
@@ -342,9 +342,9 @@
       XSTerm xt2 = xspart2.getTerm();
       if(xt1 instanceof XSModelGroup && xt2 instanceof XSModelGroup)
          bool = validateXSModelGroups((XSModelGroup)xt1, (XSModelGroup)xt2);
-      return bool; 
+      return bool;
    }
-   
+
    private boolean validateXSModelGroups( XSModelGroup xm1,  XSModelGroup xm2)
    {
       boolean bool = true;
@@ -374,12 +374,12 @@
       }
       return bool;
    }
-   
+
    private boolean validateXSElementDeclaration(XSElementDeclaration xe1,
          XSElementDeclaration xe2)
    {
       boolean bool = true;
-      bool = (xe1.getName().equals(xe2.getName())); 
+      bool = (xe1.getName().equals(xe2.getName()));
       if(bool)
       {
          //Check if there are types
@@ -387,8 +387,8 @@
          XSTypeDefinition xt2 = xe2.getTypeDefinition();
          bool = xt1.getName().equals(xt2.getName());
          String ns1 = xt1.getNamespace();
-         String ns2 = xt2.getNamespace();  
-          
+         String ns2 = xt2.getNamespace();
+
          /**
           * Ignore the namespace if it is wscompile generated arrays namespace
           */
@@ -396,7 +396,7 @@
             bool = xt1.getNamespace().equals(xt2.getNamespace());
          //TODO:take care of enclosing CT Definition
       }
-         
+
       return bool;
    }
 }

Modified: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/validation/WSDLValidator.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/validation/WSDLValidator.java	2006-09-12 21:56:58 UTC (rev 946)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/validation/WSDLValidator.java	2006-09-13 08:48:05 UTC (rev 947)
@@ -81,7 +81,7 @@
       }
       catch (IOException e)
       {
-         log.error("Error validating types:",e); 
+         log.error("Error validating types:",e);
       }
       validateInterfaces();
       validateBindings();

Modified: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/xmlschema/WSDLTypesTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/xmlschema/WSDLTypesTestCase.java	2006-09-12 21:56:58 UTC (rev 946)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/xmlschema/WSDLTypesTestCase.java	2006-09-13 08:48:05 UTC (rev 947)
@@ -48,7 +48,7 @@
       File wsdlFile = new File("resources/tools/wsdlfixture/" + filename);
       WSDLTypes types = null;
       try
-      { 
+      {
          WSDLToJavaIntf wsdljava = new WSDLToJava();
          wsdljava.setTypeMapping(new LiteralTypeMapping());
          WSDLDefinitions wsdl = wsdljava.convertWSDL2Java(wsdlFile.toURL());
@@ -72,7 +72,7 @@
       File wsdlFile = new File("resources/tools/wsdlfixture/" + filename);
       WSDLTypes types = null;
       try
-      { 
+      {
          WSDLToJavaIntf wsdljava = new WSDLToJava();
          wsdljava.setTypeMapping(new LiteralTypeMapping());
          WSDLDefinitions wsdl = wsdljava.convertWSDL2Java(wsdlFile.toURL());

Modified: branches/tdiesler/jbossws-1.0/src/test/resources/tools/jbws-206/wscompileArtifacts/UserException/sei/UserExceptionSEI.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/resources/tools/jbws-206/wscompileArtifacts/UserException/sei/UserExceptionSEI.java	2006-09-12 21:56:58 UTC (rev 946)
+++ branches/tdiesler/jbossws-1.0/src/test/resources/tools/jbws-206/wscompileArtifacts/UserException/sei/UserExceptionSEI.java	2006-09-13 08:48:05 UTC (rev 947)
@@ -12,4 +12,6 @@
         org.jboss.test.webservice.userexception.MyException,  java.rmi.RemoteException;
     public void testAnonymousException(java.lang.String string_1) throws 
         org.jboss.test.webservice.userexception.AnonymousException,  java.rmi.RemoteException;
+    public void testMyFaultType() throws 
+        org.jboss.test.webservice.userexception.MyFaultType,  java.rmi.RemoteException;
 }

Copied: branches/tdiesler/jbossws-1.0/src/test/resources/tools/jbws-206/wscompileArtifacts/UserException/usertypes/MyFaultType.java (from rev 946, branches/jbossws-1.0/src/test/resources/tools/jbws-206/wscompileArtifacts/UserException/usertypes/MyFaultType.java)

Modified: branches/tdiesler/jbossws-1.0/src/test/resources/tools/jbws-206/wsdlFixture/UserException/UserExceptionService_RPC_11.wsdl
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/resources/tools/jbws-206/wsdlFixture/UserException/UserExceptionService_RPC_11.wsdl	2006-09-12 21:56:58 UTC (rev 946)
+++ branches/tdiesler/jbossws-1.0/src/test/resources/tools/jbws-206/wsdlFixture/UserException/UserExceptionService_RPC_11.wsdl	2006-09-13 08:48:05 UTC (rev 947)
@@ -22,8 +22,14 @@
 			<complexType name="MyException">
 				<sequence />
 			</complexType>
+            <xsd:complexType name="MyFaultType">
+                <xsd:sequence>
+                    <xsd:element name="message" type="string"/>
+                </xsd:sequence>
+            </xsd:complexType>			
 			<element name="CustomException" type="tns:CustomException" />
 			<element name="MyException" type="tns:MyException" />
+            <element name="MyFault" type="tns:MyFaultType"/>						
 			<element name="anonymousException">
 				<complexType>
 					<sequence>
@@ -48,10 +54,15 @@
 	<message name="UserExceptionSEI_testAnonymousException">
 		<part name="String_1" type="xsd:string" />
 	</message>
-      <message name="UserExceptionSEI_testAnonymousExceptionResponse" />
-      <message name="AnonymousException">
-            <part name="AnonymousException" element="ns2:anonymousException"/>
-      </message>
+    <message name="UserExceptionSEI_testAnonymousExceptionResponse" />
+    <message name="AnonymousException">
+        <part name="AnonymousException" element="ns2:anonymousException"/>
+    </message>
+    <message name="UserExceptionSEI_testMyFaultType"/>
+    <message name="UserExceptionSEI_testMyFaultTypeResponse"/>
+    <message name="MyFault">
+        <part name="MyFault" element="ns2:MyFault"/>
+    </message>
 	<portType name="UserExceptionSEI">
 		<operation name="testCustomException">
 			<input message="tns:UserExceptionSEI_testCustomException" />
@@ -71,6 +82,12 @@
 				message="tns:UserExceptionSEI_testAnonymousExceptionResponse" />
 			<fault name="AnonymousException" message="tns:AnonymousException" />
 		</operation>
+		<operation name="testMyFaultType">
+		    <input message="tns:UserExceptionSEI_testMyFaultType" />
+		    <output
+		        message="tns:UserExceptionSEI_testMyFaultTypeResponse" />
+		    <fault name="MyFault" message="tns:MyFault" />
+		</operation>
 	</portType>
 	<binding name="UserExceptionSEIBinding"
 		type="tns:UserExceptionSEI">
@@ -118,6 +135,20 @@
 				<soap:fault name="AnonymousException" use="literal" />
 			</fault>
 		</operation>
+		<operation name="testMyFaultType">
+			<soap:operation soapAction="" />
+			<input>
+				<soap:body use="literal"
+					namespace="http://org.jboss.ws" />
+			</input>
+			<output>
+				<soap:body use="literal"
+					namespace="http://org.jboss.ws" />
+			</output>
+			<fault name="MyFault">
+				<soap:fault name="MyFault" use="literal" />
+			</fault>
+		</operation>		
 	</binding>
 	<service name="UserExceptionService">
 		<port name="UserExceptionSEIPort"




More information about the jboss-svn-commits mailing list