use of org.apache.directory.fortress.core.model.SDSet in project directory-fortress-core by apache.
the class AdminMgrImplTest method assignUsersDSD.
/**
* @param msg
* @param uArray
* @param sArray
*/
public static void assignUsersDSD(String msg, String[][] uArray, String[][] sArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
int i = 0;
for (String[] usr : uArray) {
SDSet dsd = RoleTestData.getSDSet(sArray[i++]);
Set<String> roles = dsd.getMembers();
User user = UserTestData.getUser(usr);
int j = 0;
for (String role : roles) {
j++;
UserRole uRole = new UserRole(user.getUserId(), role);
try {
adminMgr.assignUser(uRole);
} catch (SecurityException ex) {
LOG.error("assignUsersDSD caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(CLS_NM + "assignUsersDSD user [" + user.getUserId() + "] role [" + role + "] dsd [" + dsd.getName() + "] failed");
}
}
}
} catch (SecurityException ex) {
LOG.error("assignUsersDSD caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.model.SDSet in project directory-fortress-core by apache.
the class AdminMgrImplTest method createDsdSet.
/**
* @param sArray
*/
public static void createDsdSet(String msg, String[][] sArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
for (String[] dsdle : sArray) {
SDSet dsd = RoleTestData.getSDSet(dsdle);
SDSet entity = adminMgr.createDsdSet(dsd);
LOG.debug("createDsdSet DSD [" + entity.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("createDsdSet caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.model.SDSet in project directory-fortress-core by apache.
the class AdminMgrImplTest method deleteSsdSet.
/**
* @param sArray
*/
private void deleteSsdSet(String msg, String[][] sArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
for (String[] ssdle : sArray) {
SDSet ssd = RoleTestData.getSDSet(ssdle);
adminMgr.deleteSsdSet(ssd);
LOG.debug("deleteSsdSet role [" + ssd.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("deleteSsdSet caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.model.SDSet in project directory-fortress-core by apache.
the class AdminMgrImplTest method deleteDsdRoleMember.
/**
* @param sArray
*/
private void deleteDsdRoleMember(String msg, String[][] sArray, String[][] rArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
for (String[] dsdle : sArray) {
SDSet dsd = RoleTestData.getSDSet(dsdle);
// first add all of the roles as members of SSD entity:
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
dsd.addMember(role.getName());
}
// now iterate over roles and remove from DSD set one at a time.
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
adminMgr.deleteDsdRoleMember(dsd, role);
List<SDSet> dsdSets = reviewMgr.dsdRoleSets(role);
assertTrue(CLS_NM + "deleteDsdRoleMember list size check", dsdSets.size() == 0);
}
adminMgr.deleteDsdSet(dsd);
LOG.debug("deletedsdRoleMember DSD [" + dsd.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("deleteDsdRoleMember caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.model.SDSet in project directory-fortress-core by apache.
the class AdminMgrImplTest method addDsdRoleMember.
/**
* @param sArray
*/
public static void addDsdRoleMember(String msg, String[][] sArray, String[][] rArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
for (String[] dsdle : sArray) {
SDSet dsd = RoleTestData.getSDSet(dsdle);
SDSet entity = adminMgr.createDsdSet(dsd);
LOG.debug("addDsdRoleMember DSD [" + entity.getName() + "] successful");
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
adminMgr.addDsdRoleMember(dsd, role);
List<SDSet> dsdSets = reviewMgr.dsdRoleSets(role);
assertNotNull(dsdSets);
assertTrue(CLS_NM + "addDsdRoleMember list size check", dsdSets.size() == 1);
SDSet dsd2 = dsdSets.get(0);
assertTrue(CLS_NM + "addDsdRoleMember DSD name check", dsd.getName().equals(dsd2.getName()));
assertTrue(CLS_NM + "addDsdRoleMember DSD role check", dsd2.getMembers().contains(role.getName()));
// assertTrue(CLS_NM + "addDsdRoleMember DSD role check", dsd2.getMembers().containsKey(role.getName()));
}
}
} catch (SecurityException ex) {
LOG.error("addDsdRoleMember caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
Aggregations