use of com.evolveum.midpoint.schema.SearchResultList in project midpoint by Evolveum.
the class SqaleRepoSearchTest method test960SearchGetNames.
@Test
public void test960SearchGetNames() throws SchemaException {
var options = SchemaService.get().getOperationOptionsBuilder().resolveNames().build();
ObjectQuery query = PrismContext.get().queryFor(FocusType.class).all().build();
SearchResultList<FocusType> result = searchObjects(FocusType.class, query, createOperationResult(), options.iterator().next());
assertNotNull(result);
// noinspection rawtypes
Visitor check = visitable -> {
if (visitable instanceof PrismReferenceValue) {
assertNotNull(((PrismReferenceValue) visitable).getTargetName(), "TargetName should be set.");
}
};
for (FocusType obj : result) {
// noinspection unchecked
obj.asPrismObject().accept(check);
}
}
use of com.evolveum.midpoint.schema.SearchResultList in project midpoint by Evolveum.
the class SqaleRepoSearchTest method test503SearchObjectWithAnyValueForExtensionItemOrderedByIt.
@Test
public void test503SearchObjectWithAnyValueForExtensionItemOrderedByIt() throws SchemaException {
SearchResultList<UserType> result = searchUsersTest("with extension string item with any value ordered by that item", f -> f.not().item(UserType.F_EXTENSION, new QName("string")).isNull().asc(UserType.F_EXTENSION, new QName("string")), user1Oid, user2Oid);
// "other..." < "string..."
assertThat(result.get(0).getOid()).isEqualTo(user2Oid);
result = searchUsersTest("with extension string item with any value ordered by that item", f -> f.not().item(UserType.F_EXTENSION, new QName("string")).isNull().desc(UserType.F_EXTENSION, new QName("string")), user1Oid, user2Oid);
// to be sure it works both ways
assertThat(result.get(0).getOid()).isEqualTo(user1Oid);
}
use of com.evolveum.midpoint.schema.SearchResultList in project midpoint by Evolveum.
the class SqaleRepoSearchTest method test960SearchByAxiomQueryLanguage.
@Test
public void test960SearchByAxiomQueryLanguage() throws SchemaException {
OperationResult operationResult = createOperationResult();
given("query for not-indexed extension");
SearchResultList<FocusType> result = searchObjects(FocusType.class, ". type UserType and costCenter startsWith \"5\"", operationResult);
expect("searchObjects throws exception because of not-indexed item");
assertThat(result).extracting(f -> f.getOid()).containsExactlyInAnyOrder(user3Oid, user4Oid);
}
use of com.evolveum.midpoint.schema.SearchResultList in project midpoint by Evolveum.
the class SqaleRepoSearchTest method test911SearchByOidLowerThan.
// Following OID tests use services in one cost center, only OID conditions are of interest.
@Test
public void test911SearchByOidLowerThan() throws SchemaException {
when("searching for objects with OID lower than");
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).lt("00000000-1000-0000-0000-000000000000").build(), operationResult);
then("user with OID lower than specified are returned");
assertThatOperationResult(operationResult).isSuccess();
assertThat(result).extracting(o -> o.getOid()).containsExactlyInAnyOrder();
}
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");
}
Aggregations