You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2002/03/05 02:04:53 UTC

cvs commit: xml-axis/java/test/wsdl/interop3/docLit DocLitTestCase.java build.xml

gdaniels    02/03/04 17:04:53

  Modified:    java/test/wsdl/interop3/docLit build.xml
  Added:       java/test/wsdl/interop3/docLit DocLitTestCase.java
  Log:
  Add test case for DocLit test, and update build file to copy it over.
  
  Revision  Changes    Path
  1.8       +3 -0      xml-axis/java/test/wsdl/interop3/docLit/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/interop3/docLit/build.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- build.xml	28 Feb 2002 20:52:22 -0000	1.7
  +++ build.xml	5 Mar 2002 01:04:53 -0000	1.8
  @@ -26,6 +26,9 @@
       <copy file="WSDLInteropTestDocLitPortBindingImpl.java" overwrite="true"
             todir="${root.dir}/build/work/test/wsdl/interop3/${testname}"/>
   
  +    <copy file="DocLitTestCase.java"
  +          todir="${root.dir}/build/work/test/wsdl/interop3/${testname}"/>
  +
       <!-- compile the skeletons -->
       <javac srcdir="${root.dir}/${build.dir}/work" 
         destdir="${root.dir}/${build.dest}" debug="on">
  
  
  
  1.1                  xml-axis/java/test/wsdl/interop3/docLit/DocLitTestCase.java
  
  Index: DocLitTestCase.java
  ===================================================================
  package test.wsdl.interop3.docLit;
  
  
  import test.wsdl.interop3.docLit.xsd.ArrayOfstringLiteral;
  import test.wsdl.interop3.docLit.xsd.SOAPStruct;
  
  import java.net.URL;
  
  /*
      <!-- SOAP Builder's round III web services          -->
      <!-- interoperability testing:  import1             -->
      <!-- (see http://www.whitemesa.net/r3/plan.html)    -->
      <!-- Step 1.  Start with predefined WSDL            -->
      <!-- Step 2.  Generate client from predefined WSDL  -->
      <!-- Step 3.  Test generated client against         -->
      <!--          pre-built server                      -->
      <!-- Step 4.  Generate server from predefined WSDL  -->
      <!-- Step 5.  Test generated client against         -->
      <!--          generated server                      -->
      <!-- Step 6.  Generate second client from           -->
      <!--          generated server's WSDL (some clients -->
      <!--          can do this dynamically)              -->
      <!-- Step 7.  Test second generated client against  -->
      <!--          generated server                      -->
      <!-- Step 8.  Test second generated client against  -->
      <!--          pre-built server                      -->
  */
  
  public class DocLitTestCase extends junit.framework.TestCase {
      static URL url;
  
      public DocLitTestCase(String name) {
          super(name);
      }
  
      protected void setUp() throws Exception {
      }
  
      public void testStep3() throws Exception {
          WSDLInteropTestDocLitPortBinding binding;
          try {
              if (url != null) {
                  binding = new WSDLInteropTestDocLitServiceLocator().getWSDLInteropTestDocLitPort(url);
              } else {
                  binding = new WSDLInteropTestDocLitServiceLocator().getWSDLInteropTestDocLitPort();
              }
          }
          catch (javax.xml.rpc.ServiceException jre) {
              throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
          }
          assertNotNull("binding is null", binding);
  
          String str = "Hello there!";
          String [] strArray = new String [] { "1", "two", "trois" };
          ArrayOfstringLiteral param = new ArrayOfstringLiteral();
          param.setString(strArray);
  
          assertEquals("echoString results differ", binding.echoString(str), str);
  
          String [] resArray = binding.echoStringArray(param).getString();
          assertEquals("String array lengths differ",
                       strArray.length,
                       resArray.length);
          for (int i = 0; i < strArray.length; i++) {
              assertEquals("Array members at index " + i + " differ",
                           strArray[i],
                           resArray[i]);
          }
  
          SOAPStruct struct = new SOAPStruct();
          struct.setVarFloat(3.14159F);
          struct.setVarInt(69);
          struct.setVarString("Struct-o-rama");
  
          assertTrue("Structs weren't equal",
                     struct.equals(binding.echoStruct(struct)));
      }
  
  
  
      public static void main(String[] args) {
          if (args.length == 1) {
              try {
                  url = new URL(args[0]);
              } catch (Exception e) {
              }
          }
  
          junit.textui.TestRunner.run(new junit.framework.TestSuite(DocLitTestCase.class));
      } // main
  }