use of com.sun.identity.policy.NameNotFoundException in project OpenAM by OpenRock.
the class PrivilegeUtils method pravToPav.
static Map pravToPav(Map<String, Boolean> actionValues, String serviceName) throws PolicyException, SSOException {
if (actionValues == null) {
return null;
}
ServiceType serviceType = null;
try {
serviceType = svcTypeManager.getServiceType(serviceName);
} catch (NameNotFoundException e) {
//ignore
}
Map av = new HashMap();
Set<String> keySet = actionValues.keySet();
for (String action : keySet) {
try {
Set values = new HashSet();
Boolean value = actionValues.get(action);
if (serviceType != null) {
ActionSchema as = serviceType.getActionSchema(action);
String trueValue = as.getTrueValue();
String falseValue = as.getFalseValue();
if (value.equals(Boolean.TRUE)) {
values.add(trueValue);
} else {
values.add(falseValue);
}
} else {
values.add(value.toString());
}
av.put(action, values);
} catch (InvalidNameException e) {
Boolean value = actionValues.get(action);
Set values = new HashSet();
values.add(value.toString());
av.put(action, values);
}
}
return av;
}
use of com.sun.identity.policy.NameNotFoundException in project OpenAM by OpenRock.
the class RealmTest method deletePolicy.
@Test(groups = { "cli-realm", "delete-policies" }, dependsOnMethods = { "getPolicy" })
public void deletePolicy() throws CLIException, PolicyException, SSOException {
entering("deletePolicy", null);
String[] args = { "delete-policies", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, "/", CLIConstants.PREFIX_ARGUMENT_LONG + RealmDeletePolicy.ARGUMENT_POLICY_NAMES, "clipolicy" };
SSOToken adminSSOToken = getAdminSSOToken();
CLIRequest req = new CLIRequest(null, args, adminSSOToken);
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
PolicyManager pm = new PolicyManager(adminSSOToken, "/");
try {
Policy p = pm.getPolicy("clipolicy");
assert (p == null);
} catch (NameNotFoundException e) {
// do nothing
}
exiting("deletePolicy");
}
Aggregations