Package org.qi4j.sample.dcicargo.sample_b.context.interaction.booking

Examples of org.qi4j.sample.dcicargo.sample_b.context.interaction.booking.BookNewCargo


                protected void onSubmit( AjaxRequestTarget target, Form<?> form )
                {
                    try
                    {
                        // Perform use case
                        TrackingId trackingId = new BookNewCargo( origin, destination, deadline ).getTrackingId();

                        // Add new tracking id to list in session
                        PrevNext.addId( Session.get(), trackingId.id().get() );

                        // Show created cargo
View Full Code Here


                    // Build sortable random tracking ids
                    uuid = UUID.randomUUID().toString().toUpperCase();
                    id = ( i + 11 ) + "-" + uuid.substring( 0, uuid.indexOf( "-" ) );

                    new BookNewCargo( cargos, origin, destination, deadline ).withTrackingId( id );
                }
                uow.complete();
            }
            catch( Exception e )
            {
View Full Code Here

        throws Exception
    {
        try
        {
            thrown.expect( CannotCreateRouteSpecificationException.class, "Origin location can't be same as destination location." );
            new BookNewCargo( CARGOS, HONGKONG, HONGKONG, DAY24 ).getTrackingId();
        }
        catch( Exception ex )
        {
            ex.printStackTrace();
            throw ex;
View Full Code Here

    public void deviation_2b_DeadlineInThePastNotAccepted()
        throws Exception
    {
        deviation_2a_OriginAndDestinationSame();
        thrown.expect( CannotCreateRouteSpecificationException.class, "Arrival deadline is in the past or Today." );
        new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( -1 ) ).getTrackingId();
    }
View Full Code Here

    public void deviation_2b_DeadlineTodayIsTooEarly()
        throws Exception
    {
        deviation_2b_DeadlineInThePastNotAccepted();
        thrown.expect( CannotCreateRouteSpecificationException.class, "Arrival deadline is in the past or Today." );
        new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 0 ) ).getTrackingId();
    }
View Full Code Here

    @Test
    public void deviation_2b_DeadlineTomorrowIsOkay()
        throws Exception
    {
        deviation_2b_DeadlineTodayIsTooEarly();
        new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY1 ).getTrackingId();
    }
View Full Code Here

    public void step_2_CanCreateRouteSpecification()
        throws Exception
    {
        deviation_2b_DeadlineTomorrowIsOkay();
        UnitOfWork uow = module.currentUnitOfWork();
        trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).getTrackingId();
        cargo = uow.get( CargoEntity.class, trackingId.id().get() );
        assertThat( cargo.routeSpecification().get().origin().get(), is( equalTo( HONGKONG ) ) );
        assertThat( cargo.routeSpecification().get().destination().get(), is( equalTo( STOCKHOLM ) ) );
        assertThat( cargo.routeSpecification().get().arrivalDeadline().get(), is( equalTo( DAY24 ) ) );
    }
View Full Code Here

    public void step_3_CanDeriveInitialDeliveryData()
        throws Exception
    {
        step_2_CanCreateRouteSpecification();
        UnitOfWork uow = module.currentUnitOfWork();
        trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).getTrackingId();
        cargo = uow.get( CargoEntity.class, trackingId.id().get() );
        assertDelivery( null, null, null, null,
                        NOT_RECEIVED, notArrived,
                        NOT_ROUTED, directed, unknownETA, unknownLeg,
                        RECEIVE, HONGKONG, noSpecificDate, noVoyage );
View Full Code Here

    public void deviation_4a_TrackingIdTooShort()
        throws Exception
    {
        step_3_CanDeriveInitialDeliveryData();
        thrown.expect( ConstraintViolationException.class, "for value 'no'" );
        new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "no" );
    }
View Full Code Here

    public void deviation_4a_TrackingIdNotTooShort()
        throws Exception
    {
        deviation_4a_TrackingIdTooShort();
        UnitOfWork uow = module.currentUnitOfWork();
        trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "yes" );
        cargo = uow.get( CargoEntity.class, trackingId.id().get() );
        assertThat( cargo.trackingId().get().id().get(), is( equalTo( "yes" ) ) );
    }
View Full Code Here

TOP

Related Classes of org.qi4j.sample.dcicargo.sample_b.context.interaction.booking.BookNewCargo

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.