dims        2003/01/01 16:02:42

  Modified:    java/test/wsdl/interop4/groupG/dime/doc build.xml
                        dime-doc.wsdl
               java/src/org/apache/axis/wsdl/symbolTable SymbolTable.java
  Added:       java/test/wsdl/interop4/groupG/dime/doc
                        AttachmentsBindingImpl.java
                        DimeDOCInteropTestCase.java
  Log:
  Initial check-in for dime/doc Interop GroupG test case.
  
  Notes:
  - EchoAttachments has the same problem as mime/doc's EchoAttachments.
  
  Revision  Changes    Path
  1.3       +10 -9     xml-axis/java/test/wsdl/interop4/groupG/dime/doc/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/interop4/groupG/dime/doc/build.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- build.xml 29 Nov 2002 23:32:52 -0000      1.2
  +++ build.xml 2 Jan 2003 00:02:42 -0000       1.3
  @@ -54,7 +54,8 @@
       <!-- generate skeletons -->
       <wsdl2java url="${axis.home}/test/wsdl/interop4/groupG/dime/doc/dime-doc.wsdl"
                  output="${root.dir}/build/work" 
  -               skeletonDeploy="no"
  +               skeletonDeploy="yes"
  +               timeout="-1"
                  testCase="yes"
                  serverSide="yes">
           <mapping namespace="http://soapinterop.org/attachments/wsdl"; 
package="test.wsdl.interop4.groupG.dime.doc"/>
  @@ -70,14 +71,14 @@
       </wsdl2java>
   
       <mkdir dir="${build.dest}"/>
  -    <!--
  -    <copy file="BaseTypesInteropTestsTestCase.java"
  -         todir="${root.dir}/build/work/test/wsdl/interop5/basetype/"
  -         overwrite="yes"/>
  -    <copy file="InteropTestsBindingImpl.java"
  -         todir="${root.dir}/build/work/test/wsdl/interop5/basetype/"
  -         overwrite="yes"/>
  -    -->
  +
  +    <copy 
file="${axis.home}/test/wsdl/interop4/groupG/dime/doc/DimeDOCInteropTestCase.java"
  +          todir="${root.dir}/build/work/test/wsdl/interop4/groupG/dime/doc"
  +          overwrite="yes"/>
  +    <copy 
file="${axis.home}/test/wsdl/interop4/groupG/dime/doc/AttachmentsBindingImpl.java"
  +          todir="${root.dir}/build/work/test/wsdl/interop4/groupG/dime/doc"
  +          overwrite="yes"/>
  +
       <!-- compile the skeletons -->
       <javac srcdir="${build.dir}/work"
         destdir="${build.dest}" debug="on">
  
  
  
  1.2       +5 -0      xml-axis/java/test/wsdl/interop4/groupG/dime/doc/dime-doc.wsdl
  
  Index: dime-doc.wsdl
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/interop4/groupG/dime/doc/dime-doc.wsdl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- dime-doc.wsdl     1 Nov 2002 21:43:04 -0000       1.1
  +++ dime-doc.wsdl     2 Jan 2003 00:02:42 -0000       1.2
  @@ -208,4 +208,9 @@
                        </wsdl:output>
                </wsdl:operation>
        </wsdl:binding>
  +    <wsdl:service name="DimeDOCInterop">
  +         <wsdl:port name="DimeDOCSoapPort" binding="AttachmentsBinding">
  +            <soap:address 
location="http://localhost:8080/axis/services/DimeDOCSoapPort"/>
  +        </wsdl:port>
  +    </wsdl:service>
   </wsdl:definitions>
  
  
  
  1.1                  
xml-axis/java/test/wsdl/interop4/groupG/dime/doc/AttachmentsBindingImpl.java
  
  Index: AttachmentsBindingImpl.java
  ===================================================================
  /**
   * AttachmentsBindingImpl.java
   *
   * This file was auto-generated from WSDL
   * by the Apache Axis WSDL2Java emitter.
   */
  
  package test.wsdl.interop4.groupG.dime.doc;
  
  import org.apache.axis.Message;
  import org.apache.axis.AxisEngine;
  
  public class AttachmentsBindingImpl implements 
test.wsdl.interop4.groupG.dime.doc.AttachmentsPortType{
      public org.apache.axis.attachments.OctetStream 
echoAttachment(org.apache.axis.attachments.OctetStream in) throws 
java.rmi.RemoteException {
          return in;
      }
  
      public org.apache.axis.attachments.OctetStream[] 
echoAttachments(org.apache.axis.attachments.OctetStream[] item) throws 
java.rmi.RemoteException {
          return item;
      }
  
      public byte[] echoAttachmentAsBase64(org.apache.axis.attachments.OctetStream in) 
throws java.rmi.RemoteException {
          return in.getBytes();
      }
  
      public org.apache.axis.attachments.OctetStream echoBase64AsAttachment(byte[] in) 
throws java.rmi.RemoteException {
          Message response = 
AxisEngine.getCurrentMessageContext().getResponseMessage();
          
response.getAttachmentsImpl().setSendType(org.apache.axis.attachments.Attachments.SEND_TYPE_DIME);
          return new org.apache.axis.attachments.OctetStream(in);
      }
  
      public void echoUnrefAttachments() throws java.rmi.RemoteException {
      }
  
      public java.lang.String echoAttachmentAsString(java.lang.String in) throws 
java.rmi.RemoteException {
          return in;
      }
  
  }
  
  
  
  1.1                  
xml-axis/java/test/wsdl/interop4/groupG/dime/doc/DimeDOCInteropTestCase.java
  
  Index: DimeDOCInteropTestCase.java
  ===================================================================
  /**
   * DimeDOCInteropTestCase.java
   *
   * This file was auto-generated from WSDL
   * by the Apache Axis WSDL2Java emitter.
   */
  
  package test.wsdl.interop4.groupG.dime.doc;
  
  import java.net.URL;
  import java.util.Arrays;
  
  import org.apache.axis.attachments.OctetStream;
  
  public class DimeDOCInteropTestCase extends junit.framework.TestCase {
      public DimeDOCInteropTestCase(java.lang.String name) {
          super(name);
      }
      protected void setUp() throws Exception {
          if(url == null) {
              url = new URL(new 
test.wsdl.interop4.groupG.dime.doc.DimeDOCInteropLocator().getDimeDOCSoapPortAddress());
          }
      }    
      public void test1DimeDOCSoapPortEchoAttachment() throws Exception {
          test.wsdl.interop4.groupG.dime.doc.AttachmentsPortType binding;
          try {
              binding = new 
test.wsdl.interop4.groupG.dime.doc.DimeDOCInteropLocator().getDimeDOCSoapPort(url);
          }
          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
          OctetStream input = new OctetStream("EchoAttachment".getBytes());
          OctetStream output = null;
          output = binding.echoAttachment(input);
          // TBD - validate results
          assertTrue(Arrays.equals(input.getBytes(), output.getBytes()));
      }
  
      public void test2DimeDOCSoapPortEchoAttachments() throws Exception {
          test.wsdl.interop4.groupG.dime.doc.AttachmentsPortType binding;
          try {
              binding = new 
test.wsdl.interop4.groupG.dime.doc.DimeDOCInteropLocator().getDimeDOCSoapPort(url);
          }
          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);
  
          OctetStream[] input = new OctetStream[2];
  
          input[0] = new OctetStream("EchoAttachments0".getBytes());
          input[1] = new OctetStream("EchoAttachments1".getBytes());
          
          //TODO: Need to fix wsdl2java generation. Getting a "Bad Types" 
          //      Exception if we enable the following code.
          /*
          // Test operation
          OctetStream[] output = null;
          output = binding.echoAttachments(input);
          // TBD - validate results
          assertTrue(Arrays.equals(input[0].getBytes(), output[0].getBytes()));
          assertTrue(Arrays.equals(input[1].getBytes(), output[1].getBytes()));
          */
      }
  
      public void test3DimeDOCSoapPortEchoAttachmentAsBase64() throws Exception {
          test.wsdl.interop4.groupG.dime.doc.AttachmentsPortType binding;
          try {
              binding = new 
test.wsdl.interop4.groupG.dime.doc.DimeDOCInteropLocator().getDimeDOCSoapPort(url);
          }
          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);
  
          OctetStream input = new OctetStream("EchoAttachmentAsBase64".getBytes()); 
          // Test operation
          byte[] output = null;
          output = binding.echoAttachmentAsBase64(input);
          // TBD - validate results
          assertTrue(Arrays.equals(input.getBytes(), output));
      }
  
      public void test4DimeDOCSoapPortEchoBase64AsAttachment() throws Exception {
          test.wsdl.interop4.groupG.dime.doc.AttachmentsPortType binding;
          try {
              binding = new 
test.wsdl.interop4.groupG.dime.doc.DimeDOCInteropLocator().getDimeDOCSoapPort(url);
          }
          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);
  
          byte[] input = "EchoBase64AsAttachment".getBytes(); 
          // Test operation
          OctetStream output = null;
          output = binding.echoBase64AsAttachment(input);
          // TBD - validate results
          assertTrue(Arrays.equals(input, output.getBytes()));
      }
  
      public void test5DimeDOCSoapPortEchoUnrefAttachments() throws Exception {
          test.wsdl.interop4.groupG.dime.doc.AttachmentsPortType binding;
          try {
              binding = new 
test.wsdl.interop4.groupG.dime.doc.DimeDOCInteropLocator().getDimeDOCSoapPort(url);
          }
          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
          binding.echoUnrefAttachments();
          // TBD - validate results
      }
  
      public void test6DimeDOCSoapPortEchoAttachmentAsString() throws Exception {
          test.wsdl.interop4.groupG.dime.doc.AttachmentsPortType binding;
          try {
              binding = new 
test.wsdl.interop4.groupG.dime.doc.DimeDOCInteropLocator().getDimeDOCSoapPort(url);
          }
          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);
  
          java.lang.String input = "EchoAttachmentAsString";
          
          // Test operation
          java.lang.String output = null;
          output = binding.echoAttachmentAsString(input);
          // TBD - validate results
          assertEquals(input, output);
      }
  
      public static URL url = null;
      
      public static void main(String[] args) throws Exception {
          if (args.length == 1) {
              url = new URL(args[0]);
          } else {
              url = new URL(new 
test.wsdl.interop4.groupG.dime.doc.DimeDOCInteropLocator().getDimeDOCSoapPortAddress());
          }
          junit.textui.TestRunner.run(new 
junit.framework.TestSuite(DimeDOCInteropTestCase.class));
      } // main
  }
  
  
  
  1.66      +36 -8     
xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java
  
  Index: SymbolTable.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- SymbolTable.java  31 Dec 2002 22:46:51 -0000      1.65
  +++ SymbolTable.java  2 Jan 2003 00:02:42 -0000       1.66
  @@ -1722,12 +1722,20 @@
                            }
                            element = (org.w3c.dom.Element) partType.getNode();
                        } else if(part.getElementName() != null) {
  -                         TypeEntry partElement = getElement(part.getElementName());
  -                         if(partElement.getDimensions().length()>0){
  -                             dims = partElement.getDimensions();
  -                             partElement = partElement.getRefType();
  -                         }
  +                         TypeEntry partElement = 
getElement(part.getElementName()).getRefType();
                            element = (org.w3c.dom.Element) partElement.getNode();
  +                         QName name = getInnerCollectionComponentQName(element);
  +                         if(name != null){
  +                            dims += "[]";
  +                            partElement = getType(name);
  +                            element = (org.w3c.dom.Element) partElement.getNode();
  +                         } else {
  +                             name = getInnerTypeQName(element);
  +                             if(name != null) {
  +                                 partElement = getType(name);
  +                                 element = (org.w3c.dom.Element) 
partElement.getNode();
  +                             }
  +                         }
                        }
                        org.w3c.dom.Element e = 
(org.w3c.dom.Element)XMLUtils.findNode(element, new QName(Constants.URI_DIME_CONTENT, 
"mediaType"));
                        if(e != null){
  @@ -1835,7 +1843,7 @@
                       String dims = typeEntry.getDimensions(); 
                       if(dims.length() <=0 && typeEntry.getRefType() != null) {
                           Node node = typeEntry.getRefType().getNode();
  -                        if(getCollectionComponentQName(node)!=null)
  +                        if(getInnerCollectionComponentQName(node)!=null)
                               dims += "[]";    
                       }
                       bEntry.setMIMEInfo(op.getName(), content.getPart(), 
content.getType(), dims);
  @@ -2312,7 +2320,7 @@
           }
       } // symbolTablePut
   
  -    private static QName getCollectionComponentQName(Node node) {
  +    private static QName getInnerCollectionComponentQName(Node node) {
           if (node == null) {
               return null;
           }
  @@ -2324,7 +2332,27 @@
           // Dive into the node if necessary
           NodeList children = node.getChildNodes();
           for(int i=0;i<children.getLength();i++){
  -            name = getCollectionComponentQName(children.item(i));
  +            name = getInnerCollectionComponentQName(children.item(i));
  +            if(name != null)
  +                return name;
  +        }
  +        return null;
  +    }
  +
  +    private static QName getInnerTypeQName(Node node) {
  +        if (node == null) {
  +            return null;
  +        }
  +        
  +        BooleanHolder forElement = new BooleanHolder();
  +        QName name = Utils.getTypeQName(node, forElement, true);
  +        if(name != null)
  +            return name;
  +
  +        // Dive into the node if necessary
  +        NodeList children = node.getChildNodes();
  +        for(int i=0;i<children.getLength();i++){
  +            name = getInnerTypeQName(children.item(i));
               if(name != null)
                   return name;
           }
  
  
  


Reply via email to