archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1555675 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav: AbstractRepositoryServletTestCase.java RepositoryServletBrowseTest.java
Date Mon, 06 Jan 2014 05:32:07 GMT
Author: olamy
Date: Mon Jan  6 05:32:07 2014
New Revision: 1555675

URL: http://svn.apache.org/r1555675
Log:
follow redirect as previous testing tool did

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java?rev=1555675&r1=1555674&r2=1555675&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
Mon Jan  6 05:32:07 2014
@@ -135,7 +135,6 @@ public abstract class AbstractRepository
         }
         FileUtils.copyFile( testConf, testConfDest );
 
-
         repoRootInternal = new File( appserverBase, "data/repositories/internal" );
         repoRootLegacy = new File( appserverBase, "data/repositories/legacy" );
         Configuration config = archivaConfiguration.getConfiguration();
@@ -508,10 +507,10 @@ public abstract class AbstractRepository
     protected WebResponse getWebResponse( String path )
         throws Exception
     {
-        return getWebResponse( new GetMethodWebRequest( "http://localhost" + path ) );
+        return getWebResponse( new GetMethodWebRequest( "http://localhost" + path ) );//,
false );
     }
 
-    protected WebResponse getWebResponse( WebRequest webRequest )
+    protected WebResponse getWebResponse( WebRequest webRequest ) //, boolean followRedirect
)
         throws Exception
     {
 
@@ -527,6 +526,14 @@ public abstract class AbstractRepository
 
         final MockHttpServletResponse response = execute( request );
 
+        if ( response.getStatus() == HttpServletResponse.SC_MOVED_PERMANENTLY
+            || response.getStatus() == HttpServletResponse.SC_MOVED_TEMPORARILY )
+        {
+            String location = response.getHeader( "Location" );
+            log.debug("follow redirect to {}", location);
+            return getWebResponse( new GetMethodWebRequest( location ) );
+        }
+
         return new WebResponse( null, null, 1 )
         {
             @Override
@@ -608,7 +615,14 @@ public abstract class AbstractRepository
         public WebResponse getResponse( WebRequest request )
             throws Exception
         {
-            return abstractRepositoryServletTestCase.getWebResponse( request );
+            return getResponse( request, false );
+        }
+
+        public WebResponse getResponse( WebRequest request, boolean followRedirect )
+            throws Exception
+        {
+            // alwasy following redirect as it's normal
+            return abstractRepositoryServletTestCase.getWebResponse( request );//, followRedirect
);
         }
 
         public WebResponse getResource( WebRequest request )

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java?rev=1555675&r1=1555674&r2=1555675&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java
Mon Jan  6 05:32:07 2014
@@ -99,7 +99,7 @@ public class RepositoryServletBrowseTest
 
         WebRequest request =
             new GetMethodWebRequest( "http://machine.com/repository/internal/org/apache/archiva/artifactId"
);
-        WebResponse response = getServletUnitClient().getResponse( request );
+        WebResponse response = getServletUnitClient().getResponse( request, true );
         assertEquals( "1st Response", HttpServletResponse.SC_OK, response.getStatusCode()
);
 
         request = new GetMethodWebRequest( "http://machine.com/repository/internal/org/apache/archiva/artifactId/"
);



Mime
View raw message