james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1052176 - /james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/ExtraDotInputStreamTest.java
Date Thu, 23 Dec 2010 06:06:12 GMT
Author: norman
Date: Thu Dec 23 06:06:12 2010
New Revision: 1052176

URL: http://svn.apache.org/viewvc?rev=1052176&view=rev
Log:
Add unit test which is a proof of BUG JAMES-1152

Modified:
    james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/ExtraDotInputStreamTest.java

Modified: james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/ExtraDotInputStreamTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/ExtraDotInputStreamTest.java?rev=1052176&r1=1052175&r2=1052176&view=diff
==============================================================================
--- james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/ExtraDotInputStreamTest.java
(original)
+++ james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/ExtraDotInputStreamTest.java
Thu Dec 23 06:06:12 2010
@@ -46,4 +46,52 @@ public class ExtraDotInputStreamTest ext
         assertEquals(expectedOutput, output);
         
     }
+    
+    public void testNoDotCLRF() throws IOException {
+        String data = "ABCD\r\n";
+        ExtraDotInputStream in = new ExtraDotInputStream(new ByteArrayInputStream(data.getBytes()));
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        
+        int i = -1;
+        while((i = in.read()) != -1) {
+            out.write(i);
+        }
+        in.close();
+        out.close();
+        
+        String output = new String(out.toByteArray());
+        assertEquals(data, output);
+    }
+    
+    public void testNoDot() throws IOException {
+        String data = "ABCD";
+        ExtraDotInputStream in = new ExtraDotInputStream(new ByteArrayInputStream(data.getBytes()));
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        
+        int i = -1;
+        while((i = in.read()) != -1) {
+            out.write(i);
+        }
+        in.close();
+        out.close();
+        
+        String output = new String(out.toByteArray());
+        assertEquals(data, output);
+    }
+    // Proof of BUG JAMES-1152
+    public void testNoDotHeaderBody() throws IOException {
+        String data = "Subject: test\r\n\r\nABCD\r\n";
+        ExtraDotInputStream in = new ExtraDotInputStream(new ByteArrayInputStream(data.getBytes()));
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        
+        int i = -1;
+        while((i = in.read()) != -1) {
+            out.write(i);
+        }
+        in.close();
+        out.close();
+        
+        String output = new String(out.toByteArray());
+        assertEquals(data, output);
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message