Package org.qi4j.sample.dcicargo.sample_a.context.shipping.booking

Examples of org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BuildDeliverySnapshot


            ApplicationEvents applicationEvents;

            public void inspect()
            {
                // Step 1: Update delivery history of cargo.
                context.delivery = new BuildDeliverySnapshot( context.cargo, registeredHandlingEvent ).get();

                // Step 2: Replace updated delivery snapshot of cargo
                context.cargo.delivery().set( context.delivery );

                // Deviation 3a: Publish that cargo was misdirected
View Full Code Here


    {
        // 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();
View Full Code Here

        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();
View Full Code Here

    {
        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." );
    }
View Full Code Here

TOP

Related Classes of org.qi4j.sample.dcicargo.sample_a.context.shipping.booking.BuildDeliverySnapshot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.