use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class SearchTest method roleAssignmentSearchTest.
@Test
public void roleAssignmentSearchTest() throws Exception {
PrismReferenceValue r456 = new PrismReferenceValue("r123", RoleType.COMPLEX_TYPE);
ObjectQuery query = QueryBuilder.queryFor(UserType.class, prismContext).item(UserType.F_ASSIGNMENT, AssignmentType.F_TARGET_REF).ref(r456).build();
OperationResult result = new OperationResult("search");
List<PrismObject<UserType>> users = repositoryService.searchObjects(UserType.class, query, null, result);
result.recomputeStatus();
assertTrue(result.isSuccess());
assertEquals("Should find one user", 1, users.size());
assertEquals("Wrong user name", "atestuserX00002", users.get(0).getName().getOrig());
}
use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class SearchTest method personaSearchTest.
@Test
public void personaSearchTest() throws Exception {
PrismReferenceValue u000 = new PrismReferenceValue("u000", UserType.COMPLEX_TYPE);
ObjectQuery query = QueryBuilder.queryFor(UserType.class, prismContext).item(UserType.F_PERSONA_REF).ref(u000).build();
OperationResult result = new OperationResult("search");
List<PrismObject<UserType>> users = repositoryService.searchObjects(UserType.class, query, null, result);
result.recomputeStatus();
assertTrue(result.isSuccess());
assertEquals("Should find one user", 1, users.size());
assertEquals("Wrong user name", "atestuserX00003", users.get(0).getName().getOrig());
PrismReferenceValue r789 = new PrismReferenceValue("r789", RoleType.COMPLEX_TYPE);
query = QueryBuilder.queryFor(UserType.class, prismContext).item(UserType.F_PERSONA_REF).ref(r789).build();
users = repositoryService.searchObjects(UserType.class, query, null, result);
result.recomputeStatus();
assertTrue(result.isSuccess());
assertEquals("Should find no users", 0, users.size());
}
use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class SearchTest method roleMembershipSearchTest.
@Test
public void roleMembershipSearchTest() throws Exception {
PrismReferenceValue r456 = new PrismReferenceValue("r456", RoleType.COMPLEX_TYPE);
r456.setRelation(SchemaConstants.ORG_DEFAULT);
ObjectQuery query = QueryBuilder.queryFor(UserType.class, prismContext).item(UserType.F_ROLE_MEMBERSHIP_REF).ref(r456).build();
OperationResult result = new OperationResult("search");
List<PrismObject<UserType>> users = repositoryService.searchObjects(UserType.class, query, null, result);
result.recomputeStatus();
assertTrue(result.isSuccess());
assertEquals("Should find one user", 1, users.size());
assertEquals("Wrong user name", "atestuserX00003", users.get(0).getName().getOrig());
PrismReferenceValue r123 = new PrismReferenceValue("r123", RoleType.COMPLEX_TYPE);
query = QueryBuilder.queryFor(UserType.class, prismContext).item(UserType.F_ROLE_MEMBERSHIP_REF).ref(r123).build();
users = repositoryService.searchObjects(UserType.class, query, null, result);
result.recomputeStatus();
assertTrue(result.isSuccess());
assertEquals("Should find two users", 2, users.size());
PrismReferenceValue r123approver = new PrismReferenceValue("r123", RoleType.COMPLEX_TYPE);
r123approver.setRelation(SchemaConstants.ORG_APPROVER);
query = QueryBuilder.queryFor(UserType.class, prismContext).item(UserType.F_ROLE_MEMBERSHIP_REF).ref(r123approver).build();
users = repositoryService.searchObjects(UserType.class, query, null, result);
result.recomputeStatus();
assertTrue(result.isSuccess());
assertEquals("Should find no users", 0, users.size());
}
use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class TaskQuartzImpl method setObjectRefAndPrepareDelta.
private ReferenceDelta setObjectRefAndPrepareDelta(ObjectReferenceType value) {
setObjectRefTransient(value);
PrismReferenceValue prismReferenceValue = new PrismReferenceValue();
prismReferenceValue.setOid(value.getOid());
prismReferenceValue.setTargetType(value.getType());
return isPersistent() ? ReferenceDelta.createModificationReplace(TaskType.F_OBJECT_REF, taskManager.getTaskObjectDefinition(), prismReferenceValue) : null;
}
use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class TestVillage method assertLdapLocGov.
private void assertLdapLocGov(PrismObject<UserType> user, String expLoc, String expOrg) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException, ExpressionEvaluationException {
UserType userType = user.asObjectable();
String groupCn = expOrg + ":" + expLoc;
String groupDn = "cn=" + groupCn + ",ou=groups," + openDJController.getSuffix();
Entry groupEntry = openDJController.fetchAndAssertEntry(groupDn, "groupOfUniqueNames");
display("Group entry", groupEntry);
PrismReferenceValue accountLinkRef = getLinkRef(user, RESOURCE_OPENDJ_OID);
PrismObject<ShadowType> accountShadow = getShadowModel(accountLinkRef.getOid());
String accountDn = IntegrationTestTools.getSecondaryIdentifier(accountShadow);
openDJController.assertUniqueMember(groupEntry, accountDn);
}
Aggregations