Author: ay
Date: Fri Mar 1 21:35:01 2013
New Revision: 1451722
URL: http://svn.apache.org/r1451722
Log:
Merged revisions 1450417 via svn merge from
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
........
r1450417 | ay | 2013-02-26 22:03:24 +0100 (Tue, 26 Feb 2013) | 1 line
fix the mock usage in HTTPConduitURLEasyMockTest
........
Modified:
cxf/branches/2.5.x-fixes/ (props changed)
cxf/branches/2.5.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.5.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java?rev=1451722&r1=1451721&r2=1451722&view=diff
==============================================================================
---
cxf/branches/2.5.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
(original)
+++
cxf/branches/2.5.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
Fri Mar 1 21:35:01 2013
@@ -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;
@@ -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 = control.createMock(InputStream.class);
- connection.getInputStream();
- EasyMock.expectLastCall().andReturn(is).anyTimes();
+
switch (style) {
case NONE:
case DECOUPLED:
+ is = control.createMock(InputStream.class);
+ connection.getInputStream();
+ EasyMock.expectLastCall().andReturn(is).anyTimes();
connection.getContentLength();
if (delimiter == ResponseDelimiter.CHUNKED
|| delimiter == ResponseDelimiter.EOF) {
@@ -572,16 +577,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: