cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1450178 - in /cxf/branches/2.7.x-fixes: ./ rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
Date Tue, 26 Feb 2013 14:13:10 GMT
Author: ay
Date: Tue Feb 26 14:13:10 2013
New Revision: 1450178

URL: http://svn.apache.org/r1450178
Log:
Merged revisions 1450175 via  svn merge from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1450175 | ay | 2013-02-26 15:08:43 +0100 (Tue, 26 Feb 2013) | 1 line
  
  fix the mock usage in HTTPConduitURLEasyMockTest
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java

Propchange: cxf/branches/2.7.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java?rev=1450178&r1=1450177&r2=1450178&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
Tue Feb 26 14:13:10 2013
@@ -279,11 +279,11 @@ public class HTTPConduitURLEasyMockTest 
         message.put(AuthorizationPolicy.class, authPolicy);        
     }
 
-    private void setUpOneway(Message message) {
+    private void setUpExchange(Message message, boolean oneway) {
         Exchange exchange = control.createMock(Exchange.class);
         message.setExchange(exchange);
         exchange.isOneWay();
-        EasyMock.expectLastCall().andReturn(true).anyTimes();
+        EasyMock.expectLastCall().andReturn(oneway).anyTimes();
         exchange.isSynchronous();
         EasyMock.expectLastCall().andReturn(true).anyTimes();
         exchange.isEmpty();
@@ -445,9 +445,7 @@ public class HTTPConduitURLEasyMockTest 
             EasyMock.expectLastCall();
         }
         
-        if ((style == ResponseStyle.NONE) || (style == ResponseStyle.ONEWAY_NONE)) {
-            setUpOneway(message);
-        }
+        setUpExchange(message, style == ResponseStyle.NONE || style == ResponseStyle.ONEWAY_NONE);
         
         connection.getRequestMethod();
         EasyMock.expectLastCall().andReturn(method).anyTimes();
@@ -459,7 +457,9 @@ public class HTTPConduitURLEasyMockTest 
         wrappedOS.flush();
         wrappedOS.close();
 
-        if (style != ResponseStyle.ONEWAY_NONE) {
+        if ((style == ResponseStyle.NONE && !emptyResponse) 
+            || style == ResponseStyle.BACK_CHANNEL
+            || style == ResponseStyle.BACK_CHANNEL_ERROR) {
             assertNotNull("expected in message", inMessage);
             Map<?, ?> headerMap = (Map<?, ?>) inMessage.get(Message.PROTOCOL_HEADERS);
             assertEquals("unexpected response headers", headerMap.size(), 0);
@@ -547,7 +547,7 @@ public class HTTPConduitURLEasyMockTest 
         switch (style) {
         case NONE:            
         case DECOUPLED:
-            is = EasyMock.createMock(InputStream.class);
+            is = control.createMock(InputStream.class);
             connection.getInputStream();
             EasyMock.expectLastCall().andReturn(is).anyTimes();
             connection.getContentLength();
@@ -562,7 +562,11 @@ public class HTTPConduitURLEasyMockTest 
                     EasyMock.expectLastCall().andReturn("close");
                 }
                 is.read();
-                EasyMock.expectLastCall().andReturn(emptyResponse ? -1 : (int)'<');
+                if (emptyResponse) {
+                    EasyMock.expectLastCall().andReturn(-1).anyTimes();    
+                } else {
+                    EasyMock.expectLastCall().andReturn((int)'<');
+                }
             } else {
                 EasyMock.expectLastCall().andReturn(123).anyTimes();
             }



Mime
View raw message