tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1197386 - /tomcat/trunk/test/org/apache/coyote/http11/filters/TesterFlushableGZIPOutputStream.java
Date Fri, 04 Nov 2011 01:44:15 GMT
Author: kkolinko
Date: Fri Nov  4 01:44:15 2011
New Revision: 1197386

URL: http://svn.apache.org/viewvc?rev=1197386&view=rev
Log:
Fixed a bug in the test case:
it could not find the resources because they are not copied when tests are compiled.

Use a file stream, reading the resource from the sources like we do it with test webapps (webapp-2.3,
webapp-2.4 etc.)

Modified:
    tomcat/trunk/test/org/apache/coyote/http11/filters/TesterFlushableGZIPOutputStream.java

Modified: tomcat/trunk/test/org/apache/coyote/http11/filters/TesterFlushableGZIPOutputStream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http11/filters/TesterFlushableGZIPOutputStream.java?rev=1197386&r1=1197385&r2=1197386&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http11/filters/TesterFlushableGZIPOutputStream.java
(original)
+++ tomcat/trunk/test/org/apache/coyote/http11/filters/TesterFlushableGZIPOutputStream.java
Fri Nov  4 01:44:15 2011
@@ -18,6 +18,8 @@ package org.apache.coyote.http11.filters
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.zip.GZIPInputStream;
@@ -40,18 +42,23 @@ public class TesterFlushableGZIPOutputSt
 
         OutputStream output = new FlushableGZIPOutputStream(byteOutStream);
 
-        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        File sourcesDir = new File("test/org/apache/coyote/http11/filters/");
+        InputStream input;
 
-        InputStream input = cl.getResourceAsStream(
-                "org/apache/coyote/http11/filters/bug52121-part1");
-        IOTools.flow(input, output);
-        input.close();
+        input = new FileInputStream(new File(sourcesDir, "bug52121-part1"));
+        try {
+            IOTools.flow(input, output);
+        } finally {
+            input.close();
+        }
         output.flush();
 
-        input = cl.getResourceAsStream(
-                "org/apache/coyote/http11/filters/bug52121-part2");
-        IOTools.flow(input, output);
-        input.close();
+        input = new FileInputStream(new File(sourcesDir, "bug52121-part2"));
+        try {
+            IOTools.flow(input, output);
+        } finally {
+            input.close();
+        }
         output.flush();
 
         output.close();



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


Mime
View raw message