use of org.qi4j.api.structure.Application in project qi4j-sdk by Qi4j.
the class PrivateCompositeVisibilityTest method testPrivateCompositeVisibility.
@Test(expected = NoSuchTransientException.class)
public void testPrivateCompositeVisibility() throws Exception {
Energy4Java boot = new Energy4Java();
Assembler[][][] assemblers = new Assembler[][][] { { // Layer
{ new AssemblerA() }, { new AssemblerB() } } };
Application app = boot.newApplication(new ApplicationAssemblerAdapter(assemblers) {
});
app.activate();
ObjectA object = app.findModule("Layer 1", "Module A").newObject(ObjectA.class);
object.test();
}
use of org.qi4j.api.structure.Application 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());
}
use of org.qi4j.api.structure.Application in project qi4j-sdk by Qi4j.
the class Qi95IssueTest method canCreateAndQueryWithInMemoryRdfWithJdbm.
@Test
public void canCreateAndQueryWithInMemoryRdfWithJdbm() throws Exception {
Application application = createApplication(inMemoryRdf, jdbmStore, domain);
try {
application.activate();
Module domain = application.findModule("Domain", "Domain");
UnitOfWorkFactory unitOfWorkFactory = domain;
createABunchOfStuffAndDoQueries(unitOfWorkFactory, domain);
} finally {
application.passivate();
}
}
use of org.qi4j.api.structure.Application in project qi4j-sdk by Qi4j.
the class Qi95IssueTest method createApplication.
private Application createApplication(final ModuleAssemblyBuilder queryServiceModuleBuilder, final ModuleAssemblyBuilder entityStoreModuleBuilder, final LayerAssemblyBuilder domainLayerBuilder) throws AssemblyException {
Energy4Java qi4j = new Energy4Java();
Application application = qi4j.newApplication(new ApplicationAssembler() {
@Override
public ApplicationAssembly assemble(ApplicationAssemblyFactory applicationFactory) throws AssemblyException {
ApplicationAssembly applicationAssembly = applicationFactory.newApplicationAssembly();
LayerAssembly configLayer = applicationAssembly.layer("Config");
configModule.buildModuleAssembly(configLayer, "Configuration");
LayerAssembly infrastructureLayer = applicationAssembly.layer("Infrastructure");
infrastructureLayer.uses(configLayer);
queryServiceModuleBuilder.buildModuleAssembly(infrastructureLayer, "Query Service");
entityStoreModuleBuilder.buildModuleAssembly(infrastructureLayer, "Entity Store");
LayerAssembly domainLayer = domainLayerBuilder.buildLayerAssembly(applicationAssembly);
domainLayer.uses(infrastructureLayer);
return applicationAssembly;
}
});
return application;
}
use of org.qi4j.api.structure.Application in project qi4j-sdk by Qi4j.
the class Qi95IssueTest method canCreateAndQueryWithNativeRdfWithInMemoryStore.
@Test
public void canCreateAndQueryWithNativeRdfWithInMemoryStore() throws Exception {
Application application = createApplication(nativeRdf, inMemoryStore, domain);
try {
application.activate();
Module domain = application.findModule("Domain", "Domain");
UnitOfWorkFactory unitOfWorkFactory = domain;
createABunchOfStuffAndDoQueries(unitOfWorkFactory, domain);
} finally {
application.passivate();
}
}
Aggregations