Search in sources :

Example 1 with BookNewCargo

use of org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo in project qi4j-sdk by Qi4j.

the class InspectCargoTest method beforeEachTest.

@Before
public void beforeEachTest() throws Exception {
    UnitOfWork uow = module.currentUnitOfWork();
    Cargos CARGOS = uow.get(Cargos.class, CargosEntity.CARGOS_ID);
    Location HONGKONG = uow.get(Location.class, CNHKG.code().get());
    SHANGHAI = uow.get(Location.class, CNSHA.code().get());
    STOCKHOLM = uow.get(Location.class, SESTO.code().get());
    Location NEWYORK = uow.get(Location.class, USNYC.code().get());
    DALLAS = uow.get(Location.class, USDAL.code().get());
    Voyage V100S = uow.get(Voyage.class, "V100S");
    V200T = uow.get(Voyage.class, "V200T");
    V300A = uow.get(Voyage.class, "V300A");
    // Create cargo
    trackingId = new BookNewCargo(CARGOS, HONGKONG, STOCKHOLM, day(17)).createCargo("ABC");
    cargo = uow.get(Cargo.class, trackingId.id().get());
    Itinerary itinerary = itinerary(leg(V100S, HONGKONG, NEWYORK, day(1), day(8)), leg(V200T, NEWYORK, DALLAS, day(9), day(12)), leg(V300A, DALLAS, STOCKHOLM, day(13), day(16)));
    // Route cargo
    new BookNewCargo(cargo, itinerary).assignCargoToRoute();
}
Also used : UnitOfWork(org.qi4j.api.unitofwork.UnitOfWork) Cargo(org.qi4j.sample.dcicargo.sample_a.data.shipping.cargo.Cargo) BookNewCargo(org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo) Cargos(org.qi4j.sample.dcicargo.sample_a.data.shipping.cargo.Cargos) Itinerary(org.qi4j.sample.dcicargo.sample_a.data.shipping.itinerary.Itinerary) Voyage(org.qi4j.sample.dcicargo.sample_a.data.shipping.voyage.Voyage) BookNewCargo(org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo) Location(org.qi4j.sample.dcicargo.sample_a.data.shipping.location.Location) Before(org.junit.Before)

Example 2 with BookNewCargo

use of org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo in project qi4j-sdk by Qi4j.

the class RegisterHandlingEventTest method deviation_3c_CargoNotRoutedYet.

@Test
public void deviation_3c_CargoNotRoutedYet() throws Exception {
    TrackingId nonRoutedTrackingId = new BookNewCargo(CARGOS, HONGKONG, STOCKHOLM, day(17)).createCargo("NonRoutedCargo");
    String nonRouted = nonRoutedTrackingId.id().get();
    msg = register(time, time, nonRouted, "RECEIVE", "CNHKG", null);
    assertThat(msg, is(equalTo("Can't create handling event for non-routed cargo '" + nonRouted + "'.")));
}
Also used : TrackingId(org.qi4j.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId) BookNewCargo(org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo) Test(org.junit.Test)

Example 3 with BookNewCargo

use of org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo in project qi4j-sdk by Qi4j.

the class RegisterHandlingEventTest method beforeEachTest.

@Before
public void beforeEachTest() throws Exception {
    UnitOfWork uow = module.currentUnitOfWork();
    CARGOS = uow.get(Cargos.class, CargosEntity.CARGOS_ID);
    HONGKONG = uow.get(Location.class, CNHKG.code().get());
    STOCKHOLM = uow.get(Location.class, SESTO.code().get());
    NEWYORK = uow.get(Location.class, USNYC.code().get());
    DALLAS = uow.get(Location.class, USDAL.code().get());
    V100S = uow.get(Voyage.class, "V100S");
    V200T = uow.get(Voyage.class, "V200T");
    V300A = uow.get(Voyage.class, "V300A");
    trackingId = new BookNewCargo(CARGOS, HONGKONG, STOCKHOLM, day(17)).createCargo("ABC");
    cargo = uow.get(Cargo.class, trackingId.id().get());
    Itinerary itinerary = itinerary(leg(V100S, HONGKONG, NEWYORK, day(1), day(8)), leg(V200T, NEWYORK, DALLAS, day(9), day(12)), leg(V300A, DALLAS, STOCKHOLM, day(13), arrival = day(16)));
    new BookNewCargo(cargo, itinerary).assignCargoToRoute();
    time = day(1);
    trackId = trackingId.id().get();
}
Also used : UnitOfWork(org.qi4j.api.unitofwork.UnitOfWork) Cargo(org.qi4j.sample.dcicargo.sample_a.data.shipping.cargo.Cargo) BookNewCargo(org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo) Cargos(org.qi4j.sample.dcicargo.sample_a.data.shipping.cargo.Cargos) Itinerary(org.qi4j.sample.dcicargo.sample_a.data.shipping.itinerary.Itinerary) Voyage(org.qi4j.sample.dcicargo.sample_a.data.shipping.voyage.Voyage) BookNewCargo(org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo) Location(org.qi4j.sample.dcicargo.sample_a.data.shipping.location.Location) Before(org.junit.Before)

Aggregations

BookNewCargo (org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo)3 Before (org.junit.Before)2 UnitOfWork (org.qi4j.api.unitofwork.UnitOfWork)2 Cargo (org.qi4j.sample.dcicargo.sample_a.data.shipping.cargo.Cargo)2 Cargos (org.qi4j.sample.dcicargo.sample_a.data.shipping.cargo.Cargos)2 Itinerary (org.qi4j.sample.dcicargo.sample_a.data.shipping.itinerary.Itinerary)2 Location (org.qi4j.sample.dcicargo.sample_a.data.shipping.location.Location)2 Voyage (org.qi4j.sample.dcicargo.sample_a.data.shipping.voyage.Voyage)2 Test (org.junit.Test)1 TrackingId (org.qi4j.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId)1