fix more unit tests
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1433398 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ac75e9747f
commit
631814268a
|
@ -297,4 +297,9 @@ public class LdapRbacManagerTest
|
||||||
{
|
{
|
||||||
return size + 1;
|
return size + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean supportChildRole()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,10 +295,26 @@ public abstract class AbstractRbacManagerTestCase
|
||||||
assertEventTracker( 1, 0, 0, 0, true, true );
|
assertEventTracker( 1, 0, 0, 0, true, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ldap doesn't support child roles
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected boolean supportChildRole()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddGetChildRole()
|
public void testAddGetChildRole()
|
||||||
throws RbacManagerException
|
throws RbacManagerException
|
||||||
{
|
{
|
||||||
|
if ( !supportChildRole() )
|
||||||
|
{
|
||||||
|
log.info( "child role feature not supported by the RBACManager impl: {}",
|
||||||
|
rbacManager.getClass().getName() );
|
||||||
|
return;
|
||||||
|
}
|
||||||
RBACManager manager = rbacManager;
|
RBACManager manager = rbacManager;
|
||||||
assertNotNull( manager );
|
assertNotNull( manager );
|
||||||
|
|
||||||
|
@ -383,7 +399,7 @@ public abstract class AbstractRbacManagerTestCase
|
||||||
|
|
||||||
manager.saveUserAssignment( assignment );
|
manager.saveUserAssignment( assignment );
|
||||||
|
|
||||||
assertEquals( incAssignements( 1 ), manager.getAllUserAssignments().size() );
|
assertEquals( 1, manager.getAllUserAssignments().size() );
|
||||||
assertEquals( 1, manager.getAllRoles().size() );
|
assertEquals( 1, manager.getAllRoles().size() );
|
||||||
|
|
||||||
UserAssignment ua = manager.getUserAssignment( adminPrincipal );
|
UserAssignment ua = manager.getUserAssignment( adminPrincipal );
|
||||||
|
@ -416,7 +432,7 @@ public abstract class AbstractRbacManagerTestCase
|
||||||
assignment = manager.saveUserAssignment( assignment );
|
assignment = manager.saveUserAssignment( assignment );
|
||||||
|
|
||||||
assertEquals( 1, assignment.getRoleNames().size() );
|
assertEquals( 1, assignment.getRoleNames().size() );
|
||||||
assertEquals( 1, manager.getAssignedRoles( adminPrincipal ).size() );
|
assertEquals( incAssignements( 1 ), manager.getAssignedRoles( adminPrincipal ).size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -432,7 +448,7 @@ public abstract class AbstractRbacManagerTestCase
|
||||||
|
|
||||||
admin = manager.saveRole( admin );
|
admin = manager.saveRole( admin );
|
||||||
|
|
||||||
assertEquals( incAssignements( 1 ), manager.getAllRoles().size() );
|
assertEquals( 1, manager.getAllRoles().size() );
|
||||||
|
|
||||||
String adminPrincipal = "admin";
|
String adminPrincipal = "admin";
|
||||||
|
|
||||||
|
@ -442,7 +458,7 @@ public abstract class AbstractRbacManagerTestCase
|
||||||
|
|
||||||
manager.saveUserAssignment( ua );
|
manager.saveUserAssignment( ua );
|
||||||
|
|
||||||
assertEquals( incAssignements( 1 ), manager.getAllUserAssignments().size() );
|
assertEquals( 1, manager.getAllUserAssignments().size() );
|
||||||
|
|
||||||
Set<Permission> assignedPermissions = manager.getAssignedPermissions( adminPrincipal );
|
Set<Permission> assignedPermissions = manager.getAssignedPermissions( adminPrincipal );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue