use of org.qi4j.bootstrap.AssemblyException 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.bootstrap.AssemblyException in project qi4j-sdk by Qi4j.
the class TypeToCompositeLookupTest method values.
@Test
public void values() throws ActivationException, AssemblyException {
Module module = new SingletonAssembler() {
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
module.values(SomeOtherFoo.class);
}
}.module();
assertEquals(CATHEDRAL, module.newValueBuilder(SomeOtherFoo.class).newInstance().bar());
assertEquals(CATHEDRAL, module.newValueBuilder(BasicFoo.class).newInstance().bar());
assertEquals(CATHEDRAL, module.newValueBuilder(Foo.class).newInstance().bar());
}
use of org.qi4j.bootstrap.AssemblyException in project qi4j-sdk by Qi4j.
the class TypeToCompositeLookupTest method objects.
@Test
public void objects() throws ActivationException, AssemblyException {
Module module = new SingletonAssembler() {
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
module.objects(SomeOtherFooImpl.class);
}
}.module();
assertEquals(CATHEDRAL, module.newObject(SomeOtherFooImpl.class).bar());
assertEquals(CATHEDRAL, module.newObject(BasicFooImpl.class).bar());
assertEquals(CATHEDRAL, module.newObject(Foo.class).bar());
}
use of org.qi4j.bootstrap.AssemblyException in project qi4j-sdk by Qi4j.
the class TypeToCompositeLookupTest method services.
@Test
public void services() throws ActivationException, AssemblyException {
Module module = new SingletonAssembler() {
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
module.services(SomeOtherFoo.class);
}
}.module();
assertEquals(CATHEDRAL, module.findService(SomeOtherFoo.class).get().bar());
assertEquals(CATHEDRAL, module.findService(BasicFoo.class).get().bar());
assertEquals(CATHEDRAL, module.findService(Foo.class).get().bar());
}
use of org.qi4j.bootstrap.AssemblyException in project qi4j-sdk by Qi4j.
the class AbstractSQLEntityStoreAssembler method assemble.
@Override
public final void assemble(ModuleAssembly module) throws AssemblyException {
try {
SQLVendor sqlVendor = this.getSQLVendor();
if (sqlVendor == null) {
throw new AssemblyException("SQL Vendor could not be determined.");
}
module.services(DatabaseSQLServiceComposite.class).withMixins(DatabaseSQLServiceCoreMixin.class, DatabaseSQLServiceSpi.CommonMixin.class, getDatabaseStringBuilderMixin(), DatabaseSQLServiceStatementsMixin.class, getDatabaseSQLServiceSpecializationMixin()).identifiedBy(hasIdentity() ? identity() : DEFAULT_ENTITYSTORE_IDENTITY).visibleIn(Visibility.module).setMetaInfo(sqlVendor);
} catch (IOException ioe) {
throw new AssemblyException(ioe);
}
module.services(SQLEntityStoreService.class, UuidIdentityGeneratorService.class).visibleIn(visibility());
if (hasConfig()) {
configModule().entities(SQLConfiguration.class).visibleIn(configVisibility());
}
}
Aggregations