aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-06-13 14:22:15 +0000
committerOlivier Lamy <olamy@apache.org>2011-06-13 14:22:15 +0000
commitc97525b3b60229b88aafeff0707d46280879ccf0 (patch)
tree88e8d15dae5039301e80aa4aa9c39a083ef959f2
parent1eacae0de2a297765f6b25f6eb80ec45d3da050d (diff)
downloadarchiva-c97525b3b60229b88aafeff0707d46280879ccf0.tar.gz
archiva-c97525b3b60229b88aafeff0707d46280879ccf0.zip
fix archiva configuration duplicate remote repos during unit tests for RepositoryServletProxiedPluginSnapshotPolicyTest
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1135113 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java16
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/repository-servlet-security-test/web.xml4
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml4
4 files changed, 27 insertions, 1 deletions
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java
index 5017f3dd1..98d7f10d9 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java
@@ -138,7 +138,7 @@ public abstract class AbstractRepositoryServletProxiedTestCase
int port = repo.server.getConnectors()[0].getLocalPort();
repo.url = "http://localhost:" + port + repo.context;
- System.out.println( "Remote HTTP Server started on " + repo.url );
+ log.info( "Remote HTTP Server started on " + repo.url );
repo.config = createRemoteRepository( repo.id, "Testable [" + repo.id + "] Remote Repo", repo.url );
@@ -206,6 +206,14 @@ public abstract class AbstractRepositoryServletProxiedTestCase
remoteCentral = createServer( "central" );
assertServerSetupCorrectly( remoteCentral );
+
+ RemoteRepositoryConfiguration remoteRepositoryConfiguration =
+ archivaConfiguration.getConfiguration().getRemoteRepositoriesAsMap().get( remoteCentral.id );
+ if ( remoteRepositoryConfiguration != null )
+ {
+ archivaConfiguration.getConfiguration().removeRemoteRepository( remoteRepositoryConfiguration );
+ }
+
archivaConfiguration.getConfiguration().addRemoteRepository( remoteCentral.config );
setupCleanRepo( remoteCentral.root );
}
@@ -231,6 +239,12 @@ public abstract class AbstractRepositoryServletProxiedTestCase
remoteSnapshots = createServer( "snapshots" );
assertServerSetupCorrectly( remoteSnapshots );
+ RemoteRepositoryConfiguration remoteRepositoryConfiguration =
+ archivaConfiguration.getConfiguration().getRemoteRepositoriesAsMap().get( remoteSnapshots.id );
+ if ( remoteRepositoryConfiguration != null )
+ {
+ archivaConfiguration.getConfiguration().removeRemoteRepository( remoteRepositoryConfiguration );
+ }
archivaConfiguration.getConfiguration().addRemoteRepository( remoteSnapshots.config );
setupCleanRepo( remoteSnapshots.root );
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java
index e508e4aad..67c5e8fa4 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java
@@ -34,6 +34,8 @@ import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -70,6 +72,8 @@ public abstract class AbstractRepositoryServletTestCase
@Inject
protected ApplicationContext applicationContext;
+ protected Logger log = LoggerFactory.getLogger( getClass() );
+
protected void saveConfiguration()
throws Exception
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/repository-servlet-security-test/web.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/repository-servlet-security-test/web.xml
index f1defb60f..69ef84322 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/repository-servlet-security-test/web.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/repository-servlet-security-test/web.xml
@@ -27,6 +27,10 @@
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
+ <context-param>
+ <param-name>contextClass</param-name>
+ <param-value>org.codehaus.redback.components.springutils.CachingWebApplicationContext</param-value>
+ </context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml
index 1175e70c7..ad0d1d1a0 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml
@@ -28,6 +28,10 @@
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
+ <param-name>contextClass</param-name>
+ <param-value>org.codehaus.redback.components.springutils.CachingWebApplicationContext</param-value>
+ </context-param>
+ <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:/META-INF/spring-context.xml,