From f42244015ec3f920aa70718b0796b3035d6d526d Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 1 Sep 2011 07:04:39 +0000 Subject: [PATCH] fix unit test when executing all : an other unit tests set a mock in the singleton component git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1163922 13f79535-47bb-0310-9956-ffa450edef68 --- .../EditManagedRepositoryActionTest.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java index 2343ef864..8ce7307f1 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java @@ -21,6 +21,7 @@ package org.apache.maven.archiva.web.action.admin.repositories; import com.opensymphony.xwork2.Action; import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; +import org.apache.archiva.audit.AuditListener; import org.apache.archiva.metadata.repository.MetadataRepository; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory; @@ -43,7 +44,6 @@ import org.easymock.classextension.MockClassControl; import java.io.File; import java.io.IOException; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -117,7 +117,12 @@ public class EditManagedRepositoryActionTest ( (DefaultManagedRepositoryAdmin) getManagedRepositoryAdmin() ).setRepositoryTaskScheduler( repositoryTaskScheduler ); ( (DefaultManagedRepositoryAdmin) getManagedRepositoryAdmin() ).setRepositorySessionFactory( factory ); + + ( (DefaultManagedRepositoryAdmin) getManagedRepositoryAdmin() ).setAuditListeners( + new ArrayList( 0 ) ); + action.setManagedRepositoryAdmin( getManagedRepositoryAdmin() ); + } public void testSecureActionBundle() @@ -178,17 +183,15 @@ public class EditManagedRepositoryActionTest roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, REPO_ID ); roleManagerControl.setVoidCallable(); - roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, stageRepoId ); roleManagerControl.setReturnValue( false ); roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, stageRepoId ); - roleManagerControl.setVoidCallable( ); + roleManagerControl.setVoidCallable(); roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, stageRepoId ); roleManagerControl.setReturnValue( false ); roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, stageRepoId ); - roleManagerControl.setVoidCallable( ); - + roleManagerControl.setVoidCallable(); roleManagerControl.replay();