Search in sources :

Example 21 with Stopwatch

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

the class MidScaleRepoTest method test710GetUserMore.

@Test
public void test710GetUserMore() throws SchemaException, ObjectNotFoundException {
    OperationResult operationResult = createOperationResult();
    Stopwatch stopwatch = stopwatch("user.get2", "Repository getObject() -> user, 2nd test");
    for (int i = 1; i <= FIND_COUNT; i++) {
        String randomName = String.format("user-more-%07d", RND.nextInt(MORE_USER_COUNT) + 1);
        if (i == FIND_COUNT) {
            queryListener.start();
        }
        try (Split ignored = stopwatch.start()) {
            assertThat(repositoryService.getObject(UserType.class, users.get(randomName), null, operationResult)).isNotNull();
        }
    }
    queryListener.dumpAndStop();
}
Also used : Stopwatch(org.javasimon.Stopwatch) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Split(org.javasimon.Split) Test(org.testng.annotations.Test)

Example 22 with Stopwatch

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

the class MidScaleRepoTest method test230AddMoreShadows.

@Test
public void test230AddMoreShadows() throws ObjectAlreadyExistsException, SchemaException {
    OperationResult operationResult = createOperationResult();
    Stopwatch stopwatch = stopwatch("shadow.addMore", "Repository addObject(shadow) - 2nd batch");
    for (int userIndex = 1; 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 && queryListener.hasNoEntries()) {
                queryListener.start();
            }
            try (Split ignored = stopwatch.start()) {
                repositoryService.addObject(shadowType.asPrismObject(), null, operationResult);
            }
            if (queryListener.isStarted()) {
                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 23 with Stopwatch

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

the class MidScaleRepoTest method test610AddPeakUsers.

@Test
public void test610AddPeakUsers() throws ObjectAlreadyExistsException, 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 userType = new UserType(prismContext).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 24 with Stopwatch

use of org.javasimon.Stopwatch 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 25 with Stopwatch

use of org.javasimon.Stopwatch 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)

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