use of org.apache.directory.fortress.core.model.SDSet in project directory-fortress-core by apache.
the class AdminMgrImplTest method deleteSsdRoleMember.
/**
* @param sArray
*/
private void deleteSsdRoleMember(String msg, String[][] sArray, String[][] rArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
for (String[] ssdle : sArray) {
SDSet ssd = RoleTestData.getSDSet(ssdle);
// first add all of the roles as members of SSD entity:
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
ssd.addMember(role.getName());
}
// now iterate over roles and remove from SSD set one at a time.
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
adminMgr.deleteSsdRoleMember(ssd, role);
List<SDSet> ssdSets = reviewMgr.ssdRoleSets(role);
assertTrue(CLS_NM + "deleteSsdRoleMember list size check ssdSets size [" + ssdSets.size() + "]", ssdSets.size() == 0);
}
adminMgr.deleteSsdSet(ssd);
LOG.debug("deleteSsdRoleMember SSD [" + ssd.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("deleteSsdRoleMember 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 setSsdCardinality.
/**
* @param msg
* @param sArray
* @param rArray
*/
public static void setSsdCardinality(String msg, String[][] sArray, String[][] rArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
for (String[] ssdle : sArray) {
SDSet ssd = RoleTestData.getSDSet(ssdle);
SDSet entity = adminMgr.createSsdSet(ssd);
LOG.debug("setSsdCardinality SSD [" + entity.getName() + "] successful");
int cardinality = 1;
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
adminMgr.addSsdRoleMember(ssd, role);
adminMgr.setSsdSetCardinality(ssd, cardinality);
int currentCardinality = reviewMgr.ssdRoleSetCardinality(ssd);
assertTrue(CLS_NM + "setSsdCardinality cardinality check", currentCardinality == cardinality++);
}
}
} catch (SecurityException ex) {
LOG.error("setSsdCardinality 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 assignUsersSSD.
/**
* @param msg
* @param uArray
* @param sArray
*/
public static void assignUsersSSD(String msg, String[][] uArray, String[][] sArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
int i = 0;
for (String[] usr : uArray) {
SDSet ssd = RoleTestData.getSDSet(sArray[i++]);
// Set<String> roles = ssd.getMembers().keySet();
Set<String> roles = ssd.getMembers();
User user = UserTestData.getUser(usr);
int j = 0;
for (String role : roles) {
j++;
try {
UserRole uRole = new UserRole(user.getUserId(), role);
adminMgr.assignUser(uRole);
if (j >= ssd.getCardinality()) {
fail(CLS_NM + ".assignUsersSSD user [" + user.getUserId() + "] role [" + role + "] ssd [" + ssd.getName() + "] cardinality [" + ssd.getCardinality() + "] count [" + j + "] failed");
}
} catch (SecurityException ex) {
assertTrue(CLS_NM + ".assignUsersSSD cardinality test failed user [" + user.getUserId() + "] role [" + role + "] ssd [" + ssd.getName() + "] cardinality [" + ssd.getCardinality() + "] count [" + j + "]", j >= (ssd.getCardinality()));
assertTrue(CLS_NM + ".assignUsersSSD cardinality test failed [" + UserTestData.getUserId(usr) + "]", ex.getErrorId() == GlobalErrIds.SSD_VALIDATION_FAILED);
// still good, break from loop, we're done here
break;
}
}
}
} catch (SecurityException ex) {
LOG.error("assignUsersSSD 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 setDsdCardinality.
/**
* @param msg
* @param sArray
* @param rArray
*/
public static void setDsdCardinality(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("setDsdCardinality DSD [" + entity.getName() + "] successful");
int cardinality = 1;
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
adminMgr.addDsdRoleMember(dsd, role);
adminMgr.setDsdSetCardinality(dsd, cardinality);
int currentCardinality = reviewMgr.dsdRoleSetCardinality(dsd);
assertTrue(CLS_NM + "setDsdCardinality cardinality check", currentCardinality == cardinality++);
}
}
} catch (SecurityException ex) {
LOG.error("setDsdCardinality 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 createSsdSet.
/**
* @param sArray
*/
public static void createSsdSet(String msg, String[][] sArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
for (String[] ssdle : sArray) {
SDSet ssd = RoleTestData.getSDSet(ssdle);
SDSet entity = adminMgr.createSsdSet(ssd);
LOG.debug("createSsdSet SSD [" + entity.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("createSsdSet caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
Aggregations