hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r280907 - in /jakarta/httpclient/trunk/http-common/src/test/org/apache/http: impl/ io/ mockup/ util/
Date Wed, 14 Sep 2005 18:54:49 GMT
Author: olegk
Date: Wed Sep 14 11:54:34 2005
New Revision: 280907

URL: http://svn.apache.org/viewcvs?rev=280907&view=rev
Log:
Per default use non-NIO mockups in the tests

Added:
    jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/NIOHttpDataReceiverMockup.java
      - copied, changed from r234448, jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/HttpDataReceiverMockup.java
    jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/NIOHttpDataTransmitterMockup.java
      - copied, changed from r234448, jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/HttpDataTransmitterMockup.java
Removed:
    jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/HttpDataReceiverMockup.java
    jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/HttpDataTransmitterMockup.java
Modified:
    jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestDefaultEntityGenerator.java
    jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestNIOHttpTransmitterAndReceiver.java
    jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestChunkCoding.java
    jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestContentLengthInputStream.java
    jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataInputStream.java
    jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataOutputStream.java
    jakarta/httpclient/trunk/http-common/src/test/org/apache/http/util/TestHeadersParser.java

Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestDefaultEntityGenerator.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestDefaultEntityGenerator.java?rev=280907&r1=280906&r2=280907&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestDefaultEntityGenerator.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestDefaultEntityGenerator.java
Wed Sep 14 11:54:34 2005
@@ -38,7 +38,6 @@
 import org.apache.http.io.ContentLengthInputStream;
 import org.apache.http.io.HttpDataInputStream;
 import org.apache.http.io.HttpDataReceiver;
-import org.apache.http.mockup.HttpDataReceiverMockup;
 import org.apache.http.mockup.InputStreamHttpDataReceiverMockup;
 import org.apache.http.params.HttpProtocolParams;
 
@@ -73,7 +72,7 @@
             // expected
         }
         try {
-            entitygen.generate(new HttpDataReceiverMockup(new byte[] {}) , null);
+            entitygen.generate(new InputStreamHttpDataReceiverMockup(new byte[] {}) , null);
             fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
@@ -81,7 +80,7 @@
     }
 
     public void testEntityWithTransferEncoding() throws Exception {
-        HttpDataReceiver datareceiver = new HttpDataReceiverMockup("0\r\n", "US-ASCII");
+        HttpDataReceiver datareceiver = new InputStreamHttpDataReceiverMockup("0\r\n", "US-ASCII");
         HttpMutableMessage message = new BasicHttpMessage();
         
         // lenient mode 
@@ -123,7 +122,7 @@
     }
 
     public void testEntityWithUnsupportedTransferEncoding() throws Exception {
-        HttpDataReceiver datareceiver = new HttpDataReceiverMockup("0\r\n", "US-ASCII");
+        HttpDataReceiver datareceiver = new InputStreamHttpDataReceiverMockup("0\r\n", "US-ASCII");
         HttpMutableMessage message = new BasicHttpMessage();
         
         // lenient mode 
@@ -149,7 +148,7 @@
     }
 
     public void testChunkedTransferEncodingMustBeLast() throws Exception {
-        HttpDataReceiver datareceiver = new HttpDataReceiverMockup("0\r\n", "US-ASCII");
+        HttpDataReceiver datareceiver = new InputStreamHttpDataReceiverMockup("0\r\n", "US-ASCII");
         HttpMutableMessage message = new BasicHttpMessage();
         
         // lenient mode 
@@ -175,7 +174,7 @@
     }
 
     public void testEntityWithContentLength() throws Exception {
-        HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {});
+        HttpDataReceiver datareceiver = new InputStreamHttpDataReceiverMockup(new byte[]
{});
         HttpMutableMessage message = new BasicHttpMessage();
         
         // lenient mode 
@@ -191,7 +190,7 @@
     }
 
     public void testEntityWithMultipleContentLength() throws Exception {
-        HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {'0'});
+        HttpDataReceiver datareceiver = new InputStreamHttpDataReceiverMockup(new byte[]
{'0'});
         HttpMutableMessage message = new BasicHttpMessage();
 
         // lenient mode 
@@ -219,7 +218,7 @@
     }
     
     public void testEntityWithMultipleContentLengthSomeWrong() throws Exception {
-        HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {'0'});
+        HttpDataReceiver datareceiver = new InputStreamHttpDataReceiverMockup(new byte[]
{'0'});
         HttpMutableMessage message = new BasicHttpMessage();
 
         // lenient mode 
@@ -247,7 +246,7 @@
     }
     
     public void testEntityWithMultipleContentLengthAllWrong() throws Exception {
-        HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {'0'});
+        HttpDataReceiver datareceiver = new InputStreamHttpDataReceiverMockup(new byte[]
{'0'});
         HttpMutableMessage message = new BasicHttpMessage();
 
         // lenient mode 
@@ -275,7 +274,7 @@
     }
 
     public void testEntityWithInvalidContentLength() throws Exception {
-        HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {'0'});
+        HttpDataReceiver datareceiver = new InputStreamHttpDataReceiverMockup(new byte[]
{'0'});
         HttpMutableMessage message = new BasicHttpMessage();
 
         // lenient mode 
@@ -302,7 +301,7 @@
     }
 
     public void testEntityNeitherContentLengthNorTransferEncoding() throws Exception {
-        HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {'0'});
+        HttpDataReceiver datareceiver = new InputStreamHttpDataReceiverMockup(new byte[]
{'0'});
         HttpMutableMessage message = new BasicHttpMessage();
 
         // lenient mode 

Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestNIOHttpTransmitterAndReceiver.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestNIOHttpTransmitterAndReceiver.java?rev=280907&r1=280906&r2=280907&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestNIOHttpTransmitterAndReceiver.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestNIOHttpTransmitterAndReceiver.java
Wed Sep 14 11:54:34 2005
@@ -35,8 +35,8 @@
 
 import org.apache.http.impl.io.NIOHttpDataReceiver;
 import org.apache.http.impl.io.NIOHttpDataTransmitter;
-import org.apache.http.mockup.HttpDataReceiverMockup;
-import org.apache.http.mockup.HttpDataTransmitterMockup;
+import org.apache.http.mockup.NIOHttpDataReceiverMockup;
+import org.apache.http.mockup.NIOHttpDataTransmitterMockup;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpProtocolParams;
 
@@ -70,29 +70,29 @@
 
     public void testInit() throws Exception {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
-        new HttpDataTransmitterMockup(Channels.newChannel(out), 10); 
+        new NIOHttpDataTransmitterMockup(Channels.newChannel(out), 10); 
         try {
-            new HttpDataTransmitterMockup(Channels.newChannel(out), -10); 
+            new NIOHttpDataTransmitterMockup(Channels.newChannel(out), -10); 
             fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             //expected
         }
         try {
-            new HttpDataTransmitterMockup(null, 1024); 
+            new NIOHttpDataTransmitterMockup(null, 1024); 
             fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             //expected
         }
         ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
-        new HttpDataReceiverMockup(Channels.newChannel(in), 10); 
+        new NIOHttpDataReceiverMockup(Channels.newChannel(in), 10); 
         try {
-            new HttpDataReceiverMockup(Channels.newChannel(in), -10); 
+            new NIOHttpDataReceiverMockup(Channels.newChannel(in), -10); 
             fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             //expected
         }
         try {
-            new HttpDataReceiverMockup((ReadableByteChannel)null, 1024); 
+            new NIOHttpDataReceiverMockup((ReadableByteChannel)null, 1024); 
             fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             //expected
@@ -114,7 +114,7 @@
         teststrs[3] = "";
         teststrs[4] = "And goodbye";
         
-        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup(); 
+        NIOHttpDataTransmitterMockup transmitter = new NIOHttpDataTransmitterMockup(); 
         for (int i = 0; i < teststrs.length; i++) {
             transmitter.writeLine(teststrs[i]);
         }
@@ -122,7 +122,7 @@
         transmitter.writeLine(null);
         transmitter.flush();
         
-        HttpDataReceiverMockup receiver = new HttpDataReceiverMockup(transmitter.getData());
+        NIOHttpDataReceiverMockup receiver = new NIOHttpDataReceiverMockup(transmitter.getData());
 
         assertTrue(receiver.isDataAvailable(0));
         
@@ -134,7 +134,7 @@
     }
 
     public void testComplexReadWriteLine() throws Exception {
-        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup(); 
+        NIOHttpDataTransmitterMockup transmitter = new NIOHttpDataTransmitterMockup(); 
         transmitter.write(new byte[] {'a', '\n'});
         transmitter.write(new byte[] {'\r', '\n'});
         transmitter.write(new byte[] {'\r', '\r', '\n'});
@@ -175,7 +175,7 @@
         transmitter.write(new byte[] {'a'});
         transmitter.flush();
         
-        HttpDataReceiverMockup receiver = new HttpDataReceiverMockup(transmitter.getData());
+        NIOHttpDataReceiverMockup receiver = new NIOHttpDataReceiverMockup(transmitter.getData());
 
         assertEquals("a", receiver.readLine());
         assertEquals("", receiver.readLine());
@@ -204,7 +204,7 @@
         teststrs[3] = "";
         teststrs[4] = "And goodbye";
         
-        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup(); 
+        NIOHttpDataTransmitterMockup transmitter = new NIOHttpDataTransmitterMockup(); 
         for (int i = 0; i < teststrs.length; i++) {
             transmitter.writeLine(teststrs[i]);
         }
@@ -212,7 +212,7 @@
         transmitter.writeLine(null);
         transmitter.flush();
         
-        HttpDataReceiverMockup receiver = new HttpDataReceiverMockup(transmitter.getData(),
1024);
+        NIOHttpDataReceiverMockup receiver = new NIOHttpDataReceiverMockup(transmitter.getData(),
1024);
 
         assertTrue(receiver.isDataAvailable(0));
         
@@ -229,7 +229,7 @@
         for (int i = 0; i < out.length; i++) {
             out[i] = (byte)('0' + i);
         }
-        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
+        NIOHttpDataTransmitterMockup transmitter = new NIOHttpDataTransmitterMockup();
         int off = 0;
         int remaining = out.length;
         while (remaining > 0) {
@@ -249,7 +249,7 @@
             assertEquals(out[i], tmp[i]);
         }
         
-        HttpDataReceiverMockup receiver = new HttpDataReceiverMockup(tmp);
+        NIOHttpDataReceiverMockup receiver = new NIOHttpDataReceiverMockup(tmp);
 
         // these read operations will have no effect
         assertEquals(0, receiver.read(null, 0, 10));
@@ -283,7 +283,7 @@
         for (int i = 0; i < out.length; i++) {
             out[i] = (byte)('0' + i);
         }
-        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
+        NIOHttpDataTransmitterMockup transmitter = new NIOHttpDataTransmitterMockup();
         for (int i = 0; i < out.length; i++) {
             transmitter.write(out[i]);
         }
@@ -295,7 +295,7 @@
             assertEquals(out[i], tmp[i]);
         }
         
-        HttpDataReceiverMockup receiver = new HttpDataReceiverMockup(tmp);
+        NIOHttpDataReceiverMockup receiver = new NIOHttpDataReceiverMockup(tmp);
 
         byte[] in = new byte[40];
         for (int i = 0; i < in.length; i++) {
@@ -335,7 +335,7 @@
         HttpParams params = new DefaultHttpParams(null);
         HttpProtocolParams.setHttpElementCharset(params, "UTF-8");
         
-        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
+        NIOHttpDataTransmitterMockup transmitter = new NIOHttpDataTransmitterMockup();
         transmitter.reset(params);
 
         for (int i = 0; i < 10; i++) {
@@ -345,7 +345,7 @@
         }
         transmitter.flush();
         
-        HttpDataReceiverMockup receiver = new HttpDataReceiverMockup(transmitter.getData());
+        NIOHttpDataReceiverMockup receiver = new NIOHttpDataReceiverMockup(transmitter.getData());
         receiver.reset(params);
 
         assertTrue(receiver.isDataAvailable(0));

Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestChunkCoding.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestChunkCoding.java?rev=280907&r1=280906&r2=280907&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestChunkCoding.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestChunkCoding.java
Wed Sep 14 11:54:34 2005
@@ -34,8 +34,7 @@
 import java.io.OutputStream;
 
 import org.apache.http.Header;
-import org.apache.http.mockup.HttpDataReceiverMockup;
-import org.apache.http.mockup.HttpDataTransmitterMockup;
+import org.apache.http.mockup.InputStreamHttpDataReceiverMockup;
 import org.apache.http.mockup.OutputStreamHttpDataTransmitterMockup;
 import org.apache.http.util.EncodingUtil;
 
@@ -83,7 +82,7 @@
     // Test for when buffer is larger than chunk size
     public void testChunkedInputStreamLargeBuffer() throws IOException {
         ChunkedInputStream in = new ChunkedInputStream(
-                new HttpDataReceiverMockup(
+                new InputStreamHttpDataReceiverMockup(
                         EncodingUtil.getBytes(CHUNKED_INPUT, CONTENT_CHARSET)));
         byte[] buffer = new byte[300];
         ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -111,7 +110,7 @@
     //Test for when buffer is smaller than chunk size.
     public void testChunkedInputStreamSmallBuffer() throws IOException {
         ChunkedInputStream in = new ChunkedInputStream(
-                new HttpDataReceiverMockup(
+                new InputStreamHttpDataReceiverMockup(
                             EncodingUtil.getBytes(CHUNKED_INPUT, CONTENT_CHARSET)));
 
         byte[] buffer = new byte[7];
@@ -139,7 +138,7 @@
     public void testChunkedInputStreamOneByteRead() throws IOException {
         String s = "5\r\n01234\r\n5\r\n56789\r\n0\r\n";
         ChunkedInputStream in = new ChunkedInputStream(
-                new HttpDataReceiverMockup(
+                new InputStreamHttpDataReceiverMockup(
                         EncodingUtil.getBytes(s, CONTENT_CHARSET)));
         int ch;
         int i = '0';
@@ -156,7 +155,7 @@
     public void testChunkedInputStreamClose() throws IOException {
         String s = "5\r\n01234\r\n5\r\n56789\r\n0\r\n";
         ChunkedInputStream in = new ChunkedInputStream(
-                new HttpDataReceiverMockup(
+                new InputStreamHttpDataReceiverMockup(
                         EncodingUtil.getBytes(s, CONTENT_CHARSET)));
         in.close();
         in.close();
@@ -185,7 +184,7 @@
     public void testCorruptChunkedInputStreamMissingCRLF() throws IOException {
         String s = "5\r\n012345\r\n56789\r\n0\r\n";
         InputStream in = new ChunkedInputStream(
-                new HttpDataReceiverMockup(
+                new InputStreamHttpDataReceiverMockup(
                         EncodingUtil.getBytes(s, CONTENT_CHARSET)));
         byte[] buffer = new byte[300];
         ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -204,7 +203,7 @@
     public void testCorruptChunkedInputStreamMissingLF() throws IOException {
         String s = "5\r01234\r\n5\r\n56789\r\n0\r\n";
         InputStream in = new ChunkedInputStream(
-                new HttpDataReceiverMockup(
+                new InputStreamHttpDataReceiverMockup(
                         EncodingUtil.getBytes(s, CONTENT_CHARSET)));
         try {
             in.read();
@@ -217,7 +216,7 @@
     // Missing closing chunk
     public void testCorruptChunkedInputStreamNoClosingChunk() throws IOException {
         InputStream in = new ChunkedInputStream(
-                new HttpDataReceiverMockup(new byte[] {}));
+                new InputStreamHttpDataReceiverMockup(new byte[] {}));
         try {
             in.read();
             fail("MalformedChunkCodingException should have been thrown");
@@ -230,7 +229,7 @@
     public void testCorruptChunkedInputStreamInvalidSize() throws IOException {
         String s = "whatever\r\n01234\r\n5\r\n56789\r\n0\r\n";
         InputStream in = new ChunkedInputStream(
-                new HttpDataReceiverMockup(
+                new InputStreamHttpDataReceiverMockup(
                         EncodingUtil.getBytes(s, CONTENT_CHARSET)));
         try {
             in.read();
@@ -244,7 +243,7 @@
     public void testCorruptChunkedInputStreamInvalidFooter() throws IOException {
         String s = "1\r\n0\r\n0\r\nstuff\r\n";
         InputStream in = new ChunkedInputStream(
-                new HttpDataReceiverMockup(
+                new InputStreamHttpDataReceiverMockup(
                         EncodingUtil.getBytes(s, CONTENT_CHARSET)));
         try {
             in.read();
@@ -258,7 +257,7 @@
     public void testEmptyChunkedInputStream() throws IOException {
         String input = "0\r\n";
         InputStream in = new ChunkedInputStream(
-                new HttpDataReceiverMockup(
+                new InputStreamHttpDataReceiverMockup(
                         EncodingUtil.getBytes(input, CONTENT_CHARSET)));
         byte[] buffer = new byte[300];
         ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -279,7 +278,7 @@
         out.close();
         buffer.close();
         InputStream in = new ChunkedInputStream(
-                new HttpDataReceiverMockup(
+                new InputStreamHttpDataReceiverMockup(
                         buffer.toByteArray()));
 
         byte[] d = new byte[10];
@@ -294,7 +293,7 @@
     }
 
     public void testChunkedOutputStream() throws IOException {
-    	HttpDataTransmitterMockup buffer = new HttpDataTransmitterMockup();
+    	OutputStreamHttpDataTransmitterMockup buffer = new OutputStreamHttpDataTransmitterMockup();
         ChunkedOutputStream out = new ChunkedOutputStream(buffer, 2);
         out.write('1');  
         out.write('2');  
@@ -328,7 +327,7 @@
     }
 
     public void testChunkedOutputStreamLargeChunk() throws IOException {
-    	HttpDataTransmitterMockup buffer = new HttpDataTransmitterMockup();
+    	OutputStreamHttpDataTransmitterMockup buffer = new OutputStreamHttpDataTransmitterMockup();
         ChunkedOutputStream out = new ChunkedOutputStream(buffer, 2);
         out.write(new byte[] {'1', '2', '3', '4'});
         out.finish();

Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestContentLengthInputStream.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestContentLengthInputStream.java?rev=280907&r1=280906&r2=280907&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestContentLengthInputStream.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestContentLengthInputStream.java
Wed Sep 14 11:54:34 2005
@@ -32,7 +32,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.apache.http.mockup.HttpDataReceiverMockup;
+import org.apache.http.mockup.InputStreamHttpDataReceiverMockup;
 import org.apache.http.util.EncodingUtil;
 
 import junit.framework.Test;
@@ -60,7 +60,7 @@
     private static final String CONTENT_CHARSET = "ISO-8859-1";
         
     public void testConstructors() throws Exception {
-        new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[] {}), 10);
+        new ContentLengthInputStream(new InputStreamHttpDataReceiverMockup(new byte[] {}),
10);
         try {
             new ContentLengthInputStream(null, 10);
             fail("IllegalArgumentException should have been thrown");
@@ -68,7 +68,7 @@
             // expected
         }
         try {
-            new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[] {}), -10);
+            new ContentLengthInputStream(new InputStreamHttpDataReceiverMockup(new byte[]
{}), -10);
             fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
@@ -77,7 +77,7 @@
 
     public void testBasics() throws IOException {
         String correct = "1234567890123456";
-        InputStream in = new ContentLengthInputStream(new HttpDataReceiverMockup(
+        InputStream in = new ContentLengthInputStream(new InputStreamHttpDataReceiverMockup(
             EncodingUtil.getBytes(correct, CONTENT_CHARSET)), 10L);
         ByteArrayOutputStream out = new ByteArrayOutputStream();
 
@@ -92,16 +92,16 @@
     }
 
     public void testSkip() throws IOException {
-        InputStream in = new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[20]),
10L);
+        InputStream in = new ContentLengthInputStream(new InputStreamHttpDataReceiverMockup(new
byte[20]), 10L);
         assertEquals(10, in.skip(10));
         assertTrue(in.read() == -1);
 
-        in = new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[20]), 10L);
+        in = new ContentLengthInputStream(new InputStreamHttpDataReceiverMockup(new byte[20]),
10L);
         in.read();
         assertEquals(9, in.skip(10));
         assertTrue(in.read() == -1);
 
-        in = new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[20]), 2L);
+        in = new ContentLengthInputStream(new InputStreamHttpDataReceiverMockup(new byte[20]),
2L);
         in.read();
         in.read();
         assertTrue(in.skip(10) <= 0);
@@ -110,7 +110,7 @@
 
     public void testClose() throws IOException {
         String correct = "1234567890123456";
-        InputStream in = new ContentLengthInputStream(new HttpDataReceiverMockup(
+        InputStream in = new ContentLengthInputStream(new InputStreamHttpDataReceiverMockup(
             EncodingUtil.getBytes(correct, CONTENT_CHARSET)), 10L);
         in.close();
         in.close();

Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataInputStream.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataInputStream.java?rev=280907&r1=280906&r2=280907&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataInputStream.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataInputStream.java
Wed Sep 14 11:54:34 2005
@@ -28,12 +28,12 @@
 
 package org.apache.http.io;
 
+import org.apache.http.mockup.InputStreamHttpDataReceiverMockup;
+
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-import org.apache.http.mockup.HttpDataReceiverMockup;
-
 /**
  * Simple tests for {@link HttpDataInputStream}.
  *
@@ -59,7 +59,7 @@
     }
 
     public void testConstructor() throws Exception {
-        HttpDataReceiver receiver = new HttpDataReceiverMockup(new byte[] {});
+        HttpDataReceiver receiver = new InputStreamHttpDataReceiverMockup(new byte[] {});
         new HttpDataInputStream(receiver);
         try {
             new HttpDataInputStream(null);
@@ -71,9 +71,8 @@
     
     public void testBasicRead() throws Exception {
         byte[] input = new byte[] {'a', 'b', 'c'};
-        HttpDataReceiverMockup receiver = new HttpDataReceiverMockup(input);
+        InputStreamHttpDataReceiverMockup receiver = new InputStreamHttpDataReceiverMockup(input);
         HttpDataInputStream instream = new HttpDataInputStream(receiver);
-        assertTrue(instream.available() > 0);
         byte[] tmp = new byte[2];
         assertEquals(2, instream.read(tmp, 0, tmp.length));
         assertEquals('a', tmp[0]);
@@ -87,7 +86,7 @@
     
     public void testClosedCondition() throws Exception {
         byte[] input = new byte[] {'a', 'b', 'c'};
-        HttpDataReceiverMockup receiver = new HttpDataReceiverMockup(input);
+        InputStreamHttpDataReceiverMockup receiver = new InputStreamHttpDataReceiverMockup(input);
         HttpDataInputStream instream = new HttpDataInputStream(receiver);
 
         instream.close();

Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataOutputStream.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataOutputStream.java?rev=280907&r1=280906&r2=280907&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataOutputStream.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataOutputStream.java
Wed Sep 14 11:54:34 2005
@@ -28,12 +28,12 @@
 
 package org.apache.http.io;
 
+import org.apache.http.mockup.OutputStreamHttpDataTransmitterMockup;
+
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-import org.apache.http.mockup.HttpDataTransmitterMockup;
-
 /**
  * Simple tests for {@link HttpDataOutputStream}.
  *
@@ -59,7 +59,7 @@
     }
 
     public void testConstructor() throws Exception {
-        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
+        OutputStreamHttpDataTransmitterMockup transmitter = new OutputStreamHttpDataTransmitterMockup();
         new HttpDataOutputStream(transmitter);
         try {
             new HttpDataOutputStream(null);
@@ -70,7 +70,7 @@
     }
     
     public void testBasicWrite() throws Exception {
-        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
+    	OutputStreamHttpDataTransmitterMockup transmitter = new OutputStreamHttpDataTransmitterMockup();
         HttpDataOutputStream outstream = new HttpDataOutputStream(transmitter);
         outstream.write(new byte[] {'a', 'b'}, 0, 2);
         outstream.write('c');
@@ -87,7 +87,7 @@
     }
     
     public void testClosedCondition() throws Exception {
-        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
+    	OutputStreamHttpDataTransmitterMockup transmitter = new OutputStreamHttpDataTransmitterMockup();
         HttpDataOutputStream outstream = new HttpDataOutputStream(transmitter);
         outstream.close();
         outstream.close();

Copied: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/NIOHttpDataReceiverMockup.java
(from r234448, jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/HttpDataReceiverMockup.java)
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/NIOHttpDataReceiverMockup.java?p2=jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/NIOHttpDataReceiverMockup.java&p1=jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/HttpDataReceiverMockup.java&r1=234448&r2=280907&rev=280907&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/HttpDataReceiverMockup.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/NIOHttpDataReceiverMockup.java
Wed Sep 14 11:54:34 2005
@@ -14,13 +14,13 @@
  *
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
  */
-public class HttpDataReceiverMockup extends NIOHttpDataReceiver {
+public class NIOHttpDataReceiverMockup extends NIOHttpDataReceiver {
 
     public static int BUFFER_SIZE = 16;
     
     private final ReadableByteChannel channel;
     
-    public HttpDataReceiverMockup(final ReadableByteChannel channel, int buffersize) {
+    public NIOHttpDataReceiverMockup(final ReadableByteChannel channel, int buffersize) {
         super();
         if (channel == null) {
             throw new IllegalArgumentException("Channel may not be null");
@@ -29,22 +29,22 @@
         initBuffer(buffersize);
     }
 
-    public HttpDataReceiverMockup(final byte[] bytes) {
+    public NIOHttpDataReceiverMockup(final byte[] bytes) {
         this(bytes, BUFFER_SIZE);
     }
 
-    public HttpDataReceiverMockup(final byte[] bytes, int buffersize) {
+    public NIOHttpDataReceiverMockup(final byte[] bytes, int buffersize) {
         super();
         this.channel = Channels.newChannel(new ByteArrayInputStream(bytes));
         initBuffer(buffersize);
     }
 
-    public HttpDataReceiverMockup(final String s, final String charset, int buffersize) 
+    public NIOHttpDataReceiverMockup(final String s, final String charset, int buffersize)

         throws UnsupportedEncodingException {
         this(s.getBytes(charset), buffersize);
     }
     
-    public HttpDataReceiverMockup(final String s, final String charset) 
+    public NIOHttpDataReceiverMockup(final String s, final String charset) 
         throws UnsupportedEncodingException {
         this(s.getBytes(charset));
     

Copied: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/NIOHttpDataTransmitterMockup.java
(from r234448, jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/HttpDataTransmitterMockup.java)
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/NIOHttpDataTransmitterMockup.java?p2=jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/NIOHttpDataTransmitterMockup.java&p1=jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/HttpDataTransmitterMockup.java&r1=234448&r2=280907&rev=280907&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/HttpDataTransmitterMockup.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/mockup/NIOHttpDataTransmitterMockup.java
Wed Sep 14 11:54:34 2005
@@ -13,7 +13,7 @@
  *
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
  */
-public class HttpDataTransmitterMockup extends NIOHttpDataTransmitter {
+public class NIOHttpDataTransmitterMockup extends NIOHttpDataTransmitter {
 
     public static int BUFFER_SIZE = 16;
     
@@ -21,7 +21,7 @@
     
     private final WritableByteChannel channel;
     
-    public HttpDataTransmitterMockup(final WritableByteChannel channel, int buffersize) {
+    public NIOHttpDataTransmitterMockup(final WritableByteChannel channel, int buffersize)
{
         super();
         if (channel == null) {
             throw new IllegalArgumentException("Channel may not be null");
@@ -30,7 +30,7 @@
         initBuffer(buffersize);
     }
 
-    public HttpDataTransmitterMockup() {
+    public NIOHttpDataTransmitterMockup() {
         super();
         this.channel = Channels.newChannel(this.buffer);
         initBuffer(BUFFER_SIZE);

Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/util/TestHeadersParser.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/util/TestHeadersParser.java?rev=280907&r1=280906&r2=280907&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/util/TestHeadersParser.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/util/TestHeadersParser.java
Wed Sep 14 11:54:34 2005
@@ -31,7 +31,7 @@
 
 import org.apache.http.Header;
 import org.apache.http.io.HttpDataReceiver;
-import org.apache.http.mockup.HttpDataReceiverMockup;
+import org.apache.http.mockup.InputStreamHttpDataReceiverMockup;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -65,7 +65,7 @@
             "     and more stuff\r\n" + 
             "\t and even more stuff\r\n" +  
             "\r\n"; 
-        HttpDataReceiver receiver = new HttpDataReceiverMockup(s, "US-ASCII"); 
+        HttpDataReceiver receiver = new InputStreamHttpDataReceiverMockup(s, "US-ASCII");

         Header[] headers = HeadersParser.processHeaders(receiver);
         assertNotNull(headers);
         assertEquals(3, headers.length);
@@ -81,7 +81,7 @@
         String s = 
             "    header1: stuff\r\n" + 
             "header2  : stuff \r\n"; 
-        HttpDataReceiver receiver = new HttpDataReceiverMockup(s, "US-ASCII"); 
+        HttpDataReceiver receiver = new InputStreamHttpDataReceiverMockup(s, "US-ASCII");

         Header[] headers = HeadersParser.processHeaders(receiver);
         assertNotNull(headers);
         assertEquals(2, headers.length);
@@ -93,7 +93,7 @@
     
     public void testEmptyDataStream() throws Exception {
         String s = ""; 
-        HttpDataReceiver receiver = new HttpDataReceiverMockup(s, "US-ASCII"); 
+        HttpDataReceiver receiver = new InputStreamHttpDataReceiverMockup(s, "US-ASCII");

         Header[] headers = HeadersParser.processHeaders(receiver);
         assertNotNull(headers);
         assertEquals(0, headers.length);



Mime
View raw message