From 1fb61463c88b3891eb2f493ac6057686699d50d7 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 8 Jun 2011 20:12:23 +0000 Subject: [PATCH] ensure cleanup datas for other tests git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1133543 13f79535-47bb-0310-9956-ffa450edef68 --- .../security/DefaultUserRepositoriesTest.java | 34 +++++++++++++------ .../archiva/security/RoleManagerTest.java | 4 +-- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/maven/archiva/security/DefaultUserRepositoriesTest.java b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/maven/archiva/security/DefaultUserRepositoriesTest.java index bc11b9436..4c9707500 100644 --- a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/maven/archiva/security/DefaultUserRepositoriesTest.java +++ b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/maven/archiva/security/DefaultUserRepositoriesTest.java @@ -19,14 +19,15 @@ package org.apache.maven.archiva.security; * under the License. */ -import java.util.List; - import org.apache.commons.lang.StringUtils; +import org.junit.After; import org.junit.Before; import org.junit.Test; +import java.util.List; + /** - * DefaultUserRepositoriesTest + * DefaultUserRepositoriesTest * * @version $Id$ */ @@ -36,7 +37,8 @@ public class DefaultUserRepositoriesTest @Before - public void setUp() throws Exception + public void setUp() + throws Exception { super.setUp(); restoreGuestInitialValues( USER_ALPACA ); @@ -67,10 +69,21 @@ public class DefaultUserRepositoriesTest // the global repo observer role. assignGlobalRepositoryObserverRole( USER_ADMIN ); - assertRepoIds( new String[] { "central", "corporate" }, userRepos.getObservableRepositoryIds( USER_ALPACA ) ); - assertRepoIds( new String[] { "coporate" }, userRepos.getObservableRepositoryIds( USER_GUEST ) ); - assertRepoIds( new String[] { "central", "internal", "corporate", "snapshots", "secret" }, userRepos - .getObservableRepositoryIds( USER_ADMIN ) ); + assertRepoIds( new String[]{ "central", "corporate" }, userRepos.getObservableRepositoryIds( USER_ALPACA ) ); + assertRepoIds( new String[]{ "coporate" }, userRepos.getObservableRepositoryIds( USER_GUEST ) ); + assertRepoIds( new String[]{ "central", "internal", "corporate", "snapshots", "secret" }, + userRepos.getObservableRepositoryIds( USER_ADMIN ) ); + + } + + @After + public void tearDown() + throws Exception + { + super.tearDown(); + restoreGuestInitialValues( USER_ALPACA ); + restoreGuestInitialValues( USER_GUEST ); + restoreGuestInitialValues( USER_ADMIN ); } private void assertRepoIds( String[] expectedRepoIds, List observableRepositoryIds ) @@ -80,8 +93,9 @@ public class DefaultUserRepositoriesTest if ( expectedRepoIds.length != observableRepositoryIds.size() ) { fail( "Size of Observable Repository Ids wrong, expected <" + expectedRepoIds.length + "> but got <" - + observableRepositoryIds.size() + "> instead. \nExpected: [" + StringUtils.join( expectedRepoIds, "," ) - + "]\nActual: [" + StringUtils.join( observableRepositoryIds.iterator(), "," ) + "]" ); + + observableRepositoryIds.size() + "> instead. \nExpected: [" + + StringUtils.join( expectedRepoIds, "," ) + "]\nActual: [" + + StringUtils.join( observableRepositoryIds.iterator(), "," ) + "]" ); } } diff --git a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/maven/archiva/security/RoleManagerTest.java b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/maven/archiva/security/RoleManagerTest.java index 4f83d822f..3923d876f 100644 --- a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/maven/archiva/security/RoleManagerTest.java +++ b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/maven/archiva/security/RoleManagerTest.java @@ -38,9 +38,7 @@ import javax.inject.Inject; public class RoleManagerTest extends TestCase { - /** - * @plexus.requirement role-hint="default" - */ + @Inject RoleManager roleManager;