Search in sources :

Example 31 with Stopwatch

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

the class MidScaleNewRepoTest method test615AddPeakUsersWithOid.

@Test
public void test615AddPeakUsersWithOid() throws 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 user = new UserType(prismContext).oid(UUID.randomUUID().toString()).name(PolyStringType.fromOrig(name)).description(randomDescription(name));
        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 32 with Stopwatch

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

the class MidScaleNewRepoTest method test020AddBaseUsers.

@Test
public void test020AddBaseUsers() throws SchemaException {
    if (MORE_USER_START > 1) {
        throw new SkipException("Skipping, as we probably want to continue with more users");
    }
    OperationResult operationResult = createOperationResult();
    Stopwatch stopwatch = stopwatch("user.add", "Repository addObject(user) - 1st batch");
    for (int userIndex = 1; userIndex <= BASE_USER_COUNT; userIndex++) {
        String name = String.format("user-%07d", userIndex);
        UserType user = new UserType(prismContext).name(PolyStringType.fromOrig(name)).description(randomDescription(name));
        addExtensionValues(user);
        if (userIndex == BASE_USER_COUNT) {
            queryRecorder.clearBufferAndStartRecording();
        }
        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());
        }
    }
    queryRecorder.stopRecording();
}
Also used : QUser(com.evolveum.midpoint.repo.sqale.qmodel.focus.QUser) Stopwatch(org.javasimon.Stopwatch) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) SkipException(org.testng.SkipException) Split(org.javasimon.Split) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException) Test(org.testng.annotations.Test) SqaleRepoBaseTest(com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)

Example 33 with Stopwatch

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

the class MidScaleNewRepoTest method test210AddMoreUsers.

@Test
public // @Test(enabled = false) // uncomment this if the users are all in to skip straight to the shadows
void test210AddMoreUsers() throws SchemaException {
    OperationResult operationResult = createOperationResult();
    Stopwatch stopwatch = stopwatch("user.addMore", "Repository addObject(user) - 2nd batch");
    for (int userIndex = MORE_USER_START; userIndex <= MORE_USER_COUNT; userIndex++) {
        String name = String.format("user-more-%07d", userIndex);
        UserType user = new UserType(prismContext).name(PolyStringType.fromOrig(name)).description(randomDescription(name));
        addExtensionValues(user);
        if (userIndex == MORE_USER_COUNT) {
            queryRecorder.startRecording();
        }
        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 % 100 == 0) {
            userOidsToGet.add(user.getOid());
        }
    }
    queryRecorder.stopRecording();
}
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 34 with Stopwatch

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

the class MidScaleNewRepoTest method test030AddBaseShadows.

@Test
public void test030AddBaseShadows() throws SchemaException {
    if (MORE_USER_START > 1) {
        throw new SkipException("Skipping, as we probably want to continue with more users");
    }
    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 shadow = createShadow(name, resourceEntry.getValue());
            // for the last user, but only once for a single resource
            if (userIndex == BASE_USER_COUNT && queryRecorder.getQueryBuffer().isEmpty()) {
                queryRecorder.startRecording();
            }
            try (Split ignored = stopwatch.start()) {
                repositoryService.addObject(shadow.asPrismObject(), null, operationResult);
            } catch (ObjectAlreadyExistsException e) {
            // Ignoring
            }
            if (queryRecorder.isRecording()) {
                // stop does not clear entries, so it will not be started again above
                queryRecorder.stopRecording();
            }
        }
    }
    queryRecorder.stopRecording();
}
Also used : Stopwatch(org.javasimon.Stopwatch) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) SkipException(org.testng.SkipException) Split(org.javasimon.Split) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException) Test(org.testng.annotations.Test) SqaleRepoBaseTest(com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)

Example 35 with Stopwatch

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

the class MidScaleNewRepoTest method test611AddPeakShadows.

@Test
public void test611AddPeakShadows() throws SchemaException {
    OperationResult operationResult = createOperationResult();
    Stopwatch stopwatch = stopwatch("shadow.addPeak", "Repository addObject(shadow) - 3rd batch");
    for (int userIndex = 1; userIndex <= PEAK_USER_COUNT; userIndex++) {
        for (Map.Entry<String, String> resourceEntry : resources.entrySet()) {
            String name = String.format("shadow-peak-%07d-at-%s", userIndex, resourceEntry.getKey());
            ShadowType shadowType = createShadow(name, resourceEntry.getValue());
            try (Split ignored = stopwatch.start()) {
                repositoryService.addObject(shadowType.asPrismObject(), null, operationResult);
            } catch (ObjectAlreadyExistsException e) {
            // Ignored
            }
        }
    }
// no query recorder in this test
}
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)35 Stopwatch (org.javasimon.Stopwatch)35 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 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 URI (java.net.URI)1