From: Olivier Lamy Date: Tue, 13 Sep 2011 12:56:02 +0000 (+0000) Subject: fix unit test due to refactoring X-Git-Tag: archiva-1.4-M1~321 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=667064686cf05fad9ea49461cc0e543455d7d8ff;p=archiva.git fix unit test due to refactoring git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170160 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupAction.java index 4f2f7c78a..22e6ed154 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupAction.java @@ -108,4 +108,14 @@ public class DeleteRepositoryGroupAction { this.repoGroupId = repoGroupId; } + + public RepositoryGroupAdmin getRepositoryGroupAdmin() + { + return repositoryGroupAdmin; + } + + public void setRepositoryGroupAdmin( RepositoryGroupAdmin repositoryGroupAdmin ) + { + this.repositoryGroupAdmin = repositoryGroupAdmin; + } } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.java index 239f25fc2..e83c8d099 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.java @@ -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 )