use of com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypeType in project midpoint by Evolveum.
the class AssignmentObjectRelation method addArchetypeRef.
public void addArchetypeRef(PrismObject<ArchetypeType> archetype) {
if (archetypeRefs == null) {
archetypeRefs = new ArrayList<>();
}
ObjectReferenceType ref = MiscSchemaUtil.createObjectReference(archetype, ArchetypeType.class);
archetypeRefs.add(ref);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypeType in project midpoint by Evolveum.
the class TestRepositoryCache method test310AddInIterativeSearch.
/**
* MID-6250
*/
@Test
public void test310AddInIterativeSearch() throws SchemaException, ObjectAlreadyExistsException {
given();
PrismContext prismContext = getPrismContext();
OperationResult result = createOperationResult();
clearStatistics();
clearCaches();
String costCenter = "cc_" + getTestNameShort();
String name1 = getTestNameShort() + ".1";
String name2 = getTestNameShort() + ".2";
PrismObject<ArchetypeType> archetype1 = new ArchetypeType(prismContext).name(name1).costCenter(costCenter).asPrismObject();
repositoryCache.addObject(archetype1, null, result);
when();
ObjectQuery query = prismContext.queryFor(ArchetypeType.class).item(ArchetypeType.F_COST_CENTER).eq(costCenter).build();
AtomicInteger found = new AtomicInteger(0);
ResultHandler<ArchetypeType> handler = (object, result1) -> {
try {
PrismObject<ArchetypeType> archetype2 = new ArchetypeType(prismContext).name(name2).costCenter(costCenter).asPrismObject();
repositoryCache.addObject(archetype2, null, result);
} catch (SchemaException | ObjectAlreadyExistsException e) {
throw new AssertionError(e);
}
found.incrementAndGet();
return true;
};
repositoryCache.searchObjectsIterative(ArchetypeType.class, query, handler, null, false, result);
dumpStatistics();
assertThat(found.get()).as("objects found").isEqualTo(1);
List<PrismObject<ArchetypeType>> listAfter = repositoryCache.searchObjects(ArchetypeType.class, query, null, result);
then();
assertThat(listAfter.size()).as("objects found after").isEqualTo(2);
}
Aggregations