From: Olivier Lamy Date: Mon, 6 Jan 2014 05:30:55 +0000 (+0000) Subject: refactor unit tests to get rid of the old httpunit X-Git-Tag: archiva-2.0.0-RC1~59 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=471bb12bebb324ab3cbf1acf552170b576becd6c;p=archiva.git refactor unit tests to get rid of the old httpunit git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1555666 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml index bc11ea78f..a03dd650a 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml @@ -140,6 +140,11 @@ wagon-http-lightweight provided + + xerces + xercesImpl + test + diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml index 97e1c5415..85c5c3175 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml @@ -125,6 +125,11 @@ + + xerces + xercesImpl + test + diff --git a/archiva-modules/archiva-base/archiva-converter/pom.xml b/archiva-modules/archiva-base/archiva-converter/pom.xml index 2fa4e46c1..f3836095b 100644 --- a/archiva-modules/archiva-base/archiva-converter/pom.xml +++ b/archiva-modules/archiva-base/archiva-converter/pom.xml @@ -86,7 +86,12 @@ archiva-test-utils ${project.version} test - + + + xerces + xercesImpl + test + diff --git a/archiva-modules/archiva-base/archiva-indexer/pom.xml b/archiva-modules/archiva-base/archiva-indexer/pom.xml index 6eea49d2f..acd9c504e 100644 --- a/archiva-modules/archiva-base/archiva-indexer/pom.xml +++ b/archiva-modules/archiva-base/archiva-indexer/pom.xml @@ -158,6 +158,11 @@ wagon-http-lightweight provided + + xerces + xercesImpl + test + diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml index b0c7fe6b9..48eb1e7e7 100644 --- a/archiva-modules/archiva-base/archiva-proxy/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml @@ -190,6 +190,11 @@ redback-common-test-resources test + + xerces + xercesImpl + test + diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml index 32e7cfed1..10beac182 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml @@ -223,6 +223,12 @@ test + + xerces + xercesImpl + test + + diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml index 5425cbc32..8c9469966 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml @@ -165,6 +165,12 @@ test + + xerces + xercesImpl + test + + diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml index 240d7c8b9..c0001686a 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml @@ -68,6 +68,12 @@ slf4j-api + + xerces + xercesImpl + test + + diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml index 008cde7a0..cffe04b10 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml @@ -116,6 +116,11 @@ mockito-all test + + xerces + xercesImpl + test + diff --git a/archiva-modules/archiva-web/archiva-security/pom.xml b/archiva-modules/archiva-web/archiva-security/pom.xml index e137e14db..844606196 100644 --- a/archiva-modules/archiva-web/archiva-security/pom.xml +++ b/archiva-modules/archiva-web/archiva-security/pom.xml @@ -192,6 +192,11 @@ metadata-store-file test + + xerces + xercesImpl + test + diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java index bf9f5d17a..8767cacce 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java @@ -93,10 +93,12 @@ public abstract class AbstractRepositoryServletProxiedTestCase protected RemoteRepoInfo remoteSnapshots; @Before + @Override public void setUp() throws Exception { super.setUp(); + startRepository(); } @Override diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java index 56913f431..d1df95a39 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java @@ -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 diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java index 81901e521..04a0e5505 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java @@ -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 diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletDeployTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletDeployTest.java index 1995f52eb..591a39db5 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletDeployTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletDeployTest.java @@ -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 diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyMetadataTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyMetadataTest.java index 494cc5da7..87d1dfc96 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyMetadataTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyMetadataTest.java @@ -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 diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyTest.java index 56bfd77f8..d5710a5d0 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyTest.java @@ -46,6 +46,7 @@ public class RepositoryServletNoProxyTest { super.setUp(); archivaConfiguration.getConfiguration().setProxyConnectors( new ArrayList() ); + startRepository(); } @Test diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java index 96a78433f..0af1647af 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java @@ -124,6 +124,8 @@ public class RepositoryServletRepositoryGroupTest FileUtils.deleteDirectory( repoRootInvalid ); saveConfiguration( archivaConfiguration ); + + startRepository(); } @Override diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletTest.java index 74ad91a6c..3e897f379 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletTest.java @@ -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 diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml index 4371b0efb..0d04e7ae9 100644 --- a/archiva-modules/plugins/maven2-repository/pom.xml +++ b/archiva-modules/plugins/maven2-repository/pom.xml @@ -191,6 +191,12 @@ log4j-1.2-api + + xerces + xercesImpl + test + + diff --git a/archiva-modules/plugins/metadata-store-file/pom.xml b/archiva-modules/plugins/metadata-store-file/pom.xml index 932cd2db1..8f9cbab18 100644 --- a/archiva-modules/plugins/metadata-store-file/pom.xml +++ b/archiva-modules/plugins/metadata-store-file/pom.xml @@ -81,6 +81,11 @@ fest-assert-core test + + xerces + xercesImpl + test + diff --git a/archiva-modules/plugins/metadata-store-jcr/pom.xml b/archiva-modules/plugins/metadata-store-jcr/pom.xml index d1fbc28df..6f0dfcdcb 100644 --- a/archiva-modules/plugins/metadata-store-jcr/pom.xml +++ b/archiva-modules/plugins/metadata-store-jcr/pom.xml @@ -83,6 +83,11 @@ fest-assert-core test + + xerces + xercesImpl + test + diff --git a/archiva-modules/plugins/problem-reports/pom.xml b/archiva-modules/plugins/problem-reports/pom.xml index dd5655005..9969fe19e 100644 --- a/archiva-modules/plugins/problem-reports/pom.xml +++ b/archiva-modules/plugins/problem-reports/pom.xml @@ -69,6 +69,11 @@ test-repository test + + xerces + xercesImpl + test + diff --git a/archiva-modules/plugins/repository-statistics/pom.xml b/archiva-modules/plugins/repository-statistics/pom.xml index 528ed42bd..80cd01d36 100644 --- a/archiva-modules/plugins/repository-statistics/pom.xml +++ b/archiva-modules/plugins/repository-statistics/pom.xml @@ -75,6 +75,11 @@ mockito-all test + + xerces + xercesImpl + test +