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/03/06 11:10:28 UTC

cvs commit: xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis WSIFOperation_ApacheAxis.java MIMEHelper.java

whitlock    2003/03/06 02:10:28

  Modified:    java/test/mime MimeTest.java Mime.java
               java/src/org/apache/wsif/providers/soap/apacheaxis
                        WSIFOperation_ApacheAxis.java MIMEHelper.java
  Log:
  16993: Support unreferenced attachments as AttachmentParts
  
  Revision  Changes    Path
  1.14      +31 -0     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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- MimeTest.java	4 Mar 2003 17:16:12 -0000	1.13
  +++ MimeTest.java	6 Mar 2003 10:10:25 -0000	1.14
  @@ -77,6 +77,7 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
  +import org.apache.axis.attachments.AttachmentPart;
   import org.apache.wsif.WSIFException;
   import org.apache.wsif.WSIFMessage;
   import org.apache.wsif.WSIFOperation;
  @@ -142,6 +143,7 @@
       private final static String OPTIONAL_SOAP_BODY = "OPTIONAL_SOAP_BODY";
       private final static String MIX_MIME_PARTS = "MIX_MIME_PARTS";
       private final static String UNREF = "UNREF";
  +    private final static String SEND_UNREF_AP = "SEND_UNREF_AP";
       private final static String MAP_TYPE = "MAP-TYPE";
       private final static String BAD_NO_PART = "BAD-NO-PART";
       private final static String BAD_PART = "BAD-PART";
  @@ -356,6 +358,10 @@
           doit(server + "Port", UNREF, "Mime.wsdl");
       }
   
  +    public void testSendUnrefAttachmentPartHttp() {
  +        doit(server + "Port", SEND_UNREF_AP, "Mime.wsdl");
  +    }
  +    
       /* ***************************************************/
       /*                AXIS/JMS tests                     */
       /* ***************************************************/
  @@ -582,6 +588,8 @@
                   mix_mime_parts(portName, service, stub);
               else if (cmd.equals(UNREF))
                   unref(service, stub);
  +            else if (cmd.equals(SEND_UNREF_AP))
  +                send_unref_ap(portName, service, stub);
               else if (cmd.equals(BAD_NO_PART))
                   bad_no_part(portName, service);
               else if (cmd.equals(BAD_PART))
  @@ -946,6 +954,29 @@
           DataHandler dh1 = new DataHandler(new FileDataSource(flatfileLocation));
           DataHandler dh2 = new DataHandler(new FileDataSource(flatfileLocation2));
           String buff = stub.unref(dh1, dh2);
  +        assertTrue(compareFiles(flatfileLocation, buff));
  +    }
  +
  +    private void send_unref_ap(String portName, WSIFService service, Mime stub)
  +        throws Exception {
  +        DataHandler dh1 = new DataHandler(new FileDataSource(flatfileLocation));
  +        DataHandler dh2 = new DataHandler(new FileDataSource(flatfileLocation2));
  +        AttachmentPart ap = new AttachmentPart(dh1);
  +        ap.setContentLocation("peculiar");
  +
  +        WSIFPort port = service.getPort(portName);
  +        WSIFOperation op = port.createOperation("unref");
  +        WSIFMessage in = op.createInputMessage();
  +        WSIFMessage out = op.createOutputMessage();
  +        WSIFMessage fault = op.createFaultMessage();
  +        in.setObjectPart("file", dh1);
  +        in.setObjectPart("file2", ap);
  +
  +        boolean success = op.executeRequestResponseOperation(in, out, fault);
  +        assertTrue(success);
  +
  +        String buff = (String) (out.getObjectPart("buff"));
  +
           assertTrue(compareFiles(flatfileLocation, buff));
       }
   
  
  
  
  1.9       +3 -0      xml-axis-wsif/java/test/mime/Mime.java
  
  Index: Mime.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/mime/Mime.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Mime.java	4 Mar 2003 17:16:12 -0000	1.8
  +++ Mime.java	6 Mar 2003 10:10:27 -0000	1.9
  @@ -61,6 +61,8 @@
   
   import javax.activation.DataHandler;
   
  +import org.apache.axis.attachments.AttachmentPart;
  +
   public interface Mime {
       public String dataHandlerToString(DataHandler dh);
       public DataHandler stringToDataHandler(String buff);
  @@ -101,6 +103,7 @@
           DataHandler dh2,
           String pos3);
       public String unref(DataHandler dh1, DataHandler dh2);
  +    public String dataHandlerToString(AttachmentPart ap);
   
       public String badNoPart(DataHandler dh) throws Exception;
       public String badPart(DataHandler dh) throws Exception;
  
  
  
  1.75      +4 -3      xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java
  
  Index: WSIFOperation_ApacheAxis.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- WSIFOperation_ApacheAxis.java	5 Mar 2003 17:30:21 -0000	1.74
  +++ WSIFOperation_ApacheAxis.java	6 Mar 2003 10:10:27 -0000	1.75
  @@ -2240,9 +2240,10 @@
                           {
                               dest.setProperty(name, value);
                           }
  -                    }
  -                    else
  -                    {
  +                    } else if (value instanceof AttachmentPart) {
  +                        AttachmentPart ap = (AttachmentPart) value;
  +                        axisInputs.add(ap.getActivationDataHandler());
  +                    } else {
                           axisInputs.add(value);
                       }
                   }
  
  
  
  1.3       +3 -1      xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/MIMEHelper.java
  
  Index: MIMEHelper.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/MIMEHelper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MIMEHelper.java	7 Jan 2003 12:03:02 -0000	1.2
  +++ MIMEHelper.java	6 Mar 2003 10:10:27 -0000	1.3
  @@ -115,7 +115,9 @@
       public static AttachmentPart getAttachementPart(Object o) throws WSIFException {
   		Trc.entry(null, o);
           AttachmentPart ap = null;
  -		if (o instanceof DataHandler) {
  +		if (o instanceof AttachmentPart) {
  +            ap = (AttachmentPart)o;
  +		} else if (o instanceof DataHandler) {
               ap = new AttachmentPart((DataHandler) o);
   		} else {
   			throw new WSIFException("Object is not a DataHandler: " + o);