use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class TestActivitiQuery method test300SearchByAssignee.
@Test
public void test300SearchByAssignee() throws Exception {
final String TEST_NAME = "test210SearchByAssignee";
TestUtil.displayTestTile(this, TEST_NAME);
login(userAdministrator);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
List<PrismReferenceValue> assigneeRefs = new ArrayList<>();
assigneeRefs.add(prv("oid-number-1"));
assigneeRefs.add(prv(userLead1Oid));
assigneeRefs.add(prv("oid-number-3"));
assigneeRefs.add(prv("oid-number-4"));
assigneeRefs.add(prv("oid-number-5"));
assigneeRefs.add(prv("oid-number-6"));
ObjectQuery query = QueryBuilder.queryFor(WorkItemType.class, prismContext).item(WorkItemType.F_ASSIGNEE_REF).ref(assigneeRefs).build();
SearchResultList<WorkItemType> items = modelService.searchContainers(WorkItemType.class, query, null, task, result);
assertEquals("Wrong # of work items found using multi-assignee/multi-delegate query", 1, items.size());
}
use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class OrgStructTest method test101ParentOrgRefFilterManagerRelation.
@Test
public void test101ParentOrgRefFilterManagerRelation() throws Exception {
final String TEST_NAME = "test101ParentOrgRefFilterManagerRelation";
TestUtil.displayTestTile(TEST_NAME);
OperationResult opResult = new OperationResult(TEST_NAME);
PrismReferenceValue refVal = new PrismReferenceValue(ORG_F001_OID);
refVal.setRelation(SchemaConstants.ORG_MANAGER);
ObjectQuery query = QueryBuilder.queryFor(ObjectType.class, prismContext).item(ObjectType.F_PARENT_ORG_REF).ref(refVal).build();
// WHEN
List<PrismObject<ObjectType>> orgs = repositoryService.searchObjects(ObjectType.class, query, null, opResult);
// THEN
PrismAsserts.assertOids(orgs, ELAINE_OID);
}
use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class OrgStructTest method test102ParentOrgRefFilterAnyRelation.
@Test
public void test102ParentOrgRefFilterAnyRelation() throws Exception {
final String TEST_NAME = "test102ParentOrgRefFilterAnyRelation";
TestUtil.displayTestTile(TEST_NAME);
OperationResult opResult = new OperationResult(TEST_NAME);
PrismReferenceValue refVal = new PrismReferenceValue(ORG_F001_OID);
refVal.setRelation(PrismConstants.Q_ANY);
ObjectQuery query = QueryBuilder.queryFor(ObjectType.class, prismContext).item(ObjectType.F_PARENT_ORG_REF).ref(refVal).build();
// WHEN
List<PrismObject<ObjectType>> orgs = repositoryService.searchObjects(ObjectType.class, query, null, opResult);
// THEN
PrismAsserts.assertOids(orgs, ORG_F002_OID, ORG_F003_OID, ORG_F004_OID, ELAINE_OID, ELAINE_OID);
}
use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class AbstractPasswordTest method test300TwoParentOrgRefs.
// TODO: add user with password that violates the policy
/**
* Create an org, and create two parentOrgRefs for jack (MID-3099).
* Change to password that violates the password policy.
*/
@Test
public void test300TwoParentOrgRefs() throws Exception {
final String TEST_NAME = "test300TwoParentOrgRefs";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);
assignOrg(USER_JACK_OID, ORG_GOVERNOR_OFFICE_OID, null);
assignOrg(USER_JACK_OID, ORG_GOVERNOR_OFFICE_OID, SchemaConstants.ORG_MANAGER);
UserType jack = getUser(USER_JACK_OID).asObjectable();
display("jack", jack);
assertEquals("Wrong # of parentOrgRefs", 2, jack.getParentOrgRef().size());
ObjectDelta<OrgType> orgDelta = (ObjectDelta<OrgType>) DeltaBuilder.deltaFor(OrgType.class, prismContext).item(OrgType.F_PASSWORD_POLICY_REF).replace(new PrismReferenceValue(PASSWORD_POLICY_GLOBAL_OID)).asObjectDelta(ORG_GOVERNOR_OFFICE_OID);
executeChanges(orgDelta, null, task, result);
OrgType govOffice = getObject(OrgType.class, ORG_GOVERNOR_OFFICE_OID).asObjectable();
display("governor's office", govOffice);
assertEquals("Wrong OID of password policy ref", PASSWORD_POLICY_GLOBAL_OID, govOffice.getPasswordPolicyRef().getOid());
try {
// WHEN
modifyUserChangePassword(USER_JACK_OID, USER_PASSWORD_1_CLEAR, task, result);
AssertJUnit.fail("Unexpected success");
} catch (PolicyViolationException e) {
// This is expected
display("Exected exception", e);
}
// THEN
result.computeStatus();
TestUtil.assertFailure(result);
PrismObject<UserType> userJack = getUser(USER_JACK_OID);
display("User after change execution", userJack);
assertLinks(userJack, 3);
// Make sure that the password is unchanged
assertUserPassword(userJack, USER_PASSWORD_VALID_1);
assertPasswordMetadata(userJack, false, lastPasswordChangeStart, lastPasswordChangeEnd);
assertDummyPassword(ACCOUNT_JACK_DUMMY_USERNAME, USER_PASSWORD_VALID_1);
assertDummyAccount(RESOURCE_DUMMY_YELLOW_NAME, ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true);
assertDummyPassword(RESOURCE_DUMMY_YELLOW_NAME, ACCOUNT_JACK_DUMMY_USERNAME, USER_PASSWORD_VALID_1);
assertDummyPassword(RESOURCE_DUMMY_UGLY_NAME, ACCOUNT_JACK_DUMMY_USERNAME, USER_JACK_EMPLOYEE_NUMBER_NEW_GOOD);
}
use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class AbstractPasswordTest method test200ApplyPasswordPolicy.
@Test
public void test200ApplyPasswordPolicy() throws Exception {
final String TEST_NAME = "test200ApplyPasswordPolicy";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);
PrismReferenceValue passPolicyRef = new PrismReferenceValue(PASSWORD_POLICY_GLOBAL_OID, ValuePolicyType.COMPLEX_TYPE);
// WHEN
modifyObjectReplaceReference(SecurityPolicyType.class, getSecurityPolicyOid(), new ItemPath(SecurityPolicyType.F_CREDENTIALS, CredentialsPolicyType.F_PASSWORD, PasswordCredentialsPolicyType.F_PASSWORD_POLICY_REF), task, result, passPolicyRef);
modifyObjectReplaceProperty(SecurityPolicyType.class, getSecurityPolicyOid(), new ItemPath(SecurityPolicyType.F_CREDENTIALS, CredentialsPolicyType.F_PASSWORD, PasswordCredentialsPolicyType.F_HISTORY_LENGTH), task, result, 3);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
}
Aggregations