You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/09/11 00:28:12 UTC

svn commit: r996007 - in /cxf/branches/async-client/rt/transports/http/src: main/java/org/apache/cxf/transport/http/HTTPConduit.java test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java

Author: dkulp
Date: Fri Sep 10 22:28:11 2010
New Revision: 996007

URL: http://svn.apache.org/viewvc?rev=996007&view=rev
Log:
Get unit tests working

Modified:
    cxf/branches/async-client/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    cxf/branches/async-client/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java

Modified: cxf/branches/async-client/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/branches/async-client/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=996007&r1=996006&r2=996007&view=diff
==============================================================================
--- cxf/branches/async-client/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java (original)
+++ cxf/branches/async-client/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java Fri Sep 10 22:28:11 2010
@@ -983,7 +983,7 @@ public class HTTPConduit 
      * @return true if the connection has a chunked response pending
      */
     protected static boolean hasChunkedResponse(Map<String, List<String>> headers) {
-        List<String> s = headers.get(HttpHeaderHelper.TRANSFER_ENCODING);
+        List<String> s = headers.get(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.TRANSFER_ENCODING));
         if (s != null) {
             for (String s2 : s) {
                 if (HttpHeaderHelper.CHUNKED.equalsIgnoreCase(s2)) {
@@ -1001,7 +1001,7 @@ public class HTTPConduit 
     protected static boolean hasEofTerminatedResponse(
         Map<String, List<String>> headers
     ) {
-        List<String> s = headers.get(HttpHeaderHelper.CONNECTION);
+        List<String> s = headers.get(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONNECTION));
         if (s != null) {
             for (String s2 : s) {
                 if (HttpHeaderHelper.CLOSE.equalsIgnoreCase(s2)) {

Modified: cxf/branches/async-client/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/async-client/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java?rev=996007&r1=996006&r2=996007&view=diff
==============================================================================
--- cxf/branches/async-client/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java (original)
+++ cxf/branches/async-client/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java Fri Sep 10 22:28:11 2010
@@ -354,8 +354,6 @@ public class HTTPConduitURLEasyMockTest 
         wrappedOS.close();
 
         assertNotNull("expected in message", inMessage);
-        Map<?, ?> headerMap = (Map<?, ?>) inMessage.get(Message.PROTOCOL_HEADERS);
-        assertEquals("unexpected response headers", headerMap.size(), 0);
         Integer expectedResponseCode = style == ResponseStyle.BACK_CHANNEL
                                        ? HttpURLConnection.HTTP_OK
                                        : HttpURLConnection.HTTP_ACCEPTED;
@@ -429,8 +427,9 @@ public class HTTPConduitURLEasyMockTest 
     private void verifyHandleResponse(ResponseStyle style, 
                                       ResponseDelimiter delimiter,
                                       boolean emptyResponse) throws IOException {
+        Map<String, List<String>> headers = new HashMap<String, List<String>>();
         connection.getHeaderFields();
-        EasyMock.expectLastCall().andReturn(Collections.EMPTY_MAP).anyTimes();
+        EasyMock.expectLastCall().andReturn(headers).anyTimes();
         int responseCode = style == ResponseStyle.BACK_CHANNEL
                            ? HttpURLConnection.HTTP_OK
                            : HttpURLConnection.HTTP_ACCEPTED;
@@ -447,11 +446,13 @@ public class HTTPConduitURLEasyMockTest 
                 || delimiter == ResponseDelimiter.EOF) {
                 EasyMock.expectLastCall().andReturn(-1).anyTimes();
                 if (delimiter == ResponseDelimiter.CHUNKED) {
-                    connection.getHeaderField("Transfer-Encoding");
-                    EasyMock.expectLastCall().andReturn("chunked");
+                    //connection.getHeaderField("Transfer-Encoding");
+                    //EasyMock.expectLastCall().andReturn("chunked");
+                    headers.put("Transfer-Encoding", Collections.singletonList("chunked"));
                 } else if (delimiter == ResponseDelimiter.EOF) {
-                    connection.getHeaderField("Connection");
-                    EasyMock.expectLastCall().andReturn("close");
+                    //connection.getHeaderField("Connection");
+                    //EasyMock.expectLastCall().andReturn("close");
+                    headers.put("Connection", Collections.singletonList("close"));
                 }
                 is.read();
                 EasyMock.expectLastCall().andReturn(emptyResponse ? -1 : (int)'<');