use of com.evolveum.midpoint.schema.SearchResultList in project midpoint by Evolveum.
the class SqaleRepoSearchTest method test915SearchByUpperCaseOidPrefixGoe.
@Test
public void test915SearchByUpperCaseOidPrefixGoe() throws SchemaException {
when("searching for objects with upper-case OID prefix greater than or equal");
OperationResult operationResult = createOperationResult();
SearchResultList<ServiceType> result = repositorySearchObjects(ServiceType.class, prismContext.queryFor(ServiceType.class).item(ServiceType.F_COST_CENTER).eq("OIDTEST").and().item(PrismConstants.T_ID).ge("FF").build(), operationResult);
then("user with OID greater than or equal to specified prefix ignoring case are returned");
assertThatOperationResult(operationResult).isSuccess();
assertThat(result).extracting(o -> o.getOid()).containsExactlyInAnyOrder("ff000000-0000-0000-0000-000000000000", "ffffffff-ffff-ffff-ffff-ffffffffffff");
}
use of com.evolveum.midpoint.schema.SearchResultList in project midpoint by Evolveum.
the class SqaleRepoSearchTest method searchCaseWorkItemByAssignee.
private void searchCaseWorkItemByAssignee(String assigneeOid, String... expectedCaseOids) throws Exception {
when("searching case with query for workitem/assigneeRef OID " + assigneeOid);
OperationResult operationResult = createOperationResult();
SearchResultList<CaseType> result = searchObjects(CaseType.class, prismContext.queryFor(CaseType.class).item(CaseType.F_WORK_ITEM, CaseWorkItemType.F_ASSIGNEE_REF).ref(assigneeOid).build(), operationResult);
then("case with the matching workitem assigneeRef is returned");
assertThatOperationResult(operationResult).isSuccess();
assertThat(result).extracting(o -> o.getOid()).containsExactlyInAnyOrder(expectedCaseOids);
}
use of com.evolveum.midpoint.schema.SearchResultList in project midpoint by Evolveum.
the class AuditSearchTest method test252SearchByChangedItemsComplexPath.
@Test
public void test252SearchByChangedItemsComplexPath() throws SchemaException {
when("searching audit by changed items equal to complex path");
SearchResultList<AuditEventRecordType> result = searchObjects(prismContext.queryFor(AuditEventRecordType.class).item(AuditEventRecordType.F_CHANGED_ITEM).eq(new ItemPathType(ItemPath.create(ObjectType.F_METADATA, MetadataType.F_REQUEST_TIMESTAMP))).build());
then("only audit events with the specified changed items are returned");
assertThat(result).hasSize(1);
assertThat(result).extracting(aer -> aer.getParameter()).containsExactlyInAnyOrder("1");
}
use of com.evolveum.midpoint.schema.SearchResultList in project midpoint by Evolveum.
the class AuditSearchTest method test250SearchByChangedItemsSimplePath.
@Test
public void test250SearchByChangedItemsSimplePath() throws SchemaException {
when("searching audit by changed items equal to simple path");
SearchResultList<AuditEventRecordType> result = searchObjects(prismContext.queryFor(AuditEventRecordType.class).item(AuditEventRecordType.F_CHANGED_ITEM).eq(new ItemPathType(UserType.F_FULL_NAME)).build());
then("audit events with the specified changed items are returned");
assertThat(result).hasSize(2);
assertThat(result).extracting(aer -> aer.getParameter()).containsExactlyInAnyOrder("1", "2");
}
use of com.evolveum.midpoint.schema.SearchResultList in project midpoint by Evolveum.
the class TaskRetriever method searchTasks.
@NotNull
public SearchResultList<PrismObject<TaskType>> searchTasks(ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult result) throws SchemaException {
// returns null if noFetch is set
ClusterStatusInformation csi = clusterStatusInformationRetriever.getClusterStatusInformation(options, TaskType.class, true, result);
List<PrismObject<TaskType>> tasksInRepository;
try {
tasksInRepository = repositoryService.searchObjects(TaskType.class, query, options, result);
} catch (SchemaException e) {
result.recordFatalError("Couldn't get tasks from repository: " + e.getMessage(), e);
throw e;
}
boolean retrieveNextRunStartTime = SelectorOptions.hasToLoadPath(TaskType.F_NEXT_RUN_START_TIMESTAMP, options);
boolean retrieveRetryTime = SelectorOptions.hasToLoadPath(TaskType.F_NEXT_RETRY_TIMESTAMP, options);
boolean retrieveNodeAsObserved = SelectorOptions.hasToLoadPath(TaskType.F_NODE_AS_OBSERVED, options);
boolean loadSubtasks = SelectorOptions.hasToLoadPath(TaskType.F_SUBTASK_REF, options);
List<PrismObject<TaskType>> tasks = new ArrayList<>();
for (PrismObject<TaskType> taskInRepository : tasksInRepository) {
addTransientTaskInformation(taskInRepository, csi, retrieveNextRunStartTime, retrieveRetryTime, retrieveNodeAsObserved, result);
if (loadSubtasks) {
fillInSubtasks(taskInRepository, csi, options, result);
}
tasks.add(taskInRepository);
}
return new SearchResultList<>(tasks);
}
Aggregations