use of org.qi4j.api.structure.Module in project qi4j-sdk by Qi4j.
the class ModuleTest method givenFixture1WhenFindFromAnotherModuleThenCompositeTypeIsReturned.
@Test
public void givenFixture1WhenFindFromAnotherModuleThenCompositeTypeIsReturned() throws ClassNotFoundException, AssemblyException {
Application app = givenFixture1();
Module module = app.findModule("Layer 1", "Module 1").newTransient(TestComposite1.class).getModule();
module.classLoader().loadClass(TestComposite2.class.getName());
}
use of org.qi4j.api.structure.Module in project qi4j-sdk by Qi4j.
the class TypeToCompositeLookupTest method transientsAmbiguousDeclaration.
@Test
public void transientsAmbiguousDeclaration() throws ActivationException, AssemblyException {
Module module = new SingletonAssembler() {
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
module.transients(SomeOtherFoo.class, BasicFoo.class);
}
}.module();
assertEquals(CATHEDRAL, module.newTransientBuilder(SomeOtherFoo.class).newInstance().bar());
assertEquals(BAZAR, module.newTransientBuilder(BasicFoo.class).newInstance().bar());
try {
module.newTransientBuilder(Foo.class);
fail("Ambiguous type exception not detected for Transients");
} catch (AmbiguousTypeException expected) {
}
}
use of org.qi4j.api.structure.Module in project qi4j-sdk by Qi4j.
the class ModuleTest method givenFixture1WhenGetNameThenConfiguredNameIsReturned.
@Test
public void givenFixture1WhenGetNameThenConfiguredNameIsReturned() throws AssemblyException {
Application app = givenFixture1();
Module module = app.findModule("Layer 1", "Module 1").newTransient(TestComposite1.class).getModule();
assertThat("module name is correct", module.name(), equalTo("Module 1"));
}
use of org.qi4j.api.structure.Module 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.Module 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