]> source.dussan.org Git - archiva.git/commitdiff
fix unit test due to refactoring
authorOlivier Lamy <olamy@apache.org>
Tue, 13 Sep 2011 12:55:40 +0000 (12:55 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 13 Sep 2011 12:55:40 +0000 (12:55 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170158 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java

index f47f44f0f356dc18ba51e129a6845484ee5941eb..8a9dfdd7b9b74ea6bba5d86d4fc77274940c5861 100644 (file)
@@ -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;
     }