use of org.qi4j.bootstrap.SingletonAssembler in project qi4j-sdk by Qi4j.
the class TransferMoneyTest method setup.
@BeforeClass
public static void setup() throws Exception {
assembler = new SingletonAssembler() {
public void assemble(ModuleAssembly module) throws AssemblyException {
module.entities(CheckingAccountRolemap.class, SavingsAccountRolemap.class, CreditorRolemap.class);
new EntityTestAssembler().assemble(module);
}
};
bootstrapData(assembler);
}
use of org.qi4j.bootstrap.SingletonAssembler in project qi4j-sdk by Qi4j.
the class TransferMoneyTest2 method setup.
@BeforeClass
public static void setup() throws Exception {
SingletonAssembler assembler = new SingletonAssembler() {
public void assemble(ModuleAssembly module) throws AssemblyException {
module.entities(CheckingAccountEntity.class, SavingsAccountEntity.class, CreditorEntity.class);
new EntityTestAssembler().assemble(module);
module.transients(TransferMoneyContext2.class);
module.objects(PayBillsContext2.class);
}
};
module = assembler.module();
bootstrapData();
}
use of org.qi4j.bootstrap.SingletonAssembler in project qi4j-sdk by Qi4j.
the class SequencingConcernTest method failingBooking.
/**
* Tests that when shipping service fails to make the booking generator is not called and booking failure code is
* returned.
*/
@Test
@Ignore("Expectations need to be figured out.")
public void failingBooking() throws ActivationException, AssemblyException {
SingletonAssembler assembler = new SingletonAssembler() {
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
module.transients(ShippingServiceTestComposite.class);
}
};
ShippingService shippingService = createMock(ShippingService.class);
Cargo cargo = createMock(Cargo.class);
Voyage voyage = createMock(Voyage.class);
HasSequence sequence = createMock(HasSequence.class);
expect(shippingService.makeBooking(cargo, voyage)).andReturn(-1000);
expect(voyage.bookedCargoSize().get()).andReturn(0.0).atLeastOnce();
expect(cargo.size().get()).andReturn(0.0).atLeastOnce();
expect(sequence.sequence().get()).andReturn(0).atLeastOnce();
replay(shippingService, cargo, voyage);
ShippingServiceTestComposite underTest = assembler.module().newTransient(ShippingServiceTestComposite.class);
underTest.useMock(shippingService).forClass(ShippingService.class);
assertThat("Booking result", underTest.makeBooking(cargo, voyage), is(equalTo(-1000)));
verify(shippingService, cargo, voyage);
}
use of org.qi4j.bootstrap.SingletonAssembler in project qi4j-sdk by Qi4j.
the class HelloWorldTest method setUp.
@Before
public void setUp() throws Exception {
SingletonAssembler assembly = new SingletonAssembler() {
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
module.transients(HelloWorldComposite.class);
}
};
helloWorld = assembly.module().newTransient(HelloWorldComposite.class);
}
use of org.qi4j.bootstrap.SingletonAssembler in project qi4j-sdk by Qi4j.
the class HelloWorldTest method setUp.
@Before
public void setUp() throws Exception {
SingletonAssembler assembly = new SingletonAssembler() {
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
module.transients(HelloWorldComposite.class);
}
};
helloWorld = assembly.module().newTransientBuilder(HelloWorldComposite.class).newInstance();
}
Aggregations