hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1776187 [20/21] - in /httpcomponents/httpclient/trunk: ./ httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/ httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ httpclient5-cache/src/test/java/org/apache/h...
Date Tue, 27 Dec 2016 19:48:10 GMT
Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestMinimalClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestMinimalClientExec.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestMinimalClientExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestMinimalClientExec.java Tue Dec 27 19:48:07 2016
@@ -39,21 +39,19 @@ import org.apache.hc.client5.http.entity
 import org.apache.hc.client5.http.impl.io.ConnectionShutdownException;
 import org.apache.hc.client5.http.io.ConnectionRequest;
 import org.apache.hc.client5.http.io.HttpClientConnectionManager;
-import org.apache.hc.client5.http.methods.CloseableHttpResponse;
 import org.apache.hc.client5.http.methods.HttpExecutionAware;
 import org.apache.hc.client5.http.methods.HttpGet;
-import org.apache.hc.client5.http.methods.HttpRequestWrapper;
+import org.apache.hc.client5.http.methods.RoutedHttpRequest;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
 import org.apache.hc.core5.concurrent.Cancellable;
+import org.apache.hc.core5.http.ClassicHttpRequest;
+import org.apache.hc.core5.http.ClassicHttpResponse;
 import org.apache.hc.core5.http.ConnectionReuseStrategy;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.HttpRequest;
-import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
 import org.apache.hc.core5.http.io.HttpClientConnection;
-import org.apache.hc.core5.http.message.BasicHttpResponse;
+import org.apache.hc.core5.http.message.BasicClassicHttpResponse;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -106,15 +104,14 @@ public class TestMinimalClientExec {
                 .setConnectionRequestTimeout(345)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
         Mockito.when(requestExecutor.execute(
                 Mockito.same(request),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(response);
 
-        final CloseableHttpResponse finalResponse = minimalClientExec.execute(
-                route, request, context, execAware);
+        final ClassicHttpResponse finalResponse = minimalClientExec.execute(request, context, execAware);
         Mockito.verify(connManager).requestConnection(route, null);
         Mockito.verify(connRequest).get(345, TimeUnit.MILLISECONDS);
         Mockito.verify(execAware, Mockito.times(1)).setCancellable(connRequest);
@@ -128,7 +125,7 @@ public class TestMinimalClientExec {
 
         Assert.assertSame(managedConn, context.getConnection());
         Assert.assertNotNull(finalResponse);
-        Assert.assertTrue(finalResponse instanceof HttpResponseProxy);
+        Assert.assertTrue(finalResponse instanceof CloseableHttpResponse);
     }
 
     @Test
@@ -141,8 +138,8 @@ public class TestMinimalClientExec {
                 .setConnectionRequestTimeout(345)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
 
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.TRUE);
         Mockito.when(managedConn.isStale()).thenReturn(Boolean.FALSE);
@@ -158,8 +155,7 @@ public class TestMinimalClientExec {
                 Mockito.same(response),
                 Mockito.<HttpClientContext>any())).thenReturn(678L);
 
-        final CloseableHttpResponse finalResponse = minimalClientExec.execute(
-                route, request, context, execAware);
+        final ClassicHttpResponse finalResponse = minimalClientExec.execute(request, context, execAware);
         Mockito.verify(connManager).requestConnection(route, null);
         Mockito.verify(connRequest).get(345, TimeUnit.MILLISECONDS);
         Mockito.verify(requestExecutor, Mockito.times(1)).execute(request, managedConn, context);
@@ -167,7 +163,7 @@ public class TestMinimalClientExec {
         Mockito.verify(managedConn, Mockito.never()).close();
 
         Assert.assertNotNull(finalResponse);
-        Assert.assertTrue(finalResponse instanceof HttpResponseProxy);
+        Assert.assertTrue(finalResponse instanceof CloseableHttpResponse);
     }
 
     @Test
@@ -180,8 +176,8 @@ public class TestMinimalClientExec {
                 .setConnectionRequestTimeout(345)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
         // The entity is streaming
         response.setEntity(EntityBuilder.create()
                 .setStream(new ByteArrayInputStream(new byte[]{}))
@@ -198,8 +194,7 @@ public class TestMinimalClientExec {
                 Mockito.same(response),
                 Mockito.<HttpClientContext>any())).thenReturn(Boolean.FALSE);
 
-        final CloseableHttpResponse finalResponse = minimalClientExec.execute(
-                route, request, context, execAware);
+        final ClassicHttpResponse finalResponse = minimalClientExec.execute(request, context, execAware);
         Mockito.verify(connManager).requestConnection(route, null);
         Mockito.verify(connRequest).get(345, TimeUnit.MILLISECONDS);
         Mockito.verify(requestExecutor, Mockito.times(1)).execute(request, managedConn, context);
@@ -211,7 +206,7 @@ public class TestMinimalClientExec {
         Mockito.verify(managedConn, Mockito.never()).close();
 
         Assert.assertNotNull(finalResponse);
-        Assert.assertTrue(finalResponse instanceof HttpResponseProxy);
+        Assert.assertTrue(finalResponse instanceof CloseableHttpResponse);
         finalResponse.close();
 
         Mockito.verify(connManager, Mockito.times(1)).releaseConnection(
@@ -224,16 +219,16 @@ public class TestMinimalClientExec {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
         final RequestConfig config = RequestConfig.custom().setSocketTimeout(3000).build();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
         context.setRequestConfig(config);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
         Mockito.when(managedConn.isOpen()).thenReturn(true);
         Mockito.when(requestExecutor.execute(
                 Mockito.same(request),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(response);
 
-        minimalClientExec.execute(route, request, context, execAware);
+        minimalClientExec.execute(request, context, execAware);
         Mockito.verify(managedConn).setSocketTimeout(3000);
     }
 
@@ -241,15 +236,15 @@ public class TestMinimalClientExec {
     public void testSocketTimeoutReset() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.TRUE);
         Mockito.when(requestExecutor.execute(
                 Mockito.same(request),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(response);
 
-        minimalClientExec.execute(route, request, context, execAware);
+        minimalClientExec.execute(request, context, execAware);
         Mockito.verify(managedConn, Mockito.never()).setSocketTimeout(Mockito.anyInt());
     }
 
@@ -257,12 +252,12 @@ public class TestMinimalClientExec {
     public void testExecAbortedPriorToConnectionLease() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.FALSE);
         Mockito.when(execAware.isAborted()).thenReturn(Boolean.TRUE);
         try {
-            minimalClientExec.execute(route, request, context, execAware);
+            minimalClientExec.execute(request, context, execAware);
         } catch (final IOException ex) {
             Mockito.verify(connRequest, Mockito.times(1)).cancel();
             throw ex;
@@ -273,40 +268,40 @@ public class TestMinimalClientExec {
     public void testExecConnectionRequestFailed() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(connRequest.get(Mockito.anyInt(), Mockito.<TimeUnit>any()))
                 .thenThrow(new ExecutionException("Opppsie", null));
-        minimalClientExec.execute(route, request, context, execAware);
+        minimalClientExec.execute(request, context, execAware);
     }
 
     @Test(expected=InterruptedIOException.class)
     public void testExecConnectionShutDown() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenThrow(new ConnectionShutdownException());
 
-        minimalClientExec.execute(route, request, context, execAware);
+        minimalClientExec.execute(request, context, execAware);
     }
 
     @Test(expected=RuntimeException.class)
     public void testExecRuntimeException() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenThrow(new RuntimeException("Ka-boom"));
 
         try {
-            minimalClientExec.execute(route, request, context, execAware);
+            minimalClientExec.execute(request, context, execAware);
         } catch (final Exception ex) {
             Mockito.verify(connManager).releaseConnection(managedConn, null, 0, TimeUnit.MILLISECONDS);
 
@@ -318,15 +313,15 @@ public class TestMinimalClientExec {
     public void testExecHttpException() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenThrow(new HttpException("Ka-boom"));
 
         try {
-            minimalClientExec.execute(route, request, context, execAware);
+            minimalClientExec.execute(request, context, execAware);
         } catch (final Exception ex) {
             Mockito.verify(connManager).releaseConnection(managedConn, null, 0, TimeUnit.MILLISECONDS);
 
@@ -338,15 +333,15 @@ public class TestMinimalClientExec {
     public void testExecIOException() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenThrow(new IOException("Ka-boom"));
 
         try {
-            minimalClientExec.execute(route, request, context, execAware);
+            minimalClientExec.execute(request, context, execAware);
         } catch (final Exception ex) {
             Mockito.verify(connManager).releaseConnection(managedConn, null, 0, TimeUnit.MILLISECONDS);
 
@@ -358,19 +353,19 @@ public class TestMinimalClientExec {
     public void absoluteUriIsRewrittenToRelativeBeforeBeingPassedInRequestLine() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
-        final HttpResponse response = Mockito.mock(HttpResponse.class);
+        final ClassicHttpResponse response = Mockito.mock(ClassicHttpResponse.class);
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(response);
 
-        minimalClientExec.execute(route, request, context, execAware);
+        minimalClientExec.execute(request, context, execAware);
 
-        final ArgumentCaptor<HttpRequest> reqCaptor = ArgumentCaptor.forClass(HttpRequest.class);
+        final ArgumentCaptor<ClassicHttpRequest> reqCaptor = ArgumentCaptor.forClass(ClassicHttpRequest.class);
         Mockito.verify(requestExecutor).execute(reqCaptor.capture(), Mockito.<HttpClientConnection>any(), Mockito.<HttpClientContext>any());
 
-        Assert.assertEquals("/test", reqCaptor.getValue().getRequestLine().getUri());
+        Assert.assertEquals("/test", reqCaptor.getValue().getRequestUri());
     }
 }

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestNullBackoffStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestNullBackoffStrategy.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestNullBackoffStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestNullBackoffStrategy.java Tue Dec 27 19:48:07 2016
@@ -30,7 +30,6 @@ import static org.junit.Assert.assertFal
 
 import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.message.BasicHttpResponse;
 import org.junit.Before;
 import org.junit.Test;
@@ -52,8 +51,7 @@ public class TestNullBackoffStrategy {
 
     @Test
     public void doesNotBackoffForResponses() {
-        final HttpResponse resp = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_SERVICE_UNAVAILABLE, "Service Unavailable");
+        final HttpResponse resp = new BasicHttpResponse(HttpStatus.SC_SERVICE_UNAVAILABLE, "Service Unavailable");
         assertFalse(impl.shouldBackoff(resp));
     }
 }

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestProtocolExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestProtocolExec.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestProtocolExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestProtocolExec.java Tue Dec 27 19:48:07 2016
@@ -33,14 +33,14 @@ import org.apache.hc.client5.http.HttpRo
 import org.apache.hc.client5.http.auth.AuthScope;
 import org.apache.hc.client5.http.auth.Credentials;
 import org.apache.hc.client5.http.auth.CredentialsProvider;
-import org.apache.hc.client5.http.methods.CloseableHttpResponse;
 import org.apache.hc.client5.http.methods.HttpExecutionAware;
 import org.apache.hc.client5.http.methods.HttpGet;
-import org.apache.hc.client5.http.methods.HttpRequestWrapper;
+import org.apache.hc.client5.http.methods.RoutedHttpRequest;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
+import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.EntityDetails;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.message.BasicHttpRequest;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 import org.junit.Assert;
@@ -62,133 +62,54 @@ public class TestProtocolExec {
 
     private ProtocolExec protocolExec;
     private HttpHost target;
-    private HttpHost proxy;
 
     @Before
     public void setup() throws Exception {
         MockitoAnnotations.initMocks(this);
         protocolExec = new ProtocolExec(requestExecutor, httpProcessor);
         target = new HttpHost("foo", 80);
-        proxy = new HttpHost("bar", 8888);
     }
 
     @Test
     public void testFundamentals() throws Exception {
         final HttpRoute route = new HttpRoute(target);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("/test"), route);
         final HttpClientContext context = HttpClientContext.create();
 
-        final CloseableHttpResponse response = Mockito.mock(CloseableHttpResponse.class);
+        final ClassicHttpResponse response = Mockito.mock(ClassicHttpResponse.class);
 
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response);
 
-        protocolExec.execute(route, request, context, execAware);
+        protocolExec.execute(request, context, execAware);
 
-        Mockito.verify(httpProcessor).process(request, context);
-        Mockito.verify(requestExecutor).execute(route, request, context, execAware);
-        Mockito.verify(httpProcessor).process(response, context);
+        Mockito.verify(httpProcessor).process(request, null, context);
+        Mockito.verify(requestExecutor).execute(request, context, execAware);
+        Mockito.verify(httpProcessor).process(response, null, context);
 
-        Assert.assertEquals(new HttpHost("foo", 80), context.getTargetHost());
-        Assert.assertEquals(target, context.getTargetHost());
         Assert.assertEquals(route, context.getHttpRoute());
         Assert.assertSame(request, context.getRequest());
         Assert.assertSame(response, context.getResponse());
     }
 
     @Test
-    public void testRewriteAbsoluteRequestURI() throws Exception {
-        final HttpRoute route = new HttpRoute(target);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(
-                new HttpGet("http://foo/test"), target);
-        protocolExec.rewriteRequestURI(request, route);
-        Assert.assertEquals(new URI("/test"), request.getURI());
-    }
-
-    @Test
-    public void testRewriteEmptyRequestURI() throws Exception {
-        final HttpRoute route = new HttpRoute(target);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(
-                new HttpGet(""), target);
-        protocolExec.rewriteRequestURI(request, route);
-        Assert.assertEquals(new URI("/"), request.getURI());
-    }
-
-    @Test
-    public void testRewriteAbsoluteRequestURIViaPRoxy() throws Exception {
-        final HttpRoute route = new HttpRoute(target, proxy);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(
-                new HttpGet("http://foo/test"), target);
-        protocolExec.rewriteRequestURI(request, route);
-        Assert.assertEquals(new URI("http://foo/test"), request.getURI());
-    }
-
-    @Test
-    public void testRewriteRelativeRequestURIViaPRoxy() throws Exception {
-        final HttpRoute route = new HttpRoute(target, proxy);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(
-                new HttpGet("/test"), target);
-        protocolExec.rewriteRequestURI(request, route);
-        Assert.assertEquals(new URI("http://foo:80/test"), request.getURI());
-    }
-
-    @Test
-    public void testHostHeaderUriRequest() throws Exception {
-        final HttpRoute route = new HttpRoute(target);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(
-                new HttpGet("http://bar/test"), target);
-        final HttpClientContext context = HttpClientContext.create();
-        protocolExec.execute(route, request, context, execAware);
-        // ProtocolExect should have extracted the host from request URI
-        Assert.assertEquals(new HttpHost("bar", -1, "http"), context.getTargetHost());
-    }
-
-    @Test
-    public void testHostHeaderWhenNonUriRequest() throws Exception {
-        final HttpRoute route = new HttpRoute(target);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(
-                new BasicHttpRequest("GET", "http://bar/test"), target);
-        final HttpClientContext context = HttpClientContext.create();
-        protocolExec.execute(route, request, context, execAware);
-        // ProtocolExect should have extracted the host from request URI
-        Assert.assertEquals(new HttpHost("bar", -1, "http"), context.getTargetHost());
-    }
-
-    @Test
-    public void testHostHeaderWhenNonUriRequestAndInvalidUri() throws Exception {
-        final HttpRoute route = new HttpRoute(target);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(
-                new BasicHttpRequest("GET", "http://bar/test|"), target);
-        final HttpClientContext context = HttpClientContext.create();
-        protocolExec.execute(route, request, context, execAware);
-        // ProtocolExect should have fall back to physical host as request URI
-        // is not parseable
-        Assert.assertEquals(new HttpHost("foo", 80, "http"), context.getTargetHost());
-    }
-
-    @Test
-    public void testHostHeaderImplicitHost() throws Exception {
-        final HttpHost somehost = new HttpHost("somehost", 8080);
-        final HttpRoute route = new HttpRoute(somehost);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("/test"), somehost);
-        final HttpClientContext context = HttpClientContext.create();
-        protocolExec.execute(route, request, context, execAware);
-        Assert.assertEquals(somehost, context.getTargetHost());
-    }
-
-    @Test
     public void testUserInfoInRequestURI() throws Exception {
         final HttpRoute route = new HttpRoute(new HttpHost("somehost", 8080));
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(
-                new HttpGet("http://somefella:secret@bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(
+                new HttpGet("http://somefella:secret@bar/test"), route);
         final HttpClientContext context = HttpClientContext.create();
         context.setCredentialsProvider(new BasicCredentialsProvider());
-        protocolExec.execute(route, request, context, execAware);
-        Assert.assertEquals(new URI("/test"), request.getURI());
-        Assert.assertEquals(new HttpHost("bar", -1), context.getTargetHost());
+
+        final ClassicHttpResponse response = Mockito.mock(ClassicHttpResponse.class);
+        Mockito.when(requestExecutor.execute(
+                Mockito.<RoutedHttpRequest>any(),
+                Mockito.<HttpClientContext>any(),
+                Mockito.<HttpExecutionAware>any())).thenReturn(response);
+
+        protocolExec.execute(request, context, execAware);
+        Assert.assertEquals(new URI("http://bar/test"), request.getUri());
         final CredentialsProvider credentialsProvider = context.getCredentialsProvider();
         final Credentials creds = credentialsProvider.getCredentials(new AuthScope("bar", -1, null), null);
         Assert.assertNotNull(creds);
@@ -198,20 +119,19 @@ public class TestProtocolExec {
     @Test(expected = HttpException.class)
     public void testPostProcessHttpException() throws Exception {
         final HttpRoute route = new HttpRoute(target);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("/test"), route);
         final HttpClientContext context = HttpClientContext.create();
 
-        final CloseableHttpResponse response = Mockito.mock(CloseableHttpResponse.class);
+        final ClassicHttpResponse response = Mockito.mock(ClassicHttpResponse.class);
 
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response);
         Mockito.doThrow(new HttpException("Ooopsie")).when(httpProcessor).process(
-                Mockito.same(response), Mockito.<HttpContext>any());
+                Mockito.same(response), Mockito.isNull(EntityDetails.class), Mockito.<HttpContext>any());
         try {
-            protocolExec.execute(route, request, context, execAware);
+            protocolExec.execute(request, context, execAware);
         } catch (final Exception ex) {
             Mockito.verify(response).close();
             throw ex;
@@ -221,19 +141,18 @@ public class TestProtocolExec {
     @Test(expected = IOException.class)
     public void testPostProcessIOException() throws Exception {
         final HttpRoute route = new HttpRoute(target);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("/test"), route);
         final HttpClientContext context = HttpClientContext.create();
 
-        final CloseableHttpResponse response = Mockito.mock(CloseableHttpResponse.class);
+        final ClassicHttpResponse response = Mockito.mock(ClassicHttpResponse.class);
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response);
         Mockito.doThrow(new IOException("Ooopsie")).when(httpProcessor).process(
-                Mockito.same(response), Mockito.<HttpContext>any());
+                Mockito.same(response), Mockito.isNull(EntityDetails.class), Mockito.<HttpContext>any());
         try {
-            protocolExec.execute(route, request, context, execAware);
+            protocolExec.execute(request, context, execAware);
         } catch (final Exception ex) {
             Mockito.verify(response).close();
             throw ex;
@@ -243,19 +162,18 @@ public class TestProtocolExec {
     @Test(expected = RuntimeException.class)
     public void testPostProcessRuntimeException() throws Exception {
         final HttpRoute route = new HttpRoute(target);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("/test"), route);
         final HttpClientContext context = HttpClientContext.create();
 
-        final CloseableHttpResponse response = Mockito.mock(CloseableHttpResponse.class);
+        final ClassicHttpResponse response = Mockito.mock(ClassicHttpResponse.class);
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response);
         Mockito.doThrow(new RuntimeException("Ooopsie")).when(httpProcessor).process(
-                Mockito.same(response), Mockito.<HttpContext>any());
+                Mockito.same(response), Mockito.isNull(EntityDetails.class), Mockito.<HttpContext>any());
         try {
-            protocolExec.execute(route, request, context, execAware);
+            protocolExec.execute(request, context, execAware);
         } catch (final Exception ex) {
             Mockito.verify(response).close();
             throw ex;

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestRedirectExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestRedirectExec.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestRedirectExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestRedirectExec.java Tue Dec 27 19:48:07 2016
@@ -36,15 +36,14 @@ import org.apache.hc.client5.http.config
 import org.apache.hc.client5.http.entity.EntityBuilder;
 import org.apache.hc.client5.http.impl.auth.BasicScheme;
 import org.apache.hc.client5.http.impl.auth.NTLMScheme;
-import org.apache.hc.client5.http.methods.CloseableHttpResponse;
 import org.apache.hc.client5.http.methods.HttpExecutionAware;
 import org.apache.hc.client5.http.methods.HttpGet;
-import org.apache.hc.client5.http.methods.HttpRequestWrapper;
+import org.apache.hc.client5.http.methods.RoutedHttpRequest;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
 import org.apache.hc.client5.http.protocol.RedirectException;
 import org.apache.hc.client5.http.protocol.RedirectStrategy;
 import org.apache.hc.client5.http.routing.HttpRoutePlanner;
-import org.apache.hc.core5.http.Header;
+import org.apache.hc.core5.http.ClassicHttpResponse;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHost;
@@ -87,18 +86,16 @@ public class TestRedirectExec {
     public void testFundamentals() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpGet get = new HttpGet("/test");
-        get.addHeader("header", "this");
-        get.addHeader("header", "that");
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(get, target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(get, route);
         final HttpClientContext context = HttpClientContext.create();
 
-        final CloseableHttpResponse response1 = Mockito.mock(CloseableHttpResponse.class);
+        final ClassicHttpResponse response1 = Mockito.mock(ClassicHttpResponse.class);
         final InputStream instream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
         final HttpEntity entity1 = EntityBuilder.create()
                 .setStream(instream1)
                 .build();
         Mockito.when(response1.getEntity()).thenReturn(entity1);
-        final CloseableHttpResponse response2 = Mockito.mock(CloseableHttpResponse.class);
+        final ClassicHttpResponse response2 = Mockito.mock(ClassicHttpResponse.class);
         final InputStream instream2 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
         final HttpEntity entity2 = EntityBuilder.create()
                 .setStream(instream2)
@@ -107,12 +104,10 @@ public class TestRedirectExec {
         final HttpGet redirect = new HttpGet("http://localhost:80/redirect");
 
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
                 Mockito.same(request),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response1);
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
                 HttpRequestWrapperMatcher.same(redirect),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response2);
@@ -126,29 +121,22 @@ public class TestRedirectExec {
                 Mockito.<HttpClientContext>any())).thenReturn(redirect);
         Mockito.when(httpRoutePlanner.determineRoute(
                 Mockito.eq(target),
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(route);
 
-        redirectExec.execute(route, request, context, execAware);
+        redirectExec.execute(request, context, execAware);
 
-        final ArgumentCaptor<HttpRequestWrapper> reqCaptor = ArgumentCaptor.forClass(
-                HttpRequestWrapper.class);
+        final ArgumentCaptor<RoutedHttpRequest> reqCaptor = ArgumentCaptor.forClass(
+                RoutedHttpRequest.class);
         Mockito.verify(requestExecutor, Mockito.times(2)).execute(
-                Mockito.eq(route),
                 reqCaptor.capture(),
                 Mockito.same(context),
                 Mockito.same(execAware));
 
-        final List<HttpRequestWrapper> allValues = reqCaptor.getAllValues();
+        final List<RoutedHttpRequest> allValues = reqCaptor.getAllValues();
         Assert.assertNotNull(allValues);
         Assert.assertEquals(2, allValues.size());
         Assert.assertSame(request, allValues.get(0));
-        final HttpRequestWrapper redirectWrapper = allValues.get(1);
-        final Header[] headers = redirectWrapper.getHeaders("header");
-        Assert.assertNotNull(headers);
-        Assert.assertEquals(2, headers.length);
-        Assert.assertEquals("this", headers[0].getValue());
-        Assert.assertEquals("that", headers[1].getValue());
 
         Mockito.verify(response1, Mockito.times(1)).close();
         Mockito.verify(instream1, Mockito.times(1)).close();
@@ -160,7 +148,7 @@ public class TestRedirectExec {
     public void testMaxRedirect() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpGet get = new HttpGet("/test");
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(get, target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(get, route);
         final HttpClientContext context = HttpClientContext.create();
         final RequestConfig config = RequestConfig.custom()
                 .setRedirectsEnabled(true)
@@ -168,47 +156,44 @@ public class TestRedirectExec {
                 .build();
         context.setRequestConfig(config);
 
-        final CloseableHttpResponse response1 = Mockito.mock(CloseableHttpResponse.class);
+        final ClassicHttpResponse response1 = Mockito.mock(ClassicHttpResponse.class);
         final HttpGet redirect = new HttpGet("http://localhost:80/redirect");
 
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response1);
         Mockito.when(redirectStrategy.isRedirected(
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpResponse>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(Boolean.TRUE);
         Mockito.when(redirectStrategy.getRedirect(
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpResponse>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(redirect);
         Mockito.when(httpRoutePlanner.determineRoute(
                 Mockito.eq(target),
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(route);
 
-        redirectExec.execute(route, request, context, execAware);
+        redirectExec.execute(request, context, execAware);
     }
 
     @Test(expected = HttpException.class)
     public void testRelativeRedirect() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpGet get = new HttpGet("/test");
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(get, target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(get, route);
         final HttpClientContext context = HttpClientContext.create();
 
-        final CloseableHttpResponse response1 = Mockito.mock(CloseableHttpResponse.class);
-        final CloseableHttpResponse response2 = Mockito.mock(CloseableHttpResponse.class);
+        final ClassicHttpResponse response1 = Mockito.mock(ClassicHttpResponse.class);
+        final ClassicHttpResponse response2 = Mockito.mock(ClassicHttpResponse.class);
         final HttpGet redirect = new HttpGet("/redirect");
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
                 Mockito.same(request),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response1);
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
                 HttpRequestWrapperMatcher.same(redirect),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response2);
@@ -222,10 +207,10 @@ public class TestRedirectExec {
                 Mockito.<HttpClientContext>any())).thenReturn(redirect);
         Mockito.when(httpRoutePlanner.determineRoute(
                 Mockito.eq(target),
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(route);
 
-        redirectExec.execute(route, request, context, execAware);
+        redirectExec.execute(request, context, execAware);
     }
 
     @Test
@@ -234,7 +219,7 @@ public class TestRedirectExec {
         final HttpHost proxy = new HttpHost("proxy");
         final HttpRoute route = new HttpRoute(target, proxy);
         final HttpGet get = new HttpGet("/test");
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(get, target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(get, route);
         final HttpClientContext context = HttpClientContext.create();
 
         final AuthExchange targetAuthExchange = new AuthExchange();
@@ -246,16 +231,15 @@ public class TestRedirectExec {
         context.setAuthExchange(target, targetAuthExchange);
         context.setAuthExchange(proxy, proxyAuthExchange);
 
-        final CloseableHttpResponse response1 = Mockito.mock(CloseableHttpResponse.class);
-        final CloseableHttpResponse response2 = Mockito.mock(CloseableHttpResponse.class);
-        final HttpGet redirect = new HttpGet("http://otherhost/redirect");
+        final ClassicHttpResponse response1 = Mockito.mock(ClassicHttpResponse.class);
+        final ClassicHttpResponse response2 = Mockito.mock(ClassicHttpResponse.class);
+        final HttpHost otherHost = new HttpHost("otherhost", 8888);
+        final HttpGet redirect = new HttpGet("http://otherhost:8888/redirect");
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
                 Mockito.same(request),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response1);
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
                 HttpRequestWrapperMatcher.same(redirect),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response2);
@@ -269,10 +253,14 @@ public class TestRedirectExec {
                 Mockito.<HttpClientContext>any())).thenReturn(redirect);
         Mockito.when(httpRoutePlanner.determineRoute(
                 Mockito.eq(target),
-                Mockito.<HttpRequestWrapper>any(),
-                Mockito.<HttpClientContext>any())).thenReturn(new HttpRoute(new HttpHost("otherhost", 80)));
+                Mockito.<RoutedHttpRequest>any(),
+                Mockito.<HttpClientContext>any())).thenReturn(new HttpRoute(target));
+        Mockito.when(httpRoutePlanner.determineRoute(
+                Mockito.eq(otherHost),
+                Mockito.<RoutedHttpRequest>any(),
+                Mockito.<HttpClientContext>any())).thenReturn(new HttpRoute(otherHost));
 
-        redirectExec.execute(route, request, context, execAware);
+        redirectExec.execute(request, context, execAware);
 
         final AuthExchange authExchange1 = context.getAuthExchange(target);
         Assert.assertNotNull(authExchange1);
@@ -288,12 +276,11 @@ public class TestRedirectExec {
     public void testRedirectRuntimeException() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpGet get = new HttpGet("/test");
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(get, target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(get, route);
         final HttpClientContext context = HttpClientContext.create();
 
-        final CloseableHttpResponse response1 = Mockito.mock(CloseableHttpResponse.class);
+        final ClassicHttpResponse response1 = Mockito.mock(ClassicHttpResponse.class);
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
                 Mockito.same(request),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response1);
@@ -307,7 +294,7 @@ public class TestRedirectExec {
                 Mockito.<HttpClientContext>any()));
 
         try {
-            redirectExec.execute(route, request, context, execAware);
+            redirectExec.execute(request, context, execAware);
         } catch (final Exception ex) {
             Mockito.verify(response1).close();
             throw ex;
@@ -318,17 +305,16 @@ public class TestRedirectExec {
     public void testRedirectProtocolException() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpGet get = new HttpGet("/test");
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(get, target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(get, route);
         final HttpClientContext context = HttpClientContext.create();
 
-        final CloseableHttpResponse response1 = Mockito.mock(CloseableHttpResponse.class);
+        final ClassicHttpResponse response1 = Mockito.mock(ClassicHttpResponse.class);
         final InputStream instream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
         final HttpEntity entity1 = EntityBuilder.create()
                 .setStream(instream1)
                 .build();
         Mockito.when(response1.getEntity()).thenReturn(entity1);
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
                 Mockito.same(request),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response1);
@@ -342,7 +328,7 @@ public class TestRedirectExec {
                 Mockito.<HttpClientContext>any());
 
         try {
-            redirectExec.execute(route, request, context, execAware);
+            redirectExec.execute(request, context, execAware);
         } catch (final Exception ex) {
             Mockito.verify(instream1).close();
             Mockito.verify(response1).close();
@@ -350,7 +336,7 @@ public class TestRedirectExec {
         }
     }
 
-    static class HttpRequestWrapperMatcher extends ArgumentMatcher<HttpRequestWrapper> {
+    static class HttpRequestWrapperMatcher extends ArgumentMatcher<RoutedHttpRequest> {
 
         private final HttpRequest original;
 
@@ -360,11 +346,11 @@ public class TestRedirectExec {
         }
         @Override
         public boolean matches(final Object obj) {
-            final HttpRequestWrapper wrapper = (HttpRequestWrapper) obj;
+            final RoutedHttpRequest wrapper = (RoutedHttpRequest) obj;
             return original == wrapper.getOriginal();
         }
 
-        static HttpRequestWrapper same(final HttpRequest original) {
+        static RoutedHttpRequest same(final HttpRequest original) {
             return Matchers.argThat(new HttpRequestWrapperMatcher(original));
         }
 

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestResponseEntityWrapper.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestResponseEntityWrapper.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestResponseEntityWrapper.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestResponseEntityWrapper.java Tue Dec 27 19:48:07 2016
@@ -32,7 +32,7 @@ import java.io.OutputStream;
 import java.net.SocketException;
 
 import org.apache.hc.core5.http.HttpEntity;
-import org.apache.hc.core5.http.entity.EntityUtils;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestRetryExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestRetryExec.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestRetryExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestRetryExec.java Tue Dec 27 19:48:07 2016
@@ -35,10 +35,11 @@ import org.apache.hc.client5.http.entity
 import org.apache.hc.client5.http.methods.HttpExecutionAware;
 import org.apache.hc.client5.http.methods.HttpGet;
 import org.apache.hc.client5.http.methods.HttpPost;
-import org.apache.hc.client5.http.methods.HttpRequestWrapper;
+import org.apache.hc.client5.http.methods.RoutedHttpRequest;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
 import org.apache.hc.client5.http.protocol.NonRepeatableRequestException;
 import org.apache.hc.client5.http.sync.HttpRequestRetryHandler;
+import org.apache.hc.core5.http.ClassicHttpRequest;
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpRequest;
@@ -78,11 +79,10 @@ public class TestRetryExec {
         final HttpGet get = new HttpGet("/test");
         get.addHeader("header", "this");
         get.addHeader("header", "that");
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(get, target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(get, route);
         final HttpClientContext context = HttpClientContext.create();
 
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
                 Mockito.same(request),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenAnswer(new Answer<Object>() {
@@ -90,7 +90,7 @@ public class TestRetryExec {
             @Override
             public Object answer(final InvocationOnMock invocationOnMock) throws Throwable {
                 final Object[] args = invocationOnMock.getArguments();
-                final HttpRequestWrapper wrapper = (HttpRequestWrapper) args[1];
+                final RoutedHttpRequest wrapper = (RoutedHttpRequest) args[0];
                 final Header[] headers = wrapper.getAllHeaders();
                 Assert.assertEquals(2, headers.length);
                 Assert.assertEquals("this", headers[0].getValue());
@@ -106,10 +106,9 @@ public class TestRetryExec {
                 Mockito.eq(1),
                 Mockito.<HttpContext>any())).thenReturn(Boolean.TRUE);
         try {
-            retryExec.execute(route, request, context, execAware);
+            retryExec.execute(request, context, execAware);
         } catch (final IOException ex) {
             Mockito.verify(requestExecutor, Mockito.times(2)).execute(
-                    Mockito.eq(route),
                     Mockito.same(request),
                     Mockito.same(context),
                     Mockito.same(execAware));
@@ -121,21 +120,19 @@ public class TestRetryExec {
     public void testAbortedRequest() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpGet get = new HttpGet("/test");
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(get, target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(get, route);
         final HttpClientContext context = HttpClientContext.create();
 
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
                 Mockito.same(request),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenThrow(new IOException("Ka-boom"));
 
         Mockito.when(execAware.isAborted()).thenReturn(Boolean.TRUE);
         try {
-            retryExec.execute(route, request, context, execAware);
+            retryExec.execute(request, context, execAware);
         } catch (final IOException ex) {
             Mockito.verify(requestExecutor, Mockito.times(1)).execute(
-                    Mockito.eq(route),
                     Mockito.same(request),
                     Mockito.same(context),
                     Mockito.same(execAware));
@@ -156,11 +153,10 @@ public class TestRetryExec {
         post.setEntity(EntityBuilder.create()
                 .setStream(new ByteArrayInputStream(new byte[]{}))
                 .build());
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(post, target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(post, route);
         final HttpClientContext context = HttpClientContext.create();
 
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
                 Mockito.same(request),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenAnswer(new Answer<Object>() {
@@ -168,7 +164,7 @@ public class TestRetryExec {
             @Override
             public Object answer(final InvocationOnMock invocationOnMock) throws Throwable {
                 final Object[] args = invocationOnMock.getArguments();
-                final HttpRequest req = (HttpRequest) args[1];
+                final ClassicHttpRequest req = (ClassicHttpRequest) args[0];
                 req.getEntity().writeTo(new ByteArrayOutputStream());
                 throw new IOException("Ka-boom");
             }
@@ -180,10 +176,9 @@ public class TestRetryExec {
                 Mockito.eq(1),
                 Mockito.<HttpContext>any())).thenReturn(Boolean.TRUE);
         try {
-            retryExec.execute(route, request, context, execAware);
+            retryExec.execute(request, context, execAware);
         } catch (final IOException ex) {
             Mockito.verify(requestExecutor, Mockito.times(1)).execute(
-                    Mockito.eq(route),
                     Mockito.same(request),
                     Mockito.same(context),
                     Mockito.same(execAware));

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestServiceUnavailableRetryExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestServiceUnavailableRetryExec.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestServiceUnavailableRetryExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestServiceUnavailableRetryExec.java Tue Dec 27 19:48:07 2016
@@ -27,12 +27,12 @@
 package org.apache.hc.client5.http.impl.sync;
 
 import org.apache.hc.client5.http.HttpRoute;
-import org.apache.hc.client5.http.methods.CloseableHttpResponse;
 import org.apache.hc.client5.http.methods.HttpExecutionAware;
 import org.apache.hc.client5.http.methods.HttpGet;
-import org.apache.hc.client5.http.methods.HttpRequestWrapper;
+import org.apache.hc.client5.http.methods.RoutedHttpRequest;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
 import org.apache.hc.client5.http.sync.ServiceUnavailableRetryStrategy;
+import org.apache.hc.core5.http.ClassicHttpResponse;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.protocol.HttpContext;
@@ -66,13 +66,12 @@ public class TestServiceUnavailableRetry
     public void testFundamentals() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpGet get = new HttpGet("/test");
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(get, target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(get, route);
         final HttpClientContext context = HttpClientContext.create();
 
-        final CloseableHttpResponse response = Mockito.mock(CloseableHttpResponse.class);
+        final ClassicHttpResponse response = Mockito.mock(ClassicHttpResponse.class);
 
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
                 Mockito.same(request),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response);
@@ -84,10 +83,9 @@ public class TestServiceUnavailableRetry
                 Mockito.<HttpResponse>any(),
                 Mockito.<HttpContext>any())).thenReturn(0L);
 
-        retryExec.execute(route, request, context, execAware);
+        retryExec.execute(request, context, execAware);
 
         Mockito.verify(requestExecutor, Mockito.times(2)).execute(
-                Mockito.eq(route),
                 Mockito.same(request),
                 Mockito.same(context),
                 Mockito.same(execAware));
@@ -97,13 +95,12 @@ public class TestServiceUnavailableRetry
     @Test(expected = RuntimeException.class)
     public void testStrategyRuntimeException() throws Exception {
         final HttpRoute route = new HttpRoute(target);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("/test"), route);
         final HttpClientContext context = HttpClientContext.create();
 
-        final CloseableHttpResponse response = Mockito.mock(CloseableHttpResponse.class);
+        final ClassicHttpResponse response = Mockito.mock(ClassicHttpResponse.class);
         Mockito.when(requestExecutor.execute(
-                Mockito.eq(route),
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpClientContext>any(),
                 Mockito.<HttpExecutionAware>any())).thenReturn(response);
         Mockito.doThrow(new RuntimeException("Ooopsie")).when(retryStrategy).retryRequest(
@@ -111,7 +108,7 @@ public class TestServiceUnavailableRetry
                 Mockito.anyInt(),
                 Mockito.<HttpContext>any());
         try {
-            retryExec.execute(route, request, context, execAware);
+            retryExec.execute(request, context, execAware);
         } catch (final Exception ex) {
             Mockito.verify(response).close();
             throw ex;

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/EchoHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/EchoHandler.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/EchoHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/EchoHandler.java Tue Dec 27 19:48:07 2016
@@ -30,15 +30,15 @@ package org.apache.hc.client5.http.local
 import java.io.IOException;
 import java.util.Locale;
 
+import org.apache.hc.core5.http.ClassicHttpRequest;
+import org.apache.hc.core5.http.ClassicHttpResponse;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpException;
-import org.apache.hc.core5.http.HttpRequest;
-import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.MethodNotSupportedException;
-import org.apache.hc.core5.http.entity.ByteArrayEntity;
-import org.apache.hc.core5.http.entity.EntityUtils;
 import org.apache.hc.core5.http.io.HttpRequestHandler;
+import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
 import org.apache.hc.core5.http.protocol.HttpContext;
 
 /**
@@ -58,12 +58,12 @@ public class EchoHandler implements Http
      * @throws IOException      in case of an IO problem
      */
     @Override
-    public void handle(final HttpRequest request,
-                       final HttpResponse response,
+    public void handle(final ClassicHttpRequest request,
+                       final ClassicHttpResponse response,
                        final HttpContext context)
         throws HttpException, IOException {
 
-        final String method = request.getRequestLine().getMethod().toUpperCase(Locale.ROOT);
+        final String method = request.getMethod().toUpperCase(Locale.ROOT);
         if (!"GET".equals(method) &&
             !"POST".equals(method) &&
             !"PUT".equals(method)
@@ -89,7 +89,7 @@ public class EchoHandler implements Http
         }
         entity = bae;
 
-        response.setStatusCode(HttpStatus.SC_OK);
+        response.setCode(HttpStatus.SC_OK);
         response.setEntity(entity);
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/LocalServerTestBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/LocalServerTestBase.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/LocalServerTestBase.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/LocalServerTestBase.java Tue Dec 27 19:48:07 2016
@@ -33,9 +33,9 @@ import org.apache.hc.client5.http.impl.i
 import org.apache.hc.client5.http.impl.sync.CloseableHttpClient;
 import org.apache.hc.client5.http.impl.sync.HttpClientBuilder;
 import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.bootstrap.io.HttpServer;
-import org.apache.hc.core5.http.bootstrap.io.ServerBootstrap;
 import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.impl.io.bootstrap.HttpServer;
+import org.apache.hc.core5.http.impl.io.bootstrap.ServerBootstrap;
 import org.junit.After;
 import org.junit.Before;
 
@@ -46,8 +46,6 @@ public abstract class LocalServerTestBas
 
     public enum ProtocolScheme { http, https };
 
-    public static final String ORIGIN = "TEST/1.1";
-
     protected final ProtocolScheme scheme;
 
     protected ServerBootstrap serverBootstrap;
@@ -75,7 +73,6 @@ public abstract class LocalServerTestBas
                 .build();
         this.serverBootstrap = ServerBootstrap.bootstrap()
                 .setSocketConfig(socketConfig)
-                .setServerInfo(ORIGIN)
                 .registerHandler("/echo/*", new EchoHandler())
                 .registerHandler("/random/*", new RandomHandler());
         if (this.scheme.equals(ProtocolScheme.https)) {

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/RandomHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/RandomHandler.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/RandomHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/RandomHandler.java Tue Dec 27 19:48:07 2016
@@ -33,13 +33,13 @@ import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.util.Locale;
 
+import org.apache.hc.core5.http.ClassicHttpRequest;
+import org.apache.hc.core5.http.ClassicHttpResponse;
 import org.apache.hc.core5.http.HttpException;
-import org.apache.hc.core5.http.HttpRequest;
-import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.MethodNotSupportedException;
-import org.apache.hc.core5.http.entity.AbstractHttpEntity;
 import org.apache.hc.core5.http.io.HttpRequestHandler;
+import org.apache.hc.core5.http.io.entity.AbstractHttpEntity;
 import org.apache.hc.core5.http.protocol.HttpContext;
 
 /**
@@ -63,18 +63,18 @@ public class RandomHandler implements Ht
      * @throws IOException      in case of an IO problem
      */
     @Override
-    public void handle(final HttpRequest request,
-                       final HttpResponse response,
+    public void handle(final ClassicHttpRequest request,
+                       final ClassicHttpResponse response,
                        final HttpContext context)
         throws HttpException, IOException {
 
-        final String method = request.getRequestLine().getMethod().toUpperCase(Locale.ROOT);
+        final String method = request.getMethod().toUpperCase(Locale.ROOT);
         if (!"GET".equals(method) && !"HEAD".equals(method)) {
             throw new MethodNotSupportedException
                 (method + " not supported by " + getClass().getName());
         }
 
-        final String uri = request.getRequestLine().getUri();
+        final String uri = request.getRequestUri();
         final int  slash = uri.lastIndexOf('/');
         int length = -1;
         if (slash < uri.length()-1) {
@@ -83,11 +83,11 @@ public class RandomHandler implements Ht
                 length = Integer.parseInt(uri.substring(slash+1));
 
                 if (length < 0) {
-                    response.setStatusCode(HttpStatus.SC_BAD_REQUEST);
+                    response.setCode(HttpStatus.SC_BAD_REQUEST);
                     response.setReasonPhrase("LENGTH " + length);
                 }
             } catch (final NumberFormatException nfx) {
-                response.setStatusCode(HttpStatus.SC_BAD_REQUEST);
+                response.setCode(HttpStatus.SC_BAD_REQUEST);
                 response.setReasonPhrase(nfx.toString());
             }
         } else {
@@ -97,7 +97,7 @@ public class RandomHandler implements Ht
 
         if (length >= 0) {
 
-            response.setStatusCode(HttpStatus.SC_OK);
+            response.setCode(HttpStatus.SC_OK);
 
             if (!"HEAD".equals(method)) {
                 final RandomEntity entity = new RandomEntity(length);
@@ -217,9 +217,12 @@ public class RandomHandler implements Ht
             }
             out.close();
 
-        } // writeTo
+        }
 
-    } // class RandomEntity
+        @Override
+        public void close() throws IOException {
+        }
 
+    }
 
-} // class RandomHandler
+}

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/RequestBasicAuth.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/RequestBasicAuth.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/RequestBasicAuth.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/RequestBasicAuth.java Tue Dec 27 19:48:07 2016
@@ -29,6 +29,7 @@ package org.apache.hc.client5.http.local
 
 import java.io.IOException;
 
+import org.apache.hc.core5.http.EntityDetails;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpRequestInterceptor;
@@ -46,6 +47,7 @@ public class RequestBasicAuth implements
     @Override
     public void process(
             final HttpRequest request,
+            final EntityDetails entityDetails,
             final HttpContext context) throws HttpException, IOException {
         context.setAttribute("creds", this.authTokenExtractor.extract(request));
     }

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/ResponseBasicUnauthorized.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/ResponseBasicUnauthorized.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/ResponseBasicUnauthorized.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/localserver/ResponseBasicUnauthorized.java Tue Dec 27 19:48:07 2016
@@ -29,6 +29,7 @@ package org.apache.hc.client5.http.local
 
 import java.io.IOException;
 
+import org.apache.hc.core5.http.EntityDetails;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHeaders;
 import org.apache.hc.core5.http.HttpResponse;
@@ -41,8 +42,9 @@ public class ResponseBasicUnauthorized i
     @Override
     public void process(
             final HttpResponse response,
+            final EntityDetails entityDetails,
             final HttpContext context) throws HttpException, IOException {
-        if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
+        if (response.getCode() == HttpStatus.SC_UNAUTHORIZED) {
             if (!response.containsHeader(HttpHeaders.WWW_AUTHENTICATE)) {
                 response.addHeader(HttpHeaders.WWW_AUTHENTICATE, "Basic realm=\"test realm\"");
             }

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/methods/TestHttpOptions.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/methods/TestHttpOptions.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/methods/TestHttpOptions.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/methods/TestHttpOptions.java Tue Dec 27 19:48:07 2016
@@ -29,9 +29,7 @@ package org.apache.hc.client5.http.metho
 
 import java.util.Set;
 
-import org.apache.hc.core5.http.ProtocolVersion;
 import org.apache.hc.core5.http.message.BasicHttpResponse;
-import org.apache.hc.core5.http.message.BasicStatusLine;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -39,13 +37,11 @@ public class TestHttpOptions {
 
     @Test
     public void testMultipleAllows() {
-        final ProtocolVersion proto = new ProtocolVersion("HTTP", 1, 1);
-        final BasicStatusLine line = new BasicStatusLine(proto, 200, "test reason");
-        final BasicHttpResponse resp = new BasicHttpResponse(line);
+        final BasicHttpResponse resp = new BasicHttpResponse(200, "test reason");
         resp.addHeader("Allow", "POST");
         resp.addHeader("Allow", "GET");
 
-        final HttpOptions opt = new HttpOptions();
+        final HttpOptions opt = new HttpOptions("*");
         final Set<String> methodsName = opt.getAllowedMethods(resp);
 
         Assert.assertTrue(methodsName.contains("POST"));

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/methods/TestHttpRequestBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/methods/TestHttpRequestBase.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/methods/TestHttpRequestBase.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/methods/TestHttpRequestBase.java Tue Dec 27 19:48:07 2016
@@ -27,7 +27,8 @@
 
 package org.apache.hc.client5.http.methods;
 
-import org.apache.hc.core5.http.HttpVersion;
+import java.net.URI;
+
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -36,15 +37,14 @@ public class TestHttpRequestBase {
     @Test
     public void testBasicProperties() throws Exception {
         final HttpGet httpget = new HttpGet("http://host/path");
-        Assert.assertEquals("GET", httpget.getRequestLine().getMethod());
-        Assert.assertEquals("http://host/path", httpget.getRequestLine().getUri());
-        Assert.assertEquals(HttpVersion.HTTP_1_1, httpget.getRequestLine().getProtocolVersion());
+        Assert.assertEquals("GET", httpget.getMethod());
+        Assert.assertEquals(new URI("http://host/path"), httpget.getUri());
     }
 
     @Test
     public void testEmptyURI() throws Exception {
         final HttpGet httpget = new HttpGet("");
-        Assert.assertEquals("/", httpget.getRequestLine().getUri());
+        Assert.assertEquals(new URI("/"), httpget.getUri());
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/methods/TestRequestBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/methods/TestRequestBuilder.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/methods/TestRequestBuilder.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/methods/TestRequestBuilder.java Tue Dec 27 19:48:07 2016
@@ -31,15 +31,14 @@ import java.net.URI;
 import java.util.List;
 
 import org.apache.hc.client5.http.config.RequestConfig;
+import org.apache.hc.core5.http.ContentType;
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpEntity;
-import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.NameValuePair;
-import org.apache.hc.core5.http.entity.BasicHttpEntity;
-import org.apache.hc.core5.http.entity.ContentType;
-import org.apache.hc.core5.http.entity.EntityUtils;
-import org.apache.hc.core5.http.entity.StringEntity;
+import org.apache.hc.core5.http.io.entity.BasicHttpEntity;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
+import org.apache.hc.core5.http.io.entity.StringEntity;
 import org.apache.hc.core5.http.message.BasicHeader;
 import org.apache.hc.core5.http.message.BasicNameValuePair;
 import org.junit.Assert;
@@ -52,8 +51,7 @@ public class TestRequestBuilder {
         final HttpUriRequest request = RequestBuilder.get().build();
         Assert.assertNotNull(request);
         Assert.assertEquals("GET", request.getMethod());
-        Assert.assertEquals(URI.create("/"), request.getURI());
-        Assert.assertEquals(HttpVersion.HTTP_1_1, request.getProtocolVersion());
+        Assert.assertEquals(URI.create("/"), request.getUri());
     }
 
     @Test
@@ -61,8 +59,7 @@ public class TestRequestBuilder {
         final HttpUriRequest request = RequestBuilder.create("Whatever").build();
         Assert.assertNotNull(request);
         Assert.assertEquals("Whatever", request.getMethod());
-        Assert.assertEquals(URI.create("/"), request.getURI());
-        Assert.assertEquals(HttpVersion.HTTP_1_1, request.getProtocolVersion());
+        Assert.assertEquals(URI.create("/"), request.getUri());
     }
 
     @Test
@@ -71,8 +68,7 @@ public class TestRequestBuilder {
         final HttpUriRequest request = RequestBuilder.post().setEntity(entity).build();
         Assert.assertNotNull(request);
         Assert.assertEquals("POST", request.getMethod());
-        Assert.assertEquals(URI.create("/"), request.getURI());
-        Assert.assertEquals(HttpVersion.HTTP_1_1, request.getProtocolVersion());
+        Assert.assertEquals(URI.create("/"), request.getUri());
         Assert.assertSame(entity, request.getEntity());
     }
 
@@ -82,8 +78,7 @@ public class TestRequestBuilder {
         final HttpUriRequest request = RequestBuilder.get().setEntity(entity).build();
         Assert.assertNotNull(request);
         Assert.assertEquals("GET", request.getMethod());
-        Assert.assertEquals(URI.create("/"), request.getURI());
-        Assert.assertEquals(HttpVersion.HTTP_1_1, request.getProtocolVersion());
+        Assert.assertEquals(URI.create("/"), request.getUri());
         Assert.assertSame(entity, request.getEntity());
     }
 
@@ -93,7 +88,7 @@ public class TestRequestBuilder {
                 .addParameter("p1", "this")
                 .addParameter("p2", "that")
                 .build();
-        Assert.assertEquals(new URI("/?p1=this&p2=that"), request.getURI());
+        Assert.assertEquals(new URI("/?p1=this&p2=that"), request.getUri());
     }
 
     @Test
@@ -102,7 +97,7 @@ public class TestRequestBuilder {
                 .addParameter("p1", "this")
                 .addParameters(new BasicNameValuePair("p2", "that"))
                 .build();
-        Assert.assertEquals(new URI("/?p1=this&p2=that"), request.getURI());
+        Assert.assertEquals(new URI("/?p1=this&p2=that"), request.getUri());
     }
 
     @Test
@@ -113,7 +108,7 @@ public class TestRequestBuilder {
                 .build();
         final HttpEntity entity = request.getEntity();
         Assert.assertNotNull(entity);
-        Assert.assertEquals(new URI("/"), request.getURI());
+        Assert.assertEquals(new URI("/"), request.getUri());
         Assert.assertEquals("p1=this&p2=that", EntityUtils.toString(entity));
     }
 
@@ -125,7 +120,7 @@ public class TestRequestBuilder {
                 .addParameter("p2", "that")
                 .setEntity(new StringEntity("blah"))
                 .build();
-        Assert.assertEquals(new URI("http://targethost/?blah&p1=this&p2=that"), request.getURI());
+        Assert.assertEquals(new URI("http://targethost/?blah&p1=this&p2=that"), request.getUri());
     }
 
     @Test
@@ -142,12 +137,12 @@ public class TestRequestBuilder {
             .build();
         Assert.assertNotNull(request);
         Assert.assertEquals("PUT", request.getMethod());
-        Assert.assertEquals(URI.create("/stuff"), request.getURI());
-        Assert.assertEquals(HttpVersion.HTTP_1_0, request.getProtocolVersion());
+        Assert.assertEquals(URI.create("/stuff"), request.getUri());
+        Assert.assertEquals(HttpVersion.HTTP_1_0, request.getVersion());
 
         final HttpUriRequest copy = RequestBuilder.copy(request).setUri("/other-stuff").build();
         Assert.assertEquals("PUT", copy.getMethod());
-        Assert.assertEquals(URI.create("/other-stuff"), copy.getURI());
+        Assert.assertEquals(URI.create("/other-stuff"), copy.getUri());
         Assert.assertSame(entity, copy.getEntity());
         Assert.assertTrue(copy instanceof Configurable);
         Assert.assertSame(config, ((Configurable) copy).getConfig());
@@ -202,9 +197,9 @@ public class TestRequestBuilder {
     public void testCopyAndSetUri() throws Exception {
         final URI uri1 = URI.create("http://host1.com/path?param=something");
         final URI uri2 = URI.create("http://host2.com/path?param=somethingdifferent");
-        final HttpRequest request1 = new HttpGet(uri1);
+        final HttpGet request1 = new HttpGet(uri1);
         final HttpUriRequest request2 = RequestBuilder.copy(request1).setUri(uri2).build();
-        Assert.assertEquals(request2.getURI(), uri2);
+        Assert.assertEquals(request2.getUri(), uri2);
     }
 
     @Test

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestAcceptEncoding.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestAcceptEncoding.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestAcceptEncoding.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestAcceptEncoding.java Tue Dec 27 19:48:07 2016
@@ -43,7 +43,7 @@ public class TestRequestAcceptEncoding {
         final HttpContext context = new BasicHttpContext();
 
         final HttpRequestInterceptor interceptor = new RequestAcceptEncoding();
-        interceptor.process(request, context);
+        interceptor.process(request, null, context);
         final Header header = request.getFirstHeader("Accept-Encoding");
         Assert.assertNotNull(header);
         Assert.assertEquals("gzip,deflate", header.getValue());
@@ -56,7 +56,7 @@ public class TestRequestAcceptEncoding {
         final HttpContext context = new BasicHttpContext();
 
         final HttpRequestInterceptor interceptor = new RequestAcceptEncoding();
-        interceptor.process(request, context);
+        interceptor.process(request, null, context);
         final Header header = request.getFirstHeader("Accept-Encoding");
         Assert.assertNotNull(header);
         Assert.assertEquals("stuff", header.getValue());



Mime
View raw message