Search in sources :

Example 26 with Split

use of org.javasimon.Split in project midpoint by Evolveum.

the class MidScaleRepoTest method test615AddPeakUsersWithOid.

@Test
public void test615AddPeakUsersWithOid() throws ObjectAlreadyExistsException, SchemaException {
    OperationResult operationResult = createOperationResult();
    Stopwatch stopwatch = stopwatch("user.addPeakWithOid", "Repository addObject(user) - 4th batch");
    for (int userIndex = 1; userIndex <= PEAK_USER_COUNT; userIndex++) {
        String name = String.format("user-peak-oid-%07d", userIndex);
        UserType userType = new UserType(prismContext).oid(UUID.randomUUID().toString()).name(PolyStringType.fromOrig(name));
        try (Split ignored = stopwatch.start()) {
            repositoryService.addObject(userType.asPrismObject(), null, operationResult);
        }
        users.put(name, userType.getOid());
    }
// no query listener in this test
}
Also used : Stopwatch(org.javasimon.Stopwatch) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Split(org.javasimon.Split) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 27 with Split

use of org.javasimon.Split in project midpoint by Evolveum.

the class MidScaleRepoTest method test030AddBaseShadows.

@Test
public void test030AddBaseShadows() throws ObjectAlreadyExistsException, SchemaException {
    OperationResult operationResult = createOperationResult();
    Stopwatch stopwatch = stopwatch("shadow.add", "Repository addObject(shadow) - 1st batch");
    for (int userIndex = 1; userIndex <= BASE_USER_COUNT; userIndex++) {
        for (Map.Entry<String, String> resourceEntry : resources.entrySet()) {
            String name = String.format("shadow-%07d-at-%s", userIndex, resourceEntry.getKey());
            ShadowType shadowType = createShadow(name, resourceEntry.getValue());
            // for the last user, but only once for a single resource
            if (userIndex == BASE_USER_COUNT && queryListener.hasNoEntries()) {
                queryListener.start();
            }
            try (Split ignored = stopwatch.start()) {
                repositoryService.addObject(shadowType.asPrismObject(), null, operationResult);
            }
            if (queryListener.isStarted()) {
                // stop does not clear entries, so it will not be started again
                queryListener.stop();
            }
        }
    }
    queryListener.dumpAndStop();
}
Also used : ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) Stopwatch(org.javasimon.Stopwatch) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Split(org.javasimon.Split) Test(org.testng.annotations.Test)

Example 28 with Split

use of org.javasimon.Split in project midpoint by Evolveum.

the class TestDeltaPerfComparison method complexStructure.

@Test(dataProvider = "combinations")
public void complexStructure(int assigmentCount, PlusMinusZero operation) throws SchemaException {
    PrismObject<UserType> user = PrismTestUtil.getPrismContext().createObject(UserType.class);
    user.setOid(newUuid());
    user.asObjectable().setName(PolyString.toPolyStringType(PolyString.fromOrig("User")));
    AssignmentType assigment = null;
    for (int i = 0; i < assigmentCount; i++) {
        assigment = randomAssigment();
        user.asObjectable().assignment(assigment);
    }
    PrismContainerValue lastAssign = assigment.asPrismContainerValue().clone();
    lastAssign.freeze();
    ObjectDelta<UserType> delta = PrismTestUtil.getPrismContext().deltaFor(UserType.class).item(UserType.F_ASSIGNMENT).mod(operation, lastAssign).asObjectDelta(user.getOid());
    Stopwatch clone = stopwatch(monitorName("delta", "clone", String.valueOf(assigmentCount)), "Cloning of structure");
    Stopwatch applyDelta = stopwatch(monitorName("delta", operation.toString(), "apply", String.valueOf(assigmentCount)), "Application of delta");
    for (int i = 0; i < REPETITIONS; i++) {
        PrismObject<UserType> userMod = null;
        try (Split s = clone.start()) {
            userMod = user.clone();
        }
        // Measure
        try (Split s = applyDelta.start()) {
            delta.applyTo(userMod);
        }
        assertNotNull(userMod.getOid());
        assertNotNull(userMod.asObjectable().getAssignment());
    }
}
Also used : PrismContainerValue(com.evolveum.midpoint.prism.PrismContainerValue) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) Stopwatch(org.javasimon.Stopwatch) Split(org.javasimon.Split) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 29 with Split

use of org.javasimon.Split in project midpoint by Evolveum.

the class MidScaleNewRepoTest method test610AddPeakUsers.

@Test
public void test610AddPeakUsers() throws SchemaException {
    OperationResult operationResult = createOperationResult();
    Stopwatch stopwatch = stopwatch("user.addPeak", "Repository addObject(user) - 3rd batch");
    for (int userIndex = 1; userIndex <= PEAK_USER_COUNT; userIndex++) {
        String name = String.format("user-peak-%07d", userIndex);
        UserType user = new UserType(prismContext).name(PolyStringType.fromOrig(name)).description(randomDescription(name));
        addExtensionValues(user);
        try (Split ignored = stopwatch.start()) {
            repositoryService.addObject(user.asPrismObject(), null, operationResult);
        } catch (ObjectAlreadyExistsException e) {
            QUser u = aliasFor(QUser.class);
            user.setOid(selectOne(u, u.nameOrig.eq(name)).oid.toString());
        }
        if (userIndex % 10 == 0) {
            userOidsToGet.add(user.getOid());
        }
    }
// no query recorder in this test
}
Also used : QUser(com.evolveum.midpoint.repo.sqale.qmodel.focus.QUser) Stopwatch(org.javasimon.Stopwatch) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Split(org.javasimon.Split) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException) Test(org.testng.annotations.Test) SqaleRepoBaseTest(com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)

Example 30 with Split

use of org.javasimon.Split in project midpoint by Evolveum.

the class MidScaleNewRepoTest method test230AddMoreShadows.

@Test
public void test230AddMoreShadows() throws SchemaException {
    OperationResult operationResult = createOperationResult();
    Stopwatch stopwatch = stopwatch("shadow.addMore", "Repository addObject(shadow) - 2nd batch");
    for (int userIndex = MORE_USER_START; userIndex <= MORE_USER_COUNT; userIndex++) {
        for (Map.Entry<String, String> resourceEntry : resources.entrySet()) {
            String name = String.format("shadow-more-%07d-at-%s", userIndex, resourceEntry.getKey());
            ShadowType shadowType = createShadow(name, resourceEntry.getValue());
            // for the last user, but only once for a single resource
            if (userIndex == MORE_USER_COUNT && queryRecorder.getQueryBuffer().isEmpty()) {
                queryRecorder.startRecording();
            }
            try (Split ignored = stopwatch.start()) {
                repositoryService.addObject(shadowType.asPrismObject(), null, operationResult);
            } catch (ObjectAlreadyExistsException e) {
            // Ignored
            }
            if (queryRecorder.isRecording()) {
                queryRecorder.stopRecording();
            }
        }
        // we need to free memory from time to time
        if (userIndex % 10 == 0) {
            compactOperationResult(operationResult);
            // to get rid of finished operations list
            clearPerformanceMonitor();
        }
    }
    queryRecorder.stopRecording();
}
Also used : Stopwatch(org.javasimon.Stopwatch) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Split(org.javasimon.Split) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException) Test(org.testng.annotations.Test) SqaleRepoBaseTest(com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)

Aggregations

Split (org.javasimon.Split)38 Stopwatch (org.javasimon.Stopwatch)36 Test (org.testng.annotations.Test)28 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)22 SqaleRepoBaseTest (com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)11 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)8 AbstractGuiIntegrationTest (com.evolveum.midpoint.web.AbstractGuiIntegrationTest)5 AbstractInitializedGuiIntegrationTest (com.evolveum.midpoint.web.AbstractInitializedGuiIntegrationTest)5 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 QUser (com.evolveum.midpoint.repo.sqale.qmodel.focus.QUser)4 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)4 SkipException (org.testng.SkipException)3 Objectable (com.evolveum.midpoint.prism.Objectable)1 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 PrismParser (com.evolveum.midpoint.prism.PrismParser)1 QResource (com.evolveum.midpoint.repo.sqale.qmodel.resource.QResource)1 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)1 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)1