]> source.dussan.org Git - archiva.git/commitdiff
fix archiva configuration duplicate remote repos during unit tests for RepositoryServ...
authorOlivier Lamy <olamy@apache.org>
Mon, 13 Jun 2011 14:22:15 +0000 (14:22 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 13 Jun 2011 14:22:15 +0000 (14:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1135113 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java
archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/repository-servlet-security-test/web.xml
archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml

index 5017f3dd1783f85ff45bf91dfe7f316689a8b0e4..98d7f10d908ba0fc298e706b2bfea5cae6dbaf12 100644 (file)
@@ -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 );
     }
index e508e4aad927a70b22ee07d5ef8334497431f6aa..67c5e8fa4d520f6d666fee8517db2c1d5fae88e4 100644 (file)
@@ -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
index f1defb60f753233963b7b5a2ce72f886d203851f..69ef84322060339e511719c19b3d178c39ecd12e 100644 (file)
   <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>
index 1175e70c7375267a7523df202c4359257cc35df4..ad0d1d1a0bdabec5c74343dbd9b0065caa58e5bc 100644 (file)
   <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>
     <param-value>