cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1236849 - /cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
Date Fri, 27 Jan 2012 19:26:11 GMT
Author: ay
Date: Fri Jan 27 19:26:11 2012
New Revision: 1236849

URL: http://svn.apache.org/viewvc?rev=1236849&view=rev
Log:
make HTTPConduitURLEasyMockTest work when proxy is active

Modified:
    cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java

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=1236849&r1=1236848&r2=1236849&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
Fri Jan 27 19:26:11 2012
@@ -50,14 +50,17 @@ import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
 
 import org.junit.After;
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
  */
 public class HTTPConduitURLEasyMockTest extends Assert {
-    
+    private static String oldHttpProxyHost;
+
     private enum ResponseStyle { NONE, BACK_CHANNEL, BACK_CHANNEL_ERROR, DECOUPLED };
     private enum ResponseDelimiter { LENGTH, CHUNKED, EOF };
 
@@ -73,6 +76,22 @@ public class HTTPConduitURLEasyMockTest 
     private OutputStream os;
     private InputStream is;
     
+    @BeforeClass
+    public static void disableHttpProxy() throws Exception {
+        oldHttpProxyHost = System.getProperty("http.proxyHost");
+        if (oldHttpProxyHost != null) {
+            // disable http proxy so that the connection mocking works (see setUpConduit)
+            System.clearProperty("http.proxyHost");
+        }
+    }
+    
+    @AfterClass
+    public static void revertHttpProxy() throws Exception {
+        if (oldHttpProxyHost != null) {
+            System.setProperty("http.proxyHost", oldHttpProxyHost);
+        }
+    }
+
     /**
      * This is an extension to the HTTPConduit that replaces
      * the dynamic assignment of the HttpURLConnectionFactory,



Mime
View raw message