/** * <p> * Creates a new {@link Group} instance using the API. This method also checks if the group was properly created by * retrieving his information from the store. * </p> * * @throws Exception */ @Test public void testCreate() throws Exception { Group newGroupInstance = loadOrCreateGroup("someGroup", null, true); IdentityManager identityManager = getIdentityManager(); Group storedGroupInstance = identityManager.getGroup(newGroupInstance.getName()); assertNotNull(storedGroupInstance); assertEquals(newGroupInstance.getKey(), storedGroupInstance.getKey()); assertEquals(newGroupInstance.getName(), storedGroupInstance.getName()); }
/** * <p> * Creates a new {@link Group} instance as a child of another {@link Group} using the API. This method also checks if the * group was properly created by retrieving his information from the store. * </p> * * @throws Exception */ @Test public void testCreateWithParentGroup() throws Exception { Group childGroup = loadOrCreateGroup("childGroup", "parentGroup", true); // let's retrieve the group information and see if it was properly stored IdentityManager identityManager = getIdentityManager(); Group storedChildGroup = identityManager.getGroup(childGroup.getName()); assertNotNull(storedChildGroup); assertNotNull(storedChildGroup.getParentGroup()); assertEquals(childGroup.getKey(), storedChildGroup.getKey()); assertEquals(childGroup.getName(), storedChildGroup.getName()); assertEquals(childGroup.getParentGroup().getName(), storedChildGroup.getParentGroup().getName()); }
/** * <p> * Loads from the LDAP tree an already stored group. * </p> * * @throws Exception */ @Test public void testGet() throws Exception { Group storedGroupInstance = getIdentityType(true); IdentityManager identityManager = getIdentityManager(); storedGroupInstance = identityManager.getGroup(storedGroupInstance.getName()); assertNotNull(storedGroupInstance); assertNotNull(storedGroupInstance.getParentGroup()); assertEquals("GROUP:///Test Parent Group/Test Group", storedGroupInstance.getKey()); assertEquals("Test Group", storedGroupInstance.getName()); }
/** * <p> * Loads from the LDAP tree an already stored group. * </p> * * @throws Exception */ @Test public void testGetWithParent() throws Exception { Group storedGroupInstance = getIdentityType(true); IdentityManager identityManager = getIdentityManager(); storedGroupInstance = identityManager.getGroup("Test Group", new SimpleGroup("Test Parent Group")); assertNotNull(storedGroupInstance); assertNotNull(storedGroupInstance.getParentGroup()); assertEquals("GROUP:///Test Parent Group/Test Group", storedGroupInstance.getKey()); assertEquals("Test Group", storedGroupInstance.getName()); Group invalidGroupInstance = identityManager.getGroup("Test Group", new SimpleGroup("Invalid Parent Group")); assertNull(invalidGroupInstance); }
&& membership.getGroup().getKey().equals(fileUser.getKey())) { valuesMatchCount--;