summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-webdav
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-01-06 05:30:55 +0000
committerOlivier Lamy <olamy@apache.org>2014-01-06 05:30:55 +0000
commit471bb12bebb324ab3cbf1acf552170b576becd6c (patch)
tree40d481dc79316a039b2773280b7509d00cf77eaa /archiva-modules/archiva-web/archiva-webdav
parent4825f8eb88ef35ca265903515ae715014bb4d597 (diff)
downloadarchiva-471bb12bebb324ab3cbf1acf552170b576becd6c.tar.gz
archiva-471bb12bebb324ab3cbf1acf552170b576becd6c.zip
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
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webdav')
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java17
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletDeployTest.java9
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyMetadataTest.java10
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletNoProxyTest.java1
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletTest.java9
8 files changed, 50 insertions, 2 deletions
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<ProxyConnectorConfiguration>() );
+ 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