use of org.javasimon.Stopwatch 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
}
use of org.javasimon.Stopwatch 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();
}
use of org.javasimon.Stopwatch 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();
}
use of org.javasimon.Stopwatch 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();
}
use of org.javasimon.Stopwatch 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();
}
Aggregations