use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class ImmenseTermTest method assemble.
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
// Config module
ModuleAssembly config = module.layer().module("config");
new EntityTestAssembler().assemble(config);
// EntityStore
new EntityTestAssembler().assemble(module);
// Index/Query
new ESFilesystemIndexQueryAssembler().withConfig(config, Visibility.layer).assemble(module);
ElasticSearchConfiguration esConfig = config.forMixin(ElasticSearchConfiguration.class).declareDefaults();
esConfig.indexNonAggregatedAssociations().set(Boolean.TRUE);
// FileConfig
FileConfigurationOverride override = new FileConfigurationOverride().withData(new File(DATA_DIR, "qi4j-data")).withLog(new File(DATA_DIR, "qi4j-logs")).withTemporary(new File(DATA_DIR, "qi4j-temp"));
module.services(FileConfigurationService.class).setMetaInfo(override);
// Entities & Values
module.entities(TestEntity.class, TestEntity2.class);
}
use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class SQLTestHelper method doCommonAssembling.
protected static void doCommonAssembling(ModuleAssembly mainModule) throws AssemblyException {
ModuleAssembly config = mainModule.layer().module("config");
new EntityTestAssembler().assemble(config);
// START SNIPPET: assembly
// DataSourceService
new DBCPDataSourceServiceAssembler().identifiedBy("postgres-datasource-service").visibleIn(Visibility.module).withConfig(config, Visibility.layer).assemble(mainModule);
// DataSource
new DataSourceAssembler().withDataSourceServiceIdentity("postgres-datasource-service").identifiedBy("postgres-datasource").visibleIn(Visibility.module).withCircuitBreaker().assemble(mainModule);
// SQL Index/Query
new PostgreSQLIndexQueryAssembler().visibleIn(Visibility.module).withConfig(config, Visibility.layer).assemble(mainModule);
// END SNIPPET: assembly
// Always re-build schema in test scenarios because of possibly different app structure in
// various tests
mainModule.services(RebuildingStrategy.class).withMixins(RebuildingStrategy.AlwaysNeed.class).visibleIn(Visibility.module);
// Always re-index in test scenarios
mainModule.services(ReindexingStrategy.class).withMixins(ReindexingStrategy.AlwaysNeed.class).visibleIn(Visibility.module);
config.entities(ReindexerConfiguration.class).visibleIn(Visibility.layer);
}
use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class ReindexerTest method assemble.
@SuppressWarnings("unchecked")
public void assemble(ModuleAssembly module) throws AssemblyException {
// JDBM EntityStore
new JdbmEntityStoreAssembler().assemble(module);
// Native Sesame EntityFinder
new RdfNativeSesameStoreAssembler().assemble(module);
// Reindexer
module.services(ReindexerService.class);
// Configuration
ModuleAssembly config = module.layer().module("config");
new EntityTestAssembler().assemble(config);
config.entities(JdbmConfiguration.class, NativeConfiguration.class, ReindexerConfiguration.class).visibleIn(Visibility.layer);
// Test entity
module.entities(MyEntity.class);
}
use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class RdfQueryTest method assemble.
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
super.assemble(module);
module.services(FileConfigurationService.class);
module.services(NativeRepositoryService.class, RdfQueryParserFactory.class).instantiateOnStartup();
module.services(RdfIndexingEngineService.class).instantiateOnStartup();
module.services(OrgJsonValueSerializationService.class).taggedWith(ValueSerialization.Formats.JSON);
module.objects(EntityStateSerializer.class, EntityTypeSerializer.class);
ModuleAssembly config = module.layer().module("Config");
config.entities(NativeConfiguration.class).visibleIn(Visibility.layer);
config.forMixin(NativeConfiguration.class).declareDefaults().dataDirectory().set(DATA_DIR.getAbsolutePath());
new EntityTestAssembler().assemble(config);
}
use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class ContainsAllTest method assemble.
// This test creates a one-layer, two-module application, with one module
// being testing module, and another for retrieving configuration for
// services from preferences. This test assumes that those configurations
// already exist in preference ES.
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
module.services(FileConfigurationService.class);
ModuleAssembly prefModule = module.layer().module("PrefModule");
prefModule.entities(NativeConfiguration.class).visibleIn(Visibility.application);
prefModule.forMixin(NativeConfiguration.class).declareDefaults().dataDirectory().set(DATA_DIR.getAbsolutePath());
new EntityTestAssembler().assemble(prefModule);
module.entities(ExampleEntity.class);
module.values(ExampleValue.class, ExampleValue2.class);
EntityTestAssembler testAss = new EntityTestAssembler();
testAss.assemble(module);
RdfNativeSesameStoreAssembler rdfAssembler = new RdfNativeSesameStoreAssembler();
rdfAssembler.assemble(module);
}
Aggregations