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

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

index 4f2f7c78abe41e014a7d065a9fb371c535463a96..22e6ed15451ef5256a29d8d1f0cf4a60d59fd46d 100644 (file)
@@ -108,4 +108,14 @@ public class DeleteRepositoryGroupAction
     {
         this.repoGroupId = repoGroupId;
     }
+
+    public RepositoryGroupAdmin getRepositoryGroupAdmin()
+    {
+        return repositoryGroupAdmin;
+    }
+
+    public void setRepositoryGroupAdmin( RepositoryGroupAdmin repositoryGroupAdmin )
+    {
+        this.repositoryGroupAdmin = repositoryGroupAdmin;
+    }
 }
index 239f25fc25381ea3a050b8c8d4efbf5168c1b2b0..e83c8d09982b192cb4214d1bc3a59a92da17fcf7 100644 (file)
@@ -22,6 +22,7 @@ package org.apache.maven.archiva.web.action.admin.repositories;
 import com.opensymphony.xwork2.Action;
 import org.apache.archiva.admin.model.RepositoryAdminException;
 import org.apache.archiva.admin.model.group.RepositoryGroup;
+import org.apache.archiva.admin.repository.group.DefaultRepositoryGroupAdmin;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
@@ -51,12 +52,14 @@ public class DeleteRepositoryGroupActionTest
     {
         super.setUp();
 
-        //action = (DeleteRepositoryGroupAction) lookup ( Action.class.getName(), "deleteRepositoryGroupAction" );
         action = (DeleteRepositoryGroupAction) getActionProxy( "/admin/deleteRepositoryGroup.action" ).getAction();
 
         archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
         archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
         action.setArchivaConfiguration( archivaConfiguration );
+
+        ( (DefaultRepositoryGroupAdmin) action.getRepositoryGroupAdmin() ).setArchivaConfiguration(
+            archivaConfiguration );
     }
 
     public void testSecureActionBundle()
@@ -98,7 +101,7 @@ public class DeleteRepositoryGroupActionTest
         Configuration configuration = createConfigurationForEditing( createRepositoryGroup() );
 
         archivaConfiguration.getConfiguration();
-        archivaConfigurationControl.setReturnValue( configuration, 3 );
+        archivaConfigurationControl.setReturnValue( configuration, 5 );
         archivaConfiguration.save( configuration );
         archivaConfigurationControl.replay();
 
@@ -108,7 +111,8 @@ public class DeleteRepositoryGroupActionTest
         assertEquals( REPO_GROUP_ID, action.getRepoGroupId() );
         RepositoryGroup repoGroup = action.getRepositoryGroup();
         assertNotNull( repoGroup );
-        assertEquals( Collections.singletonList( repoGroup ), configuration.getRepositoryGroups() );
+        assertEquals( Collections.singletonList( repoGroup ),
+                      action.getRepositoryGroupAdmin().getRepositoriesGroups() );
 
         String status = action.delete();
         assertEquals( Action.SUCCESS, status );
@@ -136,7 +140,8 @@ public class DeleteRepositoryGroupActionTest
 
         String status = action.execute();
         assertEquals( Action.SUCCESS, status );
-        assertEquals( Collections.singletonList( repoGroup ), configuration.getRepositoryGroups() );
+        assertEquals( Collections.singletonList( repoGroup ),
+                      action.getRepositoryGroupAdmin().getRepositoriesGroups() );
     }
 
     private Configuration createConfigurationForEditing( RepositoryGroupConfiguration repoGroup )