hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r479354 - in /jakarta/httpcomponents/httpasync/trunk/src: java/org/apache/http/async/ test/java/org/apache/http/async/
Date Sun, 26 Nov 2006 13:01:08 GMT
Author: olegk
Date: Sun Nov 26 05:01:08 2006
New Revision: 479354

URL: http://svn.apache.org/viewvc?view=rev&rev=479354
Log:
Fixed test case breakage

Modified:
    jakarta/httpcomponents/httpasync/trunk/src/java/org/apache/http/async/AbstractHttpDispatcher.java
    jakarta/httpcomponents/httpasync/trunk/src/java/org/apache/http/async/AsyncHttpProcessor.java
    jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockAsyncHttpProcessor.java
    jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpDispatcher.java
    jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpHandle.java
    jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpNotificationHandler.java
    jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/TestAbstractHttpDispatcher.java

Modified: jakarta/httpcomponents/httpasync/trunk/src/java/org/apache/http/async/AbstractHttpDispatcher.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpasync/trunk/src/java/org/apache/http/async/AbstractHttpDispatcher.java?view=diff&rev=479354&r1=479353&r2=479354
==============================================================================
--- jakarta/httpcomponents/httpasync/trunk/src/java/org/apache/http/async/AbstractHttpDispatcher.java
(original)
+++ jakarta/httpcomponents/httpasync/trunk/src/java/org/apache/http/async/AbstractHttpDispatcher.java
Sun Nov 26 05:01:08 2006
@@ -33,7 +33,6 @@
 import java.util.Collection;
 import java.util.LinkedList;
 
-import org.apache.http.HttpClientConnection;
 import org.apache.http.HttpException;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
@@ -41,7 +40,6 @@
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpExecutionContext;
 
-
 /**
  * Abstract base for implementations of {@link HttpDispatcher HttpDispatcher}.
  * Provides access to protected methods in
@@ -245,10 +243,10 @@
      * @throws IOException        in case of an IO problem
      */
     protected static
-        HttpResponse obtainResponse(AsyncHttpProcessor   proc,
-                                    HttpRequest          request,
-                                    HttpContext          context,
-                                    HttpClientConnection connection)
+        HttpResponse obtainResponse(AsyncHttpProcessor        proc,
+                                    HttpRequest               request,
+                                    HttpContext               context,
+                                    HttpAsyncClientConnection connection)
         throws HttpException, IOException {
 
         return proc.doReceiveResponse(request, connection, context);

Modified: jakarta/httpcomponents/httpasync/trunk/src/java/org/apache/http/async/AsyncHttpProcessor.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpasync/trunk/src/java/org/apache/http/async/AsyncHttpProcessor.java?view=diff&rev=479354&r1=479353&r2=479354
==============================================================================
--- jakarta/httpcomponents/httpasync/trunk/src/java/org/apache/http/async/AsyncHttpProcessor.java
(original)
+++ jakarta/httpcomponents/httpasync/trunk/src/java/org/apache/http/async/AsyncHttpProcessor.java
Sun Nov 26 05:01:08 2006
@@ -31,7 +31,6 @@
 
 import java.io.IOException;
 
-import org.apache.http.HttpClientConnection;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
 import org.apache.http.HttpHost;
@@ -45,7 +44,6 @@
 import org.apache.http.protocol.HttpProcessor;
 import org.apache.http.protocol.HttpRequestExecutor;
 
-
 /**
  * HTTP processor for asynchronously dispatched requests.
  * This is the asynchronous version of
@@ -183,9 +181,9 @@
      * @throws IOException        in case of an IO problem
      */
     protected
-        HttpResponse doReceiveResponse(HttpRequest          request,
-                                       HttpClientConnection connection,
-                                       HttpContext          context)
+        HttpResponse doReceiveResponse(HttpRequest               request,
+                                       HttpAsyncClientConnection connection,
+                                       HttpContext               context)
         throws HttpException, IOException {
 
         // argument checking is done here...

Modified: jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockAsyncHttpProcessor.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockAsyncHttpProcessor.java?view=diff&rev=479354&r1=479353&r2=479354
==============================================================================
--- jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockAsyncHttpProcessor.java
(original)
+++ jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockAsyncHttpProcessor.java
Sun Nov 26 05:01:08 2006
@@ -28,18 +28,10 @@
 
 package org.apache.http.async;
 
-
-import org.apache.http.HttpClientConnection;
-import org.apache.http.HttpEntityEnclosingRequest;
-import org.apache.http.HttpException;
-import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
-import org.apache.http.ProtocolException;
 import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpExecutionContext;
-import org.apache.http.protocol.HttpRequestExecutor;
-
+import org.apache.http.protocol.HttpProcessor;
 
 public class MockAsyncHttpProcessor extends AsyncHttpProcessor {
 
@@ -49,8 +41,8 @@
     protected int count_finish;
 
 
-    public MockAsyncHttpProcessor(HttpContext context) {
-        super(context);
+    public MockAsyncHttpProcessor(HttpProcessor processor) {
+        super(processor);
         reset();
     }
 
@@ -69,16 +61,16 @@
         count_prepare++;
     }
 
-    protected void asyncSendRequest(HttpRequest          request,
-                                    HttpClientConnection connection,
-                                    HttpContext          context) {
+    protected void asyncSendRequest(HttpRequest               request,
+                                    HttpAsyncClientConnection connection,
+                                    HttpContext               context) {
         count_send++;
     }
 
     protected
-        HttpResponse doReceiveResponse(HttpRequest          request,
-                                       HttpClientConnection connection,
-                                       HttpContext          context) {
+        HttpResponse doReceiveResponse(HttpRequest               request,
+                                       HttpAsyncClientConnection connection,
+                                       HttpContext               context) {
         count_receive++;
         return null;
     }

Modified: jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpDispatcher.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpDispatcher.java?view=diff&rev=479354&r1=479353&r2=479354
==============================================================================
--- jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpDispatcher.java
(original)
+++ jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpDispatcher.java
Sun Nov 26 05:01:08 2006
@@ -28,15 +28,12 @@
 
 package org.apache.http.async;
 
-
 import java.util.Collection;
 
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
-import org.apache.http.HttpException;
 import org.apache.http.protocol.HttpContext;
-
 
 public class MockHttpDispatcher extends AbstractHttpDispatcher {
 

Modified: jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpHandle.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpHandle.java?view=diff&rev=479354&r1=479353&r2=479354
==============================================================================
--- jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpHandle.java
(original)
+++ jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpHandle.java
Sun Nov 26 05:01:08 2006
@@ -28,10 +28,8 @@
 
 package org.apache.http.async;
 
-
 import java.io.IOException;
 
-import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpException;

Modified: jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpNotificationHandler.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpNotificationHandler.java?view=diff&rev=479354&r1=479353&r2=479354
==============================================================================
--- jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpNotificationHandler.java
(original)
+++ jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/MockHttpNotificationHandler.java
Sun Nov 26 05:01:08 2006
@@ -28,10 +28,7 @@
 
 package org.apache.http.async;
 
-
 import org.apache.http.HttpResponse;
-import org.apache.http.protocol.HttpContext;
-
 
 public class MockHttpNotificationHandler implements HttpNotificationHandler {
 

Modified: jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/TestAbstractHttpDispatcher.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/TestAbstractHttpDispatcher.java?view=diff&rev=479354&r1=479353&r2=479354
==============================================================================
--- jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/TestAbstractHttpDispatcher.java
(original)
+++ jakarta/httpcomponents/httpasync/trunk/src/test/java/org/apache/http/async/TestAbstractHttpDispatcher.java
Sun Nov 26 05:01:08 2006
@@ -28,37 +28,21 @@
 
 package org.apache.http.async;
 
-
 import java.util.List;
 import java.util.ArrayList;
 
 import junit.framework.TestCase;
 
-import org.apache.http.Scheme;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.message.BasicHttpRequest;
+import org.apache.http.protocol.BasicHttpProcessor;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpExecutionContext;
-import org.apache.http.io.SocketFactory;
-import org.apache.http.impl.io.PlainSocketFactory;
-
+import org.apache.http.protocol.HttpProcessor;
 
 public class TestAbstractHttpDispatcher extends TestCase {
 
-    // public default constructor
-
-
-    public void setUp() {
-        SocketFactory socketfactory = PlainSocketFactory.getSocketFactory();
-        Scheme.registerScheme("http", new Scheme("http", socketfactory, 80));
-    }
-
-    public void tearDown() {
-        Scheme.unregisterScheme("http");
-    }
-
-
     public void testCreateNull() throws Exception {
         AbstractHttpDispatcher ahd = new MockHttpDispatcher(null);
         assertNotNull("no collection of handles", ahd.linked_handles);
@@ -74,10 +58,9 @@
 
 
     public void testPrepareContext() throws Exception {
-        MockAsyncHttpProcessor mahp = new MockAsyncHttpProcessor(null);
+        HttpProcessor processor = new BasicHttpProcessor();
+        MockAsyncHttpProcessor mahp = new MockAsyncHttpProcessor(processor);
         HttpHost target = new HttpHost("127.0.0.1", 80);
-        HttpRequest req =
-            new BasicHttpRequest("GET", "http://127.0.0.1/");
         HttpContext ctxt = null;
 
         try {
@@ -115,7 +98,8 @@
 
 
     public void testPrepare() throws Exception {
-        MockAsyncHttpProcessor mahp = new MockAsyncHttpProcessor(null);
+        HttpProcessor processor = new BasicHttpProcessor();
+        MockAsyncHttpProcessor mahp = new MockAsyncHttpProcessor(processor);
         HttpHost target = new HttpHost("127.0.0.1", 80);
         HttpRequest req =
             new BasicHttpRequest("GET", "http://127.0.0.1/");
@@ -163,7 +147,8 @@
 
 
     public void testTransmitRequestTo() throws Exception {
-        MockAsyncHttpProcessor mahp = new MockAsyncHttpProcessor(null);
+        HttpProcessor processor = new BasicHttpProcessor();
+        MockAsyncHttpProcessor mahp = new MockAsyncHttpProcessor(processor);
         AbstractHttpDispatcher.transmitRequestTo(mahp, null, null, null);
         assertEquals("prepare invoked",     0, mahp.count_prepare);
         assertEquals("send not invoked",    1, mahp.count_send);
@@ -173,7 +158,8 @@
 
 
     public void testObtainResponse() throws Exception {
-        MockAsyncHttpProcessor mahp = new MockAsyncHttpProcessor(null);
+        HttpProcessor processor = new BasicHttpProcessor();
+        MockAsyncHttpProcessor mahp = new MockAsyncHttpProcessor(processor);
         AbstractHttpDispatcher.obtainResponse(mahp, null, null, null);
         assertEquals("prepare invoked",     0, mahp.count_prepare);
         assertEquals("send invoked",        0, mahp.count_send);
@@ -183,7 +169,8 @@
 
 
     public void testFinishResponse() throws Exception {
-        MockAsyncHttpProcessor mahp = new MockAsyncHttpProcessor(null);
+        HttpProcessor processor = new BasicHttpProcessor();
+        MockAsyncHttpProcessor mahp = new MockAsyncHttpProcessor(processor);
         AbstractHttpDispatcher.finishResponse(mahp, null, null);
         assertEquals("prepare invoked",     0, mahp.count_prepare);
         assertEquals("send invoked",        0, mahp.count_send);



Mime
View raw message