hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1406885 - in /httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio: integration/ protocol/
Date Thu, 08 Nov 2012 01:33:16 GMT
Author: sebb
Date: Thu Nov  8 01:33:15 2012
New Revision: 1406885

URL: http://svn.apache.org/viewvc?rev=1406885&view=rev
Log:
Fix some obvious boxing in test classes

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestProducer.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncResponseProducer.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java?rev=1406885&r1=1406884&r2=1406885&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java
Thu Nov  8 01:33:15 2012
@@ -426,7 +426,7 @@ public class TestHttpAsyncHandlers exten
             request.setEntity(entity);
 
             HttpContext context = new BasicHttpContext();
-            context.setAttribute(ExecutionContext.HTTP_EXPECT_CONT, true);
+            context.setAttribute(ExecutionContext.HTTP_EXPECT_CONT, Boolean.TRUE);
 
             Future<HttpResponse> future = this.client.execute(target, request, context);
             queue.add(future);
@@ -486,7 +486,7 @@ public class TestHttpAsyncHandlers exten
         Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
         for (int i = 0; i < requests.length; i++) {
             HttpContext context = new BasicHttpContext();
-            context.setAttribute(ExecutionContext.HTTP_EXPECT_CONT, true);
+            context.setAttribute(ExecutionContext.HTTP_EXPECT_CONT, Boolean.TRUE);
 
             Future<HttpResponse> future = this.client.execute(target, requests[i],
context);
             queue.add(future);
@@ -631,7 +631,7 @@ public class TestHttpAsyncHandlers exten
         Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
         for (int i = 0; i < requests.length; i++) {
             HttpContext context = new BasicHttpContext();
-            context.setAttribute(ExecutionContext.HTTP_EXPECT_CONT, true);
+            context.setAttribute(ExecutionContext.HTTP_EXPECT_CONT, Boolean.TRUE);
 
             Future<HttpResponse> future = this.client.execute(target, requests[i],
context);
             queue.add(future);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestProducer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestProducer.java?rev=1406885&r1=1406884&r2=1406885&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestProducer.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestProducer.java
Thu Nov  8 01:33:15 2012
@@ -96,18 +96,20 @@ public class TestBasicAsyncRequestProduc
         Assert.assertSame(target, res);
     }
 
+    @SuppressWarnings("boxing")
     @Test
     public void testProduceContentEncoderCompleted() throws Exception {
-        when(encoder.isCompleted()).thenReturn(true);
+        when(encoder.isCompleted()).thenReturn(Boolean.TRUE);
 
         producer.produceContent(encoder,  null);
 
         verify(contentProducer, times(1)).close();
     }
 
+    @SuppressWarnings("boxing")
     @Test
     public void testProduceContentEncoderNotCompleted() throws Exception {
-        when(encoder.isCompleted()).thenReturn(false);
+        when(encoder.isCompleted()).thenReturn(Boolean.FALSE);
 
         producer.produceContent(encoder,  null);
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncResponseProducer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncResponseProducer.java?rev=1406885&r1=1406884&r2=1406885&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncResponseProducer.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncResponseProducer.java
Thu Nov  8 01:33:15 2012
@@ -71,18 +71,20 @@ public class TestBasicAsyncResponseProdu
         Assert.assertSame(response, res);
     }
 
+    @SuppressWarnings("boxing")
     @Test
     public void testProduceContentEncoderCompleted() throws Exception {
-        when(encoder.isCompleted()).thenReturn(true);
+        when(encoder.isCompleted()).thenReturn(Boolean.TRUE);
 
         producer.produceContent(encoder,  null);
 
         verify(contentProducer, times(1)).close();
     }
 
+    @SuppressWarnings("boxing")
     @Test
     public void testProduceContentEncoderNotCompleted() throws Exception {
-        when(encoder.isCompleted()).thenReturn(false);
+        when(encoder.isCompleted()).thenReturn(Boolean.FALSE);
 
         producer.produceContent(encoder,  null);
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java?rev=1406885&r1=1406884&r2=1406885&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
Thu Nov  8 01:33:15 2012
@@ -235,7 +235,7 @@ public class TestHttpAsyncRequestExecuto
         State state = new HttpAsyncRequestExecutor.State();
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this.exchangeHandler);
-        Mockito.when(this.encoder.isCompleted()).thenReturn(false);
+        Mockito.when(this.encoder.isCompleted()).thenReturn(Boolean.FALSE);
 
         this.protocolHandler.outputReady(this.conn, this.encoder);
 
@@ -248,7 +248,7 @@ public class TestHttpAsyncRequestExecuto
         State state = new HttpAsyncRequestExecutor.State();
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this.exchangeHandler);
-        Mockito.when(this.encoder.isCompleted()).thenReturn(true);
+        Mockito.when(this.encoder.isCompleted()).thenReturn(Boolean.TRUE);
 
         this.protocolHandler.outputReady(this.conn, this.encoder);
 
@@ -400,7 +400,7 @@ public class TestHttpAsyncRequestExecuto
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this.exchangeHandler);
         BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
         Mockito.when(this.conn.getHttpResponse()).thenReturn(response);
-        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(true);
+        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(Boolean.TRUE);
 
         this.protocolHandler.responseReceived(this.conn);
 
@@ -422,7 +422,7 @@ public class TestHttpAsyncRequestExecuto
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this.exchangeHandler);
         BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
         Mockito.when(this.conn.getHttpResponse()).thenReturn(response);
-        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(true);
+        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(Boolean.TRUE);
 
         this.protocolHandler.responseReceived(this.conn);
 
@@ -446,7 +446,7 @@ public class TestHttpAsyncRequestExecuto
                 HttpStatus.SC_NOT_MODIFIED, "Not modified");
         response.setEntity(new BasicHttpEntity());
         Mockito.when(this.conn.getHttpResponse()).thenReturn(response);
-        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(true);
+        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(Boolean.TRUE);
 
         this.protocolHandler.responseReceived(this.conn);
 
@@ -465,7 +465,7 @@ public class TestHttpAsyncRequestExecuto
         State state = new HttpAsyncRequestExecutor.State();
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this.exchangeHandler);
-        Mockito.when(this.decoder.isCompleted()).thenReturn(false);
+        Mockito.when(this.decoder.isCompleted()).thenReturn(Boolean.TRUE);
 
         this.protocolHandler.inputReady(this.conn, this.decoder);
 
@@ -482,8 +482,8 @@ public class TestHttpAsyncRequestExecuto
         state.setResponse(response);
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this.exchangeHandler);
-        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(true);
-        Mockito.when(this.decoder.isCompleted()).thenReturn(true);
+        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(Boolean.TRUE);
+        Mockito.when(this.decoder.isCompleted()).thenReturn(Boolean.TRUE);
 
         this.protocolHandler.inputReady(this.conn, this.decoder);
 
@@ -504,7 +504,7 @@ public class TestHttpAsyncRequestExecuto
         state.invalidate();
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this.exchangeHandler);
-        Mockito.when(this.decoder.isCompleted()).thenReturn(true);
+        Mockito.when(this.decoder.isCompleted()).thenReturn(Boolean.TRUE);
 
         this.protocolHandler.inputReady(this.conn, this.decoder);
 
@@ -524,8 +524,8 @@ public class TestHttpAsyncRequestExecuto
         state.setResponse(response);
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this.exchangeHandler);
-        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(false);
-        Mockito.when(this.decoder.isCompleted()).thenReturn(true);
+        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(Boolean.FALSE);
+        Mockito.when(this.decoder.isCompleted()).thenReturn(Boolean.TRUE);
 
         this.protocolHandler.inputReady(this.conn, this.decoder);
 
@@ -653,7 +653,7 @@ public class TestHttpAsyncRequestExecuto
         state.setResponse(response);
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this.exchangeHandler);
-        Mockito.when(this.exchangeHandler.isDone()).thenReturn(true);
+        Mockito.when(this.exchangeHandler.isDone()).thenReturn(Boolean.TRUE);
 
         Assert.assertEquals("request state: READY; request: GET / HTTP/1.1; " +
                 "response state: READY; response: HTTP/1.1 200 OK; valid: true;",

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java?rev=1406885&r1=1406884&r2=1406885&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
Thu Nov  8 01:33:15 2012
@@ -225,7 +225,7 @@ public class TestHttpAsyncService {
         state.setRequestConsumer(this.requestConsumer);
         state.setResponseProducer(this.responseProducer);
         this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
-        Mockito.when(this.conn.isResponseSubmitted()).thenReturn(true);
+        Mockito.when(this.conn.isResponseSubmitted()).thenReturn(Boolean.TRUE);
 
         HttpException httpex = new HttpException();
         this.protocolHandler.exception(this.conn, httpex);
@@ -498,7 +498,7 @@ public class TestHttpAsyncService {
         state.setRequest(request);
         state.setRequestConsumer(this.requestConsumer);
         this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
-        Mockito.when(this.decoder.isCompleted()).thenReturn(false);
+        Mockito.when(this.decoder.isCompleted()).thenReturn(Boolean.FALSE);
 
         this.protocolHandler.inputReady(conn, this.decoder);
 
@@ -520,7 +520,7 @@ public class TestHttpAsyncService {
         state.setRequestConsumer(this.requestConsumer);
         state.setRequestHandler(this.requestHandler);
         this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
-        Mockito.when(this.decoder.isCompleted()).thenReturn(true);
+        Mockito.when(this.decoder.isCompleted()).thenReturn(Boolean.TRUE);
         Mockito.when(this.requestConsumer.getException()).thenReturn(null);
         Object data = new Object();
         Mockito.when(this.requestConsumer.getResult()).thenReturn(data);
@@ -549,7 +549,7 @@ public class TestHttpAsyncService {
         state.setRequestConsumer(this.requestConsumer);
         state.setRequestHandler(this.requestHandler);
         this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
-        Mockito.when(this.decoder.isCompleted()).thenReturn(true);
+        Mockito.when(this.decoder.isCompleted()).thenReturn(Boolean.TRUE);
         Mockito.when(this.requestConsumer.getException()).thenReturn(new HttpException());
         Mockito.when(this.requestConsumer.getResult()).thenReturn(null);
 
@@ -579,7 +579,7 @@ public class TestHttpAsyncService {
         state.setRequestConsumer(this.requestConsumer);
         state.setRequestHandler(this.requestHandler);
         this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
-        Mockito.when(this.decoder.isCompleted()).thenReturn(true);
+        Mockito.when(this.decoder.isCompleted()).thenReturn(Boolean.TRUE);
         Mockito.when(this.requestConsumer.getException()).thenReturn(null);
         Object data = new Object();
         Mockito.when(this.requestConsumer.getResult()).thenReturn(data);
@@ -612,7 +612,7 @@ public class TestHttpAsyncService {
 
         BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
         Mockito.when(this.responseProducer.generateResponse()).thenReturn(response);
-        Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(true);
+        Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(Boolean.TRUE);
 
         this.protocolHandler.responseReady(this.conn);
 
@@ -638,7 +638,7 @@ public class TestHttpAsyncService {
 
         BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
         Mockito.when(this.responseProducer.generateResponse()).thenReturn(response);
-        Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(false);
+        Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(Boolean.FALSE);
 
         this.protocolHandler.responseReady(this.conn);
 
@@ -690,7 +690,7 @@ public class TestHttpAsyncService {
         BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
         response.setEntity(new NStringEntity("stuff"));
         Mockito.when(this.responseProducer.generateResponse()).thenReturn(response);
-        Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(true);
+        Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(Boolean.TRUE);
 
         this.protocolHandler.responseReady(this.conn);
 
@@ -718,7 +718,7 @@ public class TestHttpAsyncService {
                 HttpStatus.SC_NOT_MODIFIED, "Not modified");
         response.setEntity(new NStringEntity("stuff"));
         Mockito.when(this.responseProducer.generateResponse()).thenReturn(response);
-        Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(true);
+        Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(Boolean.TRUE);
 
         this.protocolHandler.responseReady(this.conn);
 
@@ -802,7 +802,7 @@ public class TestHttpAsyncService {
 
         BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 112, "Something
stupid");
         Mockito.when(this.responseProducer.generateResponse()).thenReturn(response);
-        Mockito.when(this.conn.isResponseSubmitted()).thenReturn(false);
+        Mockito.when(this.conn.isResponseSubmitted()).thenReturn(Boolean.FALSE);
 
         this.protocolHandler.responseReady(this.conn);
     }
@@ -821,7 +821,7 @@ public class TestHttpAsyncService {
         BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
         response.setEntity(new NStringEntity("stuff"));
         Mockito.when(this.responseProducer.generateResponse()).thenReturn(response);
-        Mockito.when(this.conn.isResponseSubmitted()).thenReturn(false);
+        Mockito.when(this.conn.isResponseSubmitted()).thenReturn(Boolean.FALSE);
 
         this.protocolHandler.responseReady(this.conn);
     }
@@ -877,7 +877,7 @@ public class TestHttpAsyncService {
         state.setResponse(response);
         state.setResponseProducer(this.responseProducer);
         this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
-        Mockito.when(this.encoder.isCompleted()).thenReturn(false);
+        Mockito.when(this.encoder.isCompleted()).thenReturn(Boolean.FALSE);
 
         this.protocolHandler.outputReady(conn, this.encoder);
 
@@ -901,7 +901,7 @@ public class TestHttpAsyncService {
         state.setResponseProducer(this.responseProducer);
         this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
         Mockito.when(this.encoder.isCompleted()).thenReturn(true);
-        Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(true);
+        Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(Boolean.TRUE);
 
         this.protocolHandler.outputReady(conn, this.encoder);
 
@@ -926,7 +926,7 @@ public class TestHttpAsyncService {
         state.setResponseProducer(this.responseProducer);
         this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
         Mockito.when(this.encoder.isCompleted()).thenReturn(true);
-        Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(false);
+        Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(Boolean.FALSE);
 
         this.protocolHandler.outputReady(conn, this.encoder);
 



Mime
View raw message