hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [2/2] httpcomponents-client git commit: Upgraded HttpCore dependency to version 5.0-beta1
Date Sun, 05 Nov 2017 17:05:27 GMT
Upgraded HttpCore dependency to version 5.0-beta1


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/389272de
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/389272de
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/389272de

Branch: refs/heads/master
Commit: 389272de3a5f0e22e3d8e10a5ddb8b1445d2c102
Parents: d88e32f
Author: Oleg Kalnichevski <olegk@apache.org>
Authored: Sat Nov 4 11:44:36 2017 +0100
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Sun Nov 5 13:57:34 2017 +0100

----------------------------------------------------------------------
 httpclient5-fluent/pom.xml                      |  1 -
 .../testing/async/AsyncRandomHandler.java       |  6 ++
 .../impl/async/InternalAsyncEntityProducer.java |  5 ++
 .../http/impl/async/LoggingIOSession.java       | 20 +++++++
 .../io/PoolingHttpClientConnectionManager.java  | 12 ++--
 .../PoolingAsyncClientConnectionManager.java    | 12 ++--
 .../http/impl/classic/MockConnPoolControl.java  |  7 +++
 .../TestPoolingHttpClientConnectionManager.java | 58 +++++++++++++++++---
 pom.xml                                         |  2 +-
 9 files changed, 103 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/389272de/httpclient5-fluent/pom.xml
----------------------------------------------------------------------
diff --git a/httpclient5-fluent/pom.xml b/httpclient5-fluent/pom.xml
index 84923bb..c30ac24 100644
--- a/httpclient5-fluent/pom.xml
+++ b/httpclient5-fluent/pom.xml
@@ -67,7 +67,6 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
-    <!-- TODO: does not appear to be needed; remove? -->
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/389272de/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
index 57bb64d..5a3135b 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
@@ -173,6 +173,12 @@ public class AsyncRandomHandler implements AsyncServerExchangeHandler
{
 
         @Override
         public void releaseResources() {
+            remaining = length;
+        }
+
+        @Override
+        public boolean isRepeatable() {
+            return true;
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/389272de/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalAsyncEntityProducer.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalAsyncEntityProducer.java
b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalAsyncEntityProducer.java
index 14840e5..4c067f2 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalAsyncEntityProducer.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalAsyncEntityProducer.java
@@ -71,6 +71,11 @@ final class InternalAsyncEntityProducer implements AsyncEntityProducer
{
     }
 
     @Override
+    public boolean isRepeatable() {
+        return false;
+    }
+
+    @Override
     public boolean isChunked() {
         return entityDetails.isChunked();
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/389272de/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
index fad7f1e..c8f27c1 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
@@ -190,6 +190,26 @@ class LoggingIOSession implements TlsCapableIOSession {
     }
 
     @Override
+    public long getLastReadTime() {
+        return this.session.getLastReadTime();
+    }
+
+    @Override
+    public long getLastWriteTime() {
+        return this.session.getLastWriteTime();
+    }
+
+    @Override
+    public void updateReadTime() {
+        this.session.updateReadTime();
+    }
+
+    @Override
+    public void updateWriteTime() {
+        this.session.updateWriteTime();
+    }
+
+    @Override
     public IOEventHandler getHandler() {
         return this.session.getHandler();
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/389272de/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
index f3ff470..c5e7e86 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
@@ -27,6 +27,7 @@
 package org.apache.hc.client5.http.impl.io;
 
 import java.io.IOException;
+import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
@@ -249,11 +250,7 @@ public class PoolingHttpClientConnectionManager
         if (this.log.isDebugEnabled()) {
             this.log.debug("Connection request: " + ConnPoolSupport.formatStats(null, route,
state, this.pool));
         }
-        //TODO: fix me.
-        if (log.isWarnEnabled() && Timeout.isPositive(requestTimeout)) {
-            log.warn("Connection request timeout is not supported");
-        }
-        final Future<PoolEntry<HttpRoute, ManagedHttpClientConnection>> leaseFuture
= this.pool.lease(route, state, /** requestTimeout, */ null);
+        final Future<PoolEntry<HttpRoute, ManagedHttpClientConnection>> leaseFuture
= this.pool.lease(route, state, requestTimeout, null);
         return new LeaseRequest() {
 
             private volatile ConnectionEndpoint endpoint;
@@ -412,6 +409,11 @@ public class PoolingHttpClientConnectionManager
     }
 
     @Override
+    public Set<HttpRoute> getRoutes() {
+        return this.pool.getRoutes();
+    }
+
+    @Override
     public int getMaxTotal() {
         return this.pool.getMaxTotal();
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/389272de/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
index 1cad085..1afb96e 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
@@ -29,6 +29,7 @@ package org.apache.hc.client5.http.impl.nio;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
+import java.util.Set;
 import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicLong;
@@ -212,12 +213,8 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
             log.debug("Connection request: " + ConnPoolSupport.formatStats(null, route, state,
pool));
         }
         final ComplexFuture<AsyncConnectionEndpoint> resultFuture = new ComplexFuture<>(callback);
-        //TODO: fix me.
-        if (log.isWarnEnabled() && Timeout.isPositive(requestTimeout)) {
-            log.warn("Connection request timeout is not supported");
-        }
         final Future<PoolEntry<HttpRoute, ManagedAsyncClientConnection>> leaseFuture
= pool.lease(
-                route, state, /** requestTimeout, **/ new FutureCallback<PoolEntry<HttpRoute,
ManagedAsyncClientConnection>>() {
+                route, state, requestTimeout, new FutureCallback<PoolEntry<HttpRoute,
ManagedAsyncClientConnection>>() {
 
                     void leaseCompleted(final PoolEntry<HttpRoute, ManagedAsyncClientConnection>
poolEntry) {
                         if (log.isDebugEnabled()) {
@@ -395,6 +392,11 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
     }
 
     @Override
+    public Set<HttpRoute> getRoutes() {
+        return pool.getRoutes();
+    }
+
+    @Override
     public void setMaxTotal(final int max) {
         pool.setMaxTotal(max);
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/389272de/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/MockConnPoolControl.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/MockConnPoolControl.java
b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/MockConnPoolControl.java
index 24e17ba..0d977dc 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/MockConnPoolControl.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/MockConnPoolControl.java
@@ -26,7 +26,9 @@
  */
 package org.apache.hc.client5.http.impl.classic;
 
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.hc.client5.http.HttpRoute;
@@ -110,6 +112,11 @@ public final class MockConnPoolControl implements ConnPoolControl<HttpRoute>
{
     }
 
     @Override
+    public Set<HttpRoute> getRoutes() {
+        return new HashSet<>(this.maxPerHostMap.keySet());
+    }
+
+    @Override
     public String toString() {
         return this.maxPerHostMap.toString();
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/389272de/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
index 0c46b0e..7303701 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
@@ -43,6 +43,7 @@ import org.apache.hc.client5.http.io.ManagedHttpClientConnection;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
 import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
 import org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory;
+import org.apache.hc.core5.concurrent.FutureCallback;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.config.Lookup;
 import org.apache.hc.core5.http.config.SocketConfig;
@@ -50,6 +51,7 @@ import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.pool.PoolEntry;
 import org.apache.hc.core5.pool.StrictConnPool;
 import org.apache.hc.core5.util.TimeValue;
+import org.apache.hc.core5.util.Timeout;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -106,7 +108,12 @@ public class TestPoolingHttpClientConnectionManager {
         Mockito.when(conn.isOpen()).thenReturn(true);
         Mockito.when(future.isCancelled()).thenReturn(false);
         Mockito.when(future.get(1, TimeUnit.SECONDS)).thenReturn(entry);
-        Mockito.when(pool.lease(route, null, null)).thenReturn(future);
+        Mockito.when(pool.lease(
+                Mockito.eq(route),
+                Mockito.eq(null),
+                Mockito.<Timeout>any(),
+                Mockito.<FutureCallback<PoolEntry<HttpRoute, ManagedHttpClientConnection>>>eq(null)))
+                .thenReturn(future);
 
         final LeaseRequest connRequest1 = mgr.lease(route, null);
         final ConnectionEndpoint endpoint1 = connRequest1.get(1, TimeUnit.SECONDS);
@@ -133,7 +140,12 @@ public class TestPoolingHttpClientConnectionManager {
         Mockito.when(conn.isOpen()).thenReturn(true);
         Mockito.when(future.isCancelled()).thenReturn(false);
         Mockito.when(future.get(1, TimeUnit.SECONDS)).thenReturn(entry);
-        Mockito.when(pool.lease(route, null, null)).thenReturn(future);
+        Mockito.when(pool.lease(
+                Mockito.eq(route),
+                Mockito.eq(null),
+                Mockito.<Timeout>any(),
+                Mockito.<FutureCallback<PoolEntry<HttpRoute, ManagedHttpClientConnection>>>eq(null)))
+                .thenReturn(future);
 
         final LeaseRequest connRequest1 = mgr.lease(route, null);
         final ConnectionEndpoint endpoint1 = connRequest1.get(1, TimeUnit.SECONDS);
@@ -155,7 +167,12 @@ public class TestPoolingHttpClientConnectionManager {
 
         Mockito.when(future.isCancelled()).thenReturn(Boolean.TRUE);
         Mockito.when(future.get(1, TimeUnit.SECONDS)).thenReturn(entry);
-        Mockito.when(pool.lease(route, null, null)).thenReturn(future);
+        Mockito.when(pool.lease(
+                Mockito.eq(route),
+                Mockito.eq(null),
+                Mockito.<Timeout>any(),
+                Mockito.<FutureCallback<PoolEntry<HttpRoute, ManagedHttpClientConnection>>>eq(null)))
+                .thenReturn(future);
 
         final LeaseRequest connRequest1 = mgr.lease(route, null);
         connRequest1.get(1, TimeUnit.SECONDS);
@@ -168,7 +185,12 @@ public class TestPoolingHttpClientConnectionManager {
 
         Mockito.when(future.isCancelled()).thenReturn(Boolean.TRUE);
         Mockito.when(future.get(1, TimeUnit.SECONDS)).thenThrow(new TimeoutException());
-        Mockito.when(pool.lease(route, null, null)).thenReturn(future);
+        Mockito.when(pool.lease(
+                Mockito.eq(route),
+                Mockito.eq(null),
+                Mockito.<Timeout>any(),
+                Mockito.<FutureCallback<PoolEntry<HttpRoute, ManagedHttpClientConnection>>>eq(null)))
+                .thenReturn(future);
 
         final LeaseRequest connRequest1 = mgr.lease(route, null);
         connRequest1.get(1, TimeUnit.SECONDS);
@@ -184,7 +206,12 @@ public class TestPoolingHttpClientConnectionManager {
 
         Mockito.when(future.isCancelled()).thenReturn(Boolean.FALSE);
         Mockito.when(future.get(1, TimeUnit.SECONDS)).thenReturn(entry);
-        Mockito.when(pool.lease(route, null, null)).thenReturn(future);
+        Mockito.when(pool.lease(
+                Mockito.eq(route),
+                Mockito.eq(null),
+                Mockito.<Timeout>any(),
+                Mockito.<FutureCallback<PoolEntry<HttpRoute, ManagedHttpClientConnection>>>eq(null)))
+                .thenReturn(future);
         Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE);
 
         final LeaseRequest connRequest1 = mgr.lease(route, null);
@@ -208,7 +235,12 @@ public class TestPoolingHttpClientConnectionManager {
 
         Mockito.when(future.isCancelled()).thenReturn(Boolean.FALSE);
         Mockito.when(future.get(1, TimeUnit.SECONDS)).thenReturn(entry);
-        Mockito.when(pool.lease(route, null, null)).thenReturn(future);
+        Mockito.when(pool.lease(
+                Mockito.eq(route),
+                Mockito.eq(null),
+                Mockito.<Timeout>any(),
+                Mockito.<FutureCallback<PoolEntry<HttpRoute, ManagedHttpClientConnection>>>eq(null)))
+                .thenReturn(future);
         Mockito.when(conn.isOpen()).thenReturn(Boolean.FALSE);
 
         final LeaseRequest connRequest1 = mgr.lease(route, null);
@@ -236,7 +268,12 @@ public class TestPoolingHttpClientConnectionManager {
         Mockito.when(conn.isOpen()).thenReturn(false);
         Mockito.when(future.isCancelled()).thenReturn(false);
         Mockito.when(future.get(1, TimeUnit.SECONDS)).thenReturn(entry);
-        Mockito.when(pool.lease(route, null, null)).thenReturn(future);
+        Mockito.when(pool.lease(
+                Mockito.eq(route),
+                Mockito.eq(null),
+                Mockito.<Timeout>any(),
+                Mockito.<FutureCallback<PoolEntry<HttpRoute, ManagedHttpClientConnection>>>eq(null)))
+                .thenReturn(future);
 
         final LeaseRequest connRequest1 = mgr.lease(route, null);
         final ConnectionEndpoint endpoint1 = connRequest1.get(1, TimeUnit.SECONDS);
@@ -284,7 +321,12 @@ public class TestPoolingHttpClientConnectionManager {
         Mockito.when(conn.isOpen()).thenReturn(false);
         Mockito.when(future.isCancelled()).thenReturn(false);
         Mockito.when(future.get(1, TimeUnit.SECONDS)).thenReturn(entry);
-        Mockito.when(pool.lease(route, null, null)).thenReturn(future);
+        Mockito.when(pool.lease(
+                Mockito.eq(route),
+                Mockito.eq(null),
+                Mockito.<Timeout>any(),
+                Mockito.<FutureCallback<PoolEntry<HttpRoute, ManagedHttpClientConnection>>>eq(null)))
+                .thenReturn(future);
 
         final LeaseRequest connRequest1 = mgr.lease(route, null);
         final ConnectionEndpoint endpoint1 = connRequest1.get(1, TimeUnit.SECONDS);

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/389272de/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 634a1f6..d867dd5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,7 +68,7 @@
   <properties>
     <maven.compiler.source>1.7</maven.compiler.source>
     <maven.compiler.target>1.7</maven.compiler.target>
-    <httpcore.version>5.0-alpha4</httpcore.version>
+    <httpcore.version>5.0-beta1</httpcore.version>
     <log4j.version>2.9.1</log4j.version>
     <commons-codec.version>1.10</commons-codec.version>
     <ehcache.version>3.4.0</ehcache.version>


Mime
View raw message