maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1213499 - in /maven/wagon/trunk: wagon-provider-test/src/main/java/org/apache/maven/wagon/http/ wagon-providers/ wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/ wagon-providers/wagon-webdav-jackrabbit/src/te...
Date Mon, 12 Dec 2011 23:44:17 GMT
Author: olamy
Date: Mon Dec 12 23:44:16 2011
New Revision: 1213499

URL: http://svn.apache.org/viewvc?rev=1213499&view=rev
Log:
[WAGON-366] support Preemptive Authentication on proxy for wagon-http.
add unit test.

Modified:
    maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
    maven/wagon/trunk/wagon-providers/pom.xml
    maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTest.java
    maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonTest.java
    maven/wagon/trunk/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavWagonTest.java
    maven/wagon/trunk/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavsWagonTest.java

Modified: maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java?rev=1213499&r1=1213498&r2=1213499&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
(original)
+++ maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
Mon Dec 12 23:44:16 2011
@@ -424,11 +424,22 @@ public abstract class HttpWagonTestCase
         ProxyInfo proxyInfo = createProxyInfo();
         proxyInfo.setUserName( "user" );
         proxyInfo.setPassword( "secret" );
-        TestHeaderHandler handler = new AuthorizingProxyHandler();
+        AuthorizingProxyHandler handler = new AuthorizingProxyHandler();
 
         runTestProxiedRequest( proxyInfo, handler );
 
         assertTrue( handler.headers.containsKey( "Proxy-Authorization" ) );
+
+        if ( supportProxyPreemptiveAuthentication() )
+        {
+            assertEquals( 200, handler.securityHandlerRequestReponses.get( 0 ).responseCode
);
+        }
+        else
+        {
+            assertEquals( 407, handler.securityHandlerRequestReponses.get( 0 ).responseCode
);
+            assertEquals( 200, handler.securityHandlerRequestReponses.get( 1 ).responseCode
);
+        }
+
     }
 
     private void runTestProxiedRequest( ProxyInfo proxyInfo, TestHeaderHandler handler )
@@ -975,6 +986,11 @@ public abstract class HttpWagonTestCase
 
     protected abstract boolean supportPreemptiveAuthentication();
 
+    protected boolean supportProxyPreemptiveAuthentication()
+    {
+        return false;
+    }
+
     protected void testPreemptiveAuthentication( TestSecurityHandler sh )
     {
 
@@ -1102,18 +1118,23 @@ public abstract class HttpWagonTestCase
         extends TestHeaderHandler
     {
 
+        List<SecurityHandlerRequestReponse> securityHandlerRequestReponses =
+            new ArrayList<SecurityHandlerRequestReponse>();
+
         public void handle( String target, HttpServletRequest request, HttpServletResponse
response, int dispatch )
             throws IOException, ServletException
         {
             System.out.println( " handle proxy request" );
             if ( request.getHeader( "Proxy-Authorization" ) == null )
             {
+                securityHandlerRequestReponses.add( new SecurityHandlerRequestReponse( request.getMethod(),
407 ) );
                 response.setStatus( 407 );
                 response.addHeader( "Proxy-Authenticate", "Basic realm=\"Squid proxy-caching
web server\"" );
 
                 ( (Request) request ).setHandled( true );
                 return;
             }
+            securityHandlerRequestReponses.add( new SecurityHandlerRequestReponse( request.getMethod(),
200 ) );
             super.handle( target, request, response, dispatch );
         }
     }
@@ -1121,7 +1142,7 @@ public abstract class HttpWagonTestCase
     private static class TestHeaderHandler
         extends AbstractHandler
     {
-        private Map headers = Collections.EMPTY_MAP;
+        public Map headers = Collections.EMPTY_MAP;
 
         public TestHeaderHandler()
         {

Modified: maven/wagon/trunk/wagon-providers/pom.xml
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/pom.xml?rev=1213499&r1=1213498&r2=1213499&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/pom.xml (original)
+++ maven/wagon/trunk/wagon-providers/pom.xml Mon Dec 12 23:44:16 2011
@@ -34,10 +34,10 @@ under the License.
   <modules>
     <module>wagon-file</module>
     <module>wagon-ftp</module>
-    <module>wagon-http-lightweight</module>
+    <module>wagon-http-shared4</module>
     <module>wagon-http</module>
     <module>wagon-http-shared</module>
-    <module>wagon-http-shared4</module>
+    <module>wagon-http-lightweight</module>
     <module>wagon-scm</module>
     <module>wagon-ssh-external</module>
     <module>wagon-ssh-common</module>

Modified: maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTest.java?rev=1213499&r1=1213498&r2=1213499&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTest.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTest.java
Mon Dec 12 23:44:16 2011
@@ -68,4 +68,9 @@ public class HttpWagonTest
     {
         return true;
     }
+
+    protected boolean supportProxyPreemptiveAuthentication()
+    {
+        return true;
+    }
 }

Modified: maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonTest.java?rev=1213499&r1=1213498&r2=1213499&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonTest.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonTest.java
Mon Dec 12 23:44:16 2011
@@ -46,4 +46,9 @@ public class HttpsWagonTest
         server.setConnectors( new Connector[]{ connector } );
     }
 
+    protected boolean supportProxyPreemptiveAuthentication()
+    {
+        return true;
+    }
+
 }

Modified: maven/wagon/trunk/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavWagonTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavWagonTest.java?rev=1213499&r1=1213498&r2=1213499&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavWagonTest.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavWagonTest.java
Mon Dec 12 23:44:16 2011
@@ -424,4 +424,9 @@ public class WebDavWagonTest
         }
     }
 
+    protected boolean supportProxyPreemptiveAuthentication()
+    {
+        return true;
+    }
+
 }

Modified: maven/wagon/trunk/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavsWagonTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavsWagonTest.java?rev=1213499&r1=1213498&r2=1213499&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavsWagonTest.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavsWagonTest.java
Mon Dec 12 23:44:16 2011
@@ -52,4 +52,9 @@ public class WebDavsWagonTest
         connector.setTrustPassword( "wagonhttp" );
         server.setConnectors( new Connector[] { connector } );
     }
+
+    protected boolean supportProxyPreemptiveAuthentication()
+    {
+        return true;
+    }
 }



Mime
View raw message