Search in sources :

Example 1 with DeltaBuilder

use of com.evolveum.midpoint.prism.impl.delta.builder.DeltaBuilder in project midpoint by Evolveum.

the class PerfTestPrismObjectSize method replaceDelta.

@Test(dataProvider = "combinations")
public void replaceDelta(ContainerTestParams config) throws SchemaException {
    for (int maxOps : DELTA_OP_COUNT) {
        int opCount = Math.min(config.count, maxOps);
        measureDelta(config, monitorName("replace", config.monitorId(), Integer.toString(opCount)), assignments -> {
            DeltaBuilder<UserType> delta = new DeltaBuilder<>(UserType.class, getPrismContext());
            for (int i = assignments.size() - opCount; i < assignments.size(); i++) {
                AssignmentType assignment = assignments.get(i).clone();
                assignment.description("Modified");
                delta = (DeltaBuilder<UserType>) delta.item(UserType.F_ASSIGNMENT).replace(assignment.asPrismContainerValue());
            }
            return delta.asObjectDelta("");
        });
    }
}
Also used : DeltaBuilder(com.evolveum.midpoint.prism.impl.delta.builder.DeltaBuilder) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 2 with DeltaBuilder

use of com.evolveum.midpoint.prism.impl.delta.builder.DeltaBuilder in project midpoint by Evolveum.

the class PerfTestPrismObjectSize method deleteNoIdDelta.

@Test(dataProvider = "combinations")
public void deleteNoIdDelta(ContainerTestParams config) throws SchemaException {
    for (int maxOps : DELTA_OP_COUNT) {
        int opCount = Math.min(config.count, maxOps);
        measureDelta(config, monitorName("delete.no.id", config.monitorId(), Integer.toString(opCount)), assignments -> {
            DeltaBuilder<UserType> delta = new DeltaBuilder<>(UserType.class, getPrismContext());
            for (int i = assignments.size() - opCount; i < assignments.size(); i++) {
                AssignmentType assignment = assignments.get(i).clone();
                delta = (DeltaBuilder<UserType>) delta.item(UserType.F_ASSIGNMENT).delete(assignment.asPrismContainerValue());
            }
            return delta.asObjectDelta("");
        });
    }
}
Also used : DeltaBuilder(com.evolveum.midpoint.prism.impl.delta.builder.DeltaBuilder) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 3 with DeltaBuilder

use of com.evolveum.midpoint.prism.impl.delta.builder.DeltaBuilder in project midpoint by Evolveum.

the class PerfTestPrismObjectSize method addDelta.

@Test(dataProvider = "combinations")
public void addDelta(ContainerTestParams config) throws SchemaException {
    for (int maxOps : DELTA_OP_COUNT) {
        int opCount = maxOps;
        measureDelta(config, monitorName("add", config.monitorId(), Integer.toString(opCount)), assignments -> {
            DeltaBuilder<UserType> delta = new DeltaBuilder<>(UserType.class, getPrismContext());
            for (int i = 0; i < opCount; i++) {
                AssignmentType assignment = assignments.get(0).clone();
                assignment.getConstruction().resourceRef(newUuid(), assignment.getConstruction().getResourceRef().getType());
                assignment.setId(null);
                delta = (DeltaBuilder<UserType>) delta.item(UserType.F_ASSIGNMENT).add(assignment.asPrismContainerValue());
            }
            return delta.asObjectDelta("");
        });
    }
}
Also used : DeltaBuilder(com.evolveum.midpoint.prism.impl.delta.builder.DeltaBuilder) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 4 with DeltaBuilder

use of com.evolveum.midpoint.prism.impl.delta.builder.DeltaBuilder in project midpoint by Evolveum.

the class PerfTestPrismObjectSize method deleteDelta.

@Test(dataProvider = "combinations")
public void deleteDelta(ContainerTestParams config) throws SchemaException {
    for (int maxOps : DELTA_OP_COUNT) {
        int opCount = Math.min(config.count, maxOps);
        measureDelta(config, monitorName("delete", config.monitorId(), Integer.toString(opCount)), assignments -> {
            DeltaBuilder<UserType> delta = new DeltaBuilder<>(UserType.class, getPrismContext());
            for (int i = assignments.size() - opCount; i < assignments.size(); i++) {
                AssignmentType assignment = assignments.get(i).clone();
                delta = (DeltaBuilder<UserType>) delta.item(UserType.F_ASSIGNMENT).delete(assignment.asPrismContainerValue());
            }
            return delta.asObjectDelta("");
        });
    }
}
Also used : DeltaBuilder(com.evolveum.midpoint.prism.impl.delta.builder.DeltaBuilder) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Aggregations

DeltaBuilder (com.evolveum.midpoint.prism.impl.delta.builder.DeltaBuilder)4 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)4 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)4 Test (org.testng.annotations.Test)4