fix unit test due to refactoring

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170158 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-09-13 12:55:40 +00:00
parent 919a5ac3eb
commit 4ae58b1684
1 changed files with 17 additions and 4 deletions

View File

@ -186,6 +186,11 @@ public class DeleteManagedRepositoryActionTest
stageRepoConfiguration.addManagedRepository( createStagingRepository() ); stageRepoConfiguration.addManagedRepository( createStagingRepository() );
archivaConfigurationControl.setReturnValue( stageRepoConfiguration ); archivaConfigurationControl.setReturnValue( stageRepoConfiguration );
archivaConfiguration.getConfiguration();
archivaConfigurationControl.setReturnValue( configuration );
archivaConfigurationControl.replay(); archivaConfigurationControl.replay();
action.setRepoid( REPO_ID ); action.setRepoid( REPO_ID );
@ -201,7 +206,8 @@ public class DeleteManagedRepositoryActionTest
repository = action.getRepository(); repository = action.getRepository();
assertRepositoryEquals( repository, createRepository() ); assertRepositoryEquals( repository, createRepository() );
assertEquals( Collections.singletonList( originalRepository ), configuration.getManagedRepositories() ); assertEquals( Collections.singletonList( originalRepository ),
action.getManagedRepositoryAdmin().getManagedRepositories() );
} }
public void testDeleteRepositoryKeepContent() public void testDeleteRepositoryKeepContent()
@ -316,7 +322,8 @@ public class DeleteManagedRepositoryActionTest
ManagedRepository repository = action.getRepository(); ManagedRepository repository = action.getRepository();
assertRepositoryEquals( repository, createRepository() ); assertRepositoryEquals( repository, createRepository() );
assertEquals( Collections.singletonList( originalRepository ), configuration.getManagedRepositories() ); assertEquals( Collections.singletonList( originalRepository ),
action.getManagedRepositoryAdmin().getManagedRepositories() );
assertTrue( location.exists() ); assertTrue( location.exists() );
@ -327,6 +334,10 @@ public class DeleteManagedRepositoryActionTest
private Configuration prepDeletionTest( ManagedRepository originalRepository, int expectCountGetConfig ) private Configuration prepDeletionTest( ManagedRepository originalRepository, int expectCountGetConfig )
throws RegistryException, IndeterminateConfigurationException, RepositoryAdminException throws RegistryException, IndeterminateConfigurationException, RepositoryAdminException
{ {
//Configuration originalConfiguration =
// ( (DefaultManagedRepositoryAdmin) getManagedRepositoryAdmin() ).getArchivaConfiguration().getConfiguration();
location.mkdirs(); location.mkdirs();
Configuration configuration = createConfigurationForEditing( originalRepository ); Configuration configuration = createConfigurationForEditing( originalRepository );
@ -376,8 +387,10 @@ public class DeleteManagedRepositoryActionTest
private Configuration createConfigurationForEditing( ManagedRepository repositoryConfiguration ) private Configuration createConfigurationForEditing( ManagedRepository repositoryConfiguration )
{ {
Configuration configuration = new Configuration(); Configuration configuration = new Configuration();
configuration.addManagedRepository( ManagedRepositoryConfiguration managedRepositoryConfiguration =
new BeanReplicator().replicateBean( repositoryConfiguration, ManagedRepositoryConfiguration.class ) ); new BeanReplicator().replicateBean( repositoryConfiguration, ManagedRepositoryConfiguration.class );
managedRepositoryConfiguration.setRefreshCronExpression( repositoryConfiguration.getCronExpression() );
configuration.addManagedRepository( managedRepositoryConfiguration );
return configuration; return configuration;
} }