]> source.dussan.org Git - archiva.git/commitdiff
refactor unit tests to get rid of the old httpunit
authorOlivier Lamy <olamy@apache.org>
Mon, 6 Jan 2014 05:30:55 +0000 (05:30 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 6 Jan 2014 05:30:55 +0000 (05:30 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1555666 13f79535-47bb-0310-9956-ffa450edef68

23 files changed:
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml
archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml
archiva-modules/archiva-base/archiva-converter/pom.xml
archiva-modules/archiva-base/archiva-indexer/pom.xml
archiva-modules/archiva-base/archiva-proxy/pom.xml
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml
archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml
archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml
archiva-modules/archiva-web/archiva-security/pom.xml
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletDeployTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyMetadataTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletTest.java
archiva-modules/plugins/maven2-repository/pom.xml
archiva-modules/plugins/metadata-store-file/pom.xml
archiva-modules/plugins/metadata-store-jcr/pom.xml
archiva-modules/plugins/problem-reports/pom.xml
archiva-modules/plugins/repository-statistics/pom.xml

index bc11ea78fb31e4caefcf87830d7629d26a0e5882..a03dd650abb19c27204f969d87788a0f76e6c3e0 100644 (file)
       <artifactId>wagon-http-lightweight</artifactId>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <pluginManagement>
index 97e1c54159e75d946672932e2a7fb8458d708a6c..85c5c3175538605a78e72769472427bcb7ddbabc 100644 (file)
         </exclusion>
       </exclusions>
     </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
index 2fa4e46c15f886d9e248b9cd82242f0bee941020..f3836095b6503158fd1d3d9df19a2e3f76f5aef2 100644 (file)
       <artifactId>archiva-test-utils</artifactId>
       <version>${project.version}</version>
       <scope>test</scope>
-    </dependency>    
+    </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
index 6eea49d2fd287b80efb7fdd026364eeeb678a034..acd9c504ef18a50882bf4121f388a5069e8638c2 100644 (file)
       <artifactId>wagon-http-lightweight</artifactId>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <pluginManagement>
index b0c7fe6b955c915330aee40b58ec2b0d56ce6821..48eb1e7e7accc81f430a715b82a440fe30b98b41 100644 (file)
       <artifactId>redback-common-test-resources</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
index 32e7cfed1aba6c2885d4714d79f4b680c8fc4604..10beac1824787b8d87e820d64e61c287b2a2ded0 100644 (file)
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 
   <build>
index 5425cbc32e247a8e1940e92d038c239abc0dc792..8c94699665b2e76049302c894a0591d2cf48909a 100644 (file)
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 
   <build>
index 240d7c8b90e4e7d3fac056b20f4b1737d0255096..c0001686a6d561ffb27ccdfb150eb115cb22b18f 100644 (file)
       <artifactId>slf4j-api</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
   <build>
     <plugins>
index 008cde7a07e7171a73b7134b9047b08dc1e4efbc..cffe04b1063ffea778026ac7000df1055c17aab2 100644 (file)
       <artifactId>mockito-all</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
index e137e14db403bc22bc815150b13eda2e552d2bbb..8446061966373b13763d2aad9538bd325077c18e 100644 (file)
       <artifactId>metadata-store-file</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
index bf9f5d17a725d334376862a664bba573ab7883fe..8767cacceb43237913a62a72632ade9c8472f450 100644 (file)
@@ -93,10 +93,12 @@ public abstract class AbstractRepositoryServletProxiedTestCase
     protected RemoteRepoInfo remoteSnapshots;
 
     @Before
+    @Override
     public void setUp()
         throws Exception
     {
         super.setUp();
+        startRepository();
     }
 
     @Override
index 56913f4319f1cca23b923bb9c997afb97e350f71..d1df95a39e422fa2e8cb3b6098ada8b10f4a7d99 100644 (file)
@@ -34,6 +34,7 @@ import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 import org.apache.archiva.webdav.util.MavenIndexerCleaner;
+import org.apache.archiva.webdav.util.ReinitServlet;
 import org.apache.catalina.Context;
 import org.apache.catalina.deploy.ApplicationParameter;
 import org.apache.catalina.startup.Tomcat;
@@ -132,6 +133,12 @@ public abstract class AbstractRepositoryServletTestCase
 
         applicationContext.getBean( MavenIndexerCleaner.class ).cleanupIndex();
 
+
+
+    }
+
+    protected void startRepository() throws Exception
+    {
         tomcat = new Tomcat();
         tomcat.setBaseDir( System.getProperty( "java.io.tmpdir" ) );
         tomcat.setPort( 0 );
@@ -150,10 +157,13 @@ public abstract class AbstractRepositoryServletTestCase
         Tomcat.addServlet( context, "repository", new UnauthenticatedRepositoryServlet() );
         context.addServletMapping( "/repository/*", "repository" );
 
+
+        Tomcat.addServlet( context, "reinitservlet", new ReinitServlet() );
+        context.addServletMapping( "/reinit/*", "reinitservlet" );
+
         tomcat.start();
 
         this.port = tomcat.getConnector().getLocalPort();
-
     }
 
     protected String getSpringConfigLocation()
@@ -193,6 +203,7 @@ public abstract class AbstractRepositoryServletTestCase
         webClient.getOptions().setJavaScriptEnabled( false );
         webClient.getOptions().setCssEnabled( false );
         webClient.getOptions().setAppletEnabled( false );
+        webClient.getOptions().setThrowExceptionOnFailingStatusCode( false );
         webClient.setAjaxController( new NicelyResynchronizingAjaxController() );
         return webClient;
     }
@@ -201,7 +212,9 @@ public abstract class AbstractRepositoryServletTestCase
     protected static WebResponse getWebResponse( String path )
         throws Exception
     {
-        return newClient().getPage( "http://localhost:" + port + path ).getWebResponse();
+        WebClient client = newClient();
+        client.getPage( "http://localhost:" + port + "/reinit/reload" );
+        return client.getPage( "http://localhost:" + port + path ).getWebResponse();
     }
 
     public static class GetMethodWebRequest
index 81901e5212fba9efbdace02532ad47eacd057f48..04a0e55052e0fd0ba8e1229b61ac15338de06c87 100644 (file)
@@ -47,6 +47,8 @@ public class RepositoryServletBrowseTest
         new File( repoRootInternal, "org/codehaus/mojo/" ).mkdirs();
         new File( repoRootInternal, "net/sourceforge" ).mkdirs();
         new File( repoRootInternal, "commons-lang" ).mkdirs();
+
+        startRepository();
     }
 
     @Test
index 1995f52eb1cc8ea3b9a49566ea855f0599616dc6..591a39db55b5cced1b988a1037bb144caabebe80 100644 (file)
@@ -28,6 +28,7 @@ import com.gargoylesoftware.htmlunit.WebRequest;
 import com.gargoylesoftware.htmlunit.WebResponse;
 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.archiva.webdav.httpunit.MkColMethodWebRequest;
+import org.junit.Before;
 import org.junit.Test;
 
 
@@ -41,6 +42,14 @@ public class RepositoryServletDeployTest
 {
     private static final String ARTIFACT_DEFAULT_LAYOUT = "/path/to/artifact/1.0.0/artifact-1.0.0.jar";
 
+    @Before
+    @Override
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        startRepository();
+    }
+
     @Test
     public void testPutWithMissingParentCollection()
         throws Exception
index 494cc5da73230faaaff4d8034c50659348fc34b4..87d1dfc968f3cca7d414cffb732c30f8d1893b38 100644 (file)
@@ -22,6 +22,7 @@ package org.apache.archiva.webdav;
 import com.gargoylesoftware.htmlunit.WebRequest;
 import com.gargoylesoftware.htmlunit.WebResponse;
 import org.apache.commons.io.FileUtils;
+import org.junit.Before;
 import org.junit.Test;
 
 import java.io.File;
@@ -33,6 +34,15 @@ import java.nio.charset.Charset;
 public class RepositoryServletNoProxyMetadataTest
     extends AbstractRepositoryServletTestCase
 {
+
+    @Before
+    @Override
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        startRepository();
+    }
+
     @Test
     public void testGetVersionMetadataDefaultLayout()
         throws Exception
index 56bfd77f824b103a1e9ee68250c1a4dc5e215351..d5710a5d07df8e719db78fcdd78fc51efd70f382 100644 (file)
@@ -46,6 +46,7 @@ public class RepositoryServletNoProxyTest
     {
         super.setUp();
         archivaConfiguration.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>() );
+        startRepository();
     }
 
     @Test
index 96a78433f44e1e5025eb505edad1c517a8e512d9..0af1647afbe7610f20c5f0fbc5d5bb7444f16b78 100644 (file)
@@ -124,6 +124,8 @@ public class RepositoryServletRepositoryGroupTest
         FileUtils.deleteDirectory( repoRootInvalid );
 
         saveConfiguration( archivaConfiguration );
+
+        startRepository();
     }
 
     @Override
index 74ad91a6cd16b202e23a88b4a3dab467218ce094..3e897f3790f042ce3058b5245e583d560c599e17 100644 (file)
@@ -25,6 +25,7 @@ import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.configuration.Configuration;
 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.junit.Before;
 import org.junit.Test;
 
 import java.io.File;
@@ -69,6 +70,14 @@ public class RepositoryServletTest
         assertNull( repository );
     }
 
+    @Before
+    @Override
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        startRepository();
+    }
+
     @Test
     public void testGetRepositoryAfterAdd()
         throws Exception
index 4371b0efb71d027c28a26fa7868f785d256e459d..0d04e7ae9788e62b4c366b2fb61baaab06212b57 100644 (file)
       <artifactId>log4j-1.2-api</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
   <build>
     <plugins>
index 932cd2db104345bed8e6c67578e0df9a74d184ff..8f9cbab18ff018421ca470654fc6392dc1e03ac4 100644 (file)
       <artifactId>fest-assert-core</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
index d1fbc28df1f8c3d3bde8851729323960a388f3bd..6f0dfcdcb042ec92e89db015ed3aa43cb69b8b42 100644 (file)
       <artifactId>fest-assert-core</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <testResources>
index dd5655005a950b657a1840d13bb511852b3856ac..9969fe19e3cff2bb7d9ebd634541719f43865bfd 100644 (file)
       <artifactId>test-repository</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
index 528ed42bdfd688371db42025e44a0c4943d0793a..80cd01d36f38899b8e0af342c60597e813f1867e 100644 (file)
       <artifactId>mockito-all</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>