From: Olivier Lamy Date: Tue, 13 Sep 2011 12:55:40 +0000 (+0000) Subject: fix unit test due to refactoring X-Git-Tag: archiva-1.4-M1~322 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4ae58b1684aa45872506a6c901e8a38eb787d31b;p=archiva.git fix unit test due to refactoring git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170158 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java index f47f44f0f..8a9dfdd7b 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java @@ -186,6 +186,11 @@ public class DeleteManagedRepositoryActionTest stageRepoConfiguration.addManagedRepository( createStagingRepository() ); archivaConfigurationControl.setReturnValue( stageRepoConfiguration ); + + archivaConfiguration.getConfiguration(); + archivaConfigurationControl.setReturnValue( configuration ); + + archivaConfigurationControl.replay(); action.setRepoid( REPO_ID ); @@ -201,7 +206,8 @@ public class DeleteManagedRepositoryActionTest repository = action.getRepository(); assertRepositoryEquals( repository, createRepository() ); - assertEquals( Collections.singletonList( originalRepository ), configuration.getManagedRepositories() ); + assertEquals( Collections.singletonList( originalRepository ), + action.getManagedRepositoryAdmin().getManagedRepositories() ); } public void testDeleteRepositoryKeepContent() @@ -316,7 +322,8 @@ public class DeleteManagedRepositoryActionTest ManagedRepository repository = action.getRepository(); assertRepositoryEquals( repository, createRepository() ); - assertEquals( Collections.singletonList( originalRepository ), configuration.getManagedRepositories() ); + assertEquals( Collections.singletonList( originalRepository ), + action.getManagedRepositoryAdmin().getManagedRepositories() ); assertTrue( location.exists() ); @@ -327,6 +334,10 @@ public class DeleteManagedRepositoryActionTest private Configuration prepDeletionTest( ManagedRepository originalRepository, int expectCountGetConfig ) throws RegistryException, IndeterminateConfigurationException, RepositoryAdminException { + + //Configuration originalConfiguration = + // ( (DefaultManagedRepositoryAdmin) getManagedRepositoryAdmin() ).getArchivaConfiguration().getConfiguration(); + location.mkdirs(); Configuration configuration = createConfigurationForEditing( originalRepository ); @@ -376,8 +387,10 @@ public class DeleteManagedRepositoryActionTest private Configuration createConfigurationForEditing( ManagedRepository repositoryConfiguration ) { Configuration configuration = new Configuration(); - configuration.addManagedRepository( - new BeanReplicator().replicateBean( repositoryConfiguration, ManagedRepositoryConfiguration.class ) ); + ManagedRepositoryConfiguration managedRepositoryConfiguration = + new BeanReplicator().replicateBean( repositoryConfiguration, ManagedRepositoryConfiguration.class ); + managedRepositoryConfiguration.setRefreshCronExpression( repositoryConfiguration.getCronExpression() ); + configuration.addManagedRepository( managedRepositoryConfiguration ); return configuration; }