]> source.dussan.org Git - archiva.git/commitdiff
ensure cleanup datas for other tests
authorOlivier Lamy <olamy@apache.org>
Wed, 8 Jun 2011 20:12:23 +0000 (20:12 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 8 Jun 2011 20:12:23 +0000 (20:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1133543 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/maven/archiva/security/DefaultUserRepositoriesTest.java
archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/maven/archiva/security/RoleManagerTest.java

index bc11b9436b7c057355ace82565556f9e5052a7b1..4c97075001a1253d7ff7e657891da6e22344695f 100644 (file)
@@ -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<String> 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(), "," ) + "]" );
         }
     }
 
index 4f83d822fbf930e4d18498bb8cc5a565d7023f82..3923d876fcbb24da9e1e4738ba49d6f5fd613750 100644 (file)
@@ -38,9 +38,7 @@ import javax.inject.Inject;
 public class RoleManagerTest
     extends TestCase
 {
-    /**
-     * @plexus.requirement role-hint="default"
-     */
+
     @Inject
     RoleManager roleManager;