maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1303213 - /maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
Date Tue, 20 Mar 2012 23:42:09 GMT
Author: olamy
Date: Tue Mar 20 23:42:08 2012
New Revision: 1303213

URL: http://svn.apache.org/viewvc?rev=1303213&view=rev
Log:
enable this test

Modified:
    maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.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=1303213&r1=1303212&r2=1303213&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
Tue Mar 20 23:42:08 2012
@@ -1027,7 +1027,8 @@ public abstract class HttpWagonTestCase
         runTestSecuredGet( authInfo );
     }
 
-    public void runTestSecuredGetToStream( AuthenticationInfo authInfo )
+
+    public void runTestSecuredGet( AuthenticationInfo authInfo )
         throws Exception
     {
         String localRepositoryPath = FileTestUtils.getTestOutputDir().toString();
@@ -1046,21 +1047,24 @@ public abstract class HttpWagonTestCase
 
             wagon.connect( testRepository, authInfo );
 
-            StringOutputStream out = new StringOutputStream();
+            File file = File.createTempFile( "wagon-test", "txt" );
+
             try
             {
-                wagon.getToStream( "test-secured-resource", out );
+                wagon.get( "test-secured-resource", file );
             }
             finally
             {
                 wagon.disconnect();
             }
 
-            assertEquals( "top secret", out.toString() );
+            FileInputStream in = new FileInputStream( file );
+
+            assertEquals( "top secret", IOUtil.toString( in ) );
 
             TestSecurityHandler securityHandler = (TestSecurityHandler) ( (Context) server.getHandler()
).getHandler();
-            assertEquals( 2, securityHandler.handlerRequestResponses.size() );
             testPreemptiveAuthenticationGet( securityHandler, supportPreemptiveAuthenticationGet()
);
+
         }
         finally
         {
@@ -1068,7 +1072,17 @@ public abstract class HttpWagonTestCase
         }
     }
 
-    public void runTestSecuredGet( AuthenticationInfo authInfo )
+
+    public void testSecuredGetToStream()
+        throws Exception
+    {
+        AuthenticationInfo authInfo = new AuthenticationInfo();
+        authInfo.setUserName( "user" );
+        authInfo.setPassword( "secret" );
+        runTestSecuredGetToStream( authInfo );
+    }
+
+    public void runTestSecuredGetToStream( AuthenticationInfo authInfo )
         throws Exception
     {
         String localRepositoryPath = FileTestUtils.getTestOutputDir().toString();
@@ -1087,24 +1101,20 @@ public abstract class HttpWagonTestCase
 
             wagon.connect( testRepository, authInfo );
 
-            File file = File.createTempFile( "wagon-test", "txt" );
-
+            StringOutputStream out = new StringOutputStream();
             try
             {
-                wagon.get( "test-secured-resource", file );
+                wagon.getToStream( "test-secured-resource", out );
             }
             finally
             {
                 wagon.disconnect();
             }
 
-            FileInputStream in = new FileInputStream( file );
-
-            assertEquals( "top secret", IOUtil.toString( in ) );
+            assertEquals( "top secret", out.toString() );
 
             TestSecurityHandler securityHandler = (TestSecurityHandler) ( (Context) server.getHandler()
).getHandler();
             testPreemptiveAuthenticationGet( securityHandler, supportPreemptiveAuthenticationGet()
);
-
         }
         finally
         {



Mime
View raw message