dims        2002/12/01 10:53:46

  Added:       java/test/wsdl/gateway build.xml Gateway.java
                        GatewayServiceTestCase.java
                        GatewaySoapBindingImpl.java MyClass.java
                        OutClass.java
  Log:
  Test case for Bug 14033 - bean property multi-dimensional arrays don't deserialize
  
  Notes:
  - Am unable to find the cause of problem
  - To recreate the problem comment out setValues and getValues method in MyClass.java 
and run "ant compile run" from the test/wsdl/gateway directory.
  
  Revision  Changes    Path
  1.1                  xml-axis/java/test/wsdl/gateway/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0" ?>
  <!DOCTYPE project [
          <!ENTITY properties SYSTEM "file:../../../xmls/properties.xml">
          <!ENTITY paths  SYSTEM "file:../../../xmls/path_refs.xml">
          <!ENTITY taskdefs SYSTEM "file:../../../xmls/taskdefs.xml">
          <!ENTITY taskdefs_post_compile SYSTEM 
"file:../../../xmls/taskdefs_post_compile.xml">
          <!ENTITY targets SYSTEM "file:../../../xmls/targets.xml">
  ]>
  
  <!-- ===================================================================
  <description>
     Test/Sample Component file for Axis
  
  Notes:
     This is a build file for use with the Jakarta Ant build tool.
  
  Prerequisites:
  
     jakarta-ant from http://jakarta.apache.org
  
  Build Instructions:
     To compile
          ant compile
     To execute
          ant run
  
  Author:
    Matt Seibert [EMAIL PROTECTED]
  
  Copyright:
    Copyright (c) 2002-2003 Apache Software Foundation.
  </description>
  ==================================================================== -->
  
  <project default="compile">
  
  <property name="axis.home" location="../../.." />
  <property name="componentName" value="test/wsdl/gateway" />
          &properties;
          &paths;
          &taskdefs;
          &taskdefs_post_compile;
          &targets;
  
  <target name="clean">
      <echo message="componentName is ${componentName}"/>
      <echo message="Removing ${build.dir}/**/test/wsdl/gateway" />
      <delete dir="${build.dir}/classes/test/wsdl/gateway"/>
      <delete dir="${build.dir}/work/test/wsdl/gateway"/>
  </target>
  
  <!-- main target, always start from scratch -->
  <target name="compile" depends="setenv, clean">
    <echo message="Compiling test.wsdl.gateway"/>
    
      <!-- Compile the test classes for Java2WSDL -->
      <javac srcdir="${axis.home}/test/wsdl/gateway" 
             destdir="${build.dest}" 
             fork="${javac.fork}"
             debug="${debug}">
        <classpath refid="classpath" />
        <include name="Gateway.java" />
        <include name="MyClass.java" />
        <include name="OutClass.java" />
      </javac>
      
      <mkdir dir="${build.dir}/work/test/wsdl/gateway"/>
      
      <!-- Generate WSDL from java -->
      <java2wsdl output="${build.dir}/work/test/wsdl/gateway/Gateway.wsdl"
                 className= "test.wsdl.gateway.Gateway"
                 extraClasses="test.wsdl.gateway.MyClass, test.wsdl.gateway.OutClass"
                 namespace="http://test.com/gateway";
                 location="http://localhost:8080/axis/services/Gateway";>
          <mapping package="test.wsdl.gateway" namespace="http://test.com/gateway"; />
      </java2wsdl>
      
      <!-- Verify files generated based on everything in WSDL -->
      <wsdl2java url="${build.dir}/work/test/wsdl/gateway/Gateway.wsdl"
                 output="${axis.home}/build/work"
                 serverSide="yes"
                 all="yes"
                 verbose="no"
                 testcase="no">
          <mapping namespace="http://test.com/gateway"; package="test.wsdl.gateway"/>
      </wsdl2java>
  
      <!-- Copy the test case -->
      <copy file="GatewayServiceTestCase.java" overwrite="true"
            todir="${build.dir}/work/test/wsdl/gateway"/>
  
      <!-- Copy the binding impl case -->
      <copy file="GatewaySoapBindingImpl.java" overwrite="true"
            todir="${build.dir}/work/test/wsdl/gateway"/>
  
        <!-- Clean up old classes -->
      <delete dir="${build.dir}/classes/test/wsdl/gateway" />
  
      <!-- Compile the test case -->
      <javac srcdir="${build.dir}/work" destdir="${build.dest}" fork="${javac.fork}"
             debug="${debug}">
        <classpath refid="classpath" />
        <include name="test/wsdl/gateway/*.java" />
      </javac>
  
  </target>
  
  <target name="run" >
    <antcall target="execute-Component" />
  </target>
  
  </project>
  
  
  
  1.1                  xml-axis/java/test/wsdl/gateway/Gateway.java
  
  Index: Gateway.java
  ===================================================================
  package test.wsdl.gateway;
  
  public interface Gateway {
        public String test1(MyClass myClass);
        public MyClass test2();
        public String[][] test3();
        public String test4(String[][] param);
  }
  
  
  1.1                  xml-axis/java/test/wsdl/gateway/GatewayServiceTestCase.java
  
  Index: GatewayServiceTestCase.java
  ===================================================================
  /**
   * GatewayServiceTestCase.java
   *
   * This file was auto-generated from WSDL
   * by the Apache Axis WSDL2Java emitter.
   */
  
  package test.wsdl.gateway;
  
  public class GatewayServiceTestCase extends junit.framework.TestCase {
      public GatewayServiceTestCase(java.lang.String name) {
          super(name);
      }
      public void test1GatewayTest1() throws Exception {
          test.wsdl.gateway.Gateway binding;
          try {
              binding = new test.wsdl.gateway.GatewayServiceLocator().getGateway();
          }
          catch (javax.xml.rpc.ServiceException jre) {
              if(jre.getLinkedCause()!=null)
                  jre.getLinkedCause().printStackTrace();
              throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException 
caught: " + jre);
          }
          assertTrue("binding is null", binding != null);
  
          // Test operation
          test.wsdl.gateway.MyClass myClass = new test.wsdl.gateway.MyClass();
          myClass.setValues(new String[][]{{"hello"}});
          java.lang.String value = null;
          value = binding.test1(myClass);
          // TBD - validate results
      }
  
      public void test2GatewayTest2() throws Exception {
          test.wsdl.gateway.Gateway binding;
          try {
              binding = new test.wsdl.gateway.GatewayServiceLocator().getGateway();
          }
          catch (javax.xml.rpc.ServiceException jre) {
              if(jre.getLinkedCause()!=null)
                  jre.getLinkedCause().printStackTrace();
              throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException 
caught: " + jre);
          }
          assertTrue("binding is null", binding != null);
  
          // Test operation
          test.wsdl.gateway.MyClass response = null;
          response = binding.test2();
          assertTrue(response.getValues()!=null);
          System.out.println("Response cell 1,1="+response.getValues()[1][1]);
      }
  
      public void test3GatewayTest3() throws Exception {
          test.wsdl.gateway.Gateway binding;
          try {
              binding = new test.wsdl.gateway.GatewayServiceLocator().getGateway();
          }
          catch (javax.xml.rpc.ServiceException jre) {
              if(jre.getLinkedCause()!=null)
                  jre.getLinkedCause().printStackTrace();
              throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException 
caught: " + jre);
          }
          assertTrue("binding is null", binding != null);
  
          // Test operation
          java.lang.String[][] value = null;
          value = binding.test3();
          // TBD - validate results
      }
  
      public void test4GatewayTest4() throws Exception {
          test.wsdl.gateway.Gateway binding;
          try {
              binding = new test.wsdl.gateway.GatewayServiceLocator().getGateway();
          }
          catch (javax.xml.rpc.ServiceException jre) {
              if(jre.getLinkedCause()!=null)
                  jre.getLinkedCause().printStackTrace();
              throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException 
caught: " + jre);
          }
          assertTrue("binding is null", binding != null);
  
          // Test operation
          java.lang.String value = null;
          value = binding.test4(new java.lang.String[0][0]);
          // TBD - validate results
      }
  
  }
  
  
  
  1.1                  xml-axis/java/test/wsdl/gateway/GatewaySoapBindingImpl.java
  
  Index: GatewaySoapBindingImpl.java
  ===================================================================
  /**
   * GatewaySoapBindingImpl.java
   *
   * This file was auto-generated from WSDL
   * by the Apache Axis WSDL2Java emitter.
   */
  
  package test.wsdl.gateway;
  
  public class GatewaySoapBindingImpl implements test.wsdl.gateway.Gateway{
      public java.lang.String test1(test.wsdl.gateway.MyClass myClass) throws 
java.rmi.RemoteException {
          String[][] textArray=myClass.getValues();
          return "value of 1,1 = "+textArray[0][0];
      }
  
      public test.wsdl.gateway.MyClass test2() throws java.rmi.RemoteException {
          String[][] param=new String[2][];
          param[0]=new String[1];
          param[0][0]="0,0";
          param[1]=new String[3];
          param[1][0]="1,0";
          param[1][1]="*1,1";
          param[1][2]="1,2";
          MyClass myClass=new MyClass();
          myClass.setValues(param);
          return myClass;
      }
  
      public java.lang.String[][] test3() throws java.rmi.RemoteException {
          return null;
      }
  
      public java.lang.String test4(java.lang.String[][] in0) throws 
java.rmi.RemoteException {
          return null;
      }
  
  }
  
  
  
  1.1                  xml-axis/java/test/wsdl/gateway/MyClass.java
  
  Index: MyClass.java
  ===================================================================
  package test.wsdl.gateway;
  
  /**
   * To recreate the Bug 14033 - bean property multi-dimensional arrays don't 
deserialize
   * problem, just comment out the getValues and setValues methods
   */ 
  public class MyClass {
        public String[][] Values;
  
        public String[][] getValues() {
                return Values;
        }
        public void setValues(String[][] values) {
                Values=values;
        }
  }
  
  
  
  1.1                  xml-axis/java/test/wsdl/gateway/OutClass.java
  
  Index: OutClass.java
  ===================================================================
  package test.wsdl.gateway;
  
  public class OutClass {
        public String text;
        public int val;
  }
  
  
  


Reply via email to