use of com.evolveum.midpoint.repo.sqale.qmodel.resource.QResource 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();
}
Aggregations