mirror of https://github.com/apache/archiva.git
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
This commit is contained in:
parent
1eacae0de2
commit
c97525b3b6
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
<param-value>
|
||||
|
|
Loading…
Reference in New Issue