cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1365733 [2/2] - in /cxf/trunk/rt/transports/http/src: main/java/org/apache/cxf/transport/http/ main/java/org/apache/cxf/transport/http/auth/ test/java/org/apache/cxf/transport/http/
Date Wed, 25 Jul 2012 20:48:50 GMT
Modified: cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java?rev=1365733&r1=1365732&r2=1365733&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
(original)
+++ cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
Wed Jul 25 20:48:50 2012
@@ -19,6 +19,7 @@
 package org.apache.cxf.transport.http;
 
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -96,7 +97,7 @@ public class HTTPConduitURLEasyMockTest 
      * the dynamic assignment of the HttpURLConnectionFactory,
      * and we just use the EasyMocked version for this test.
      */
-    private class HTTPTestConduit extends HTTPConduit {
+    private class HTTPTestConduit extends URLConnectionHTTPConduit {
         HTTPTestConduit(
             Bus                      associatedBus, 
             EndpointInfo             endpoint, 
@@ -308,6 +309,9 @@ public class HTTPConduitURLEasyMockTest 
             proxy = null;
             connection =
                 control.createMock(HttpURLConnection.class);
+            connection.getURL();
+            EasyMock.expectLastCall().andReturn(new URL(NOWHERE + "bar/foo")).anyTimes();
+           
             connectionFactory.createConnection((TLSClientParameters)EasyMock.isNull(),
                                       EasyMock.eq(proxy), 
                                       EasyMock.eq(new URL(NOWHERE + "bar/foo")));
@@ -534,17 +538,18 @@ public class HTTPConduitURLEasyMockTest 
             connection.getResponseCode();
             EasyMock.expectLastCall().andReturn(301).once().andReturn(responseCode).anyTimes();
             connection.getURL();
-            EasyMock.expectLastCall().andReturn(new URL(NOWHERE + "bar/foo/redirect")).once();
+            EasyMock.expectLastCall().andReturn(new URL(NOWHERE + "bar/foo/redirect")).anyTimes();
         } else {
             connection.getResponseCode();
             EasyMock.expectLastCall().andReturn(responseCode).anyTimes();
         }
-        is = EasyMock.createMock(InputStream.class);
-        connection.getInputStream();
-        EasyMock.expectLastCall().andReturn(is).anyTimes();
+        
         switch (style) {
         case NONE:            
         case DECOUPLED:
+            is = EasyMock.createMock(InputStream.class);
+            connection.getInputStream();
+            EasyMock.expectLastCall().andReturn(is).anyTimes();
             connection.getContentLength();
             if (delimiter == ResponseDelimiter.CHUNKED 
                 || delimiter == ResponseDelimiter.EOF) {
@@ -568,16 +573,22 @@ public class HTTPConduitURLEasyMockTest 
             break;
             
         case BACK_CHANNEL:
+            is = EasyMock.createMock(InputStream.class);
+            connection.getInputStream();
+            EasyMock.expectLastCall().andReturn(is).anyTimes();
             break;
             
         case BACK_CHANNEL_ERROR:
+            is = EasyMock.createMock(InputStream.class);
+            connection.getInputStream();
+            EasyMock.expectLastCall().andReturn(is).anyTimes();
             connection.getErrorStream();
             EasyMock.expectLastCall().andReturn(null);
             break; 
             
         case ONEWAY_NONE:
-            is.close();
-            EasyMock.expectLastCall();
+            connection.getInputStream();
+            EasyMock.expectLastCall().andReturn(new ByteArrayInputStream(new byte[0])).anyTimes();
             break;
             
         default:



Mime
View raw message