mirror of https://github.com/apache/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
This commit is contained in:
parent
4825f8eb88
commit
471bb12beb
|
@ -140,6 +140,11 @@
|
|||
<artifactId>wagon-http-lightweight</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
|
|
|
@ -125,6 +125,11 @@
|
|||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -86,7 +86,12 @@
|
|||
<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>
|
||||
|
|
|
@ -158,6 +158,11 @@
|
|||
<artifactId>wagon-http-lightweight</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
|
|
|
@ -190,6 +190,11 @@
|
|||
<artifactId>redback-common-test-resources</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -223,6 +223,12 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -165,6 +165,12 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -68,6 +68,12 @@
|
|||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -116,6 +116,11 @@
|
|||
<artifactId>mockito-all</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -192,6 +192,11 @@
|
|||
<artifactId>metadata-store-file</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -93,10 +93,12 @@ public abstract class AbstractRepositoryServletProxiedTestCase
|
|||
protected RemoteRepoInfo remoteSnapshots;
|
||||
|
||||
@Before
|
||||
@Override
|
||||
public void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
startRepository();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -46,6 +46,7 @@ public class RepositoryServletNoProxyTest
|
|||
{
|
||||
super.setUp();
|
||||
archivaConfiguration.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>() );
|
||||
startRepository();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -124,6 +124,8 @@ public class RepositoryServletRepositoryGroupTest
|
|||
FileUtils.deleteDirectory( repoRootInvalid );
|
||||
|
||||
saveConfiguration( archivaConfiguration );
|
||||
|
||||
startRepository();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -191,6 +191,12 @@
|
|||
<artifactId>log4j-1.2-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -81,6 +81,11 @@
|
|||
<artifactId>fest-assert-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -83,6 +83,11 @@
|
|||
<artifactId>fest-assert-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<testResources>
|
||||
|
|
|
@ -69,6 +69,11 @@
|
|||
<artifactId>test-repository</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -75,6 +75,11 @@
|
|||
<artifactId>mockito-all</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
Loading…
Reference in New Issue