Search in sources :

Example 1 with ListXNodeImpl

use of com.evolveum.midpoint.prism.impl.xnode.ListXNodeImpl in project midpoint by Evolveum.

the class PerfTestPrismObjectSize method generateTestObject.

private static final RootXNode generateTestObject(int count, int conflicts, boolean withIds) throws SchemaException, IOException {
    @NotNull PrismObject<UserType> baseObject = getJack();
    @NotNull RootXNode rootNode = getPrismContext().xnodeSerializer().serialize(baseObject);
    MapXNodeImpl user = (MapXNodeImpl) rootNode.getSubnode();
    ListXNodeImpl assignments = new ListXNodeImpl();
    int unique = count - conflicts;
    List<String> uuids = generateUUIDs(unique);
    for (int i = 0; i < unique; i++) {
        assignments.add(createXNodeAssignment(uuids.get(i), withIds ? i : -1));
    }
    for (int i = 0; i < conflicts; i++) {
        int id = unique - 1 - i;
        assignments.add(createXNodeAssignment(uuids.get(id), withIds ? id : -1));
    }
    user.put(UserType.F_ASSIGNMENT, assignments);
    return rootNode;
}
Also used : RootXNode(com.evolveum.midpoint.prism.xnode.RootXNode) MapXNodeImpl(com.evolveum.midpoint.prism.impl.xnode.MapXNodeImpl) NotNull(org.jetbrains.annotations.NotNull) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ListXNodeImpl(com.evolveum.midpoint.prism.impl.xnode.ListXNodeImpl)

Aggregations

ListXNodeImpl (com.evolveum.midpoint.prism.impl.xnode.ListXNodeImpl)1 MapXNodeImpl (com.evolveum.midpoint.prism.impl.xnode.MapXNodeImpl)1 RootXNode (com.evolveum.midpoint.prism.xnode.RootXNode)1 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)1 NotNull (org.jetbrains.annotations.NotNull)1