Search in sources :

Example 46 with ModuleAssembly

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);
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) ESFilesystemIndexQueryAssembler(org.qi4j.index.elasticsearch.assembly.ESFilesystemIndexQueryAssembler) FileConfigurationService(org.qi4j.library.fileconfig.FileConfigurationService) EntityTestAssembler(org.qi4j.test.EntityTestAssembler) FileConfigurationOverride(org.qi4j.library.fileconfig.FileConfigurationOverride) File(java.io.File) FileConfigurationOverride(org.qi4j.library.fileconfig.FileConfigurationOverride)

Example 47 with ModuleAssembly

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);
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) DataSourceAssembler(org.qi4j.library.sql.assembly.DataSourceAssembler) EntityTestAssembler(org.qi4j.test.EntityTestAssembler) PostgreSQLIndexQueryAssembler(org.qi4j.index.sql.assembly.PostgreSQLIndexQueryAssembler) ReindexerConfiguration(org.qi4j.index.reindexer.ReindexerConfiguration) DBCPDataSourceServiceAssembler(org.qi4j.library.sql.dbcp.DBCPDataSourceServiceAssembler)

Example 48 with ModuleAssembly

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);
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) RdfNativeSesameStoreAssembler(org.qi4j.index.rdf.assembly.RdfNativeSesameStoreAssembler) JdbmConfiguration(org.qi4j.entitystore.jdbm.JdbmConfiguration) EntityTestAssembler(org.qi4j.test.EntityTestAssembler) NativeConfiguration(org.qi4j.library.rdf.repository.NativeConfiguration) JdbmEntityStoreAssembler(org.qi4j.entitystore.jdbm.assembly.JdbmEntityStoreAssembler)

Example 49 with ModuleAssembly

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);
}
Also used : NativeRepositoryService(org.qi4j.library.rdf.repository.NativeRepositoryService) ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) OrgJsonValueSerializationService(org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationService) EntityTestAssembler(org.qi4j.test.EntityTestAssembler) RdfQueryParserFactory(org.qi4j.index.rdf.query.RdfQueryParserFactory) NativeConfiguration(org.qi4j.library.rdf.repository.NativeConfiguration)

Example 50 with ModuleAssembly

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);
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) RdfNativeSesameStoreAssembler(org.qi4j.index.rdf.assembly.RdfNativeSesameStoreAssembler) EntityTestAssembler(org.qi4j.test.EntityTestAssembler) NativeConfiguration(org.qi4j.library.rdf.repository.NativeConfiguration)

Aggregations

ModuleAssembly (org.qi4j.bootstrap.ModuleAssembly)191 SingletonAssembler (org.qi4j.bootstrap.SingletonAssembler)87 Test (org.junit.Test)82 EntityTestAssembler (org.qi4j.test.EntityTestAssembler)59 AssemblyException (org.qi4j.bootstrap.AssemblyException)27 Application (org.qi4j.api.structure.Application)26 OrgJsonValueSerializationAssembler (org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler)24 Assembler (org.qi4j.bootstrap.Assembler)23 Module (org.qi4j.api.structure.Module)19 LayerAssembly (org.qi4j.bootstrap.LayerAssembly)15 Before (org.junit.Before)12 UnitOfWork (org.qi4j.api.unitofwork.UnitOfWork)12 Energy4Java (org.qi4j.bootstrap.Energy4Java)12 DataSourceAssembler (org.qi4j.library.sql.assembly.DataSourceAssembler)11 DBCPDataSourceServiceAssembler (org.qi4j.library.sql.dbcp.DBCPDataSourceServiceAssembler)9 IOException (java.io.IOException)8 ApplicationAssemblerAdapter (org.qi4j.bootstrap.ApplicationAssemblerAdapter)8 ApplicationAssembly (org.qi4j.bootstrap.ApplicationAssembly)8 File (java.io.File)7 OrgJsonValueSerializationService (org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationService)7