Author: ay
Date: Tue Feb 26 16:20:55 2013
New Revision: 1450256
URL: http://svn.apache.org/r1450256
Log:
Merged revisions 1450178 via svn merge from
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes
........
r1450178 | ay | 2013-02-26 15:13:10 +0100 (Tue, 26 Feb 2013) | 9 lines
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.6.x-fixes/ (props changed)
cxf/branches/2.6.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
Propchange: cxf/branches/2.6.x-fixes/
('svn:mergeinfo' removed)
Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.6.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java?rev=1450256&r1=1450255&r2=1450256&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
Tue Feb 26 16:20:55 2013
@@ -278,11 +278,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();
@@ -441,9 +441,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();
@@ -455,7 +453,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);
@@ -539,7 +539,7 @@ public class HTTPConduitURLEasyMockTest
connection.getResponseCode();
EasyMock.expectLastCall().andReturn(responseCode).anyTimes();
}
- is = EasyMock.createMock(InputStream.class);
+ is = control.createMock(InputStream.class);
connection.getInputStream();
EasyMock.expectLastCall().andReturn(is).anyTimes();
switch (style) {
@@ -557,7 +557,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();
}
|