use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class AbstractEntityStorePerformanceTest method warmup.
@Before
public void warmup() throws Exception {
try {
Assembler assembler = new Assembler() {
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
module.entities(SimpleProduct.class);
}
};
createQi4jRuntime(assembler);
for (int i = 0; i < 10000; i++) {
try (UnitOfWork uow = module.newUnitOfWork(newUsecase("Warmup " + i))) {
SimpleProduct product = uow.newEntity(SimpleProduct.class);
String id = product.identity().get();
}
}
} catch (Exception ex) {
logger.error("Unable to warmup: {}", ex.getMessage(), ex);
throw ex;
} finally {
cleanUp();
}
}
use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class JdbmEntityStorePerformanceTest method createAssembler.
private static Assembler createAssembler() {
return new Assembler() {
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
new JdbmEntityStoreAssembler().assemble(module);
new OrgJsonValueSerializationAssembler().assemble(module);
ModuleAssembly configModule = module.layer().module("Config");
configModule.entities(JdbmConfiguration.class).visibleIn(Visibility.layer);
new EntityTestAssembler().assemble(configModule);
module.services(EhCachePoolService.class);
configModule.entities(EhCacheConfiguration.class).visibleIn(Visibility.layer);
}
};
}
use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class MemoryEntityStorePerformanceTest method createAssembler.
private static Assembler createAssembler() {
return new Assembler() {
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
new MemoryEntityStoreAssembler().assemble(module);
new OrgJsonValueSerializationAssembler().assemble(module);
}
};
}
use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class DerbySQLEntityStorePerformanceTest method createAssembler.
private static Assembler createAssembler() {
return new Assembler() {
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
ModuleAssembly config = module.layer().module("config");
new EntityTestAssembler().assemble(config);
new OrgJsonValueSerializationAssembler().assemble(module);
// DataSourceService
new DBCPDataSourceServiceAssembler().identifiedBy("derby-datasource-service").visibleIn(Visibility.module).withConfig(config, Visibility.layer).assemble(module);
// DataSource
new DataSourceAssembler().withDataSourceServiceIdentity("derby-datasource-service").identifiedBy("derby-datasource").withCircuitBreaker().assemble(module);
// SQL EntityStore
new DerbySQLEntityStoreAssembler().withConfig(config, Visibility.layer).assemble(module);
}
};
}
use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class AbstractEntityStorePerformanceTest method whenCreateEntityWithSinglePropertyThenRecordIterationsPerSecond.
@Test
public void whenCreateEntityWithSinglePropertyThenRecordIterationsPerSecond() throws Exception {
try {
Assembler assembler = new Assembler() {
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
module.entities(SimpleProduct.class);
}
};
createQi4jRuntime(assembler);
profile(new Callable<Void>() {
@Override
public Void call() throws Exception {
Report report = new Report(storeName);
report.start("createEntityWithSingleProperty");
for (int i = 0; i < ITERATIONS; i++) {
try (UnitOfWork uow = module.newUnitOfWork(newUsecase("createEntityWithSingleProperty " + i))) {
SimpleProduct product = uow.newEntity(SimpleProduct.class);
String id = product.identity().get();
uow.complete();
}
if (i % 1000 == 0) {
logger.info("Iteration {}", i);
}
}
report.stop(ITERATIONS);
writeReport(report);
return null;
}
});
} finally {
cleanUp();
}
}
Aggregations