axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/wsdl TestCaseEmitter.java
Date Wed, 17 Oct 2001 15:56:18 GMT
bloritsch    01/10/17 08:56:18

  Modified:    java/src/org/apache/axis/wsdl TestCaseEmitter.java
  Log:
  Fix the TestCaseEmitter so that the testcase is valid as much as possible.
  
  Revision  Changes    Path
  1.6       +36 -4     xml-axis/java/src/org/apache/axis/wsdl/TestCaseEmitter.java
  
  Index: TestCaseEmitter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/TestCaseEmitter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestCaseEmitter.java	2001/10/16 18:52:55	1.5
  +++ TestCaseEmitter.java	2001/10/17 15:56:18	1.6
  @@ -57,16 +57,18 @@
   import javax.wsdl.Binding;
   import javax.wsdl.Operation;
   import javax.wsdl.PortType;
  +import javax.wsdl.Fault;
   import java.io.IOException;
   import java.io.PrintWriter;
   import java.util.Iterator;
  +import java.util.Map;
   
   /**
    * Generate the TestCase code for use in testing services derived from the
    * generated stubs.
    *
    * @author <a href="bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.5 $ $Date: 2001/10/16 18:52:55 $
  + * @version CVS $Revision: 1.6 $ $Date: 2001/10/17 15:56:18 $
    */
   
   public class TestCaseEmitter {
  @@ -219,7 +221,17 @@
                   }
   
                   Emitter.Parameter param = (Emitter.Parameter) iparam.next();
  -                String paramType = param.type;
  +                String paramType = null;
  +
  +                switch (param.mode) {
  +                    case Emitter.Parameter.IN:
  +                        paramType = param.type;
  +                        break;
  +
  +                    default:
  +                        paramType = emitter.holder(param.type);
  +                }
  +                
                   if ( this.emitter.isPrimitiveType(paramType) ) {
                       if ( "boolean".equals(paramType) ) {
                           writer.print("true");
  @@ -228,7 +240,7 @@
                       }
                   } else {
                       writer.print("new ");
  -                    writer.print(param.type);
  +                    writer.print(paramType);
                       writer.print("()");
                   }
               }
  @@ -252,7 +264,27 @@
               writer.println("        } catch (java.rmi.RemoteException re) {");
               writer.print(INDENT);
               writer.println("throw new junit.framework.AssertionFailedError(\"Remote Exception
caught: \" + re );");
  -            writer.println("        }");
  +            writer.print("        }");
  +            
  +            Map faultMap = op.getFaults();
  +
  +            if (faultMap != null) {
  +                Iterator i = faultMap.values().iterator();
  +                int count = 0;
  +
  +                while (i.hasNext()) {
  +                    count++;
  +                    Fault f = (Fault) i.next();
  +                    writer.print(" catch (");
  +                    writer.print(f.getName());
  +                    writer.println(" e" + count + ") {");
  +                    writer.print(INDENT);
  +                    writer.println("throw new junit.framework.AssertionFailedError(\""
+ f.getName() + " Exception caught: \" + e" + count + ");");
  +                    writer.print("        }");
  +                }
  +            }
  +
  +            writer.println();
           }
       }
   
  
  
  

Mime
View raw message