polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [06/34] zest-java git commit: ZEST-132, ZEST-97 UnitOfWorkFactory as a customizable Service UnitOfWork as a customizable Transient Class can be a Transient directly, with itself as both the Composite Type and the Mixin. SideEffects declaratio
Date Thu, 14 Apr 2016 06:13:12 GMT
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java
index 65120c9..90ea8a0 100644
--- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java
+++ b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java
@@ -66,10 +66,10 @@ import static org.apache.zest.api.structure.Application.Mode.test;
  */
 @SuppressWarnings( "unchecked" )
 public class TestAssembler
-      implements ApplicationAssembler
+    implements ApplicationAssembler
 {
     public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
-          throws AssemblyException
+        throws AssemblyException
     {
         // Application assembly
         ApplicationAssembly assembly = applicationFactory.newApplicationAssembly();
@@ -85,17 +85,17 @@ public class TestAssembler
 
         // Layer dependencies
         bootstrapLayer.uses(
-              contextLayer,
-              domainLayer,
-              infrastructureLayer );
+            contextLayer,
+            domainLayer,
+            infrastructureLayer );
 
         contextLayer.uses(
-              domainLayer,
-              infrastructureLayer );
+            domainLayer,
+            infrastructureLayer );
 
         domainLayer.uses(
-              contextLayer,
-              infrastructureLayer
+            contextLayer,
+            infrastructureLayer
         );
 
         // Assemble
@@ -107,120 +107,125 @@ public class TestAssembler
         return assembly;
     }
 
-    private void assembleBootstrapLayer( LayerAssembly bootstrapLayer ) throws AssemblyException
+    private void assembleBootstrapLayer( LayerAssembly bootstrapLayer )
+        throws AssemblyException
     {
-        ModuleAssembly bootstrapModule = bootstrapLayer.module( "BOOTSTRAP-Bootstrap" );
+        ModuleAssembly bootstrapModule = bootstrapLayer.module( "BOOTSTRAP-Bootstrap" ).withDefaultUnitOfWorkFactory();
 
         // Load base data on startup
         bootstrapModule
-              .addServices(
-                    BaseDataService.class )
-              .visibleIn( application )
-              .instantiateOnStartup();
+            .addServices(
+                BaseDataService.class )
+            .visibleIn( application )
+            .instantiateOnStartup();
     }
 
-    private void assembleContextLayer( LayerAssembly contextLayer ) throws AssemblyException
+    private void assembleContextLayer( LayerAssembly contextLayer )
+        throws AssemblyException
     {
         // Role-playing entities
-        ModuleAssembly entityRoleModule = contextLayer.module( "CONTEXT-EntityRole" );
+        ModuleAssembly entityRoleModule = contextLayer.module( "CONTEXT-EntityRole" ).withDefaultUnitOfWorkFactory();
         entityRoleModule
-              .entities(
-                    CargoRoleMap.class,
-                    CargosRoleMap.class,
-                    HandlingEventRoleMap.class,
-                    HandlingEventsRoleMap.class )
-              .visibleIn( application );
-
+            .entities(
+                CargoRoleMap.class,
+                CargosRoleMap.class,
+                HandlingEventRoleMap.class,
+                HandlingEventsRoleMap.class )
+            .visibleIn( application );
 
         // Role-playing values
-        ModuleAssembly valueRoleModule = contextLayer.module( "CONTEXT-ValueRole" );
+        ModuleAssembly valueRoleModule = contextLayer.module( "CONTEXT-ValueRole" ).withDefaultUnitOfWorkFactory();
         valueRoleModule
-              .values(
-                    ItineraryRoleMap.class,
-                    RouteSpecificationRoleMap.class )
-              .visibleIn( application );
-
+            .values(
+                ItineraryRoleMap.class,
+                RouteSpecificationRoleMap.class )
+            .visibleIn( application );
 
-        ModuleAssembly contextSupportModule = contextLayer.module( "CONTEXT-ContextSupport" );
+        ModuleAssembly contextSupportModule = contextLayer.module( "CONTEXT-ContextSupport" )
+            .withDefaultUnitOfWorkFactory();
         contextSupportModule
-              .addServices(
-                    RoutingService.class,
-                    ApplicationEvents.class )
-              .visibleIn( application );
+            .addServices(
+                RoutingService.class,
+                ApplicationEvents.class )
+            .visibleIn( application );
 
         contextSupportModule
-              .values(
-                    RegisterHandlingEventAttemptDTO.class )
-              .visibleIn( application );
+            .values(
+                RegisterHandlingEventAttemptDTO.class )
+            .visibleIn( application );
     }
 
-    private void assembleDomainLayer( LayerAssembly domainLayer ) throws AssemblyException
+    private void assembleDomainLayer( LayerAssembly domainLayer )
+        throws AssemblyException
     {
         // Non-role-playing entities
-        ModuleAssembly entityModule = domainLayer.module( "DOMAIN-Entity" );
+        ModuleAssembly entityModule = domainLayer.module( "DOMAIN-Entity" ).withDefaultUnitOfWorkFactory();
         entityModule
-              .entities(
-                    LocationEntity.class,
-                    VoyageEntity.class )
-              .visibleIn( application );
-
+            .entities(
+                LocationEntity.class,
+                VoyageEntity.class )
+            .visibleIn( application );
 
         // Non-role-playing values
-        ModuleAssembly dataModule = domainLayer.module( "DOMAIN-Data" );
+        ModuleAssembly dataModule = domainLayer.module( "DOMAIN-Data" ).withDefaultUnitOfWorkFactory();
         dataModule
-              .values(
-                    TrackingId.class,
-                    Delivery.class,
-                    ExpectedHandlingEvent.class,
-                    UnLocode.class,
-                    Leg.class,
-                    CarrierMovement.class,
-                    Schedule.class,
-                    VoyageNumber.class )
-              .visibleIn( application );
+            .values(
+                TrackingId.class,
+                Delivery.class,
+                ExpectedHandlingEvent.class,
+                UnLocode.class,
+                Leg.class,
+                CarrierMovement.class,
+                Schedule.class,
+                VoyageNumber.class )
+            .visibleIn( application );
     }
 
-    private void assembleInfrastructureLayer( LayerAssembly infrastructureLayer ) throws AssemblyException
+    private void assembleInfrastructureLayer( LayerAssembly infrastructureLayer )
+        throws AssemblyException
     {
-        ModuleAssembly serializationModule = infrastructureLayer.module( "INFRASTRUCTURE-Serialization" );
+        ModuleAssembly serializationModule = infrastructureLayer.module( "INFRASTRUCTURE-Serialization" )
+            .withDefaultUnitOfWorkFactory();
         serializationModule
             .services( OrgJsonValueSerializationService.class )
             .taggedWith( ValueSerialization.Formats.JSON )
             .setMetaInfo( new Function<Application, Module>()
-        {
-            @Override
-            public Module apply( Application application )
             {
-                return application.findModule( "CONTEXT", "CONTEXT-ContextSupport" );
-            }
-        } )
-        .visibleIn( application );
-
-        ModuleAssembly indexingModule = infrastructureLayer.module( "INFRASTRUCTURE-Indexing" );
+                @Override
+                public Module apply( Application application )
+                {
+                    return application.findModule( "CONTEXT", "CONTEXT-ContextSupport" );
+                }
+            } )
+            .visibleIn( application );
+
+        ModuleAssembly indexingModule = infrastructureLayer.module( "INFRASTRUCTURE-Indexing" )
+            .withDefaultUnitOfWorkFactory();
         indexingModule
-              .objects(
-                    EntityStateSerializer.class,
-                    EntityTypeSerializer.class );
+            .objects(
+                EntityStateSerializer.class,
+                EntityTypeSerializer.class );
 
         indexingModule
-              .addServices(
-                    MemoryRepositoryService.class,
-                    RdfIndexingEngineService.class )
-              .visibleIn( application );
-
+            .addServices(
+                MemoryRepositoryService.class,
+                RdfIndexingEngineService.class )
+            .visibleIn( application );
 
-        ModuleAssembly entityStoreModule = infrastructureLayer.module( "INFRASTRUCTURE-EntityStore" );
+        ModuleAssembly entityStoreModule = infrastructureLayer.module( "INFRASTRUCTURE-EntityStore" )
+            .withDefaultUnitOfWorkFactory();
         entityStoreModule
-              .addServices(
-                    MemoryEntityStoreService.class,
-                    UuidIdentityGeneratorService.class )
-              .visibleIn( application );
+            .addServices(
+                MemoryEntityStoreService.class,
+                UuidIdentityGeneratorService.class )
+            .visibleIn( application );
 
-        ModuleAssembly externalServiceModule = infrastructureLayer.module( "INFRASTRUCTURE-ExternalService" );
+        ModuleAssembly externalServiceModule = infrastructureLayer.module( "INFRASTRUCTURE-ExternalService" )
+            .withDefaultUnitOfWorkFactory();
         externalServiceModule
-              .importedServices(
-                    GraphTraversalService.class )
-              .setMetaInfo( new GraphTraversalServiceImpl( new GraphDAO() ) )
-              .visibleIn( application );
+            .importedServices(
+                GraphTraversalService.class )
+            .setMetaInfo( new GraphTraversalServiceImpl( new GraphDAO() ) )
+            .visibleIn( application );
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java
index 66974bf..236f48d 100644
--- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java
+++ b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java
@@ -19,6 +19,7 @@ package org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking;
 
 import java.util.Date;
 import java.util.List;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -52,19 +53,20 @@ public class BookNewCargoTest
 {
 
     private static final Date TODAY = new Date();
+    private UnitOfWorkFactory uowf;
 
     @Before
     public void prepareTest()
         throws Exception
     {
         super.prepareTest();
-
+        uowf = module.unitOfWorkFactory();
     }
 
     @Test( expected = RouteException.class )
     public void deviation2a_OriginAndDestinationSame() throws Exception
     {
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
         new BookNewCargo( CARGOS, HONGKONG, HONGKONG, day( 17 ) ).book();
@@ -73,7 +75,7 @@ public class BookNewCargoTest
     @Test( expected = RouteException.class )
     public void deviation_2b_1_DeadlineInThePastNotAccepted() throws Exception
     {
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
         Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
@@ -83,7 +85,7 @@ public class BookNewCargoTest
     @Test( expected = RouteException.class )
     public void deviation_2b_2_DeadlineTodayIsTooEarly() throws Exception
     {
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
         Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
@@ -93,7 +95,7 @@ public class BookNewCargoTest
     @Test
     public void deviation_2b_3_DeadlineTomorrowIsOkay() throws Exception
     {
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
         Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
@@ -103,7 +105,7 @@ public class BookNewCargoTest
     @Test
     public void step_2_CreateNewCargo() throws Exception
     {
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
         Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
@@ -143,7 +145,7 @@ public class BookNewCargoTest
     @Test( expected = FoundNoRoutesException.class )
     public void deviation_3a_NoRoutesCanBeThatFast() throws Exception
     {
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
         Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
@@ -157,7 +159,7 @@ public class BookNewCargoTest
     @Test
     public void step_3_CalculatePossibleRoutes() throws Exception
     {
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
         Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
@@ -187,7 +189,7 @@ public class BookNewCargoTest
     @Test
     public void step_5_AssignCargoToRoute() throws Exception
     {
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
         Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/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
index 30c91f9..2277e71 100644
--- 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
@@ -18,6 +18,7 @@
 package org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking;
 
 import java.util.Date;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -74,13 +75,15 @@ public class BuildDeliverySnapshotTest
     private TrackingId trackingId;
     private Cargo cargo;
     private Itinerary itinerary;
+    private UnitOfWorkFactory uowf;
 
     @Before
     public void prepareTest()
         throws Exception
     {
         super.prepareTest();
-        UnitOfWork uow = module.currentUnitOfWork();
+        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() );
@@ -153,7 +156,7 @@ public class BuildDeliverySnapshotTest
     {
         deviation_2c_ItineraryIsUnknown_buildFromRouteSpecification();
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         RouteSpecification routeSpec = routeSpecification( HONGKONG, STOCKHOLM, day( 20 ) );
         Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
         Delivery delivery = new BuildDeliverySnapshot( routeSpec ).get();
@@ -268,7 +271,7 @@ public class BuildDeliverySnapshotTest
     {
         deviation_3a_CargoHasNoHandlingHistory();
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
         // Unexpected receipt in Shanghai
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, HandlingEventType.RECEIVE, SHANGHAI, null );
@@ -294,7 +297,7 @@ public class BuildDeliverySnapshotTest
     {
         deviation_4a_RECEIVE_1a_UnexpectedPort();
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
         // Expected receipt in Hong Kong
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, HandlingEventType.RECEIVE, HONGKONG, null );
@@ -318,7 +321,7 @@ public class BuildDeliverySnapshotTest
     {
         deviation_4a_RECEIVE_1b_ExpectedPort();
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
         // Unexpected load in Tokyo
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, LOAD, TOKYO, V100S );
@@ -340,7 +343,7 @@ public class BuildDeliverySnapshotTest
     {
         deviation_4b_LOAD_2a_UnexpectedPort();
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
         // Expected load in Hong Kong
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, LOAD, HONGKONG, V100S );
@@ -364,7 +367,7 @@ public class BuildDeliverySnapshotTest
     {
         deviation_4b_LOAD_2b_ExpectedPort();
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
         // Load onto unexpected voyage
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, LOAD, HONGKONG, V400S );
@@ -386,7 +389,7 @@ public class BuildDeliverySnapshotTest
     {
         deviation_4b_LOAD_2c_UnexpectedVoyageNotFromItinerary();
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
 
         // The system doesn't currently check if handling events happen in the right order, so
@@ -415,7 +418,7 @@ public class BuildDeliverySnapshotTest
     {
         deviation_4b_LOAD_2c_ExpectedButLaterVoyageInItinerary();
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
 
         // Unexpected unload in Tokyo
@@ -508,7 +511,7 @@ public class BuildDeliverySnapshotTest
     {
         deviation_4c_UNLOAD_1a_UnexpectedPort();
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
 
         // Unload at midpoint location of itinerary
@@ -534,7 +537,7 @@ public class BuildDeliverySnapshotTest
     {
         deviation_4c_UNLOAD_1b_ExpectedMidpointLocation();
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
 
         // Unload at destination
@@ -563,7 +566,7 @@ public class BuildDeliverySnapshotTest
     {
         deviation_4c_UNLOAD_1c_Destination();
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
 
         // Cargo was handled by the customs authorities
@@ -590,7 +593,7 @@ public class BuildDeliverySnapshotTest
     {
         deviation_4d_CUSTOMS_1a_CargoIsInDestinationPort();
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
 
         // Cargo was claimed but not at destination location
@@ -616,7 +619,7 @@ public class BuildDeliverySnapshotTest
     {
         deviation_4e_CLAIM_1a_CargoIsNotInDestinationPort();
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
 
         // Cargo was claimed by customer at destination location

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/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
index e5f9ad6..6a434f9 100644
--- 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
@@ -17,6 +17,7 @@
  */
 package org.apache.zest.sample.dcicargo.sample_a.context.shipping.handling;
 
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -55,12 +56,14 @@ public class InspectCargoTest
     private Voyage V200T;
     private Voyage V300A;
     private HandlingEvent handlingEvent;
+    private UnitOfWorkFactory uowf;
 
     @Before
     public void beforeEachTest()
         throws Exception
     {
-        UnitOfWork uow = module.currentUnitOfWork();
+        uowf = module.unitOfWorkFactory();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         SHANGHAI = uow.get( Location.class, CNSHA.code().get() );
@@ -89,7 +92,7 @@ public class InspectCargoTest
         throws Exception
     {
         // Create misdirected handling event for cargo (receipt in Shanghai is unexpected)
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
         handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 0 ), day( 0 ), trackingId, HandlingEventType.RECEIVE, SHANGHAI, null );
         Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
@@ -106,7 +109,7 @@ public class InspectCargoTest
     public void deviation_3b_CargoHasArrived()
         throws Exception
     {
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
         handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 15 ), day( 15 ), trackingId, HandlingEventType.UNLOAD, STOCKHOLM, V300A );
         Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
@@ -124,7 +127,7 @@ public class InspectCargoTest
         throws Exception
     {
         logger.info( "  Handling cargo 'ABC' (unloaded in Dallas):" );
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
         handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 12 ), day( 12 ), trackingId, HandlingEventType.UNLOAD, DALLAS, V200T );
         cargo.delivery().set( new BuildDeliverySnapshot( cargo, handlingEvent ).get() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/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
index 060d8d3..81e3ae6 100644
--- 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
@@ -64,7 +64,7 @@ public class RegisterHandlingEventTest
 
     @Before
     public void beforeEachTest() throws Exception {
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
         CARGOS = uow.get(Cargos.class,  CargosEntity.CARGOS_ID );
         HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         STOCKHOLM = uow.get( Location.class, SESTO.code().get() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseData.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseData.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseData.java
index a694e43..939a3d2 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseData.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseData.java
@@ -21,8 +21,8 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
-import org.apache.zest.api.structure.Module;
 import org.apache.zest.api.value.ValueBuilder;
+import org.apache.zest.api.value.ValueBuilderFactory;
 import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.parsing.dto.ParsedHandlingEventData;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.Delivery;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.NextHandlingEvent;
@@ -57,23 +57,23 @@ public abstract class BaseData
     protected UnLocode USCHI;
     protected UnLocode USDAL;
     protected UnLocode USNYC;
-    protected final Module module;
+    protected ValueBuilderFactory vbf;
 
-    protected BaseData( Module module )
+    protected BaseData( ValueBuilderFactory vbf )
     {
-        this.module = module;
+        this.vbf = vbf;
     }
 
     protected UnLocode unlocode( String unlocodeString )
     {
-        ValueBuilder<UnLocode> unlocode = module.newValueBuilder( UnLocode.class );
+        ValueBuilder<UnLocode> unlocode = vbf.newValueBuilder( UnLocode.class );
         unlocode.prototype().code().set( unlocodeString );
         return unlocode.newInstance();
     }
 
     protected CarrierMovement carrierMovement( Location depLoc, Location arrLoc, Date depTime, Date arrTime )
     {
-        ValueBuilder<CarrierMovement> carrierMovement = module.newValueBuilder( CarrierMovement.class );
+        ValueBuilder<CarrierMovement> carrierMovement = vbf.newValueBuilder( CarrierMovement.class );
         carrierMovement.prototype().departureLocation().set( depLoc );
         carrierMovement.prototype().arrivalLocation().set( arrLoc );
         carrierMovement.prototype().departureTime().set( depTime );
@@ -83,7 +83,7 @@ public abstract class BaseData
 
     protected Schedule schedule( CarrierMovement... carrierMovements )
     {
-        ValueBuilder<Schedule> schedule = module.newValueBuilder( Schedule.class );
+        ValueBuilder<Schedule> schedule = vbf.newValueBuilder( Schedule.class );
         List<CarrierMovement> cm = new ArrayList<>();
         cm.addAll( Arrays.asList( carrierMovements ) );
         schedule.prototype().carrierMovements().set( cm );
@@ -92,7 +92,7 @@ public abstract class BaseData
 
     protected Leg leg( Voyage voyage, Location load, Location unload, Date loadTime, Date unloadTime )
     {
-        ValueBuilder<Leg> leg = module.newValueBuilder( Leg.class );
+        ValueBuilder<Leg> leg = vbf.newValueBuilder( Leg.class );
         leg.prototype().voyage().set( voyage );
         leg.prototype().loadLocation().set( load );
         leg.prototype().unloadLocation().set( unload );
@@ -103,7 +103,7 @@ public abstract class BaseData
 
     protected Itinerary itinerary( Leg... legArray )
     {
-        ValueBuilder<Itinerary> itinerary = module.newValueBuilder( Itinerary.class );
+        ValueBuilder<Itinerary> itinerary = vbf.newValueBuilder( Itinerary.class );
         List<Leg> legs = new ArrayList<>();
         legs.addAll( Arrays.asList( legArray ) );
         itinerary.prototype().legs().set( legs );
@@ -121,7 +121,7 @@ public abstract class BaseData
         NextHandlingEvent nextHandlingEvent
     )
     {
-        ValueBuilder<Delivery> delivery = module.newValueBuilder( Delivery.class );
+        ValueBuilder<Delivery> delivery = vbf.newValueBuilder( Delivery.class );
         delivery.prototype().timestamp().set( new Date() );
         delivery.prototype().lastHandlingEvent().set( lastHandlingEvent );
         delivery.prototype().transportStatus().set( transportStatus );
@@ -141,7 +141,7 @@ public abstract class BaseData
                                  Integer itineraryProgressIndex
     )
     {
-        ValueBuilder<Delivery> delivery = module.newValueBuilder( Delivery.class );
+        ValueBuilder<Delivery> delivery = vbf.newValueBuilder( Delivery.class );
         delivery.prototype().timestamp().set( date );
         delivery.prototype().transportStatus().set( transportStatus );
         delivery.prototype().routingStatus().set( routingStatus );
@@ -155,7 +155,7 @@ public abstract class BaseData
                                                    Voyage voyage
     )
     {
-        ValueBuilder<NextHandlingEvent> nextHandlingEvent = module.newValueBuilder( NextHandlingEvent.class );
+        ValueBuilder<NextHandlingEvent> nextHandlingEvent = vbf.newValueBuilder( NextHandlingEvent.class );
         nextHandlingEvent.prototype().handlingEventType().set( handlingEventType );
         nextHandlingEvent.prototype().location().set( location );
         nextHandlingEvent.prototype().time().set( time );
@@ -172,7 +172,7 @@ public abstract class BaseData
     )
         throws Exception
     {
-        ValueBuilder<ParsedHandlingEventData> attempt = module.newValueBuilder( ParsedHandlingEventData.class );
+        ValueBuilder<ParsedHandlingEventData> attempt = vbf.newValueBuilder( ParsedHandlingEventData.class );
         attempt.prototype().registrationTime().set( registrationTime );
         attempt.prototype().completionTime().set( completionTime );
         attempt.prototype().trackingIdString().set( trackingIdString );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseDataService.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseDataService.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseDataService.java
index fd3a23e..c8ed3d2 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseDataService.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseDataService.java
@@ -28,10 +28,11 @@ import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.service.ServiceComposite;
 import org.apache.zest.api.service.ServiceReference;
-import org.apache.zest.api.structure.Module;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.apache.zest.api.value.ValueBuilder;
+import org.apache.zest.api.value.ValueBuilderFactory;
 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;
@@ -51,8 +52,8 @@ import static org.apache.zest.api.usecase.UsecaseBuilder.newUsecase;
 /**
  * Create basic sample data on startup of application.
  */
-@Mixins(BaseDataService.Mixin.class)
-@Activators(BaseDataService.Activator.class)
+@Mixins( BaseDataService.Mixin.class )
+@Activators( BaseDataService.Activator.class )
 public interface BaseDataService
     extends ServiceComposite
 {
@@ -76,14 +77,17 @@ public interface BaseDataService
         extends BaseData
         implements BaseDataService
     {
+        @Structure
+        UnitOfWorkFactory uowf;
+
         @Service
         GraphTraversalService graphTraversalService;
 
         private static final Logger logger = LoggerFactory.getLogger( BaseDataService.class );
 
-        protected Mixin( @Structure Module module )
+        protected Mixin( @Structure ValueBuilderFactory vbf )
         {
-            super( module );
+            super( vbf );
         }
 
         @Override
@@ -92,7 +96,7 @@ public interface BaseDataService
         {
             logger.debug( "CREATING BASIC DATA..." );
 
-            UnitOfWork uow = module.newUnitOfWork( newUsecase( "Create base data" ) );
+            UnitOfWork uow = uowf.newUnitOfWork( newUsecase( "Create base data" ) );
 
             // Create locations
             location( unlocode( "AUMEL" ), "Melbourne" );
@@ -125,7 +129,7 @@ public interface BaseDataService
                         carrierMovements.add( carrierMovement( from, to, voyageEdge.getFromDate(), voyageEdge.getToDate() ) );
                     }
 
-                    ValueBuilder<Schedule> schedule = module.newValueBuilder( Schedule.class );
+                    ValueBuilder<Schedule> schedule = vbf.newValueBuilder( Schedule.class );
                     schedule.prototype().carrierMovements().set( carrierMovements );
                     voyage( voyageNumber, schedule.newInstance() );
                 }
@@ -154,14 +158,14 @@ public interface BaseDataService
 
         protected UnLocode unlocode( String unlocodeString )
         {
-            ValueBuilder<UnLocode> unlocode = module.newValueBuilder( UnLocode.class );
+            ValueBuilder<UnLocode> unlocode = vbf.newValueBuilder( UnLocode.class );
             unlocode.prototype().code().set( unlocodeString );
             return unlocode.newInstance();
         }
 
         protected Location location( UnLocode unlocode, String locationStr )
         {
-            UnitOfWork uow = module.currentUnitOfWork();
+            UnitOfWork uow = uowf.currentUnitOfWork();
             EntityBuilder<Location> location = uow.newEntityBuilder( Location.class, unlocode.code().get() );
             location.instance().unLocode().set( unlocode );
             location.instance().name().set( locationStr );
@@ -170,11 +174,11 @@ public interface BaseDataService
 
         protected Voyage voyage( String voyageNumberStr, Schedule schedule )
         {
-            UnitOfWork uow = module.currentUnitOfWork();
+            UnitOfWork uow = uowf.currentUnitOfWork();
             EntityBuilder<Voyage> voyage = uow.newEntityBuilder( Voyage.class, voyageNumberStr );
 
             // VoyageNumber
-            ValueBuilder<VoyageNumber> voyageNumber = module.newValueBuilder( VoyageNumber.class );
+            ValueBuilder<VoyageNumber> voyageNumber = vbf.newValueBuilder( VoyageNumber.class );
             voyageNumber.prototype().number().set( voyageNumberStr );
             voyage.instance().voyageNumber().set( voyageNumber.newInstance() );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/SampleDataService.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/SampleDataService.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/SampleDataService.java
index 5753a0c..b4866c1 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/SampleDataService.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/SampleDataService.java
@@ -22,23 +22,23 @@ import java.util.Date;
 import java.util.List;
 import java.util.Random;
 import java.util.UUID;
-import org.joda.time.DateTime;
-import org.joda.time.LocalDate;
-import org.joda.time.LocalTime;
 import org.apache.zest.api.activation.ActivatorAdapter;
 import org.apache.zest.api.activation.Activators;
+import org.apache.zest.api.composite.TransientBuilderFactory;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.query.Query;
 import org.apache.zest.api.query.QueryBuilder;
+import org.apache.zest.api.query.QueryBuilderFactory;
 import org.apache.zest.api.service.ServiceComposite;
 import org.apache.zest.api.service.ServiceReference;
-import org.apache.zest.api.structure.Module;
 import org.apache.zest.api.unitofwork.UnitOfWork;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.api.usecase.UsecaseBuilder;
 import org.apache.zest.api.value.ValueBuilder;
+import org.apache.zest.api.value.ValueBuilderFactory;
 import org.apache.zest.sample.dcicargo.sample_b.context.interaction.booking.BookNewCargo;
 import org.apache.zest.sample.dcicargo.sample_b.context.interaction.booking.routing.AssignCargoToRoute;
 import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.ProcessHandlingEvent;
@@ -55,6 +55,9 @@ import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinera
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.CarrierMovement;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Voyage;
+import org.joda.time.DateTime;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalTime;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -71,8 +74,8 @@ import static org.apache.zest.sample.dcicargo.sample_b.infrastructure.dci.Contex
  *
  * Add more cases if needed in the loop below.
  */
-@Mixins(SampleDataService.Mixin.class)
-@Activators(SampleDataService.Activator.class)
+@Mixins( SampleDataService.Mixin.class )
+@Activators( SampleDataService.Activator.class )
 public interface SampleDataService
     extends ServiceComposite
 {
@@ -91,11 +94,20 @@ public interface SampleDataService
         }
     }
 
-    public abstract class Mixin
+    abstract class Mixin
         implements SampleDataService
     {
         @Structure
-        Module module;
+        UnitOfWorkFactory uowf;
+
+        @Structure
+        ValueBuilderFactory vbf;
+
+        @Structure
+        QueryBuilderFactory qbf;
+
+        @Structure
+        TransientBuilderFactory tbf;
 
         @Service
         RoutingService routingService;
@@ -112,7 +124,7 @@ public interface SampleDataService
         public void insertSampleData()
             throws Exception
         {
-            prepareContextBaseClass( module );
+            prepareContextBaseClass( uowf, vbf );
 
             logger.info( "######  CREATING SAMPLE DATA...  ##########################################" );
 
@@ -120,11 +132,11 @@ public interface SampleDataService
             populateRandomCargos( 12 );
 
             // Handle cargos
-            UnitOfWork uow = module.newUnitOfWork( newUsecase( "Create sample data" ) );
+            UnitOfWork uow = uowf.newUnitOfWork( newUsecase( "Create sample data" ) );
             try
             {
                 int i = 11; // starting at 11 for sortable tracking id prefix in lists
-                QueryBuilder<Cargo> qb = module.newQueryBuilder( Cargo.class );
+                QueryBuilder<Cargo> qb = qbf.newQueryBuilder( Cargo.class );
                 for( Cargo cargo : uow.newQuery( qb ) )
 
                 {
@@ -157,7 +169,7 @@ public interface SampleDataService
                         Location origin = routeSpec.origin().get();
                         Location dest = routeSpec.destination().get();
                         Location badDest = null;
-                        Query<Location> locations = uow.newQuery( module.newQueryBuilder( Location.class ) );
+                        Query<Location> locations = uow.newQuery( qbf.newQueryBuilder( Location.class ) );
                         for( Location loc : locations )
                         {
                             if( !origin.equals( loc ) && !dest.equals( loc ) )
@@ -193,8 +205,8 @@ public interface SampleDataService
                         voyageNumber = nextEvent.voyage().get().voyageNumber().get().number().get();
 
                         // Find earliest wrong carrier movement (voyage) with same departure location
-                        final Query<Voyage> voyages = module.currentUnitOfWork()
-                            .newQuery( module.newQueryBuilder( Voyage.class ) );
+                        final Query<Voyage> voyages = uowf.currentUnitOfWork()
+                            .newQuery( qbf.newQueryBuilder( Voyage.class ) );
                         int depth = 0;
                         do
                         {
@@ -341,11 +353,11 @@ public interface SampleDataService
         private void populateRandomCargos( int numberOfCargos )
         {
             Usecase usecase = UsecaseBuilder.newUsecase( "Populate Random Cargos" );
-            UnitOfWork uow = module.newUnitOfWork( usecase );
+            UnitOfWork uow = uowf.newUnitOfWork( usecase );
 
             CargoAggregateRoot cargos = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 
-            Query<Location> allLocations = uow.newQuery( module.newQueryBuilder( Location.class ) );
+            Query<Location> allLocations = uow.newQuery( qbf.newQueryBuilder( Location.class ) );
             int locationSize = (int) allLocations.count();
 
             // Make array for selection of location with random index
@@ -402,7 +414,7 @@ public interface SampleDataService
         )
             throws Exception
         {
-            ValueBuilder<ParsedHandlingEventData> event = module.newValueBuilder( ParsedHandlingEventData.class );
+            ValueBuilder<ParsedHandlingEventData> event = vbf.newValueBuilder( ParsedHandlingEventData.class );
             event.prototype().registrationTime().set( registrationTime );
             event.prototype().completionTime().set( completionTime );
             event.prototype().trackingIdString().set( trackingIdString );
@@ -410,7 +422,7 @@ public interface SampleDataService
             event.prototype().unLocodeString().set( unLocodeString );
             event.prototype().voyageNumberString().set( voyageNumberString );
 
-            module.newTransient( ProcessHandlingEvent.class ).register( event.newInstance() );
+            tbf.newTransient( ProcessHandlingEvent.class ).register( event.newInstance() );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/WicketZestApplication.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/WicketZestApplication.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/WicketZestApplication.java
index 55ceeab..ad391db 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/WicketZestApplication.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/WicketZestApplication.java
@@ -23,13 +23,17 @@ import org.apache.wicket.protocol.http.WebApplication;
 import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
 import org.apache.wicket.request.cycle.RequestCycle;
 import org.apache.zest.api.ZestAPI;
+import org.apache.zest.api.composite.TransientBuilderFactory;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
+import org.apache.zest.api.query.QueryBuilderFactory;
 import org.apache.zest.api.structure.Application;
 import org.apache.zest.api.structure.Module;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.apache.zest.api.usecase.UsecaseBuilder;
+import org.apache.zest.api.value.ValueBuilderFactory;
 import org.apache.zest.bootstrap.ApplicationAssembler;
 import org.apache.zest.bootstrap.Energy4Java;
 import org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion.EntityToDTOService;
@@ -54,7 +58,16 @@ public class WicketZestApplication
     protected Module zestModule;
 
     @Structure
-    protected Module module;
+    protected UnitOfWorkFactory uowf;
+
+    @Structure
+    protected ValueBuilderFactory vbf;
+
+    @Structure
+    protected TransientBuilderFactory tbf;
+
+    @Structure
+    protected QueryBuilderFactory qbf;
 
     @Structure
     protected ZestAPI api;
@@ -118,10 +131,10 @@ public class WicketZestApplication
         startZest();
         handleUnitOfWork();
 
-        Context.prepareContextBaseClass( module );
-        BaseWebPage.prepareBaseWebPageClass( module );
+        Context.prepareContextBaseClass( uowf, vbf );
+        BaseWebPage.prepareBaseWebPageClass( tbf );
         ReadOnlyModel.prepareModelBaseClass( zestModule, api, valueConverter );
-        Queries.prepareQueriesBaseClass( module, module );
+        Queries.prepareQueriesBaseClass( uowf, qbf );
 
         wicketInit();
     }
@@ -163,14 +176,14 @@ public class WicketZestApplication
                 logger.debug( requestCycle.getRequest().toString() );
                 logger.debug( requestCycle.getRequest().getRequestParameters().toString() );
 
-                UnitOfWork uow = module.newUnitOfWork( UsecaseBuilder.newUsecase( "REQUEST" ) );
+                UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( "REQUEST" ) );
                 logger.debug( "  ### NEW " + uow + "   ### MODULE: " + zestModule );
             }
 
             @Override
             public void onEndRequest( final RequestCycle requestCycle )
             {
-                UnitOfWork uow = module.currentUnitOfWork();
+                UnitOfWork uow = uowf.currentUnitOfWork();
                 if( uow != null )
                 {
                     try

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/dci/Context.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/dci/Context.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/dci/Context.java
index f74c29b..f57a0be 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/dci/Context.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/dci/Context.java
@@ -19,8 +19,9 @@ package org.apache.zest.sample.dcicargo.sample_b.infrastructure.dci;
 
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
-import org.apache.zest.api.structure.Module;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.apache.zest.api.value.ValueBuilder;
+import org.apache.zest.api.value.ValueBuilderFactory;
 import org.apache.zest.api.value.ValueComposite;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -41,7 +42,8 @@ public abstract class Context
      *
      * All entities should be created through aggregate r
      */
-    private static Module module;
+    private static ValueBuilderFactory vbf;
+    private static UnitOfWorkFactory uowf;
 
     protected Context()
     {
@@ -122,22 +124,23 @@ public abstract class Context
 
     protected <T, U> T rolePlayer( Class<T> roleClass, Class<U> dataClass, String entityId )
     {
-        U dataObject = module.currentUnitOfWork().get( dataClass, entityId );
+        U dataObject = uowf.currentUnitOfWork().get( dataClass, entityId );
         return rolePlayer( roleClass, dataObject );
     }
 
     protected static <T> T loadEntity( Class<T> entityRoleClass, String entityId )
     {
-        return module.currentUnitOfWork().get( entityRoleClass, entityId );
+        return uowf.currentUnitOfWork().get( entityRoleClass, entityId );
     }
 
     protected static <T extends ValueComposite> ValueBuilder<T> valueBuilder( Class<T> valueClass )
     {
-        return module.newValueBuilder( valueClass );
+        return vbf.newValueBuilder( valueClass );
     }
 
-    public static void prepareContextBaseClass( Module module )
+    public static void prepareContextBaseClass( UnitOfWorkFactory uowf, ValueBuilderFactory vbf )
     {
-        Context.module = module;
+        Context.uowf = uowf;
+        Context.vbf = vbf;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/EntityModel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/EntityModel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/EntityModel.java
index 459488b..4383ed1 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/EntityModel.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/EntityModel.java
@@ -73,10 +73,10 @@ public class EntityModel<T extends DTO, U extends EntityComposite>
 
     private U loadEntity()
     {
-        U entity = module.currentUnitOfWork().get( entityClass, identity );
+        U entity = uowf.currentUnitOfWork().get( entityClass, identity );
         if( entity == null )
         {
-            Usecase usecase = module.currentUnitOfWork().usecase();
+            Usecase usecase = uowf.currentUnitOfWork().usecase();
             throw new NoSuchEntityException( EntityReference.parseEntityReference( identity ), entityClass, usecase );
         }
         return entity;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/JSONModel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/JSONModel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/JSONModel.java
index aa9a2d9..4aa7567 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/JSONModel.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/JSONModel.java
@@ -35,7 +35,7 @@ public class JSONModel<T, U extends ValueComposite>
     @SuppressWarnings( "unchecked" )
     public JSONModel( T valueComposite, Class<U> valueCompositeClass )
     {
-        json = module.findService( ValueSerializer.class ).get().serialize( (U) valueComposite );;
+        json = serviceFinder.findService( ValueSerializer.class ).get().serialize( (U) valueComposite );;
         this.valueCompositeClass = valueCompositeClass;
     }
 
@@ -59,7 +59,7 @@ public class JSONModel<T, U extends ValueComposite>
         if( valueComposite == null && json != null )
         {
             // De-serialize
-            valueComposite = (T) module.newValueFromSerializedState( valueCompositeClass, json ); // Unchecked cast
+            valueComposite = (T) vbf.newValueFromSerializedState( valueCompositeClass, json ); // Unchecked cast
         }
         return valueComposite;
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/ReadOnlyModel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/ReadOnlyModel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/ReadOnlyModel.java
index fb99ade..ad3ef43 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/ReadOnlyModel.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/ReadOnlyModel.java
@@ -19,7 +19,10 @@ package org.apache.zest.sample.dcicargo.sample_b.infrastructure.model;
 
 import org.apache.wicket.model.IModel;
 import org.apache.zest.api.ZestAPI;
+import org.apache.zest.api.service.ServiceFinder;
 import org.apache.zest.api.structure.Module;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
+import org.apache.zest.api.value.ValueBuilderFactory;
 import org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion.EntityToDTOService;
 
 /**
@@ -34,7 +37,9 @@ public abstract class ReadOnlyModel<T>
 
     static protected EntityToDTOService valueConverter;
     static protected ZestAPI api;
-    static protected Module module;
+    static protected ServiceFinder serviceFinder;
+    static protected UnitOfWorkFactory uowf;
+    static protected ValueBuilderFactory vbf;
 
     /**
      * This default implementation of setObject unconditionally throws an
@@ -64,7 +69,9 @@ public abstract class ReadOnlyModel<T>
                                               EntityToDTOService entityToDTO
     )
     {
-        module = m;
+        uowf = m.unitOfWorkFactory();
+        serviceFinder = m;
+        vbf = m;
         ReadOnlyModel.api = api;
         valueConverter = entityToDTO;
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestApplication.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestApplication.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestApplication.java
index fa2c3ed..1c51598 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestApplication.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestApplication.java
@@ -19,6 +19,9 @@ package org.apache.zest.sample.dcicargo.sample_b.bootstrap.test;
 
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import org.apache.zest.api.query.QueryBuilderFactory;
+import org.apache.zest.api.service.ServiceFinder;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -65,6 +68,10 @@ import static org.junit.Assert.*;
 public class TestApplication
       extends BaseData
 {
+    protected static ServiceFinder serviceFinder;
+    protected static UnitOfWorkFactory uowf;
+    protected static QueryBuilderFactory qbf;
+
     // Logger for sub classes
     protected Logger logger = LoggerFactory.getLogger( getClass() );
 
@@ -157,7 +164,11 @@ public class TestApplication
         System.out.println( "\n@@@@@@@@@@@  TEST SUITE  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" );
         app = new Energy4Java().newApplication( new TestAssembler() );
         app.activate();
-        Context.prepareContextBaseClass( findHostingModule() );
+        Module module = findHostingModule();
+        serviceFinder = module;
+        qbf = module;
+        uowf = module.unitOfWorkFactory();
+        Context.prepareContextBaseClass( module.unitOfWorkFactory(), module );
 
     }
 
@@ -175,11 +186,11 @@ public class TestApplication
     {
         logger.info( name.getMethodName() );
         Usecase usecase = UsecaseBuilder.newUsecase( "Usecase:" + name );
-        UnitOfWork uow = module.newUnitOfWork(usecase);
+        UnitOfWork uow = uowf.newUnitOfWork( usecase);
         populateTestData();
 
         ServiceReference<RouteSpecificationFactoryService> routeSpecFactoryServiceRef =
-            module.findService( RouteSpecificationFactoryService.class );
+            serviceFinder.findService( RouteSpecificationFactoryService.class );
         routeSpecFactory = routeSpecFactoryServiceRef.get();
 
         // Separate test suites in console output
@@ -189,16 +200,16 @@ public class TestApplication
     @After
     public void concludeTests()
     {
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         if (uow != null)
         {
             uow.discard();
         }
-        if( module.isUnitOfWorkActive() )
+        if( uowf.isUnitOfWorkActive() )
         {
-            while( module.isUnitOfWorkActive() )
+            while( uowf.isUnitOfWorkActive() )
             {
-                uow = module.currentUnitOfWork();
+                uow = uowf.currentUnitOfWork();
                 if( uow.isOpen() )
                 {
                     System.err.println( "UnitOfWork not cleaned up:" + uow.usecase().name() );
@@ -247,7 +258,7 @@ public class TestApplication
         USDAL = unlocode( "USDAL" ); // Dallas
         USNYC = unlocode( "USNYC" ); // New York
 
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
 
         // Get locations created in BaseDataService on startup
         MELBOURNE = uow.get( Location.class, "AUMEL" );
@@ -430,11 +441,11 @@ public class TestApplication
 
     protected Voyage voyage( String voyageNumberStr, Schedule schedule )
     {
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         EntityBuilder<Voyage> voyage = uow.newEntityBuilder( Voyage.class, voyageNumberStr );
 
         // VoyageNumber
-        ValueBuilder<VoyageNumber> voyageNumber = module.newValueBuilder( VoyageNumber.class );
+        ValueBuilder<VoyageNumber> voyageNumber = vbf.newValueBuilder( VoyageNumber.class );
         voyageNumber.prototype().number().set( voyageNumberStr );
         voyage.instance().voyageNumber().set( voyageNumber.newInstance() );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestAssembler.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestAssembler.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestAssembler.java
index 1995a0b..42e7a04 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestAssembler.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestAssembler.java
@@ -113,7 +113,7 @@ public class TestAssembler
     private void assembleBootstrapLayer( LayerAssembly bootstrapLayer )
         throws AssemblyException
     {
-        ModuleAssembly bootstrapModule = bootstrapLayer.module( "BOOTSTRAP-Bootstrap" );
+        ModuleAssembly bootstrapModule = bootstrapLayer.module( "BOOTSTRAP-Bootstrap" ).withDefaultUnitOfWorkFactory();
 
         // Load base data on startup
         bootstrapModule
@@ -125,7 +125,7 @@ public class TestAssembler
     private void assembleContextLayer( LayerAssembly contextLayer )
         throws AssemblyException
     {
-        ModuleAssembly roleMapModule = contextLayer.module( "CONTEXT-RoleMap" );
+        ModuleAssembly roleMapModule = contextLayer.module( "CONTEXT-RoleMap" ).withDefaultUnitOfWorkFactory();
 
         // Role-playing entities
         roleMapModule
@@ -143,13 +143,13 @@ public class TestAssembler
                 VoyageEntity.class )
             .visibleIn( application );
 
-        ModuleAssembly interactionModule = contextLayer.module( "CONTEXT-Interaction" );
+        ModuleAssembly interactionModule = contextLayer.module( "CONTEXT-Interaction" ).withDefaultUnitOfWorkFactory();
         interactionModule
             .transients(
                 ProcessHandlingEvent.class )
             .visibleIn( application );
 
-        ModuleAssembly contextServiceModule = contextLayer.module( "CONTEXT-Service" );
+        ModuleAssembly contextServiceModule = contextLayer.module( "CONTEXT-Service" ).withDefaultUnitOfWorkFactory();
         contextServiceModule
             .services(
                 ParseHandlingEventData.class,
@@ -167,7 +167,7 @@ public class TestAssembler
         throws AssemblyException
     {
         // Non-role-playing values
-        ModuleAssembly structureModule = dataLayer.module( "DATA-Structure" );
+        ModuleAssembly structureModule = dataLayer.module( "DATA-Structure" ).withDefaultUnitOfWorkFactory();
         structureModule
             .values(
                 TrackingId.class,
@@ -187,14 +187,14 @@ public class TestAssembler
     private void assembleInfrastructureLayer( LayerAssembly infrastructureLayer )
         throws AssemblyException
     {
-        ModuleAssembly serializationModule = infrastructureLayer.module( "INFRASTRUCTURE-Serialization" );
+        ModuleAssembly serializationModule = infrastructureLayer.module( "INFRASTRUCTURE-Serialization" ).withDefaultUnitOfWorkFactory();
         serializationModule
             .services( OrgJsonValueSerializationService.class )
             .taggedWith( ValueSerialization.Formats.JSON )
             .setMetaInfo( (Function<Application, Module>) application -> application.findModule( "CONTEXT", "CONTEXT-RoleMap" ) )
         .visibleIn( application );
 
-        ModuleAssembly indexingModule = infrastructureLayer.module( "INFRASTRUCTURE-Indexing" );
+        ModuleAssembly indexingModule = infrastructureLayer.module( "INFRASTRUCTURE-Indexing" ).withDefaultUnitOfWorkFactory();
         indexingModule
             .objects(
                 EntityStateSerializer.class,
@@ -207,14 +207,14 @@ public class TestAssembler
             .visibleIn( application )
             .instantiateOnStartup();
 
-        ModuleAssembly entityStoreModule = infrastructureLayer.module( "INFRASTRUCTURE-EntityStore" );
+        ModuleAssembly entityStoreModule = infrastructureLayer.module( "INFRASTRUCTURE-EntityStore" ).withDefaultUnitOfWorkFactory();
         entityStoreModule
             .addServices(
                 MemoryEntityStoreService.class,
                 UuidIdentityGeneratorService.class )
             .visibleIn( application );
 
-        ModuleAssembly externalServiceModule = infrastructureLayer.module( "INFRASTRUCTURE-ExternalService" );
+        ModuleAssembly externalServiceModule = infrastructureLayer.module( "INFRASTRUCTURE-ExternalService" ).withDefaultUnitOfWorkFactory();
         externalServiceModule
             .importedServices(
                 GraphTraversalService.class )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/BookNewCargoTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/BookNewCargoTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/BookNewCargoTest.java
index cacd426..aa9a944 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/BookNewCargoTest.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/BookNewCargoTest.java
@@ -50,7 +50,7 @@ public class BookNewCargoTest extends TestApplication
         throws Exception
     {
         super.prepareTest();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
     }
 
@@ -101,7 +101,7 @@ public class BookNewCargoTest extends TestApplication
         throws Exception
     {
         deviation_2b_DeadlineTomorrowIsOkay();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.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 ) ) );
@@ -114,7 +114,7 @@ public class BookNewCargoTest extends TestApplication
         throws Exception
     {
         step_2_CanCreateRouteSpecification();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).getTrackingId();
         cargo = uow.get( CargoEntity.class, trackingId.id().get() );
         assertDelivery( null, null, null, null,
@@ -137,7 +137,7 @@ public class BookNewCargoTest extends TestApplication
         throws Exception
     {
         deviation_4a_TrackingIdTooShort();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.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" ) ) );
@@ -157,7 +157,7 @@ public class BookNewCargoTest extends TestApplication
         throws Exception
     {
         deviation_4a_TrackingIdTooLong();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "123456789012345678901234567890" );
         cargo = uow.get( CargoEntity.class, trackingId.id().get() );
         assertThat( cargo.trackingId().get().id().get(), is( equalTo( "123456789012345678901234567890" ) ) );
@@ -202,7 +202,7 @@ public class BookNewCargoTest extends TestApplication
         throws Exception
     {
         step_4_CanAutoCreateTrackingIdFromNull();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "ABC" );
         cargo = uow.get( CargoEntity.class, trackingId.id().get() );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/routing/AssignCargoToRouteTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/routing/AssignCargoToRouteTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/routing/AssignCargoToRouteTest.java
index 7682ceb..f21169b 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/routing/AssignCargoToRouteTest.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/routing/AssignCargoToRouteTest.java
@@ -55,7 +55,7 @@ public class AssignCargoToRouteTest extends TestApplication
         throws Exception
     {
         super.prepareTest();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HANDLING_EVENTS = uow.get( HandlingEventAggregateRoot.class, HandlingEventAggregateRoot.HANDLING_EVENTS_ID );
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/routing/RegisterNewDestinationTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/routing/RegisterNewDestinationTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/routing/RegisterNewDestinationTest.java
index 00474d2..c35d4e2 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/routing/RegisterNewDestinationTest.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/routing/RegisterNewDestinationTest.java
@@ -54,7 +54,7 @@ public class RegisterNewDestinationTest extends TestApplication
         throws Exception
     {
         super.prepareTest();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HANDLING_EVENTS = uow.get( HandlingEventAggregateRoot.class, HandlingEventAggregateRoot.HANDLING_EVENTS_ID );
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/specification/DeriveUpdatedRouteSpecTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/specification/DeriveUpdatedRouteSpecTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/specification/DeriveUpdatedRouteSpecTest.java
index e8fb093..a8bb584 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/specification/DeriveUpdatedRouteSpecTest.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/specification/DeriveUpdatedRouteSpecTest.java
@@ -42,7 +42,7 @@ public class DeriveUpdatedRouteSpecTest extends TestApplication
         throws Exception
     {
         super.prepareTest();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HANDLING_EVENTS = uow.get( HandlingEventAggregateRoot.class, HandlingEventAggregateRoot.HANDLING_EVENTS_ID );
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectArrivedCargoTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectArrivedCargoTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectArrivedCargoTest.java
index 1b61869..b1fb4c3 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectArrivedCargoTest.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectArrivedCargoTest.java
@@ -48,7 +48,7 @@ public class InspectArrivedCargoTest extends TestApplication
         throws Exception
     {
         super.prepareTest();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HANDLING_EVENTS = uow.get( HandlingEventAggregateRoot.class, HandlingEventAggregateRoot.HANDLING_EVENTS_ID );
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectCargoInCustomsTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectCargoInCustomsTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectCargoInCustomsTest.java
index 7b6bd59..7f32055 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectCargoInCustomsTest.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectCargoInCustomsTest.java
@@ -47,7 +47,7 @@ public class InspectCargoInCustomsTest extends TestApplication
         throws Exception
     {
         super.prepareTest();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HANDLING_EVENTS = uow.get( HandlingEventAggregateRoot.class, HandlingEventAggregateRoot.HANDLING_EVENTS_ID );
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectClaimedCargoTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectClaimedCargoTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectClaimedCargoTest.java
index bf8aa65..d161ef3 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectClaimedCargoTest.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectClaimedCargoTest.java
@@ -45,7 +45,7 @@ public class InspectClaimedCargoTest extends TestApplication
         throws Exception
     {
         super.prepareTest();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HANDLING_EVENTS = uow.get( HandlingEventAggregateRoot.class, HandlingEventAggregateRoot.HANDLING_EVENTS_ID );
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectLoadedCargoTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectLoadedCargoTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectLoadedCargoTest.java
index ddc6026..6d9b4f3 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectLoadedCargoTest.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectLoadedCargoTest.java
@@ -63,7 +63,7 @@ public class InspectLoadedCargoTest extends TestApplication
         throws Exception
     {
         super.prepareTest();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
         HANDLING_EVENTS = uow.get( HandlingEventAggregateRoot.class, HandlingEventAggregateRoot.HANDLING_EVENTS_ID );
         // Create new cargo

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectReceivedCargoTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectReceivedCargoTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectReceivedCargoTest.java
index 89c45bf..c7591ae 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectReceivedCargoTest.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectReceivedCargoTest.java
@@ -53,7 +53,7 @@ public class InspectReceivedCargoTest extends TestApplication
         throws Exception
     {
         super.prepareTest();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HANDLING_EVENTS = uow.get( HandlingEventAggregateRoot.class, HandlingEventAggregateRoot.HANDLING_EVENTS_ID );
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectUnhandledCargoTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectUnhandledCargoTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectUnhandledCargoTest.java
index 4f6b473..a5d1242 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectUnhandledCargoTest.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectUnhandledCargoTest.java
@@ -47,7 +47,7 @@ public class InspectUnhandledCargoTest extends TestApplication
         throws Exception
     {
         super.prepareTest();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HANDLING_EVENTS = uow.get( HandlingEventAggregateRoot.class, HandlingEventAggregateRoot.HANDLING_EVENTS_ID );
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectUnloadedCargoTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectUnloadedCargoTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectUnloadedCargoTest.java
index a8b8a31..7146839 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectUnloadedCargoTest.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/inspection/event/InspectUnloadedCargoTest.java
@@ -55,7 +55,7 @@ public class InspectUnloadedCargoTest extends TestApplication
         throws Exception
     {
         super.prepareTest();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         HANDLING_EVENTS = uow.get( HandlingEventAggregateRoot.class, HandlingEventAggregateRoot.HANDLING_EVENTS_ID );
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/parsing/ParseHandlingEventDataTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/parsing/ParseHandlingEventDataTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/parsing/ParseHandlingEventDataTest.java
index d296149..1b81117 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/parsing/ParseHandlingEventDataTest.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/parsing/ParseHandlingEventDataTest.java
@@ -46,7 +46,7 @@ public class ParseHandlingEventDataTest extends TestApplication
     {
         super.prepareTest();
         TestApplication.setup();
-        UnitOfWork uow = module.currentUnitOfWork();
+        UnitOfWork uow = uowf.currentUnitOfWork();
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 
         // Create new cargo
@@ -60,7 +60,7 @@ public class ParseHandlingEventDataTest extends TestApplication
 
         // Start ParseHandlingEventData service
         ServiceReference<ParseHandlingEventData> ParseHandlingEventDataRef =
-            module.findService( ParseHandlingEventData.class );
+            serviceFinder.findService( ParseHandlingEventData.class );
         handlingEventParser = ParseHandlingEventDataRef.get();
     }
 


Mime
View raw message