mirror of https://github.com/apache/archiva.git
ensure cleanup datas for other tests
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1133543 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c82abad170
commit
1fb61463c8
|
@ -19,14 +19,15 @@ package org.apache.maven.archiva.security;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DefaultUserRepositoriesTest
|
* DefaultUserRepositoriesTest
|
||||||
*
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +37,8 @@ public class DefaultUserRepositoriesTest
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception
|
public void setUp()
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
restoreGuestInitialValues( USER_ALPACA );
|
restoreGuestInitialValues( USER_ALPACA );
|
||||||
|
@ -67,10 +69,21 @@ public class DefaultUserRepositoriesTest
|
||||||
// the global repo observer role.
|
// the global repo observer role.
|
||||||
assignGlobalRepositoryObserverRole( USER_ADMIN );
|
assignGlobalRepositoryObserverRole( USER_ADMIN );
|
||||||
|
|
||||||
assertRepoIds( new String[] { "central", "corporate" }, userRepos.getObservableRepositoryIds( USER_ALPACA ) );
|
assertRepoIds( new String[]{ "central", "corporate" }, userRepos.getObservableRepositoryIds( USER_ALPACA ) );
|
||||||
assertRepoIds( new String[] { "coporate" }, userRepos.getObservableRepositoryIds( USER_GUEST ) );
|
assertRepoIds( new String[]{ "coporate" }, userRepos.getObservableRepositoryIds( USER_GUEST ) );
|
||||||
assertRepoIds( new String[] { "central", "internal", "corporate", "snapshots", "secret" }, userRepos
|
assertRepoIds( new String[]{ "central", "internal", "corporate", "snapshots", "secret" },
|
||||||
.getObservableRepositoryIds( USER_ADMIN ) );
|
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 )
|
private void assertRepoIds( String[] expectedRepoIds, List<String> observableRepositoryIds )
|
||||||
|
@ -80,8 +93,9 @@ public class DefaultUserRepositoriesTest
|
||||||
if ( expectedRepoIds.length != observableRepositoryIds.size() )
|
if ( expectedRepoIds.length != observableRepositoryIds.size() )
|
||||||
{
|
{
|
||||||
fail( "Size of Observable Repository Ids wrong, expected <" + expectedRepoIds.length + "> but got <"
|
fail( "Size of Observable Repository Ids wrong, expected <" + expectedRepoIds.length + "> but got <"
|
||||||
+ observableRepositoryIds.size() + "> instead. \nExpected: [" + StringUtils.join( expectedRepoIds, "," )
|
+ observableRepositoryIds.size() + "> instead. \nExpected: ["
|
||||||
+ "]\nActual: [" + StringUtils.join( observableRepositoryIds.iterator(), "," ) + "]" );
|
+ StringUtils.join( expectedRepoIds, "," ) + "]\nActual: ["
|
||||||
|
+ StringUtils.join( observableRepositoryIds.iterator(), "," ) + "]" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,7 @@ import javax.inject.Inject;
|
||||||
public class RoleManagerTest
|
public class RoleManagerTest
|
||||||
extends TestCase
|
extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="default"
|
|
||||||
*/
|
|
||||||
@Inject
|
@Inject
|
||||||
RoleManager roleManager;
|
RoleManager roleManager;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue