Search in sources :

Example 31 with Split

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

the class MidScaleNewRepoTest method test710GetUserMore.

@Test
public void test710GetUserMore() throws SchemaException, ObjectNotFoundException {
    OperationResult operationResult = createOperationResult();
    Stopwatch stopwatch = stopwatch("user.get2", "Repository getObject() -> user, 2nd test");
    queryRecorder.startRecording();
    for (String userOid : userOidsToGet) {
        try (Split ignored = stopwatch.start()) {
            assertThat(repositoryService.getObject(UserType.class, userOid, null, operationResult)).isNotNull();
        }
        if (queryRecorder.isRecording()) {
            queryRecorder.stopRecording();
        }
    }
    queryRecorder.stopRecording();
}
Also used : Stopwatch(org.javasimon.Stopwatch) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Split(org.javasimon.Split) Test(org.testng.annotations.Test) SqaleRepoBaseTest(com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)

Example 32 with Split

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

the class MidScaleNewRepoTest method test010InitResources.

@Test
public void test010InitResources() throws SchemaException {
    OperationResult operationResult = createOperationResult();
    Stopwatch stopwatch = stopwatch("resource.add", "Repository addObject(resource)");
    for (int resourceIndex = 1; resourceIndex <= RESOURCE_COUNT; resourceIndex++) {
        String name = String.format("resource-%03d", resourceIndex);
        ResourceType resourceType = new ResourceType(prismContext).name(PolyStringType.fromOrig(name)).description(randomDescription(name));
        if (resourceIndex == RESOURCE_COUNT) {
            queryRecorder.clearBufferAndStartRecording();
        }
        try (Split ignored = stopwatch.start()) {
            repositoryService.addObject(resourceType.asPrismObject(), null, operationResult);
        } catch (ObjectAlreadyExistsException e) {
            QResource r = aliasFor(QResource.class);
            resourceType.setOid(selectOne(r, r.nameOrig.eq(name)).oid.toString());
        }
        resources.put(name, resourceType.getOid());
    }
    queryRecorder.stopRecording();
}
Also used : QResource(com.evolveum.midpoint.repo.sqale.qmodel.resource.QResource) 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 33 with Split

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

the class MidScaleNewRepoTest method test110GetUser.

@Test
public void test110GetUser() throws SchemaException, ObjectNotFoundException {
    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.get1", "Repository getObject() -> user, 1st test");
    queryRecorder.startRecording();
    for (String userOid : userOidsToGet) {
        try (Split ignored = stopwatch.start()) {
            assertThat(repositoryService.getObject(UserType.class, userOid, null, operationResult)).isNotNull();
        }
        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) Test(org.testng.annotations.Test) SqaleRepoBaseTest(com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)

Example 34 with Split

use of org.javasimon.Split 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 35 with Split

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

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