use of com.evolveum.midpoint.prism.query.RefFilter in project midpoint by Evolveum.
the class PrismAsserts method assertRefFilter.
public static void assertRefFilter(ObjectFilter objectFilter, QName expectedFilterDef, QName expectedTypeName, ItemPath path) {
assertEquals("Wrong filter class", RefFilter.class, objectFilter.getClass());
RefFilter filter = (RefFilter) objectFilter;
assertEquals("Wrong filter definition element name", expectedFilterDef, filter.getDefinition().getName());
assertEquals("Wrong filter definition type", expectedTypeName, filter.getDefinition().getTypeName());
assertPathEquivalent("Wrong filter path", path, filter.getFullPath());
}
use of com.evolveum.midpoint.prism.query.RefFilter in project midpoint by Evolveum.
the class TestFilterExpression method test210EvaluateExpressionLinkRefDefaultsVal.
@Test
public void test210EvaluateExpressionLinkRefDefaultsVal() throws Exception {
final String TEST_NAME = "test210EvaluateExpressionLinkRefDefaultsVal";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
OperationResult result = new OperationResult(TestFilterExpression.class.getName() + "." + TEST_NAME);
Task task = taskManager.createTaskInstance(TEST_NAME);
ObjectFilter filter = evaluateExpressionAssertFilter("expression-linkref-filter-defaults.xml", ACCOUNT_SHADOW_GUYBRUSH_OID, RefFilter.class, task, result);
RefFilter refFilter = (RefFilter) filter;
assertEquals("Wrong number of values in filter: " + refFilter.getValues(), 1, refFilter.getValues().size());
executeFilter(filter, 1, task, result);
}
use of com.evolveum.midpoint.prism.query.RefFilter in project midpoint by Evolveum.
the class TestFilterExpression method test212EvaluateExpressionLinkRefObjectReferenceTypeDefaultsVal.
@Test
public void test212EvaluateExpressionLinkRefObjectReferenceTypeDefaultsVal() throws Exception {
final String TEST_NAME = "test212EvaluateExpressionLinkRefObjectReferenceTypeDefaultsVal";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
OperationResult result = new OperationResult(TestFilterExpression.class.getName() + "." + TEST_NAME);
Task task = taskManager.createTaskInstance(TEST_NAME);
ObjectFilter filter = evaluateExpressionAssertFilter("expression-linkref-object-reference-type-filter-defaults.xml", ACCOUNT_SHADOW_GUYBRUSH_OID, RefFilter.class, task, result);
RefFilter refFilter = (RefFilter) filter;
assertEquals("Wrong number of values in filter: " + refFilter.getValues(), 1, refFilter.getValues().size());
executeFilter(filter, 1, task, result);
}
use of com.evolveum.midpoint.prism.query.RefFilter in project midpoint by Evolveum.
the class TestFilterExpression method test200EvaluateExpressionLinkRefDefaultsNull.
@Test
public void test200EvaluateExpressionLinkRefDefaultsNull() throws Exception {
final String TEST_NAME = "test200EvaluateExpressionLinkRefDefaultsNull";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
OperationResult result = new OperationResult(TestFilterExpression.class.getName() + "." + TEST_NAME);
Task task = taskManager.createTaskInstance(TEST_NAME);
ObjectFilter filter = evaluateExpressionAssertFilter("expression-linkref-filter-defaults.xml", null, RefFilter.class, task, result);
RefFilter refFilter = (RefFilter) filter;
AssertJUnit.assertNull("Expected NO values in filter, but found " + refFilter.getValues(), refFilter.getValues());
executeFilter(filter, 2, task, result);
}
use of com.evolveum.midpoint.prism.query.RefFilter in project midpoint by Evolveum.
the class TestSecurityBasic method test290AutzJackRoleOwnerAssign.
@Test
public void test290AutzJackRoleOwnerAssign() throws Exception {
final String TEST_NAME = "test290AutzJackRoleOwnerAssign";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
cleanupAutzTest(USER_JACK_OID);
assignRole(USER_JACK_OID, ROLE_ROLE_OWNER_ASSIGN_OID);
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.RELATIVE);
login(USER_JACK_USERNAME);
// WHEN
TestUtil.displayWhen(TEST_NAME);
assertReadAllow(NUMBER_OF_ALL_USERS + 1);
assertAddDeny();
assertModifyDeny();
assertDeleteDeny();
PrismObject<UserType> user = getUser(USER_JACK_OID);
assertAssignments(user, 2);
assertAssignedRole(user, ROLE_ROLE_OWNER_ASSIGN_OID);
assertAllow("assign application role 1 to jack", (task, result) -> assignRole(USER_JACK_OID, ROLE_APPLICATION_1_OID, task, result));
user = getUser(USER_JACK_OID);
assertAssignments(user, 3);
assertAssignedRole(user, ROLE_APPLICATION_1_OID);
assertDeny("assign application role 2 to jack", new Attempt() {
@Override
public void run(Task task, OperationResult result) throws Exception {
assignRole(USER_JACK_OID, ROLE_APPLICATION_2_OID, task, result);
}
});
assertAllow("unassign application role 1 from jack", (task, result) -> unassignRole(USER_JACK_OID, ROLE_APPLICATION_1_OID, task, result));
user = getUser(USER_JACK_OID);
assertAssignments(user, 2);
RoleSelectionSpecification spec = getAssignableRoleSpecification(getUser(USER_JACK_OID));
assertRoleTypes(spec);
assertFilter(spec.getFilter(), TypeFilter.class);
assertEquals("Wrong type filter type", RoleType.COMPLEX_TYPE, ((TypeFilter) spec.getFilter()).getType());
ObjectFilter subfilter = ((TypeFilter) spec.getFilter()).getFilter();
assertFilter(subfilter, RefFilter.class);
assertEquals(1, ((RefFilter) subfilter).getValues().size());
assertEquals("Wrong OID in ref filter", USER_JACK_OID, ((RefFilter) subfilter).getValues().get(0).getOid());
assertGlobalStateUntouched();
}
Aggregations