use of org.apache.directory.fortress.core.model.Group in project directory-fortress-core by apache.
the class GroupAntTest method readGroups.
private void readGroups(String msg, List<Group> groups) {
LogUtil.logIt(msg);
try {
GroupMgr groupMgr = GroupMgrFactory.createInstance();
for (Group inGroup : groups) {
Group outGroup = groupMgr.read(inGroup);
assertNotNull(outGroup);
assertEqual(inGroup, outGroup);
}
} catch (SecurityException ex) {
LOG.error("readGroups caught SecurityException=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.model.Group in project directory-fortress-core by apache.
the class GroupAntTest method testFindGroups.
@Test
public void testFindGroups() {
// gather role input data:
List<Addgroup> addgroups = fortressAntTask.getAddgroups();
for (Addgroup addgroup : addgroups) {
List<Group> groups = addgroup.getGroups();
findGroups("FIND-GRPS", groups);
}
}
use of org.apache.directory.fortress.core.model.Group in project directory-fortress-core by apache.
the class GroupMgrImplTest method deassignRoleMember.
private void deassignRoleMember(String message, Group group, String[][] roles) {
LogUtil.logIt(message);
try {
groupMgr = GroupMgrFactory.createInstance(TestUtils.getContext());
for (String[] roleArray : roles) {
Role role = RoleTestData.getRole(roleArray);
groupMgr.deassign(group, role.getName());
}
LOG.debug("deassignRoleMember group [" + group.getName() + "] successful");
int countOfOldRoles = group.getMembers().size();
// read from LDAP and get count of members
Group groupFromLdap = groupMgr.read(group);
int actualAmountOfMembers = groupFromLdap.getMembers().size();
assertEquals(CLS_NM + ".deassignRoleMember failed members size check", countOfOldRoles, actualAmountOfMembers);
} catch (SecurityException ex) {
ex.printStackTrace();
LOG.error("deassignRoleMember: caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.model.Group in project directory-fortress-core by apache.
the class GroupMgrImplTest method deleteGroups.
private void deleteGroups(String message, Group group) {
LogUtil.logIt(message);
try {
groupMgr = GroupMgrFactory.createInstance(TestUtils.getContext());
Group nameOnlyGroup = new Group(group.getName());
groupMgr.delete(nameOnlyGroup);
LOG.debug("addGroup group [" + group.getName() + "] successful");
} catch (SecurityException ex) {
ex.printStackTrace();
LOG.error("addGroup: caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.model.Group in project directory-fortress-core by apache.
the class GroupMgrImplTest method assignRoleMember.
private void assignRoleMember(String message, Group group, String[][] roles) {
LogUtil.logIt(message);
try {
groupMgr = GroupMgrFactory.createInstance(TestUtils.getContext());
for (String[] roleArray : roles) {
Role role = RoleTestData.getRole(roleArray);
groupMgr.assign(group, role.getName());
}
LOG.debug("assignRoleMember group [" + group.getName() + "] successful");
int countOfOldRoles = group.getMembers().size();
int countOfNewRoles = roles.length;
// read from LDAP and get count of members
Group groupFromLdap = groupMgr.read(group);
int actualAmountOfMembers = groupFromLdap.getMembers().size();
assertEquals(CLS_NM + ".assignRoleMember failed members size check", countOfOldRoles + countOfNewRoles, actualAmountOfMembers);
} catch (SecurityException ex) {
ex.printStackTrace();
LOG.error("assignRoleMember: caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
Aggregations