axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/test/wsdl/polymorphism C.java PolymorphismTestSoapImpl.java PolymorphismTest_ServiceTestCase.java polymorphism.wsdl
Date Mon, 22 Jul 2002 19:09:04 GMT
gdaniels    2002/07/22 12:09:04

  Modified:    java/test/wsdl Wsdl2javaTestSuite.xml
               java/test/wsdl/polymorphism PolymorphismTestSoapImpl.java
                        PolymorphismTest_ServiceTestCase.java
                        polymorphism.wsdl
  Added:       java/test/wsdl/polymorphism C.java
  Log:
  Update polymorphism test to include a test of sending back a "C", which
  ISA "A" but has no explicit type mapping registered.   Make sure we get
  it on the other side as an "A".
  
  Revision  Changes    Path
  1.115     +5 -0      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.114
  retrieving revision 1.115
  diff -u -r1.114 -r1.115
  --- Wsdl2javaTestSuite.xml	22 Jul 2002 06:23:02 -0000	1.114
  +++ Wsdl2javaTestSuite.xml	22 Jul 2002 19:09:04 -0000	1.115
  @@ -891,6 +891,11 @@
             <mapping namespace="http://xml.apache.org/axis/PolymorphismTest"
                 package="test.wsdl.polymorphism"/>
         </wsdl2java>
  +      <copy todir="${build.dir}/work/test/wsdl/polymorphism" overwrite="yes">
  +        <fileset dir="${test.dir}/wsdl/polymorphism">
  +          <include name="C.java"/>
  +        </fileset>
  +      </copy>
   
       <!-- This tests the getPort method in generated services.  -->
       <wsdl2java url="test/wsdl/getPort/getPort.wsdl"
  
  
  
  1.2       +12 -5     xml-axis/java/test/wsdl/polymorphism/PolymorphismTestSoapImpl.java
  
  Index: PolymorphismTestSoapImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/polymorphism/PolymorphismTestSoapImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PolymorphismTestSoapImpl.java	22 Jul 2002 06:23:02 -0000	1.1
  +++ PolymorphismTestSoapImpl.java	22 Jul 2002 19:09:04 -0000	1.2
  @@ -11,11 +11,18 @@
       public static final String B_TEXT = "this is my B field";
       public static final String A_TEXT = "this is my A field";
   
  -    public test.wsdl.polymorphism.A getBAsA() throws java.rmi.RemoteException {
  -        B myB = new B();
  -        myB.setB(B_TEXT);
  -        myB.setA(A_TEXT);
  -        return myB;
  +    public test.wsdl.polymorphism.A getBAsA(boolean sendC)
  +            throws java.rmi.RemoteException {
  +        if (sendC) {
  +            C myC = new C();
  +            myC.setA(A_TEXT);
  +            return myC;
  +        } else {
  +            B myB = new B();
  +            myB.setB(B_TEXT);
  +            myB.setA(A_TEXT);
  +            return myB;
  +        }
       }
   
   }
  
  
  
  1.2       +32 -1     xml-axis/java/test/wsdl/polymorphism/PolymorphismTest_ServiceTestCase.java
  
  Index: PolymorphismTest_ServiceTestCase.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/polymorphism/PolymorphismTest_ServiceTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PolymorphismTest_ServiceTestCase.java	22 Jul 2002 06:23:02 -0000	1.1
  +++ PolymorphismTest_ServiceTestCase.java	22 Jul 2002 19:09:04 -0000	1.2
  @@ -23,7 +23,9 @@
   
           try {
               test.wsdl.polymorphism.A value = null;
  -            value = binding.getBAsA();
  +
  +            // Passing false here gets us a "B"
  +            value = binding.getBAsA(false);
   
               // Check out the return value for correctness.
               assertTrue("Return value wasn't a 'B'!", value instanceof B);
  @@ -34,6 +36,35 @@
               assertEquals("A field didn't match",
                            PolymorphismTestSoapImpl.A_TEXT,
                            myB.getA());
  +        }
  +        catch (java.rmi.RemoteException re) {
  +            throw new junit.framework.AssertionFailedError("Remote Exception caught: "
+ re);
  +        }
  +    }
  +
  +    public void test1PolymorphismTestGetCAsA() {
  +        test.wsdl.polymorphism.PolymorphismTest_Port binding;
  +        try {
  +            binding = new test.wsdl.polymorphism.PolymorphismTest_ServiceLocator().getPolymorphismTest();
  +        }
  +        catch (javax.xml.rpc.ServiceException jre) {
  +            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught:
" + jre);
  +        }
  +        assertTrue("binding is null", binding != null);
  +
  +        try {
  +            test.wsdl.polymorphism.A value = null;
  +
  +            // Passing true here gets us a "C" on the server side, but since
  +            // there's no type mapping for that we should just get the "A"
  +            // part.
  +            value = binding.getBAsA(true);
  +
  +            // Check out the return value for correctness.
  +            assertTrue("Return value wasn't an 'A'!", value instanceof A);
  +            assertEquals("A field didn't match",
  +                         PolymorphismTestSoapImpl.A_TEXT,
  +                         value.getA());
           }
           catch (java.rmi.RemoteException re) {
               throw new junit.framework.AssertionFailedError("Remote Exception caught: "
+ re);
  
  
  
  1.2       +6 -1      xml-axis/java/test/wsdl/polymorphism/polymorphism.wsdl
  
  Index: polymorphism.wsdl
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/polymorphism/polymorphism.wsdl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- polymorphism.wsdl	22 Jul 2002 06:23:02 -0000	1.1
  +++ polymorphism.wsdl	22 Jul 2002 19:09:04 -0000	1.2
  @@ -18,7 +18,12 @@
       <s:schema elementFormDefault="qualified" 
   targetNamespace="http://xml.apache.org/axis/PolymorphismTest">
         <s:element name="GetBAsA">
  -        <s:complexType />
  +        <s:complexType>
  +            <s:sequence>
  +                <s:element name="sendC" minOccurs="1" maxOccurs="1"
  +                    type="s:boolean"/>
  +            </s:sequence>
  +        </s:complexType>
         </s:element>
         <s:element name="GetBAsAResponse">
           <s:complexType>
  
  
  
  1.1                  xml-axis/java/test/wsdl/polymorphism/C.java
  
  Index: C.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /**
   * C is a class which extends A, but HAS NO TYPE MAPPING associated with it
   * directly.
   *
   * We use this to make sure that such a class can still be serialized as an
   * A without any trouble.
   *
   * @author Glen Daniels (gdaniels@apache.org)
   */
  package test.wsdl.polymorphism;
  
  public class C extends A {
      private float floatField = 0.5F;
  
      public float getFloatField() {
          return floatField;
      }
  
      public void setFloatField(float floatField) {
          this.floatField = floatField;
      }
  }
  
  
  

Mime
View raw message