You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsif-dev@ws.apache.org by wh...@apache.org on 2003/04/02 17:25:28 UTC

cvs commit: xml-axis-wsif/java/test/mime MimeTest.java deploy.wsdd MimeImpl.java DeploymentDescriptor.xml

whitlock    2003/04/02 07:25:27

  Modified:    java/test/mime MimeTest.java deploy.wsdd MimeImpl.java
                        DeploymentDescriptor.xml
  Log:
  Support multiple output unreferenced attachments
  
  Revision  Changes    Path
  1.29      +12 -12    xml-axis-wsif/java/test/mime/MimeTest.java
  
  Index: MimeTest.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/mime/MimeTest.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- MimeTest.java	2 Apr 2003 13:51:19 -0000	1.28
  +++ MimeTest.java	2 Apr 2003 15:25:27 -0000	1.29
  @@ -1109,11 +1109,15 @@
           String portName,
           WSIFService service)
           throws Exception {
  -        DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation));
           WSIFPort port = service.getPort(portName);
  -        putUnref(port,dh);
  -        DataHandler dh2 = getUnref(port);
  -        assertTrue(compareFiles(dh, dh2));
  +        DataHandler dh1 = new DataHandler(new FileDataSource(flatfileLocation));
  +        DataHandler dh2 = new DataHandler(new FileDataSource(flatfileLocation2));
  +        putUnref(port,dh1);
  +        putUnref(port,dh2);
  +        List l = getUnref(port);
  +        assertTrue("l.size() expected 2 actual "+l.size(),2==l.size());
  +        assertTrue(compareFiles(((WSIFAttachmentPart)l.get(0)).getDataHandler(),dh1));
  +        assertTrue(compareFiles(((WSIFAttachmentPart)l.get(1)).getDataHandler(),dh2));
       }
       
       /**
  @@ -1144,22 +1148,18 @@
           op.executeInputOnlyOperation(in);
       }
       
  -    private DataHandler getUnref(WSIFPort port) throws Exception {
  +    private List getUnref(WSIFPort port) throws Exception {
           WSIFOperation op = port.createOperation("getUnrefDh");
           WSIFMessage in = op.createInputMessage();
           WSIFMessage out = op.createOutputMessage();
           WSIFMessage fault = op.createFaultMessage();
  -        
  +
           boolean success = op.executeRequestResponseOperation(in, out, fault);
           assertTrue(success);
   
           WSIFMessage context = op.getContext();
  -        List apList =
  -            (List) context.getObjectPart(
  -                WSIFConstants.UNREFERENCED_ATTACHMENT_PART_NAME);
  -        WSIFAttachmentPart ap = (WSIFAttachmentPart) apList.get(0);
  -        DataHandler dh = ap.getDataHandler();
  -        return dh;
  +        return (List) context.getObjectPart(
  +            WSIFConstants.UNREFERENCED_ATTACHMENT_PART_NAME);
       }
       
       private void putRef(WSIFPort port, DataHandler dh) throws Exception {
  
  
  
  1.2       +1 -1      xml-axis-wsif/java/test/mime/deploy.wsdd
  
  Index: deploy.wsdd
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/mime/deploy.wsdd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- deploy.wsdd	21 Jan 2003 17:12:02 -0000	1.1
  +++ deploy.wsdd	2 Apr 2003 15:25:27 -0000	1.2
  @@ -4,7 +4,7 @@
    <service name="Mime" provider="java:RPC">
     <parameter name="className" value="mime.MimeImpl"/>
     <parameter name="allowedMethods" value="*"/>
  -  <parameter name="scope" value="Application"/>
  +  <parameter name="scope" value="Session"/>
     
     <typeMapping 
       qname="ns:datahandler" 
  
  
  
  1.21      +11 -8     xml-axis-wsif/java/test/mime/MimeImpl.java
  
  Index: MimeImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/mime/MimeImpl.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- MimeImpl.java	2 Apr 2003 13:51:20 -0000	1.20
  +++ MimeImpl.java	2 Apr 2003 15:25:27 -0000	1.21
  @@ -82,7 +82,7 @@
   
   public class MimeImpl {
   	private static final boolean verbose = false;
  -	private String stored = null;
  +	private List stored = new ArrayList();
   	private String errText = null;
   
       public String dataHandlerToString(DataHandler dh) {
  @@ -299,13 +299,13 @@
       
       public void putRefDhInputOnly(DataHandler dh) {
           print("MimeImpl.putRefDhInputOnly dh=",dh);
  -        this.stored = dataHandlerToString(dh);
  +        this.stored.add(dataHandlerToString(dh));
           print("MimeImpl.putRefDhInputOnly stored=",stored);
       }
   
       public DataHandler getRefDh() {
           print("MimeImpl.getRefDh stored=",stored);
  -        DataHandler dh = stringToDataHandler(this.stored);
  +        DataHandler dh = stringToDataHandler((String)this.stored.get(0));
           print("MimeImpl.getRefDh dh=",dh);
           return dh;
       }
  @@ -313,16 +313,19 @@
       public void putUnrefDhInputOnly() {
           List l = getUnrefAttachments();
           DataHandler dh = ((WSIFAttachmentPart) l.get(0)).getDataHandler();
  -        this.stored = dataHandlerToString(dh);
  +        this.stored.add(dataHandlerToString(dh));
           print("MimeImpl.putUnrefDhInputOnly stored=",stored);
       }
   
       public void getUnrefDh() {
  -        print("MimeImpl.getUnrefDh stored=",stored);
  -        WSIFAttachmentPart wap =
  -            new WSIFAttachmentPart(stringToDataHandler(stored));
  +        print("MimeImpl.getUnrefDh stored=", stored);
           ArrayList l = new ArrayList();
  -        l.add(wap);
  +        Iterator it = stored.iterator();
  +        while (it.hasNext()) {
  +            WSIFAttachmentPart wap =
  +                new WSIFAttachmentPart(stringToDataHandler((String) it.next()));
  +            l.add(wap);
  +        }
           if (!putUnrefAttachments(l)) {
               System.err.println("getUnrefDh failed " + errText);
           }
  
  
  
  1.8       +1 -1      xml-axis-wsif/java/test/mime/DeploymentDescriptor.xml
  
  Index: DeploymentDescriptor.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/mime/DeploymentDescriptor.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DeploymentDescriptor.xml	4 Mar 2003 17:16:12 -0000	1.7
  +++ DeploymentDescriptor.xml	2 Apr 2003 15:25:27 -0000	1.8
  @@ -1,7 +1,7 @@
   <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
                id="http://mime/">
     <isd:provider type="java"
  -                scope="Application"
  +                scope="Session"
                   methods="dataHandlerToString stringToDataHandler plainTextToString 
                            stringToPlainText bounceImage bounceImage2 bounceImage4 
                            orMultiMimeParts andMultiMimeParts noContent typeStar