/** 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)); } }
public void testNobody() { System.out.println("testNobody"); SimplePrincipal nobody = new SimplePrincipal("<NOBODY>"); principal.addMember(nobody); assertTrue( "AnybodyPrincipal.isMember", principal.isMember(NobodyPrincipal.NOBODY_PRINCIPAL) == false); }
/** 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(); } }
/** 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(); } }
public void testEquals() { System.out.println("testEquals"); SimpleGroup CallerPrincipal = new SimpleGroup("CallerPrincipal"); assertTrue(principal.equals(CallerPrincipal)); }
public void testGetName() { System.out.println("testGetName"); assertTrue(principal.getName().equals("CallerPrincipal")); }
public void testAnybody() { System.out.println("testAnybody"); principal.addMember(principals[0]); assertTrue("AnybodyPrincipal.isMember", principal.isMember(AnybodyPrincipal.ANYBODY_PRINCIPAL)); }