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 to...@apache.org on 2005/05/31 21:58:25 UTC

cvs commit: ws-axis/java/test/wsdl/arrays StructureTypeTestCase.java ArrayTest.wsdl PersonalInfoBookSOAPBindingImpl.java

tomj        2005/05/31 12:58:25

  Modified:    java/test/wsdl/arrays ArrayTest.wsdl
                        PersonalInfoBookSOAPBindingImpl.java
  Added:       java/test/wsdl/arrays StructureTypeTestCase.java
  Log:
  Add test case for bugs 2020 and 2026 (not fixed yet).
  
  Revision  Changes    Path
  1.5       +43 -0     ws-axis/java/test/wsdl/arrays/ArrayTest.wsdl
  
  Index: ArrayTest.wsdl
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/arrays/ArrayTest.wsdl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ArrayTest.wsdl	16 Sep 2002 15:55:56 -0000	1.4
  +++ ArrayTest.wsdl	31 May 2005 19:58:25 -0000	1.5
  @@ -65,6 +65,24 @@
           </xsd:sequence>
         </xsd:complexType>
   
  +        <xsd:complexType name="StructureType">
  +            <xsd:all>
  +                <xsd:element name="fld1" type="xsd:int" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
  +                <xsd:element name="fld2" type="tns:intarr" minOccurs="0"/>
  +            </xsd:all>
  +        </xsd:complexType>
  +
  +        <xsd:complexType name="intarr">
  +            <xsd:complexContent>
  +                <xsd:restriction base="soapenc:Array">
  +                    <xsd:sequence>
  +                        <xsd:element name="element" type="xsd:int" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
  +                    </xsd:sequence>
  +                </xsd:restriction>
  +            </xsd:complexContent>
  +        </xsd:complexType>
  +
  +
       </xsd:schema>
   
     </types>
  @@ -109,6 +127,14 @@
   
     <message name="empty"/>
   
  +  <message name="EchoStructRequest">
  +    <part name="name" type="tns:StructureType"/>
  +  </message>
  +
  +  <message name="EchoStructResponse">
  +    <part name="id" type="tns:StructureType"/>
  +  </message>
  +
     <!-- port type declns -->
     <portType name="PersonalInfoBook">
       <operation name="addEntry">
  @@ -131,6 +157,10 @@
         <input message="tns:GetID2FromNameRequest"/>
         <output message="tns:GetID2FromNameResponse"/>
       </operation>
  +    <operation name="echoStruct">
  +      <input message="tns:EchoStructRequest"/>
  +      <output message="tns:EchoStructResponse"/>
  +    </operation>
     </portType>
   
     <!-- binding declns -->
  @@ -202,6 +232,19 @@
                      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
         </output>
       </operation>
  +      <operation name="echoStruct">
  +        <soap:operation soapAction=""/>
  +        <input>
  +          <soap:body use="encoded"
  +                     namespace="urn:ArrayTest"
  +                     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +        </input>
  +        <output>
  +          <soap:body use="encoded"
  +                     namespace="urn:ArrayTest"
  +                     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +        </output>
  +      </operation>
     </binding>
   
     <!-- service decln -->
  
  
  
  1.3       +4 -0      ws-axis/java/test/wsdl/arrays/PersonalInfoBookSOAPBindingImpl.java
  
  Index: PersonalInfoBookSOAPBindingImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/arrays/PersonalInfoBookSOAPBindingImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PersonalInfoBookSOAPBindingImpl.java	21 Mar 2002 16:20:48 -0000	1.2
  +++ PersonalInfoBookSOAPBindingImpl.java	31 May 2005 19:58:25 -0000	1.3
  @@ -26,4 +26,8 @@
       public int getID2FromName(java.lang.String name) throws java.rmi.RemoteException {
           return ((test.wsdl.arrays.PersonalInfo) table.get(name)).getId2();
       }
  +
  +    public StructureType echoStruct(StructureType in) throws java.rmi.RemoteException {
  +        return in;
  +    }
   }
  
  
  
  1.1                  ws-axis/java/test/wsdl/arrays/StructureTypeTestCase.java
  
  Index: StructureTypeTestCase.java
  ===================================================================
  package test.wsdl.arrays;
  
  /**
   * StructureTypeTestCase
   * <p/>
   * This test only needs to compile, as we are testing to make sure that the
   * Schema in the WSDL generates the correctly wrapped Integer arrays.
   */
  public class StructureTypeTestCase extends junit.framework.TestCase {
  
      public StructureTypeTestCase(String name) {
          super(name);
      }
  
      public void testEchoStruct() throws Exception {
          test.wsdl.arrays.PersonalInfoBookSOAPBindingStub binding;
          try {
              binding = (test.wsdl.arrays.PersonalInfoBookSOAPBindingStub)
                      new test.wsdl.arrays.PersonalInfoBookServiceLocator().getPersonalInfoBook();
          } catch (javax.xml.rpc.ServiceException jre) {
              if (jre.getLinkedCause() != null)
                  jre.getLinkedCause().printStackTrace();
              throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
          }
          assertNotNull("binding is null", binding);
  
          // Time out after a minute
          binding.setTimeout(60000);
  
          // Test operation
          Integer a1[] = new Integer[]{new Integer(1), new Integer(2), new Integer(3)};
          //Integer a2[] = new Integer[] {new Integer(9), new Integer(8), new Integer(7)};
          int a2[] = new int[]{9, 8, 7};
          final test.wsdl.arrays.StructureType inStruct = new test.wsdl.arrays.StructureType(a1, a2);
          test.wsdl.arrays.StructureType value = null;
          value = binding.echoStruct(inStruct);
          Integer r1[] = value.getFld1();
          assertEquals("return struct #1 didn't match", 1, r1[0].intValue() );
          assertEquals("return struct #1 didn't match", 2, r1[1].intValue() );
          assertEquals("return struct #1 didn't match", 3, r1[2].intValue() );
  
          //Integer r2[] = value.getFld2();
          int r2[] = value.getFld2();
          assertEquals("return struct #2 didn't match", 9, r2[0] );
          assertEquals("return struct #2 didn't match", 8, r2[1] );
          assertEquals("return struct #2 didn't match", 7, r2[2] );
  
      }
  
  
  }