fix unit test.

avoid using same registry singleton which is modified by one test.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1377860 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-08-27 21:03:38 +00:00
parent a257d19489
commit 6f6609413d
2 changed files with 8 additions and 5 deletions

View File

@ -68,10 +68,10 @@ public class ArchivaConfigurationMRM789Test
public void testGetConfigurationFromDefaultsWithDefaultRepoLocationAlreadyExisting() public void testGetConfigurationFromDefaultsWithDefaultRepoLocationAlreadyExisting()
throws Exception throws Exception
{ {
File repo = new File( FileUtil.getBasedir(), "/target/test-classes/existing_snapshots" ); File repo = new File( FileUtil.getBasedir(), "target/test-classes/existing_snapshots" );
repo.mkdirs(); repo.mkdirs();
repo = new File( FileUtil.getBasedir(), "/target/test-classes/existing_internal" ); repo = new File( FileUtil.getBasedir(), "target/test-classes/existing_internal" );
repo.mkdirs(); repo.mkdirs();
String existingTestDefaultArchivaConfigFile = FileUtils.readFileToString( String existingTestDefaultArchivaConfigFile = FileUtils.readFileToString(
@ -88,7 +88,7 @@ public class ArchivaConfigurationMRM789Test
ArchivaConfiguration archivaConfiguration = ArchivaConfiguration archivaConfiguration =
lookup( ArchivaConfiguration.class, "test-defaults-default-repo-location-exists" ); lookup( ArchivaConfiguration.class, "test-defaults-default-repo-location-exists" );
Configuration configuration = archivaConfiguration.getConfiguration(); Configuration configuration = archivaConfiguration.getConfiguration();
assertConfiguration( configuration, 2, 1, 1 ); assertConfiguration( configuration, 2, 2, 2 );
ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 ); ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
assertTrue( "check managed repositories", repository.getLocation().endsWith( "data/repositories/internal" ) ); assertTrue( "check managed repositories", repository.getLocation().endsWith( "data/repositories/internal" ) );

View File

@ -32,16 +32,19 @@
<bean name="archivaConfiguration#test-defaults-default-repo-location-exists" class="org.apache.archiva.configuration.DefaultArchivaConfiguration"> <bean name="archivaConfiguration#test-defaults-default-repo-location-exists" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
<property name="registry" ref="registry#empty"/> <property name="registry" ref="registry#empty"/>
</bean> </bean>
<bean name="registry#empty" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry"/>
<bean name="archivaConfiguration#test-defaults" class="org.apache.archiva.configuration.DefaultArchivaConfiguration"> <bean name="archivaConfiguration#test-defaults" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
<property name="registry" ref="registry#empty"/> <property name="registry" ref="registry#emptydef"/>
</bean> </bean>
<bean name="registry#empty" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry"/> <bean name="registry#emptydef" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry"/>
<bean name="archivaConfiguration#test-upgrade-09" class="org.apache.archiva.configuration.DefaultArchivaConfiguration"> <bean name="archivaConfiguration#test-upgrade-09" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
<property name="registry" ref="registry#test-upgrade-09"/> <property name="registry" ref="registry#test-upgrade-09"/>
</bean> </bean>
<bean name="registry#test-upgrade-09" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry"> <bean name="registry#test-upgrade-09" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry">
<property name="properties"> <property name="properties">
<value> <value>