You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2016/10/23 14:23:53 UTC

[12/28] zest-java git commit: ZEST-180, ZEST-186, ZEST-187, ZEST-188 Big Identity refactoring UnitOfWorkFactory is auto added to all modules that doesn't declare one IdentityGenerator is auto-added to all modules that deosn't declare one. Removed DCI/DDD

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshotTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshotTest.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshotTest.java
deleted file mode 100644
index 9693d87..0000000
--- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshotTest.java
+++ /dev/null
@@ -1,672 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking;
-
-import java.time.LocalDate;
-import java.time.ZoneOffset;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.sample.dcicargo.sample_a.bootstrap.test.TestApplication;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargos;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.RouteSpecification;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.Delivery;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.RoutingStatus;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.TransportStatus;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvent;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvents;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.itinerary.Itinerary;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType.CLAIM;
-import static org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType.CUSTOMS;
-import static org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType.LOAD;
-import static org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType.UNLOAD;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests of the Build Delivery Snapshot subfunction use case.
- *
- * All deviations of the use case are tested one by one. The business rules are therefore enforcing the
- * structure for the test suite and not arbitrary ideas of the programmer what to test. If the business
- * analyst haven't foreseen a deviation in the use case, it's his responsibility that it's not tested.
- *
- * Test method names describe the test purpose. The prefix refers to the step in the use case.
- *
- * FIXME: Test methods call each other to allow ordered execution, ie. tests are not indepedants !
- */
-public class BuildDeliverySnapshotTest
-    extends TestApplication
-{
-    private final LocalDate TODAY = LocalDate.now();
-
-    private Location HONGKONG;
-    private Location STOCKHOLM;
-    private Location NEWYORK;
-    private Location DALLAS;
-    private Location HANGZHOU;
-    private Location HELSINKI;
-    private Location TOKYO;
-    private Location HAMBURG;
-    private Voyage V100S;
-    private Voyage V200T;
-    private Voyage V300A;
-    private Voyage V400S;
-    private Voyage V500S;
-    private Location SHANGHAI;
-    private TrackingId trackingId;
-    private Cargo cargo;
-    private Itinerary itinerary;
-    private UnitOfWorkFactory uowf;
-
-    @Before
-    public void prepareTest()
-        throws Exception
-    {
-        super.prepareTest();
-        uowf = module.unitOfWorkFactory();
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HONGKONG = uow.get( Location.class, CNHKG.code().get() );
-        STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
-        SHANGHAI = uow.get( Location.class, CNSHA.code().get() );
-        TOKYO = uow.get( Location.class, JNTKO.code().get() );
-        NEWYORK = uow.get( Location.class, USNYC.code().get() );
-        DALLAS = uow.get( Location.class, USDAL.code().get() );
-        HANGZHOU = uow.get( Location.class, CNHGH.code().get() );
-        HELSINKI = uow.get( Location.class, FIHEL.code().get() );
-        HAMBURG = uow.get( Location.class, DEHAM.code().get() );
-        V100S = uow.get( Voyage.class, "V100S" );
-        V200T = uow.get( Voyage.class, "V200T" );
-        V300A = uow.get( Voyage.class, "V300A" );
-        V400S = uow.get( Voyage.class, "V400S" );
-        V500S = uow.get( Voyage.class, "V500S" );
-
-        Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID );
-        trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 17 ) ).createCargo( "ABC" );
-        cargo = uow.get( Cargo.class, trackingId.id().get() );
-
-        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 ) )
-        );
-    }
-
-    // DERIVE WITH ROUTE SPECIFICATION ==============================================================================
-
-    @Test( expected = RouteException.class )
-    public void deviation_2a_InvalidRouteSpecification_sameLocations()
-        throws Exception
-    {
-        RouteSpecification routeSpec = routeSpecification( HONGKONG, HONGKONG, day( 20 ) );
-        new BuildDeliverySnapshot( routeSpec ).get();
-    }
-
-    @Test( expected = RouteException.class )
-    public void deviation_2b_InvalidRouteSpecification_tooEarlyDeadline()
-        throws Exception
-    {
-        RouteSpecification routeSpec = routeSpecification( HONGKONG, STOCKHOLM, TODAY );
-        new BuildDeliverySnapshot( routeSpec ).get();
-    }
-
-    @Test
-    public void deviation_2c_ItineraryIsUnknown_buildFromRouteSpecification()
-        throws Exception
-    {
-        RouteSpecification routeSpec = routeSpecification( HONGKONG, STOCKHOLM, day( 20 ) );
-        Delivery delivery = new BuildDeliverySnapshot( routeSpec ).get();
-
-        assertThat( delivery.timestamp().get().isAfter( TODAY.atStartOfDay().toInstant( ZoneOffset.UTC ) ), is( equalTo( true ) ) ); // TODAY is set first
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.NOT_ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.NOT_RECEIVED ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent()
-                        .get()
-                        .handlingEventType()
-                        .get(), is( equalTo( HandlingEventType.RECEIVE ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().location().get(), is( equalTo( HONGKONG ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().voyage().get(), is( equalTo( null ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( null ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( null ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) );
-        assertThat( delivery.eta().get(), is( equalTo( null ) ) );
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( false ) ) );
-    }
-
-    // DERIVE WITH NON-ROUTED CARGO ==============================================================================
-
-    @Test
-    public void deviation_2c_ItineraryIsUnknown_buildFromNonRoutedCargo()
-        throws Exception
-    {
-        deviation_2c_ItineraryIsUnknown_buildFromRouteSpecification();
-
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        RouteSpecification routeSpec = routeSpecification( HONGKONG, STOCKHOLM, day( 20 ) );
-        Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID );
-        Delivery delivery = new BuildDeliverySnapshot( routeSpec ).get();
-        CARGOS.createCargo( routeSpec, delivery, "ABCD" );
-
-        // Same as previous test (just build from cargo instead)
-        assertThat( delivery.timestamp().get().isAfter( TODAY.atStartOfDay().toInstant( ZoneOffset.UTC ) ), is( equalTo( true ) ) ); // TODAY is set first
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.NOT_ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.NOT_RECEIVED ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().handlingEventType().get(),
-                    is( equalTo( HandlingEventType.RECEIVE ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().location().get(), is( equalTo( HONGKONG ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().voyage().get(), is( equalTo( null ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( null ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( null ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) );
-        assertThat( delivery.eta().get(), is( equalTo( null ) ) );
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( false ) ) );
-    }
-
-    // DERIVE WITH ROUTE SPECIFICATION + ITINERARY (Routed cargo) ==============================================
-
-    @Test
-    public void deviation_2d_UnsatisfyingItinerary_wrongOrigin()
-        throws Exception
-    {
-        deviation_2c_ItineraryIsUnknown_buildFromNonRoutedCargo();
-
-        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 ) )
-        );
-
-        // Hangzhou not in itinerary first leg
-        RouteSpecification routeSpec = routeSpecification( HANGZHOU, STOCKHOLM, day( 20 ) );
-        cargo.itinerary().set( itinerary );
-        cargo.routeSpecification().set( routeSpec );
-        Delivery delivery = new BuildDeliverySnapshot( cargo ).get();
-
-        // Route specification not satisfied by itinerary
-        assertThat( itinerary.firstLeg().loadLocation().get(), is( not( equalTo( routeSpec.origin().get() ) ) ) );
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.MISROUTED ) ) );
-    }
-
-    @Test
-    public void deviation_2d_UnsatisfyingItinerary_wrongDestination()
-        throws Exception
-    {
-        deviation_2d_UnsatisfyingItinerary_wrongOrigin();
-
-        // Helsinki not in itinerary last leg
-        RouteSpecification routeSpec = routeSpecification( HONGKONG, HELSINKI, day( 20 ) );
-        cargo.routeSpecification().set( routeSpec );
-        Delivery delivery = new BuildDeliverySnapshot( cargo ).get();
-
-        // Route specification not satisfied by itinerary
-        assertThat( itinerary.lastLeg().unloadLocation().get(), is( not( equalTo( routeSpec.destination().get() ) ) ) );
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.MISROUTED ) ) );
-    }
-
-    @Test
-    public void deviation_2d_UnsatisfyingItinerary_missedDeadline()
-        throws Exception
-    {
-        deviation_2d_UnsatisfyingItinerary_wrongDestination();
-
-        // Arrival on day 12 according to itinerary is not meeting deadline
-        RouteSpecification routeSpec = routeSpecification( HONGKONG, STOCKHOLM, day( 14 ) );
-        cargo.routeSpecification().set( routeSpec );
-        Delivery delivery = new BuildDeliverySnapshot( cargo ).get();
-
-        // Route specification not satisfied by itinerary
-        assertFalse( routeSpec.arrivalDeadline().get().isAfter( itinerary.finalArrivalDate() ) );
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.MISROUTED ) ) );
-    }
-
-    @Test
-    public void deviation_3a_CargoHasNoHandlingHistory()
-        throws Exception
-    {
-        deviation_2d_UnsatisfyingItinerary_missedDeadline();
-
-        LocalDate arrival = day( 16 );
-        LocalDate deadline = day( 20 );
-        // Itinerary will satisfy route specification
-        RouteSpecification routeSpec = routeSpecification( HONGKONG, STOCKHOLM, deadline );
-        cargo.routeSpecification().set( routeSpec );
-        Delivery delivery = new BuildDeliverySnapshot( cargo ).get();
-
-        // Route specification satisfied by itinerary
-        assertThat( itinerary.firstLeg().loadLocation().get(), is( equalTo( routeSpec.origin().get() ) ) );
-        assertThat( itinerary.lastLeg().unloadLocation().get(), is( equalTo( routeSpec.destination().get() ) ) );
-        assertTrue( routeSpec.arrivalDeadline().get().isAfter( itinerary.finalArrivalDate() ) );
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-
-        assertThat( delivery.timestamp()
-                        .get()
-                        .isAfter( TODAY.atStartOfDay()
-                                      .toInstant( ZoneOffset.UTC ) ), is( equalTo( true ) ) ); // TODAY is set first
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.NOT_RECEIVED ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent()
-                        .get()
-                        .handlingEventType()
-                        .get(), is( equalTo( HandlingEventType.RECEIVE ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().location().get(), is( equalTo( HONGKONG ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().voyage().get(), is( equalTo( null ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( null ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( null ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) );
-        assertThat( delivery.eta().get(), is( equalTo( arrival ) ) );
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( false ) ) );
-    }
-
-    // DERIVE WITH ROUTE SPECIFICATION + ITINERARY + LAST HANDLING EVENT ============================================
-
-    @Test
-    public void deviation_4a_RECEIVE_1a_UnexpectedPort()
-        throws Exception
-    {
-        deviation_3a_CargoHasNoHandlingHistory();
-
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
-        // Unexpected receipt in Shanghai
-        HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, HandlingEventType.RECEIVE, SHANGHAI, null );
-        Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
-
-        // We don't know what's next for a misdirected cargo
-        assertThat( delivery.isMisdirected().get(), is( equalTo( true ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get(), is( equalTo( null ) ) );
-        assertThat( delivery.eta().get(), is( equalTo( null ) ) );
-
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.IN_PORT ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( SHANGHAI ) ) );
-
-        // Cargo is still routed - but it should be re-routed according to new (unexpected) location.
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) );
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( false ) ) );
-    }
-
-    @Test
-    public void deviation_4a_RECEIVE_1b_ExpectedPort()
-        throws Exception
-    {
-        deviation_4a_RECEIVE_1a_UnexpectedPort();
-
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
-        // Expected receipt in Hong Kong
-        HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, HandlingEventType.RECEIVE, HONGKONG, null );
-        Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
-
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.IN_PORT ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( HONGKONG ) ) );
-
-        // We expect the cargo to be loaded on voyage V100S in Hong Kong
-        assertThat( delivery.nextExpectedHandlingEvent().get().handlingEventType().get(), is( equalTo( LOAD ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().location().get(), is( equalTo( HONGKONG ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().voyage().get(), is( equalTo( V100S ) ) );
-    }
-
-    @Test
-    public void deviation_4b_LOAD_2a_UnexpectedPort()
-        throws Exception
-    {
-        deviation_4a_RECEIVE_1b_ExpectedPort();
-
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
-        // Unexpected load in Tokyo
-        HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, LOAD, TOKYO, V100S );
-        Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
-
-        assertThat( delivery.isMisdirected().get(), is( equalTo( true ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get(), is( equalTo( null ) ) );
-        assertThat( delivery.eta().get(), is( equalTo( null ) ) );
-
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.ONBOARD_CARRIER ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( TOKYO ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( V100S ) ) );
-    }
-
-    @Test
-    public void deviation_4b_LOAD_2b_ExpectedPort()
-        throws Exception
-    {
-        deviation_4b_LOAD_2a_UnexpectedPort();
-
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
-        // Expected load in Hong Kong
-        HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, LOAD, HONGKONG, V100S );
-        Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
-
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.ONBOARD_CARRIER ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( HONGKONG ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( V100S ) ) );
-
-        // We expect the cargo to be unloaded from voyage V100S in New York
-        assertThat( delivery.nextExpectedHandlingEvent().get().handlingEventType().get(), is( equalTo( UNLOAD ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().location().get(), is( equalTo( NEWYORK ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().voyage().get(), is( equalTo( V100S ) ) );
-    }
-
-    @Test
-    public void deviation_4b_LOAD_2c_UnexpectedVoyageNotFromItinerary()
-        throws Exception
-    {
-        deviation_4b_LOAD_2b_ExpectedPort();
-
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
-        // Load onto unexpected voyage
-        HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, LOAD, HONGKONG, V400S );
-        Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
-
-        assertThat( delivery.isMisdirected().get(), is( equalTo( true ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get(), is( equalTo( null ) ) );
-        assertThat( delivery.eta().get(), is( equalTo( null ) ) );
-
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.ONBOARD_CARRIER ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( HONGKONG ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( V400S ) ) );
-    }
-
-    @Test
-    public void deviation_4b_LOAD_2c_ExpectedButLaterVoyageInItinerary()
-        throws Exception
-    {
-        deviation_4b_LOAD_2c_UnexpectedVoyageNotFromItinerary();
-
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
-
-        // The system doesn't currently check if handling events happen in the right order, so
-        // a cargo can now suddenly load in New York, even though it hasn't got there yet.
-        HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 5 ), day( 5 ), trackingId, LOAD, NEWYORK, V200T );
-        Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
-
-        // Should have been true, but we accept it for now...
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.ONBOARD_CARRIER ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( NEWYORK ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( V200T ) ) );
-
-        // We expect the cargo to be unloaded from voyage V200T in Dallas
-        assertThat( delivery.nextExpectedHandlingEvent().get().handlingEventType().get(), is( equalTo( UNLOAD ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().location().get(), is( equalTo( DALLAS ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().voyage().get(), is( equalTo( V200T ) ) );
-    }
-
-    @Test
-    public void deviation_4c_UNLOAD_1a_UnexpectedPort()
-        throws Exception
-    {
-        deviation_4b_LOAD_2c_ExpectedButLaterVoyageInItinerary();
-
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
-
-        // Unexpected unload in Tokyo
-        HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 5 ), day( 5 ), trackingId, UNLOAD, TOKYO, V100S );
-        Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
-        cargo.delivery().set( delivery );
-
-        assertThat( delivery.isMisdirected().get(), is( equalTo( true ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get(), is( equalTo( null ) ) );
-        assertThat( delivery.eta().get(), is( equalTo( null ) ) );
-
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.IN_PORT ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastHandlingEvent().get().handlingEventType().get(), is( equalTo( UNLOAD ) ) );
-        assertThat( delivery.lastHandlingEvent().get().voyage().get(), is( equalTo( V100S ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( TOKYO ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) );
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( false ) ) );
-
-        // Cargo needs to be rerouted
-
-        // Customer specifies a new route
-        RouteSpecification routeSpec = routeSpecification( TOKYO, STOCKHOLM, day( 20 ) );
-        cargo.routeSpecification().set( routeSpec );
-        delivery = new BuildDeliverySnapshot( cargo ).get();
-        cargo.delivery().set( delivery );
-
-        // Old itinerary will not satisfy new route specification
-        assertThat( itinerary.firstLeg().loadLocation().get(), is( not( equalTo( routeSpec.origin().get() ) ) ) );
-        assertThat( itinerary.lastLeg().unloadLocation().get(), is( equalTo( routeSpec.destination().get() ) ) );
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.MISROUTED ) ) );
-
-        // Old planned arrival time is still satisfying new deadline
-        assertTrue( routeSpec.arrivalDeadline().get().isAfter( itinerary.finalArrivalDate() ) );
-
-        // We don't know what's next before a new itinerary has been chosen
-        assertThat( delivery.nextExpectedHandlingEvent().get(), is( equalTo( null ) ) );
-        assertThat( delivery.eta().get(), is( equalTo( null ) ) );
-
-        // Cargo is still misdirected (in unexpected location) according to old itinerary
-        assertThat( delivery.isMisdirected().get(), is( equalTo( true ) ) );
-
-        // Last known data
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.IN_PORT ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastHandlingEvent().get().handlingEventType().get(), is( equalTo( UNLOAD ) ) );
-        assertThat( delivery.lastHandlingEvent().get().voyage().get(), is( equalTo( V100S ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( TOKYO ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) );
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( false ) ) );
-
-        // New itinerary that satisfy the new route specification. New origin departure from Tokyo.
-        LocalDate arrival = day( 19 );
-        itinerary = itinerary(
-            leg( V400S, TOKYO, HAMBURG, day( 9 ), day( 16 ) ),
-            leg( V500S, HAMBURG, STOCKHOLM, day( 17 ), arrival )
-        );
-
-        // Customer reroutes cargo. This is a possible step in the cargo booking process.
-        new BookNewCargo( cargo, itinerary ).assignCargoToRoute();
-        delivery = cargo.delivery().get();
-
-        // Cargo is on track again
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.IN_PORT ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastHandlingEvent().get().handlingEventType().get(), is( equalTo( UNLOAD ) ) );
-        assertThat( delivery.lastHandlingEvent().get().voyage().get(), is( equalTo( V100S ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( TOKYO ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) );
-        assertThat( delivery.eta().get(), is( equalTo( arrival ) ) );
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( false ) ) );
-
-        // When a cargo is rerouted the (often misdirected) last handling event is flagged as disregarded
-        // since it doesn't have to be part of the new itinerary (this isn't in the Citerus version).
-
-        // We now expect the cargo to be loaded onto voyage V400S in Tokyo heading to Hamburg
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().handlingEventType().get(), is( equalTo( LOAD ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().location().get(), is( equalTo( TOKYO ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().voyage().get(), is( equalTo( V400S ) ) );
-
-        // Cargo is not misdirected anymore according to new itinerary. Cargo location is now expected to be in Tokyo.
-    }
-
-    @Test
-    public void deviation_4c_UNLOAD_1b_ExpectedMidpointLocation()
-        throws Exception
-    {
-        deviation_4c_UNLOAD_1a_UnexpectedPort();
-
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
-
-        // Unload at midpoint location of itinerary
-        HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 8 ), day( 8 ), trackingId, UNLOAD, HAMBURG, V400S );
-        Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
-
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.IN_PORT ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( HAMBURG ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) );
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( false ) ) );
-
-        // We expect the cargo to be loaded onto voyage V200T in New York heading for Dallas
-        assertThat( delivery.nextExpectedHandlingEvent().get().handlingEventType().get(), is( equalTo( LOAD ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().location().get(), is( equalTo( HAMBURG ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().voyage().get(), is( equalTo( V500S ) ) );
-    }
-
-    @Test
-    public void deviation_4c_UNLOAD_1c_Destination()
-        throws Exception
-    {
-        deviation_4c_UNLOAD_1b_ExpectedMidpointLocation();
-
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
-
-        // Unload at destination
-        HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 16 ), day( 16 ), trackingId, UNLOAD, STOCKHOLM, V500S );
-        Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
-
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.IN_PORT ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( STOCKHOLM ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) );
-
-        // Cargo has arrived at destination location
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( true ) ) );
-
-        // We expect the cargo to be claimed by customer
-        assertThat( delivery.nextExpectedHandlingEvent().get().handlingEventType().get(), is( equalTo( CLAIM ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().location().get(), is( equalTo( STOCKHOLM ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().voyage().get(), is( equalTo( null ) ) );
-    }
-
-    @Test
-    public void deviation_4d_CUSTOMS_1a_CargoIsInDestinationPort()
-        throws Exception
-    {
-        deviation_4c_UNLOAD_1c_Destination();
-
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
-
-        // Cargo was handled by the customs authorities
-        HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 16 ), day( 16 ), trackingId, CUSTOMS, STOCKHOLM, null );
-        Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
-
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.IN_PORT ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( STOCKHOLM ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) );
-
-        // Cargo might be at destination, but the last handling event wasn't unloading
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( true ) ) );
-
-        // Shouldn't we expect the cargo to be claimed by the customer now ?
-        assertThat( delivery.nextExpectedHandlingEvent().get(), is( equalTo( null ) ) );
-    }
-
-    @Test
-    public void deviation_4e_CLAIM_1a_CargoIsNotInDestinationPort()
-        throws Exception
-    {
-        deviation_4d_CUSTOMS_1a_CargoIsInDestinationPort();
-
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
-
-        // Cargo was claimed but not at destination location
-        HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 16 ), trackingId, CLAIM, HELSINKI, null );
-        Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
-
-        assertThat( delivery.isMisdirected().get(), is( equalTo( true ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get(), is( equalTo( null ) ) );
-        assertThat( delivery.eta().get(), is( equalTo( null ) ) );
-
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.CLAIMED ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( HELSINKI ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) );
-
-        // Cargo is claimed but has not arrived yet in destination port
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( false ) ) );
-    }
-
-    @Test
-    public void deviation_4e_CLAIM_1b_CargoIsInDestinationPort()
-        throws Exception
-    {
-        deviation_4e_CLAIM_1a_CargoIsNotInDestinationPort();
-
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
-
-        // Cargo was claimed by customer at destination location
-        HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 16 ), day( 16 ), trackingId, CLAIM, STOCKHOLM, null );
-        Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
-
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.CLAIMED ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( handlingEvent ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( STOCKHOLM ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) );
-
-        // Cargo is claimed in destination port
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( true ) ) );
-
-        // No more expected handling events
-        assertThat( delivery.nextExpectedHandlingEvent().get(), is( equalTo( null ) ) );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/InspectCargoTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/InspectCargoTest.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/InspectCargoTest.java
deleted file mode 100644
index 0a05b2d..0000000
--- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/InspectCargoTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_a.context.shipping.handling;
-
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvents;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.sample.dcicargo.sample_a.bootstrap.test.TestApplication;
-import org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo;
-import org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking.BuildDeliverySnapshot;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargos;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.Delivery;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvent;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.itinerary.Itinerary;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Javadoc
- *
- * Test method names describe the test purpose. The prefix refers to the step in the use case.
- */
-public class InspectCargoTest
-    extends TestApplication
-{
-    private Cargo cargo;
-    private TrackingId trackingId;
-    private Location STOCKHOLM;
-    private Location DALLAS;
-    private Location SHANGHAI;
-    private Voyage V200T;
-    private Voyage V300A;
-    private HandlingEvent handlingEvent;
-    private UnitOfWorkFactory uowf;
-
-    @Before
-    public void beforeEachTest()
-        throws Exception
-    {
-        uowf = module.unitOfWorkFactory();
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        Cargos CARGOS = uow.get( Cargos.class, Cargos.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();
-    }
-
-    @Test
-    public void deviation_3a_CargoIsMisdirected()
-        throws Exception
-    {
-        // Create misdirected handling event for cargo (receipt in Shanghai is unexpected)
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.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).
-    }
-
-    @Test
-    public void deviation_3b_CargoHasArrived()
-        throws Exception
-    {
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.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).
-    }
-
-    @Test
-    public void step_3_CargoIsCorrectlyInTransit()
-        throws Exception
-    {
-        logger.info( "  Handling cargo 'ABC' (unloaded in Dallas):" );
-        UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.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." );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEventTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEventTest.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEventTest.java
deleted file mode 100644
index 0f3e992..0000000
--- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEventTest.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_a.context.shipping.handling;
-
-import java.time.LocalDate;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.sample.dcicargo.sample_a.bootstrap.test.TestApplication;
-import org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargos;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.Delivery;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.RoutingStatus;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.TransportStatus;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.itinerary.Itinerary;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType.UNLOAD;
-
-/**
- * Testing the Register Handling Event use case.
- *
- * Test method names describe the test purpose. The prefix refers to the step in the use case.
- */
-public class RegisterHandlingEventTest
-      extends TestApplication
-{
-    private LocalDate date;
-    private String trackId;
-    private String msg;
-    private LocalDate arrival;
-    private Cargo cargo;
-    private TrackingId trackingId;
-    private Cargos CARGOS;
-    private Location HONGKONG;
-    private Location STOCKHOLM;
-    private Location NEWYORK;
-    private Location DALLAS;
-    private Voyage V100S;
-    private Voyage V200T;
-    private Voyage V300A;
-
-    @Before
-    public void beforeEachTest() throws Exception {
-        UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
-        CARGOS = uow.get(Cargos.class,  Cargos.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();
-        date = day( 1 );
-        trackId = trackingId.id().get();
-    }
-
-    // INPUT EXISTENCE VALIDATION ==================================================================
-
-    @Test
-    public void deviation_2a_MissingRegistrationTime() throws Exception
-    {
-        msg = register( null, date, trackId, "RECEIVE", "CNHKG", null );
-        assertThat( msg, is( equalTo( "Registration time was null. All parameters have to be passed." ) ) );
-    }
-    @Test
-    public void deviation_2a_MissingCompletionTime() throws Exception
-    {
-        msg = register( date, null, trackId, "RECEIVE", "CNHKG", null );
-        assertThat( msg, is( equalTo( "Completion time was null. All parameters have to be passed." ) ) );
-    }
-
-    @Test
-    public void deviation_2a_MissingTrackingId() throws Exception
-    {
-        msg = register( date, date, null, "RECEIVE", "CNHKG", null );
-        assertThat( msg, is( equalTo( "Tracking id was null. All parameters have to be passed." ) ) );
-    }
-
-    @Test
-    public void deviation_2a_EmptyTrackingId() throws Exception
-    {
-        msg = register( date, date, "", "RECEIVE", "CNHKG", null );
-        assertThat( msg, is( equalTo( "Tracking id cannot be empty." ) ) );
-    }
-
-    @Test
-    public void deviation_2a_MissingEventType() throws Exception
-    {
-        msg = register( date, date, trackId, null, "CNHKG", null );
-        assertThat( msg, is( equalTo( "Event type was null. All parameters have to be passed." ) ) );
-    }
-
-    @Test
-    public void deviation_2a_EmptyEventType() throws Exception
-    {
-        msg = register( date, date, trackId, "", "CNHKG", null );
-        assertThat( msg, is( equalTo( "Event type cannot be empty." ) ) );
-    }
-
-    @Test
-    public void deviation_2a_MissingUnlocode() throws Exception
-    {
-        msg = register( date, date, trackId, "RECEIVE", null, null );
-        assertThat( msg, is( equalTo( "UnLocode was null. All parameters have to be passed." ) ) );
-    }
-
-    @Test
-    public void deviation_2a_EmptyUnlocode() throws Exception
-    {
-        msg = register( date, date, trackId, "RECEIVE", "", null );
-        assertThat( msg, is( equalTo( "UnLocode cannot be empty." ) ) );
-    }
-
-    @Test
-    public void step_2_CompleteData__Receive_in_Hong_Kong() throws Exception
-    {
-        new RegisterHandlingEvent( date, date, trackId, "RECEIVE", "CNHKG", null ).register();
-    }
-
-
-    // INPUT VALIDATION ==================================================================
-
-    @Test
-    public void deviation_3a_HandlingTypeNotRecognized() throws Exception
-    {
-        msg = register( date, date, trackId, "RECEIPT", "CNHKG", null );
-        assertThat( msg, is( equalTo(
-              "'RECEIPT' is not a valid handling event type. Valid types are: [RECEIVE, LOAD, UNLOAD, CUSTOMS, CLAIM]" ) ) );
-    }
-
-    @Test
-    public void deviation_3b_NoCargoWithTrackingId() throws Exception
-    {
-        msg = register( date, date, "XXX", "RECEIVE", "CNHKG", null );
-        assertThat( msg, is( equalTo( "Found no cargo with tracking id 'XXX'." ) ) );
-    }
-
-    @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( date, date, nonRouted, "RECEIVE", "CNHKG", null );
-        assertThat( msg, is( equalTo( "Can't create handling event for non-routed cargo '" + nonRouted + "'." ) ) );
-    }
-
-    @Test
-    public void deviation_3d_NoLocationWithUnlocode() throws Exception
-    {
-        msg = register( date, date, trackId, "RECEIVE", "ZZZZZ", null );
-        assertThat( msg, is( equalTo( "Unknown location: ZZZZZ" ) ) );
-    }
-
-    @Test
-    public void deviation_3e_1a_MissingVoyageNumber() throws Exception
-    {
-        msg = register( date, date, trackId, "LOAD", "CNHKG", null );
-        assertThat( msg, is( equalTo( "Handling event LOAD requires a voyage. No voyage number submitted." ) ) );
-    }
-
-    @Test
-    public void deviation_3e_1b_MissingVoyage() throws Exception
-    {
-        msg = register( date, date, trackId, "LOAD", "CNHKG", "V600S" );
-        assertThat( msg, is( equalTo( "Found no voyage with voyage number 'V600S'." ) ) );
-    }
-
-    @Test
-    public void deviation_3f_SkipVoyageNumberSilentlyWhenProhibited() throws Exception
-    {
-        new RegisterHandlingEvent( date, date, trackId, "RECEIVE", "CNHKG", "V100S" ).register();
-        assertThat( cargo.delivery().get().currentVoyage().get(), is( equalTo( null ) ) );
-    }
-
-    @Test
-    public void step_3_to_5_ValidRegistration__Load_in_Hong_Kong() throws Exception
-    {
-        new RegisterHandlingEvent( date, date, trackId, "LOAD", "CNHKG", "V100S" ).register();
-
-        Delivery delivery = cargo.delivery().get();
-        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
-        assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.ONBOARD_CARRIER ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().handlingEventType().get(), is( equalTo( UNLOAD ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().location().get(), is( equalTo( NEWYORK ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().voyage().get(), is( equalTo( V100S ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( HONGKONG ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( V100S ) ) );
-        assertThat( delivery.eta().get(), is( equalTo( arrival ) ) );
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( false ) ) );
-    }
-
-
-    private String register( LocalDate registrationDate,
-                             LocalDate completionDate,
-                             String trackingIdString,
-                             String eventTypeString,
-                             String unLocodeString,
-                             String voyageNumberString ) throws Exception
-    {
-        try
-        {
-            new RegisterHandlingEvent( registrationDate,
-                                       completionDate,
-                                       trackingIdString,
-                                       eventTypeString,
-                                       unLocodeString,
-                                       voyageNumberString ).register();
-        }
-        catch (IllegalArgumentException e)
-        {
-            return e.getMessage();
-        }
-        throw new Exception( "Unexpected exception." );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/build.gradle
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/build.gradle b/samples/dci-cargo/dcisample_b/build.gradle
deleted file mode 100644
index 3b7b63c..0000000
--- a/samples/dci-cargo/dcisample_b/build.gradle
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-description = "Sample of how DCI (Data, Context & Interaction) pattern is implemented with Apache Zest\u2122, for Eric Evans DDD sample."
-
-jar { manifest { name = "Apache Zest\u2122 Sample DCI Cargo - Sample B" }}
-
-dependencies {
-
-  compile project( ':org.apache.zest.core:org.apache.zest.core.bootstrap' )
-  compile project( ':org.apache.zest.libraries:org.apache.zest.library.constraints' )
-  compile project( ':org.apache.zest.extensions:org.apache.zest.extension.valueserialization-orgjson' )
-  compile project( ':org.apache.zest.extensions:org.apache.zest.extension.indexing-rdf' )
-  compile project( ':org.apache.zest.tools:org.apache.zest.tool.envisage' )
-  compile libraries.jetty_webapp
-  compile libraries.wicket
-  compile libraries.wicket_devutils
-  compile libraries.wicket_stateless
-  compile libraries.slf4j_api
-
-  runtime project( ':org.apache.zest.core:org.apache.zest.core.runtime' )
-
-  testCompile project( ':org.apache.zest.core:org.apache.zest.core.testsupport' )
-  testCompile libraries.easymock
-
-  testRuntime libraries.logback
-
-}
-
-task(runSample, dependsOn: 'testClasses', type: JavaExec) {
-    main = 'org.apache.zest.sample.dcicargo.sample_b.bootstrap.Start8082'
-    classpath = sourceSets.test.runtimeClasspath
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/GraphTraversalService.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/GraphTraversalService.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/GraphTraversalService.java
deleted file mode 100644
index 754188b..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/GraphTraversalService.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.pathfinder_b.api;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.time.LocalDate;
-import java.util.List;
-
-/**
- * Part of the external graph traversal API exposed by the routing team
- * and used by us (booking and tracking team).
- */
-public interface GraphTraversalService extends Remote
-{
-
-    /**
-     * @param departureDate
-     * @param originUnLocode      origin UN Locode
-     * @param destinationUnLocode destination UN Locode
-     *
-     * @return A list of transit paths
-     *
-     * @throws RemoteException RMI problem
-     */
-    List<TransitPath> findShortestPath( LocalDate departureDate, String originUnLocode, String destinationUnLocode )
-        throws RemoteException;
-
-    List<TransitPath> getVoyages()
-        throws RemoteException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/TransitEdge.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/TransitEdge.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/TransitEdge.java
deleted file mode 100644
index 82174d5..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/TransitEdge.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.pathfinder_b.api;
-
-import java.io.Serializable;
-import java.time.LocalDate;
-
-/**
- * Represents an edge in a path through a graph,
- * describing the route of a cargo.
- */
-public final class TransitEdge implements Serializable
-{
-
-    private final String voyageNumber;
-    private final String fromUnLocode;
-    private final String toUnLocode;
-    private final LocalDate fromDate;
-    private final LocalDate toDate;
-
-    /**
-     * Constructor.
-     *
-     * @param voyageNumber The voyage number
-     * @param fromUnLocode The UNLO code of the originating port
-     * @param toUnLocode  The UNLO code of the destination port
-     * @param fromDate The starting date of the voyage
-     * @param toDate The last day of the voyage
-     */
-    public TransitEdge( final String voyageNumber,
-                        final String fromUnLocode,
-                        final String toUnLocode,
-                        final LocalDate fromDate,
-                        final LocalDate toDate
-    )
-    {
-        this.voyageNumber = voyageNumber;
-        this.fromUnLocode = fromUnLocode;
-        this.toUnLocode = toUnLocode;
-        this.fromDate = fromDate;
-        this.toDate = toDate;
-    }
-
-    public String getVoyageNumber()
-    {
-        return voyageNumber;
-    }
-
-    public String getFromUnLocode()
-    {
-        return fromUnLocode;
-    }
-
-    public String getToUnLocode()
-    {
-        return toUnLocode;
-    }
-
-    public LocalDate getFromDate()
-    {
-        return fromDate;
-    }
-
-    public LocalDate getToDate()
-    {
-        return toDate;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/TransitPath.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/TransitPath.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/TransitPath.java
deleted file mode 100644
index d03403e..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/TransitPath.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.pathfinder_b.api;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.List;
-
-/**
- *
- */
-public final class TransitPath implements Serializable
-{
-
-    private final List<TransitEdge> transitEdges;
-
-    /**
-     * Constructor.
-     *
-     * @param transitEdges The legs for this itinerary.
-     */
-    public TransitPath( final List<TransitEdge> transitEdges )
-    {
-        this.transitEdges = transitEdges;
-    }
-
-    /**
-     * @return An unmodifiable list DTOs.
-     */
-    public List<TransitEdge> getTransitEdges()
-    {
-        return Collections.unmodifiableList( transitEdges );
-    }
-
-    public String print()
-    {
-        StringBuilder sb = new StringBuilder( "\nTRANSIT PATH -----------------------------------------------------" );
-        for( int i = 0; i < transitEdges.size(); i++ )
-        {
-            printLeg( i, sb, transitEdges.get( i ) );
-        }
-        return sb.append( "\n---------------------------------------------------------------\n" ).toString();
-    }
-
-    private void printLeg( int i, StringBuilder sb, TransitEdge edge )
-    {
-        sb.append( "\n  Leg " ).append( i );
-        sb.append( "  Load " );
-        sb.append( edge.getFromDate() );
-        sb.append( " " ).append( edge.getFromUnLocode() );
-        sb.append( "   " ).append( edge.getVoyageNumber() );
-        sb.append( "   Unload " );
-        sb.append( edge.getToDate() );
-        sb.append( " " ).append( edge.getToUnLocode() );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/package.html
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/package.html b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/package.html
deleted file mode 100644
index 8829a5e..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/api/package.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you under the Apache License, Version 2.0 (the
-  ~  "License"); you may not use this file except in compliance
-  ~  with the License.  You may obtain a copy of the License at
-  ~
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~
-  ~
-  -->
-<html>
-<body>
-<p>
-    Public API for the pathfinder application.
-</p>
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/internal/GraphDAO.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/internal/GraphDAO.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/internal/GraphDAO.java
deleted file mode 100644
index 3ff7a87..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/internal/GraphDAO.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.pathfinder_b.internal;
-
-import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Random;
-import org.apache.zest.sample.dcicargo.pathfinder_b.api.TransitEdge;
-import org.apache.zest.sample.dcicargo.pathfinder_b.api.TransitPath;
-
-public class GraphDAO
-{
-    private List<TransitPath> voyages = new ArrayList<>();
-
-    private List<String> listLocations()
-    {
-        return new ArrayList<>( Arrays.asList(
-            "CNHKG", "AUMEL", "SESTO", "FIHEL", "USCHI", "JNTKO", "DEHAM", "CNSHA", "NLRTM", "SEGOT", "CNHGH", "SOMGQ", "USNYC", "USDAL"
-        ) );
-    }
-
-    List<TransitPath> voyages()
-    {
-        if( voyages.size() > 0 )
-        {
-            return voyages;
-        }
-
-        LocalDate departureDate = LocalDate.now();
-        for( int i = 0; i < 50; i++ )
-        {
-            List<String> locations = getRandomChunkOfLocations( listLocations() );
-            final List<TransitEdge> transitEdges = new ArrayList<>( locations.size() - 1 );
-            final String voyageNumber = "V" + ( 101 + i );
-
-            // Origin and destination of voyage schedule
-            String from = locations.remove( 0 );
-            String destination = locations.remove( 0 );
-
-            LocalDate date = nextDate( departureDate );
-            LocalDate fromDate;
-            LocalDate toDate;
-
-            // Carrier movements
-            for( final String to : locations )
-            {
-                fromDate = nextDate( date );
-                toDate = nextDate( fromDate );
-                date = nextDate( toDate );
-                transitEdges.add( new TransitEdge( voyageNumber, from, to, fromDate, toDate ) );
-
-                // Arrival location of last carrier movement becomes departure location of next
-                from = to;
-            }
-
-            // Final carrier movement
-            fromDate = nextDate( date );
-            toDate = nextDate( fromDate );
-            transitEdges.add( new TransitEdge( voyageNumber, from, destination, fromDate, toDate ) );
-
-            voyages.add( new TransitPath( transitEdges ) );
-        }
-
-        return voyages;
-    }
-
-    private LocalDate nextDate( LocalDate date )
-    {
-        return date.plusDays(1);
-    }
-
-    private List<String> getRandomChunkOfLocations( List<String> allLocations )
-    {
-        Collections.shuffle( allLocations );
-        final int total = allLocations.size();
-        // Including origin and destination
-        final int chunk = total > 6 ? 3 + new Random().nextInt( 5 ) : total;
-        return allLocations.subList( 0, chunk );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/internal/GraphTraversalServiceImpl.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/internal/GraphTraversalServiceImpl.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/internal/GraphTraversalServiceImpl.java
deleted file mode 100644
index c7b6484..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/internal/GraphTraversalServiceImpl.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.pathfinder_b.internal;
-
-import java.rmi.RemoteException;
-import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Random;
-import org.apache.zest.sample.dcicargo.pathfinder_b.api.GraphTraversalService;
-import org.apache.zest.sample.dcicargo.pathfinder_b.api.TransitEdge;
-import org.apache.zest.sample.dcicargo.pathfinder_b.api.TransitPath;
-
-public class GraphTraversalServiceImpl
-    implements GraphTraversalService
-{
-    private GraphDAO dao;
-    private Random random;
-
-    public GraphTraversalServiceImpl( GraphDAO dao )
-    {
-        this.dao = dao;
-        this.random = new Random();
-    }
-
-    // Combine existing voyages to create a route.
-    public List<TransitPath> findShortestPath( final LocalDate departureDate,
-                                               final String originUnLocode,
-                                               final String destinationUnLocode
-    )
-    {
-        // Transit paths (itineraries)
-        final int candidateCount = getRandomNumberOfCandidates();
-        final List<TransitPath> routeCandidates = new ArrayList<TransitPath>( candidateCount );
-
-        int maxTries = 50;
-        int tries = 0;
-        do
-        {
-            String expectedDeparture = originUnLocode;
-            LocalDate lastArrivalTime = departureDate;
-
-            // Transit edges (itinerary legs)
-            final List<TransitEdge> routeEdges = new ArrayList<TransitEdge>();
-
-            // Avoid duplicate locations
-            final List<String> oldDepartures = new ArrayList<String>();
-
-            // Loop by depth - enabling chronological order
-            int depth = 0;
-            do
-            {
-                final List<TransitPath> voyages = getShuffledVoyages( dao.voyages() );
-
-                for( TransitPath voyage : voyages )
-                {
-                    if( depth >= voyage.getTransitEdges().size() )
-                    {
-                        continue;
-                    }
-
-                    final TransitEdge voyageEdge = voyage.getTransitEdges().get( depth );
-
-                    final String departure = voyageEdge.getFromUnLocode();
-                    final String arrival = voyageEdge.getToUnLocode();
-                    final LocalDate departureTime = voyageEdge.getFromDate();
-                    final LocalDate arrivalTime = voyageEdge.getToDate();
-
-                    boolean expectsDeparture = departure.equals( expectedDeparture );
-                    boolean uniqueDeparture = !oldDepartures.contains( departure );
-                    boolean uniqueArrival = !oldDepartures.contains( arrival );
-                    boolean afterLastArrivalTime = departureTime.isAfter( lastArrivalTime );
-
-                    if( expectsDeparture && uniqueDeparture && uniqueArrival && afterLastArrivalTime )
-                    {
-                        // Visited departure locations
-                        oldDepartures.add( departure );
-
-                        // Go with this carrier movement
-                        routeEdges.add( voyageEdge );
-
-                        // Current carrier movement destination will be origin of next movement
-                        expectedDeparture = arrival;
-                        lastArrivalTime = arrivalTime;
-
-                        // Go deeper to next edge in transit path (later dates)
-                        break;
-                    }
-                }
-            }
-            while( !expectedDeparture.equals( destinationUnLocode ) && depth++ < 10 );
-
-            // Satisfying routes with at least 2 legs (nextDeparture is the last arrival location)
-            if( expectedDeparture.equals( destinationUnLocode ) && routeEdges.size() > 1 )
-            {
-                routeCandidates.add( new TransitPath( routeEdges ) );
-            }
-        }
-        while( routeCandidates.size() < candidateCount && tries++ < maxTries );
-
-        return routeCandidates;
-    }
-
-    private List<TransitPath> getShuffledVoyages( List<TransitPath> voyages )
-    {
-        Collections.shuffle( voyages );
-        return voyages;
-    }
-
-    public List<TransitPath> getVoyages()
-        throws RemoteException
-    {
-        return dao.voyages();
-    }
-
-    private int getRandomNumberOfCandidates()
-    {
-        return 3 + random.nextInt( 3 );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/internal/package.html
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/internal/package.html b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/internal/package.html
deleted file mode 100644
index 00de161..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/internal/package.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you under the Apache License, Version 2.0 (the
-  ~  "License"); you may not use this file except in compliance
-  ~  with the License.  You may obtain a copy of the License at
-  ~
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~
-  ~
-  -->
-<html>
-<body>
-<p>
-    Internal parts of the pathfinder application.
-</p>
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/package.html
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/package.html b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/package.html
deleted file mode 100644
index 6329b87..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/pathfinder_b/package.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you under the Apache License, Version 2.0 (the
-  ~  "License"); you may not use this file except in compliance
-  ~  with the License.  You may obtain a copy of the License at
-  ~
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~
-  ~
-  -->
-<html>
-<body>
-<p>
-    This is the pathfinder application context, which is separate from "our" application and context.
-    Our domain model with cargo, itinerary, handling event etc does not exist here.
-    The routing domain service implementation works against the API exposed by
-    this context.
-</p>
-
-<p>
-    It is not related to the core application at all, and is only part of this source tree for
-    developer convenience.
-</p>
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/DCISampleApplication_b.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/DCISampleApplication_b.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/DCISampleApplication_b.java
deleted file mode 100644
index 6e25291..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/DCISampleApplication_b.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.bootstrap;
-
-import org.apache.wicket.ConverterLocator;
-import org.apache.wicket.Page;
-import org.apache.wicket.datetime.PatternDateConverter;
-import org.apache.wicket.devutils.stateless.StatelessChecker;
-import org.apache.zest.sample.dcicargo.sample_b.communication.web.booking.BookNewCargoPage;
-import org.apache.zest.sample.dcicargo.sample_b.communication.web.booking.CargoDetailsPage;
-import org.apache.zest.sample.dcicargo.sample_b.communication.web.booking.CargoListPage;
-import org.apache.zest.sample.dcicargo.sample_b.communication.web.booking.ChangeDestinationPage;
-import org.apache.zest.sample.dcicargo.sample_b.communication.web.booking.ReRouteCargoPage;
-import org.apache.zest.sample.dcicargo.sample_b.communication.web.booking.RouteCargoPage;
-import org.apache.zest.sample.dcicargo.sample_b.communication.web.handling.IncidentLoggingApplicationMockupPage;
-import org.apache.zest.sample.dcicargo.sample_b.communication.web.tracking.TrackCargoPage;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.WicketZestApplication;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.tabs.TabsPanel;
-
-/**
- * DCI Sample application instance
- *
- * A Wicket application backed by Zest.
- */
-public class DCISampleApplication_b
-    extends WicketZestApplication
-{
-    public void wicketInit()
-    {
-        // Tabs and SEO urls
-        mountPages();
-
-        // Show/hide Ajax debugging
-        getDebugSettings().setDevelopmentUtilitiesEnabled( true );
-
-        // Check that components are stateless when required
-        getComponentPostOnBeforeRenderListeners().add( new StatelessChecker() );
-
-        // Show/hide wicket tags in html code
-        getMarkupSettings().setStripWicketTags( true );
-
-        // Default date format (we don't care for now about the hour of the day)
-        ( (ConverterLocator) getConverterLocator() ).set( java.util.Date.class,
-                                                          new PatternDateConverter( "yyyy-MM-dd", true ) );
-    }
-
-    private void mountPages()
-    {
-        TabsPanel.registerTab( this, CargoListPage.class, "booking", "Booking and Routing" );
-        TabsPanel.registerTab( this, TrackCargoPage.class, "tracking", "Tracking" );
-        TabsPanel.registerTab( this, IncidentLoggingApplicationMockupPage.class, "handling", "Handling" );
-
-        mountPage( "/booking", CargoListPage.class );
-        mountPage( "/booking/book-new-cargo", BookNewCargoPage.class );
-        mountPage( "/booking/cargo", CargoDetailsPage.class );
-        mountPage( "/booking/change-destination", ChangeDestinationPage.class );
-        mountPage( "/booking/route-cargo", RouteCargoPage.class );
-        mountPage( "/booking/re-route-cargo", ReRouteCargoPage.class );
-
-        mountPage( "/tracking", TrackCargoPage.class );
-
-        mountPage( "/register-handling-event", IncidentLoggingApplicationMockupPage.class );
-    }
-
-    public Class<? extends Page> getHomePage()
-    {
-        return CargoListPage.class;
-    }
-}
\ No newline at end of file