コード例 #1
0
 /** Test of members method, of class org.jboss.security.NestablePrincipal. */
 private void testMembers() {
   Enumeration<Principal> members = principal.members();
   while (members.hasMoreElements()) {
     Principal user = (Principal) members.nextElement();
     assertTrue("Members " + user, principal.isMember(user));
   }
 }
コード例 #2
0
 public void testNobody() {
   System.out.println("testNobody");
   SimplePrincipal nobody = new SimplePrincipal("<NOBODY>");
   principal.addMember(nobody);
   assertTrue(
       "AnybodyPrincipal.isMember", principal.isMember(NobodyPrincipal.NOBODY_PRINCIPAL) == false);
 }
コード例 #3
0
  /** Test of addMember method, of class org.jboss.security.NestablePrincipal. */
  public void testAddMember() {
    System.out.println("testAddMember");

    for (int p = 0; p < principals.length; p++) {
      Principal user = principals[p];
      principal.addMember(user);
      assertTrue("AddMember " + user, principal.isMember(user));
      testMembers();
    }
  }
コード例 #4
0
 /** Test of removeMember method, of class org.jboss.security.NestablePrincipal. */
 public void testRemoveMember() {
   System.out.println("testRemoveMember");
   for (int p = principals.length - 1; p >= 0; p--) {
     assertTrue("Remove " + principals[p], principal.removeMember(principals[p]));
     testMembers();
   }
 }
コード例 #5
0
 public void testEquals() {
   System.out.println("testEquals");
   SimpleGroup CallerPrincipal = new SimpleGroup("CallerPrincipal");
   assertTrue(principal.equals(CallerPrincipal));
 }
コード例 #6
0
 public void testGetName() {
   System.out.println("testGetName");
   assertTrue(principal.getName().equals("CallerPrincipal"));
 }
コード例 #7
0
 public void testAnybody() {
   System.out.println("testAnybody");
   principal.addMember(principals[0]);
   assertTrue("AnybodyPrincipal.isMember", principal.isMember(AnybodyPrincipal.ANYBODY_PRINCIPAL));
 }