ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1154537 - /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
Date Sat, 06 Aug 2011 16:39:04 GMT
Author: veithen
Date: Sat Aug  6 16:39:04 2011
New Revision: 1154537

URL: http://svn.apache.org/viewvc?rev=1154537&view=rev
Log:
Added a regression test for AXIOM-61.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java?rev=1154537&r1=1154536&r2=1154537&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
Sat Aug  6 16:39:04 2011
@@ -18,11 +18,13 @@
  */
 package org.apache.axiom.attachments;
 
+import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
@@ -473,4 +475,24 @@ public class AttachmentsTest extends Abs
         
         in.close();
     }
+    
+    /**
+     * Tests that attachments are correctly buffered on file if the threshold is very low.
This is a
+     * regression test for <a href="https://issues.apache.org/jira/browse/AXIOM-61">AXIOM-61</a>.
+     * 
+     * @throws Exception
+     */
+    public void testFileBufferingWithLowThreshold() throws Exception {
+        InputStream in = getTestResource("mtom/msg-soap-wls81.txt");
+        Attachments attachments = new Attachments(in,
+                "multipart/related;type=\"text/xml\";boundary=\"----=_Part_0_3437046.1188904239130\";start=__WLS__1188904239161__SOAP__",
+                true, getAttachmentsDir(), "1");
+        
+        DataHandler dh = attachments.getDataHandler("__WLS__1188904239162__SOAP__");
+        BufferedReader reader = new BufferedReader(new InputStreamReader(dh.getInputStream(),
"UTF-8"));
+        assertEquals("%PDF-1.3", reader.readLine());
+        reader.close();
+        
+        in.close();
+    }
 }



Mime
View raw message