Search in sources :

Example 1 with MapXNodeImpl

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

the class PerfTestPrismObjectSize method createXNodeAssignment.

private static final MapXNodeImpl createXNodeAssignment(String uuid, int id) {
    MapXNodeImpl assignment = new MapXNodeImpl();
    if (id > 0) {
        assignment.put(CONTAINER_ID, attribute(Long.valueOf(id)));
    }
    MapXNodeImpl construction = new MapXNodeImpl();
    assignment.put(AssignmentType.F_CONSTRUCTION, construction);
    MapXNodeImpl resourceRef = new MapXNodeImpl();
    construction.put(ConstructionType.F_RESOURCE_REF, resourceRef);
    resourceRef.put(ObjectReferenceType.F_OID, attribute(uuid));
    resourceRef.put(ObjectReferenceType.F_TYPE, attribute(ResourceType.COMPLEX_TYPE));
    return assignment;
}
Also used : MapXNodeImpl(com.evolveum.midpoint.prism.impl.xnode.MapXNodeImpl)

Example 2 with MapXNodeImpl

use of com.evolveum.midpoint.prism.impl.xnode.MapXNodeImpl 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

MapXNodeImpl (com.evolveum.midpoint.prism.impl.xnode.MapXNodeImpl)2 ListXNodeImpl (com.evolveum.midpoint.prism.impl.xnode.ListXNodeImpl)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