use of org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BuildDeliverySnapshot in project qi4j-sdk by Qi4j.
the class InspectCargoTest method deviation_3b_CargoHasArrived.
@Test
public void deviation_3b_CargoHasArrived() throws Exception {
UnitOfWork uow = module.currentUnitOfWork();
HandlingEventsEntity HANDLING_EVENTS = uow.get(HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID);
handlingEvent = HANDLING_EVENTS.createHandlingEvent(day(15), day(15), trackingId, HandlingEventType.UNLOAD, STOCKHOLM, V300A);
Delivery delivery = new BuildDeliverySnapshot(cargo, handlingEvent).get();
cargo.delivery().set(delivery);
assertThat(cargo.delivery().get().isUnloadedAtDestination().get(), is(equalTo(true)));
logger.info(" Handling cargo 'ABC' (arrived):");
new InspectCargo(handlingEvent).inspect();
// Assert that notification of arrival has been sent (see console output).
}
use of org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BuildDeliverySnapshot in project qi4j-sdk by Qi4j.
the class InspectCargoTest method deviation_3a_CargoIsMisdirected.
@Test
public void deviation_3a_CargoIsMisdirected() throws Exception {
// Create misdirected handling event for cargo (receipt in Shanghai is unexpected)
UnitOfWork uow = module.currentUnitOfWork();
HandlingEventsEntity HANDLING_EVENTS = uow.get(HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID);
handlingEvent = HANDLING_EVENTS.createHandlingEvent(day(0), day(0), trackingId, HandlingEventType.RECEIVE, SHANGHAI, null);
Delivery delivery = new BuildDeliverySnapshot(cargo, handlingEvent).get();
cargo.delivery().set(delivery);
assertThat(cargo.delivery().get().isMisdirected().get(), is(equalTo(true)));
logger.info(" Handling cargo 'ABC' (misdirected):");
new InspectCargo(handlingEvent).inspect();
// Assert that notification of misdirection has been sent (see console output).
}
use of org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BuildDeliverySnapshot in project qi4j-sdk by Qi4j.
the class InspectCargoTest method step_3_CargoIsCorrectlyInTransit.
@Test
public void step_3_CargoIsCorrectlyInTransit() throws Exception {
logger.info(" Handling cargo 'ABC' (unloaded in Dallas):");
UnitOfWork uow = module.currentUnitOfWork();
HandlingEventsEntity HANDLING_EVENTS = uow.get(HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID);
handlingEvent = HANDLING_EVENTS.createHandlingEvent(day(12), day(12), trackingId, HandlingEventType.UNLOAD, DALLAS, V200T);
cargo.delivery().set(new BuildDeliverySnapshot(cargo, handlingEvent).get());
assertThat(cargo.delivery().get().isMisdirected().get(), is(equalTo(false)));
new InspectCargo(handlingEvent).inspect();
logger.info(" Cargo was correctly directed.");
}
Aggregations