use of org.apache.directory.fortress.core.ReviewMgr in project directory-fortress-core by apache.
the class ReviewMgrImplTest method readPASetFromPermission.
public static void readPASetFromPermission(String msg, String paSetName, String obj, String[] op) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
Permission pop = PermTestData.getOp(obj, op);
Permission entity = reviewMgr.readPermission(pop);
assertTrue(paSetName, entity.getPaSets().contains(paSetName));
LOG.debug("readPASetFromPermission name [" + paSetName + "] successful");
} catch (SecurityException ex) {
LOG.error("readPASetFromPermission name [" + paSetName + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.ReviewMgr in project directory-fortress-core by apache.
the class ReviewMgrImplTest method teardownRequired.
/**
* Determine if old fortress regression test cases are loaded in this directory and must be torn down.
*
* @param msg
* @param rArray
*/
public static boolean teardownRequired(String msg, String[][] rArray) {
// default return is 'true':
boolean tearDown = true;
String methodName = ".teardownRequired";
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
for (String[] rle : rArray) {
Role entity = reviewMgr.readRole(new Role(RoleTestData.getName(rle)));
RoleTestData.assertEquals(entity, rle);
}
// if we get to here it means that old test data must be removed from directory.
} catch (SecurityException ex) {
// This is the expected when teardown is not required:
if (ex.getErrorId() == GlobalErrIds.ROLE_NOT_FOUND) {
// did not find old test data no need to teardown
tearDown = false;
} else {
// Something unexpected occurred here, Report as warning to the logger:
String warning = methodName + " caught SecurityException=" + ex.getMessage();
LOG.warn(warning);
// TODO: Determine if it would be better to throw a SecurityException here.
}
}
LOG.info(methodName + ":" + tearDown);
return tearDown;
}
use of org.apache.directory.fortress.core.ReviewMgr in project directory-fortress-core by apache.
the class ReviewMgrImplTest method testDeassignRoleWithRoleConstraint.
public void testDeassignRoleWithRoleConstraint() throws SecurityException {
AdminMgr adminMgr = AdminMgrImplTest.getManagedAdminMgr();
adminMgr.deassignUser(new UserRole(UserTestData.USERS_TU1[0][0], RoleTestData.ROLES_TR1[1][0]));
ReviewMgr reviewMgr = getManagedReviewMgr();
reviewMgr.assignedRoles(new User(UserTestData.USERS_TU1[0][0]));
adminMgr.assignUser(new UserRole(UserTestData.USERS_TU1[0][0], RoleTestData.ROLES_TR1[1][0]));
}
use of org.apache.directory.fortress.core.ReviewMgr in project directory-fortress-core by apache.
the class ReviewMgrImplTest method searchSsdSets.
/**
* @param msg
* @param srchValue
* @param sArray
*/
public static void searchSsdSets(String msg, String srchValue, String[][] sArray) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
SDSet sdSet = new SDSet();
sdSet.setName(srchValue);
List<SDSet> sdSetList = reviewMgr.ssdSets(sdSet);
assertNotNull(sdSetList);
} catch (SecurityException ex) {
LOG.error("searchRoles searchSsdSets [" + srchValue + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.ReviewMgr in project directory-fortress-core by apache.
the class ReviewMgrImplTest method searchDsdSets.
/**
* @param msg
* @param srchValue
* @param sArray
*/
public static void searchDsdSets(String msg, String srchValue, String[][] sArray) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
SDSet sdSet = new SDSet();
sdSet.setName(srchValue);
List<SDSet> sdSetList = reviewMgr.ssdSets(sdSet);
assertNotNull(sdSetList);
} catch (SecurityException ex) {
LOG.error("searchRoles searchDsdSets [" + srchValue + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
Aggregations