Rebase patches

This commit is contained in:
Mikolaj Izdebski 2019-05-13 18:40:43 +02:00
parent a666faab4f
commit 544042d794
3 changed files with 98 additions and 106 deletions

View File

@ -1,21 +1,21 @@
From 455ae8a16dba896970a89e47962d32e09f63c346 Mon Sep 17 00:00:00 2001 From 85107ca9057cda2ed4d72ba1fd3c2c09be404af6 Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com> From: Mat Booth <mat.booth@redhat.com>
Date: Fri, 7 Dec 2018 19:50:08 +0000 Date: Fri, 7 Dec 2018 19:50:08 +0000
Subject: [PATCH 2/2] Port to mockito 2 Subject: [PATCH] Port to mockito 2
For details, see: For details, see:
https://github.com/mockito/mockito/wiki/What%27s-new-in-Mockito-2#incompatible https://github.com/mockito/mockito/wiki/What%27s-new-in-Mockito-2#incompatible
--- ---
.../impl/nio/pool/TestBasicNIOConnPool.java | 2 +- .../impl/nio/pool/TestBasicNIOConnPool.java | 2 +-
.../apache/http/nio/pool/TestNIOConnPool.java | 72 ++++++++++--------- .../apache/http/nio/pool/TestNIOConnPool.java | 68 +++++++++----------
.../nio/protocol/TestHttpAsyncService.java | 8 +-- .../nio/protocol/TestHttpAsyncService.java | 8 +--
3 files changed, 43 insertions(+), 39 deletions(-) 3 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
index 78f9cdc..4d0c6b0 100644 index 25e2781cf..ee277c69d 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java --- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java +++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
@@ -115,7 +115,7 @@ public class TestBasicNIOConnPool { @@ -115,7 +115,7 @@ public void testTimeoutOnLeaseRelease() throws Exception {
Mockito.when(sessionRequest.getAttachment()).thenReturn(host); Mockito.when(sessionRequest.getAttachment()).thenReturn(host);
Mockito.when(reactor.connect( Mockito.when(reactor.connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
@ -25,300 +25,296 @@ index 78f9cdc..4d0c6b0 100644
Matchers.any(SessionRequestCallback.class))). Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest); thenReturn(sessionRequest);
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java b/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java b/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
index e64a6d3..1ea6ce1 100644 index 9672db6db..20f230acb 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java --- a/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java +++ b/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
@@ -176,7 +176,7 @@ public class TestNIOConnPool { @@ -176,7 +176,7 @@ public void testSuccessfulConnect() throws Exception {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest); thenReturn(sessionRequest);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10); final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
@@ -209,7 +209,7 @@ public class TestNIOConnPool { @@ -209,7 +209,7 @@ public void testFailedConnect() throws Exception {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest); thenReturn(sessionRequest);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10); final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
@@ -246,7 +246,7 @@ public class TestNIOConnPool { @@ -246,7 +246,7 @@ public void testCencelledConnect() throws Exception {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest); thenReturn(sessionRequest);
Mockito.when(ioreactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE); Mockito.when(ioReactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
@@ -285,7 +285,7 @@ public class TestNIOConnPool { @@ -285,7 +285,7 @@ public void testTimeoutConnect() throws Exception {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest); thenReturn(sessionRequest);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10); final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
@@ -351,12 +351,12 @@ public class TestNIOConnPool { @@ -350,12 +350,12 @@ public void testLeaseRelease() throws Exception {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1); thenReturn(sessionRequest1);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest2); thenReturn(sessionRequest2);
@@ -425,12 +425,12 @@ public class TestNIOConnPool { @@ -424,12 +424,12 @@ public void testMaxLimits() throws Exception {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1); thenReturn(sessionRequest1);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest2); thenReturn(sessionRequest2);
@@ -483,7 +483,8 @@ public class TestNIOConnPool { @@ -482,7 +482,7 @@ public void testMaxLimits() throws Exception {
Assert.assertFalse(future9.isDone()); Assert.assertFalse(future9.isDone());
Mockito.verify(ioreactor, Mockito.times(3)).connect( Mockito.verify(ioReactor, Mockito.times(3)).connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class), + Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
+ Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.release(entry4, true); pool.release(entry4, true);
@@ -495,7 +496,8 @@ public class TestNIOConnPool { @@ -494,7 +494,7 @@ public void testMaxLimits() throws Exception {
Assert.assertTrue(future9.isDone()); Assert.assertTrue(future9.isDone());
Mockito.verify(ioreactor, Mockito.times(4)).connect( Mockito.verify(ioReactor, Mockito.times(4)).connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class), + Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
+ Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
} }
@@ -524,12 +526,12 @@ public class TestNIOConnPool { @@ -523,12 +523,12 @@ public void testConnectionRedistributionOnTotalMaxLimit() throws Exception {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2, sessionRequest1); thenReturn(sessionRequest1, sessionRequest2, sessionRequest1);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest3, sessionRequest4, sessionRequest3); thenReturn(sessionRequest3, sessionRequest4, sessionRequest3);
@@ -545,12 +547,12 @@ public class TestNIOConnPool { @@ -544,12 +544,12 @@ public void testConnectionRedistributionOnTotalMaxLimit() throws Exception {
Mockito.verify(ioreactor, Mockito.times(2)).connect( Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.never()).connect( Mockito.verify(ioReactor, Mockito.never()).connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1); pool.requestCompleted(sessionRequest1);
@@ -576,12 +578,12 @@ public class TestNIOConnPool { @@ -575,12 +575,12 @@ public void testConnectionRedistributionOnTotalMaxLimit() throws Exception {
Mockito.verify(ioreactor, Mockito.times(2)).connect( Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect( Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest3); pool.requestCompleted(sessionRequest3);
@@ -604,12 +606,12 @@ public class TestNIOConnPool { @@ -603,12 +603,12 @@ public void testConnectionRedistributionOnTotalMaxLimit() throws Exception {
Mockito.verify(ioreactor, Mockito.times(2)).connect( Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect( Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.release(entry3, true); pool.release(entry3, true);
@@ -617,12 +619,12 @@ public class TestNIOConnPool { @@ -616,12 +616,12 @@ public void testConnectionRedistributionOnTotalMaxLimit() throws Exception {
Mockito.verify(ioreactor, Mockito.times(3)).connect( Mockito.verify(ioReactor, Mockito.times(3)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect( Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1); pool.requestCompleted(sessionRequest1);
@@ -644,12 +646,12 @@ public class TestNIOConnPool { @@ -643,12 +643,12 @@ public void testConnectionRedistributionOnTotalMaxLimit() throws Exception {
Mockito.verify(ioreactor, Mockito.times(3)).connect( Mockito.verify(ioReactor, Mockito.times(3)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect( Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
totals = pool.getTotalStats(); totals = pool.getTotalStats();
@@ -678,7 +680,7 @@ public class TestNIOConnPool { @@ -677,7 +677,7 @@ public void testStatefulConnectionRedistributionOnPerRouteMaxLimit() throws Exce
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2, sessionRequest3); thenReturn(sessionRequest1, sessionRequest2, sessionRequest3);
@@ -691,7 +693,7 @@ public class TestNIOConnPool { @@ -690,7 +690,7 @@ public void testStatefulConnectionRedistributionOnPerRouteMaxLimit() throws Exce
Mockito.verify(ioreactor, Mockito.times(2)).connect( Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1); pool.requestCompleted(sessionRequest1);
@@ -726,7 +728,7 @@ public class TestNIOConnPool { @@ -725,7 +725,7 @@ public void testStatefulConnectionRedistributionOnPerRouteMaxLimit() throws Exce
Mockito.verify(ioreactor, Mockito.times(2)).connect( Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.release(entry3, true); pool.release(entry3, true);
@@ -743,7 +745,7 @@ public class TestNIOConnPool { @@ -742,7 +742,7 @@ public void testStatefulConnectionRedistributionOnPerRouteMaxLimit() throws Exce
Mockito.verify(ioreactor, Mockito.times(3)).connect( Mockito.verify(ioReactor, Mockito.times(3)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(iosession2).close(); Mockito.verify(ioSession2).close();
@@ -766,7 +768,7 @@ public class TestNIOConnPool { @@ -765,7 +765,7 @@ public void testCreateNewIfExpired() throws Exception {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)), Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class),
+ Matchers.<SocketAddress>isNull(), + Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1); thenReturn(sessionRequest1);
@@ -775,7 +777,8 @@ public class TestNIOConnPool { @@ -774,7 +774,7 @@ public void testCreateNewIfExpired() throws Exception {
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null); final Future<LocalPoolEntry> future1 = pool.lease("somehost", null);
Mockito.verify(ioreactor, Mockito.times(1)).connect( Mockito.verify(ioReactor, Mockito.times(1)).connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class), + Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
+ Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1); pool.requestCompleted(sessionRequest1);
@@ -795,7 +798,8 @@ public class TestNIOConnPool { @@ -794,7 +794,7 @@ public void testCreateNewIfExpired() throws Exception {
Mockito.verify(iosession1).close(); Mockito.verify(ioSession1).close();
Mockito.verify(ioreactor, Mockito.times(2)).connect( Mockito.verify(ioReactor, Mockito.times(2)).connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class), + Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
+ Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class)); Matchers.any(), Matchers.any(SessionRequestCallback.class));
final PoolStats totals = pool.getTotalStats(); final PoolStats totals = pool.getTotalStats();
@@ -824,7 +828,7 @@ public class TestNIOConnPool { @@ -823,7 +823,7 @@ public void testCloseExpired() throws Exception {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(), + Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2); thenReturn(sessionRequest1, sessionRequest2);
@@ -880,7 +884,7 @@ public class TestNIOConnPool { @@ -879,7 +879,7 @@ public void testCloseIdle() throws Exception {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(), + Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2); thenReturn(sessionRequest1, sessionRequest2);
@@ -945,7 +949,7 @@ public class TestNIOConnPool { @@ -944,7 +944,7 @@ public void testLeaseRequestTimeout() throws Exception {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(), + Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1); thenReturn(sessionRequest1);
@@ -1049,7 +1053,7 @@ public class TestNIOConnPool { @@ -1048,7 +1048,7 @@ public void testLeaseRequestCanceled() throws Exception {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(), + Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1); thenReturn(sessionRequest1);
Mockito.when(ioreactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE); Mockito.when(ioReactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
@@ -1083,7 +1087,7 @@ public class TestNIOConnPool { @@ -1082,7 +1082,7 @@ public void testLeaseRequestCanceledWhileConnecting() throws Exception {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class); final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect( Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class), - Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(), + Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
Matchers.any(), Matchers.any(SessionRequestCallback.class))). Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1); thenReturn(sessionRequest1);
Mockito.when(ioreactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE); Mockito.when(ioReactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
index 235915b..c631d46 100644 index dcb92a629..947b05fa9 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java --- a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java +++ b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
@@ -503,8 +503,8 @@ public class TestHttpAsyncService { @@ -502,8 +502,8 @@ public void testEntityEnclosingRequestContinueWithoutVerification() throws Excep
Mockito.verify(this.conn).submitResponse(Matchers.argThat(new ArgumentMatcher<HttpResponse>() { Mockito.verify(this.conn).submitResponse(Matchers.argThat(new ArgumentMatcher<HttpResponse>() {
@Override @Override
@ -329,7 +325,7 @@ index 235915b..c631d46 100644
return status == 100; return status == 100;
} }
@@ -1020,8 +1020,8 @@ public class TestHttpAsyncService { @@ -1019,8 +1019,8 @@ public void testResponseContinue() throws Exception {
Mockito.verify(this.conn).submitResponse(Matchers.argThat(new ArgumentMatcher<HttpResponse>() { Mockito.verify(this.conn).submitResponse(Matchers.argThat(new ArgumentMatcher<HttpResponse>() {
@Override @Override
@ -341,5 +337,5 @@ index 235915b..c631d46 100644
} }
-- --
2.19.1 2.21.0

View File

@ -5,9 +5,7 @@ Release: 1%{?dist}
License: ASL 2.0 License: ASL 2.0
URL: http://hc.apache.org/ URL: http://hc.apache.org/
Source0: http://www.apache.org/dist/httpcomponents/httpcore/source/httpcomponents-core-%{version}-src.tar.gz Source0: http://www.apache.org/dist/httpcomponents/httpcore/source/httpcomponents-core-%{version}-src.tar.gz
# Expired test certificates. Backported from upstream commit 8caeb927a. Patch0: 0001-Port-to-mockito-2.patch
Patch0: 0001-Re-generated-expired-test-certificates.patch
Patch1: 0002-Port-to-mockito-2.patch
BuildArch: noarch BuildArch: noarch
@ -43,9 +41,7 @@ Summary: API documentation for %{name}
%prep %prep
%setup -q %setup -q
%patch0 -p1 %patch0 -p1
%patch1 -p1
# Random test failures on ARM -- 100 ms sleep is not eneough on this # Random test failures on ARM -- 100 ms sleep is not eneough on this
# very performant arch, lets make it 2 s # very performant arch, lets make it 2 s