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
}
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();
}
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();
}
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();
}
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
}
Aggregations