Search in sources :

Example 6 with ApplicationAssemblerAdapter

use of org.qi4j.bootstrap.ApplicationAssemblerAdapter in project qi4j-sdk by Qi4j.

the class MixinVisibilityTest method testMultipleMixinsInLayerWillFailDiffModule.

@Test(expected = AmbiguousTypeException.class)
public void testMultipleMixinsInLayerWillFailDiffModule() throws Exception {
    Energy4Java boot = new Energy4Java();
    Assembler[][][] assemblers = new Assembler[][][] { { // Layer
    { // Module 1
    new Assembler() {

        public void assemble(ModuleAssembly module) throws AssemblyException {
            module.setName("Module A");
            module.objects(ObjectA.class);
        }
    } }, { // Module 2
    new Assembler() {

        public void assemble(ModuleAssembly module) throws AssemblyException {
            module.setName("Module B");
            module.transients(B1Composite.class).visibleIn(Visibility.layer);
        }
    } }, { // Module 3
    new Assembler() {

        public void assemble(ModuleAssembly module) throws AssemblyException {
            module.setName("Module C");
            module.transients(B2Composite.class).visibleIn(Visibility.layer);
        }
    } } } };
    Application app = boot.newApplication(new ApplicationAssemblerAdapter(assemblers) {
    });
    app.activate();
    ObjectA object = app.findModule("Layer 1", "Module A").newObject(ObjectA.class);
    assertEquals("ok", object.test1());
    assertEquals("abc", object.test2());
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) Energy4Java(org.qi4j.bootstrap.Energy4Java) Assembler(org.qi4j.bootstrap.Assembler) Application(org.qi4j.api.structure.Application) ApplicationAssemblerAdapter(org.qi4j.bootstrap.ApplicationAssemblerAdapter) Test(org.junit.Test)

Example 7 with ApplicationAssemblerAdapter

use of org.qi4j.bootstrap.ApplicationAssemblerAdapter in project qi4j-sdk by Qi4j.

the class ObjectVisibilityTest method setup.

@Before
public void setup() throws Exception {
    qi4j = new Energy4Java();
    Assembler[][][] assemblers = new Assembler[][][] { { // Layer Above
    { new AboveAssembler() } }, { // Layer From
    { // From Module
    new FromAssembler() }, { // Beside Module
    new BesideAssembler() } }, { // Layer Below
    { new BelowAssembler() } } };
    app = qi4j.newApplication(new ApplicationAssemblerAdapter(assemblers) {
    });
    app.activate();
    module = app.findModule("From Layer", "From");
}
Also used : Energy4Java(org.qi4j.bootstrap.Energy4Java) Assembler(org.qi4j.bootstrap.Assembler) EntityTestAssembler(org.qi4j.test.EntityTestAssembler) ApplicationAssemblerAdapter(org.qi4j.bootstrap.ApplicationAssemblerAdapter) Before(org.junit.Before)

Example 8 with ApplicationAssemblerAdapter

use of org.qi4j.bootstrap.ApplicationAssemblerAdapter in project qi4j-sdk by Qi4j.

the class AbstractEntityStorePerformanceTest method createQi4jRuntime.

private void createQi4jRuntime(Assembler testSetup) throws Exception {
    Energy4Java qi4j = new Energy4Java();
    Assembler[][][] assemblers = new Assembler[][][] { { { infrastructure, testSetup } } };
    application = qi4j.newApplication(new ApplicationAssemblerAdapter(assemblers) {
    });
    application.activate();
    Module moduleInstance = application.findModule("Layer 1", "Module 1");
    module = moduleInstance;
}
Also used : Energy4Java(org.qi4j.bootstrap.Energy4Java) Assembler(org.qi4j.bootstrap.Assembler) Module(org.qi4j.api.structure.Module) ApplicationAssemblerAdapter(org.qi4j.bootstrap.ApplicationAssemblerAdapter)

Example 9 with ApplicationAssemblerAdapter

use of org.qi4j.bootstrap.ApplicationAssemblerAdapter in project qi4j-sdk by Qi4j.

the class EntityVisibilityTest method setup.

@Before
public void setup() throws Exception {
    qi4j = new Energy4Java();
    Assembler[][][] assemblers = new Assembler[][][] { { // Layer Above
    { new AboveAssembler() } }, { // Layer From
    { // From Module
    new FromAssembler() }, { // Beside Module
    new BesideAssembler() } }, { // Layer Below
    { new BelowAssembler() } } };
    app = qi4j.newApplication(new ApplicationAssemblerAdapter(assemblers) {
    });
    app.activate();
    module = app.findModule("From Layer", "From");
}
Also used : Energy4Java(org.qi4j.bootstrap.Energy4Java) Assembler(org.qi4j.bootstrap.Assembler) EntityTestAssembler(org.qi4j.test.EntityTestAssembler) ApplicationAssemblerAdapter(org.qi4j.bootstrap.ApplicationAssemblerAdapter) Before(org.junit.Before)

Example 10 with ApplicationAssemblerAdapter

use of org.qi4j.bootstrap.ApplicationAssemblerAdapter in project qi4j-sdk by Qi4j.

the class ServiceVisibilityTest method setup.

@Before
public void setup() throws Exception {
    qi4j = new Energy4Java();
    Assembler[][][] assemblers = new Assembler[][][] { { // Layer Above
    { new AboveAssembler() } }, { // Layer From
    { // From Module
    new FromAssembler() }, { // Beside Module
    new BesideAssembler() } }, { // Layer Below
    { new BelowAssembler() } } };
    app = qi4j.newApplication(new ApplicationAssemblerAdapter(assemblers) {
    });
    app.activate();
    module = app.findModule("From Layer", "From");
}
Also used : Energy4Java(org.qi4j.bootstrap.Energy4Java) Assembler(org.qi4j.bootstrap.Assembler) EntityTestAssembler(org.qi4j.test.EntityTestAssembler) ApplicationAssemblerAdapter(org.qi4j.bootstrap.ApplicationAssemblerAdapter) Before(org.junit.Before)

Aggregations

ApplicationAssemblerAdapter (org.qi4j.bootstrap.ApplicationAssemblerAdapter)17 Assembler (org.qi4j.bootstrap.Assembler)17 Energy4Java (org.qi4j.bootstrap.Energy4Java)17 Application (org.qi4j.api.structure.Application)10 Test (org.junit.Test)9 ModuleAssembly (org.qi4j.bootstrap.ModuleAssembly)8 Before (org.junit.Before)5 EntityTestAssembler (org.qi4j.test.EntityTestAssembler)5 Module (org.qi4j.api.structure.Module)2 Connection (java.sql.Connection)1 Statement (java.sql.Statement)1 UnitOfWork (org.qi4j.api.unitofwork.UnitOfWork)1 UnitOfWorkFactory (org.qi4j.api.unitofwork.UnitOfWorkFactory)1 ApplicationAssembler (org.qi4j.bootstrap.ApplicationAssembler)1 PostgreSQLEntityStoreAssembler (org.qi4j.entitystore.sql.assembly.PostgreSQLEntityStoreAssembler)1 DataSourceAssembler (org.qi4j.library.sql.assembly.DataSourceAssembler)1 SQLConfiguration (org.qi4j.library.sql.common.SQLConfiguration)1 DBCPDataSourceServiceAssembler (org.qi4j.library.sql.dbcp.DBCPDataSourceServiceAssembler)1