polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [1/7] zest-java git commit: ZEST-124 - Replaced Joda Time API with Java Time API, and I also removed the java.util.Date support and all uses except where required when interfacing with other systems.
Date Sun, 12 Jun 2016 06:24:02 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop d83eae7f2 -> 379100175


http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEvent.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEvent.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEvent.java
index 5e6bae8..a905caf 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEvent.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEvent.java
@@ -19,8 +19,7 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.data.structure.handling;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.time.LocalDate;
 import org.apache.zest.api.association.Association;
 import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.mixin.Mixins;
@@ -57,9 +56,9 @@ import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Voyage;
 @Mixins( HandlingEvent.Mixin.class )
 public interface HandlingEvent
 {
-    Property<Date> registrationTime();
+    Property<LocalDate> registrationDate();
 
-    Property<Date> completionTime();
+    Property<LocalDate> completionDate();
 
     Property<TrackingId> trackingId();
 
@@ -83,18 +82,14 @@ public interface HandlingEvent
                 voyage = voyage().get().voyageNumber().get().number().get();
             }
 
-            SimpleDateFormat date = new SimpleDateFormat( "yyyy-MM-dd" );
-
-            StringBuilder builder = new StringBuilder( "\nHANDLING EVENT -----------------" ).
-                append( "\n  Cargo       " ).append( trackingId().get().id().get() ).
-                append( "\n  Type        " ).append( handlingEventType().get().name() ).
-                append( "\n  Location    " ).append( location().get().getString() ).
-                append( "\n  Completed   " ).append( date.format( completionTime().get() ) ).
-                append( "\n  Registered  " ).append( date.format( registrationTime().get() ) ).
-                append( "\n  Voyage      " ).append( voyage ).
-                append( "\n--------------------------------\n" );
-
-            return builder.toString();
+            return "\nHANDLING EVENT -----------------" +
+                   "\n  Cargo       " + trackingId().get().id().get() +
+                   "\n  Type        " + handlingEventType().get().name() +
+                   "\n  Location    " + location().get().getString() +
+                   "\n  Completed   " + completionDate().get() +
+                   "\n  Registered  " + registrationDate().get() +
+                   "\n  Voyage      " + voyage +
+                   "\n--------------------------------\n";
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Itinerary.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Itinerary.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Itinerary.java
index ccfd39a..b40fb60 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Itinerary.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Itinerary.java
@@ -19,11 +19,9 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.time.Duration;
+import java.time.LocalDate;
 import java.util.List;
-import org.joda.time.Days;
-import org.joda.time.LocalDate;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.property.Property;
 import org.apache.zest.api.value.ValueComposite;
@@ -51,9 +49,9 @@ public interface Itinerary
 
     Leg lastLeg();
 
-    Date eta();
+    LocalDate eta();
 
-    int days();
+    long days();
 
     String print();
 
@@ -80,16 +78,16 @@ public interface Itinerary
             return legs().get().get( legs().get().size() - 1 );
         }
 
-        public Date eta()
+        public LocalDate eta()
         {
-            return lastLeg().unloadTime().get();
+            return lastLeg().unloadDate().get();
         }
 
-        public int days()
+        public long days()
         {
-            Date dep = firstLeg().loadTime().get();
-            Date arr = lastLeg().unloadTime().get();
-            return Days.daysBetween( new LocalDate( dep ), new LocalDate( arr ) ).getDays();
+            LocalDate dep = firstLeg().loadDate().get();
+            LocalDate arr = lastLeg().unloadDate().get();
+            return Duration.between( dep, arr ).toDays();
         }
 
         public String print()
@@ -106,11 +104,11 @@ public interface Itinerary
         {
             sb.append( "\n  Leg " ).append( i );
             sb.append( "  Load " );
-            sb.append( new SimpleDateFormat( "yyyy-MM-dd" ).format( leg.loadTime().get() ) );
+            sb.append( leg.loadDate().get() );
             sb.append( " " ).append( leg.loadLocation().get() );
             sb.append( "   " ).append( leg.voyage().get() );
             sb.append( "   Unload " );
-            sb.append( new SimpleDateFormat( "yyyy-MM-dd" ).format( leg.unloadTime().get() ) );
+            sb.append( leg.unloadDate().get() );
             sb.append( " " ).append( leg.unloadLocation().get() );
         }
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Leg.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Leg.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Leg.java
index 38526de..7aeb47c 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Leg.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Leg.java
@@ -19,7 +19,7 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary;
 
-import java.util.Date;
+import java.time.LocalDate;
 import org.apache.zest.api.association.Association;
 import org.apache.zest.api.property.Property;
 import org.apache.zest.api.value.ValueComposite;
@@ -38,11 +38,11 @@ public interface Leg
 {
     Association<Location> loadLocation();
 
-    Property<Date> loadTime();
+    Property<LocalDate> loadDate();
 
     Association<Voyage> voyage();
 
-    Property<Date> unloadTime();
+    Property<LocalDate> unloadDate();
 
     Association<Location> unloadLocation();
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/CarrierMovement.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/CarrierMovement.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/CarrierMovement.java
index 3835c79..af399a9 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/CarrierMovement.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/CarrierMovement.java
@@ -19,7 +19,7 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage;
 
-import java.util.Date;
+import java.time.LocalDate;
 import org.apache.zest.api.association.Association;
 import org.apache.zest.api.property.Property;
 import org.apache.zest.api.value.ValueComposite;
@@ -39,7 +39,7 @@ public interface CarrierMovement
 
     Association<Location> arrivalLocation();
 
-    Property<Date> departureTime();
+    Property<LocalDate> departureDate();
 
-    Property<Date> arrivalTime();
+    Property<LocalDate> arrivalDate();
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/Voyage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/Voyage.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/Voyage.java
index e0fe06a..8304001 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/Voyage.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/Voyage.java
@@ -19,7 +19,6 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage;
 
-import java.text.SimpleDateFormat;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.property.Property;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
@@ -80,10 +79,10 @@ public interface Voyage
         {
             sb.append( "\n  (Leg " ).append( i ).append( ")" );
             sb.append( "  Departure " );
-            sb.append( new SimpleDateFormat( "yyyy-MM-dd" ).format( carrierMovement.departureTime().get() ) );
+            sb.append( carrierMovement.departureDate().get() );
             sb.append( " " ).append( carrierMovement.departureLocation().get() );
             sb.append( "   Arrival  " );
-            sb.append( new SimpleDateFormat( "yyyy-MM-dd" ).format( carrierMovement.arrivalTime().get() ) );
+            sb.append( carrierMovement.arrivalDate().get() );
             sb.append( " " ).append( carrierMovement.arrivalLocation().get() );
         }
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/DateTextFieldWithPicker.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/DateTextFieldWithPicker.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/DateTextFieldWithPicker.java
index e602a5b..2983e03 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/DateTextFieldWithPicker.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/DateTextFieldWithPicker.java
@@ -20,7 +20,10 @@
 package org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.form;
 
 import com.google.code.joliratools.StatelessAjaxEventBehavior;
-import java.util.Date;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
 import java.util.Map;
 import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -35,9 +38,8 @@ import org.apache.wicket.model.Model;
 import org.apache.wicket.model.PropertyModel;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.validation.validator.DateValidator;
-import org.joda.time.DateTime;
-import org.joda.time.LocalDate;
-import org.joda.time.LocalTime;
+
+import static java.util.Date.from;
 
 /**
  * DateTextFieldWithPicker
@@ -50,18 +52,18 @@ public class DateTextFieldWithPicker extends DateTextField
     DatePicker datePicker;
 
     // Configurable widget options
-    LocalDate earliestDate;
-    LocalDate selectedDate;
+    private LocalDate earliestDate;
+    private LocalDate selectedDate;
 
-    final static String YUI_DATE_FORMAT = "MM/dd/yyyy";
+    private final static DateTimeFormatter YUI_DATE_FORMAT = DateTimeFormatter.ofPattern( "MM/dd/yyyy" );
 
     public DateTextFieldWithPicker( String id, String label, Component model )
     {
 //      this( id, new PropertyModel<Date>( model, id ), new StyleDateConverter( "S-", true ) );
-        this( id, label, new PropertyModel<Date>( model, id ), new PatternDateConverter( "yyyy-MM-dd", true ) );
+        this( id, label, new PropertyModel<>( model, id ), new PatternDateConverter( "yyyy-MM-dd", true ) );
     }
 
-    public DateTextFieldWithPicker( String id, String label, IModel<Date> model, DateConverter converter )
+    public DateTextFieldWithPicker( String id, String label, IModel<java.util.Date> model, DateConverter converter )
     {
         super( id, model, converter );
 
@@ -189,8 +191,7 @@ public class DateTextFieldWithPicker extends DateTextField
 
         // Input field validation - date should be _after_ minimumDate (not the same)
         LocalDate minimumDate = newEarliestDate.minusDays( 1 );
-        Date convertedMinimumDate = new DateTime( minimumDate.toDateTime( new LocalTime() ) ).toDate();
-        add( DateValidator.minimum( convertedMinimumDate ) );
+        add( DateValidator.minimum( from( minimumDate.atTime( LocalTime.now() ).toInstant( ZoneOffset.UTC ) ) ) );
 
         return this;
     }
@@ -213,17 +214,17 @@ public class DateTextFieldWithPicker extends DateTextField
     {
         if( selectedDate != null )
         {
-            return selectedDate.toString( YUI_DATE_FORMAT );
+            return YUI_DATE_FORMAT.format( selectedDate );
         }
 
         // Select today or earliest date (if later) as default
         return earliestDate == null ?
-               new LocalDate().toString( YUI_DATE_FORMAT ) :
-               earliestDate.toString( YUI_DATE_FORMAT );
+               YUI_DATE_FORMAT.format( LocalDate.now() ) :
+               YUI_DATE_FORMAT.format( earliestDate );
     }
 
     private String getEarliestDateStr()
     {
-        return earliestDate == null ? "" : earliestDate.toString( YUI_DATE_FORMAT );
+        return earliestDate == null ? "" : YUI_DATE_FORMAT.format( earliestDate );
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/dci-cargo/dcisample_b/src/main/resources/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/CargoDetailsPage.html
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/resources/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/CargoDetailsPage.html b/samples/dci-cargo/dcisample_b/src/main/resources/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/CargoDetailsPage.html
index 37b4a32..0146e20 100644
--- a/samples/dci-cargo/dcisample_b/src/main/resources/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/CargoDetailsPage.html
+++ b/samples/dci-cargo/dcisample_b/src/main/resources/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/CargoDetailsPage.html
@@ -114,9 +114,9 @@
             <tr wicket:id="legs">
                 <td wicket:id="voyage"></td>
                 <td wicket:id="loadLocation"></td>
-                <td wicket:id="loadTime"></td>
+                <td wicket:id="loadDate"></td>
                 <td wicket:id="unloadLocation"></td>
-                <td wicket:id="unloadTime"></td>
+                <td wicket:id="unloadDate"></td>
             </tr>
             </tbody>
         </table>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/dci-cargo/dcisample_b/src/main/resources/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/RoutePanel.html
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/resources/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/RoutePanel.html b/samples/dci-cargo/dcisample_b/src/main/resources/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/RoutePanel.html
index fc3ea2e..3cf259f 100644
--- a/samples/dci-cargo/dcisample_b/src/main/resources/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/RoutePanel.html
+++ b/samples/dci-cargo/dcisample_b/src/main/resources/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/RoutePanel.html
@@ -51,9 +51,9 @@
         <tr wicket:id="legs">
             <td wicket:id="voyage"></td>
             <td wicket:id="loadLocation"></td>
-            <td wicket:id="loadTime"></td>
+            <td wicket:id="loadDate"></td>
             <td wicket:id="unloadLocation"></td>
-            <td wicket:id="unloadTime"></td>
+            <td wicket:id="unloadDate"></td>
         </tr>
         </tbody>
     </table>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/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 e9f1c4f..9690fd7 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,22 +19,16 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.bootstrap.test;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import org.apache.zest.api.entity.EntityBuilder;
 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;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-import org.apache.zest.api.entity.EntityBuilder;
 import org.apache.zest.api.service.ServiceReference;
 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.UnitOfWorkFactory;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.api.usecase.UsecaseBuilder;
 import org.apache.zest.api.value.ValueBuilder;
@@ -57,12 +51,19 @@ import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Voyage;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.VoyageNumber;
 import org.apache.zest.sample.dcicargo.sample_b.infrastructure.dci.Context;
 import org.apache.zest.sample.dcicargo.sample_b.infrastructure.testing.ExpectedException;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.rules.TestName;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Base class for testing Context Interactions
@@ -81,32 +82,32 @@ public class TestApplication
 
     protected static RouteSpecificationFactoryService routeSpecFactory;
 
-    final protected static Date TODAY = new Date();
-    final protected static Date DAY1 = day( 1 );
-    final protected static Date DAY2 = day( 2 );
-    final protected static Date DAY3 = day( 3 );
-    final protected static Date DAY4 = day( 4 );
-    final protected static Date DAY5 = day( 5 );
-    final protected static Date DAY6 = day( 6 );
-    final protected static Date DAY7 = day( 7 );
-    final protected static Date DAY8 = day( 8 );
-    final protected static Date DAY9 = day( 9 );
-    final protected static Date DAY10 = day( 10 );
-    final protected static Date DAY11 = day( 11 );
-    final protected static Date DAY12 = day( 12 );
-    final protected static Date DAY13 = day( 13 );
-    final protected static Date DAY14 = day( 14 );
-    final protected static Date DAY15 = day( 15 );
-    final protected static Date DAY16 = day( 16 );
-    final protected static Date DAY17 = day( 17 );
-    final protected static Date DAY18 = day( 18 );
-    final protected static Date DAY19 = day( 19 );
-    final protected static Date DAY20 = day( 20 );
-    final protected static Date DAY21 = day( 21 );
-    final protected static Date DAY22 = day( 22 );
-    final protected static Date DAY23 = day( 23 );
-    final protected static Date DAY24 = day( 24 );
-    final protected static Date DAY25 = day( 25 );
+    final protected static LocalDate TODAY = LocalDate.now();
+    final protected static LocalDate DAY1 = day( 1 );
+    final protected static LocalDate DAY2 = day( 2 );
+    final protected static LocalDate DAY3 = day( 3 );
+    final protected static LocalDate DAY4 = day( 4 );
+    final protected static LocalDate DAY5 = day( 5 );
+    final protected static LocalDate DAY6 = day( 6 );
+    final protected static LocalDate DAY7 = day( 7 );
+    final protected static LocalDate DAY8 = day( 8 );
+    final protected static LocalDate DAY9 = day( 9 );
+    final protected static LocalDate DAY10 = day( 10 );
+    final protected static LocalDate DAY11 = day( 11 );
+    final protected static LocalDate DAY12 = day( 12 );
+    final protected static LocalDate DAY13 = day( 13 );
+    final protected static LocalDate DAY14 = day( 14 );
+    final protected static LocalDate DAY15 = day( 15 );
+    final protected static LocalDate DAY16 = day( 16 );
+    final protected static LocalDate DAY17 = day( 17 );
+    final protected static LocalDate DAY18 = day( 18 );
+    final protected static LocalDate DAY19 = day( 19 );
+    final protected static LocalDate DAY20 = day( 20 );
+    final protected static LocalDate DAY21 = day( 21 );
+    final protected static LocalDate DAY22 = day( 22 );
+    final protected static LocalDate DAY23 = day( 23 );
+    final protected static LocalDate DAY24 = day( 24 );
+    final protected static LocalDate DAY25 = day( 25 );
 
     protected static Voyage V201;
     protected static Voyage V202;
@@ -119,8 +120,8 @@ public class TestApplication
     final protected static boolean arrived = true;
     final protected static boolean directed = false;
     final protected static boolean misdirected = true;
-    final protected static Date unknownETA = null;
-    final protected static Date noSpecificDate = null;
+    final protected static LocalDate unknownETA = null;
+    final protected static LocalDate noSpecificDate = null;
     final protected static Integer leg1 = 0;
     final protected static Integer leg2 = 1;
     final protected static Integer leg3 = 2;
@@ -129,8 +130,8 @@ public class TestApplication
     final protected static Integer unknownLeg = 0;
     final protected static NextHandlingEvent unknownNextHandlingEvent = null;
 
-    protected Date deadline;
-    protected Date arrival;
+    protected LocalDate deadline;
+    protected LocalDate arrival;
     protected RouteSpecification routeSpec;
     protected RouteSpecification newRouteSpec;
     protected Delivery delivery;
@@ -327,7 +328,7 @@ public class TestApplication
 
     public void assertDelivery( HandlingEventType handlingEventType,
                                 Location location,
-                                Date completion,
+                                LocalDate completionDate,
                                 Voyage voyage,
 
                                 TransportStatus transportStatus,
@@ -335,12 +336,12 @@ public class TestApplication
 
                                 RoutingStatus routingStatus,
                                 Boolean isMisdirected,
-                                Date eta,
+                                LocalDate eta,
                                 Integer itineraryProgress,
 
                                 HandlingEventType nextHandlingEventType,
                                 Location nextLocation,
-                                Date nextTime,
+                                LocalDate nextTime,
                                 Voyage nextVoyage
     ) throws Exception
     {
@@ -348,14 +349,14 @@ public class TestApplication
 
         // Last handling event
         if (delivery.lastHandlingEvent().get() != null
-              || handlingEventType != null || location != null || completion != null || voyage != null)
+              || handlingEventType != null || location != null || completionDate != null || voyage != null)
         {
             assertThat( "lastHandlingEvent - handlingEventType",
                         delivery.lastHandlingEvent().get().handlingEventType().get(), is( equalTo( handlingEventType ) ) );
             assertThat( "lastHandlingEvent - location",
                         delivery.lastHandlingEvent().get().location().get(), is( equalTo( location ) ) );
-            assertThat( "lastHandlingEvent - completionTime",
-                        delivery.lastHandlingEvent().get().completionTime().get(), is( equalTo( completion ) ) );
+            assertThat( "lastHandlingEvent - completionDate",
+                        delivery.lastHandlingEvent().get().completionDate().get(), is( equalTo( completionDate ) ) );
             assertThat( "lastHandlingEvent - voyage",
                         delivery.lastHandlingEvent().get().voyage().get(), is( equalTo( voyage ) ) );
         }
@@ -392,17 +393,16 @@ public class TestApplication
                         delivery.nextHandlingEvent().get().location().get(), is( equalTo( nextLocation ) ) );
 
 
-            if (delivery.nextHandlingEvent().get().time().get() != null)
+            if ( delivery.nextHandlingEvent().get().date().get() != null)
             {
                 // Estimating a new carrier arrival time might be calculated a second
                 // after initial dates are set, so we skip the seconds
-                SimpleDateFormat parser = new SimpleDateFormat( "yyyy-MM-dd HH:mm" );
-                String calculatedTime = parser.format( delivery.nextHandlingEvent().get().time().get() );
-                String expectedTime = parser.format( nextTime );
+                String calculatedTime = delivery.nextHandlingEvent().get().date().get().toString();
+                String expectedTime = nextTime.toString();
                 assertThat( "nextHandlingEvent - time", calculatedTime, is( equalTo( expectedTime ) ) );
             }
             else
-                assertThat( "nextHandlingEvent - time", delivery.nextHandlingEvent().get().time().get(), is( equalTo( nextTime ) ) );
+                assertThat( "nextHandlingEvent - time", delivery.nextHandlingEvent().get().date().get(), is( equalTo( nextTime ) ) );
 
             assertThat( "nextHandlingEvent - voyage",
                         delivery.nextHandlingEvent().get().voyage().get(), is( equalTo( nextVoyage ) ) );
@@ -412,7 +412,7 @@ public class TestApplication
 
     public void assertDelivery( HandlingEventType handlingEventType,
                                 Location location,
-                                Date completion,
+                                LocalDate completionDate,
                                 Voyage voyage,
 
                                 TransportStatus transportStatus,
@@ -420,18 +420,18 @@ public class TestApplication
 
                                 RoutingStatus routingStatus,
                                 Boolean isMisdirected,
-                                Date eta,
+                                LocalDate eta,
                                 Integer itineraryProgress,
 
                                 NextHandlingEvent noNextHandlingEvent
     ) throws Exception
     {
-        assertDelivery( handlingEventType, location, completion, voyage,
+        assertDelivery( handlingEventType, location, completionDate, voyage,
                         transportStatus, isUnloadedAtDestination, routingStatus, isMisdirected, eta,
                         itineraryProgress, null, null, null, null );
     }
 
-    public void assertRouteSpec( Location origin, Location destination, Date earliestDeparture, Date deadline )
+    public void assertRouteSpec( Location origin, Location destination, LocalDate earliestDeparture, LocalDate deadline )
     {
         newRouteSpec = cargo.routeSpecification().get();
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/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 13a976b..9c38ae6 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
@@ -19,7 +19,7 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.context.test.booking.routing;
 
-import java.util.Date;
+import java.time.LocalDate;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -49,7 +49,7 @@ import static org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.H
  */
 public class AssignCargoToRouteTest extends TestApplication
 {
-    static Itinerary itinerary2;
+    private static Itinerary itinerary2;
     private HandlingEventAggregateRoot HANDLING_EVENTS;
 
     @Before
@@ -62,7 +62,7 @@ public class AssignCargoToRouteTest extends TestApplication
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 
         // Create new cargo
-        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, new Date(), deadline = DAY24 );
+        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, LocalDate.now(), deadline = DAY24 );
         delivery = delivery( TODAY, NOT_RECEIVED, NOT_ROUTED, unknownLeg );
         cargo = CARGOS.createCargo( routeSpec, delivery, "ABC" );
         trackingId = cargo.trackingId().get();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/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 03e70c7..1661406 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
@@ -19,7 +19,7 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.context.test.handling.inspection.event;
 
-import java.util.Date;
+import java.time.LocalDate;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -55,7 +55,7 @@ public class InspectArrivedCargoTest extends TestApplication
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 
         // Create new cargo
-        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, new Date(), deadline = DAY24 );
+        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, LocalDate.now(), deadline = DAY24 );
         delivery = delivery( TODAY, IN_PORT, ROUTED, leg5 );
         cargo = CARGOS.createCargo( routeSpec, delivery, "Arrived_CARGO" );
         trackingId = cargo.trackingId().get();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/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 4b6fe7c..44c931e 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
@@ -19,7 +19,7 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.context.test.handling.inspection.event;
 
-import java.util.Date;
+import java.time.LocalDate;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -54,7 +54,7 @@ public class InspectCargoInCustomsTest extends TestApplication
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 
         // Create new cargo
-        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, new Date(), deadline = DAY24 );
+        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, LocalDate.now(), deadline = DAY24 );
         delivery = delivery( TODAY, IN_PORT, ROUTED, leg1 );
         cargo = CARGOS.createCargo( routeSpec, delivery, "CARGO_in_customs" );
         trackingId = cargo.trackingId().get();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/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 81a0218..570b3f7 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
@@ -19,14 +19,14 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.context.test.handling.inspection.event;
 
-import java.util.Date;
-import org.junit.Before;
-import org.junit.Test;
+import java.time.LocalDate;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.sample.dcicargo.sample_b.bootstrap.test.TestApplication;
 import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.inspection.event.InspectClaimedCargo;
 import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.CargoAggregateRoot;
 import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.HandlingEventAggregateRoot;
+import org.junit.Before;
+import org.junit.Test;
 
 import static org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.RoutingStatus.MISROUTED;
 import static org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.RoutingStatus.NOT_ROUTED;
@@ -52,7 +52,7 @@ public class InspectClaimedCargoTest extends TestApplication
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 
         // Create new cargo
-        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, new Date(), deadline = DAY24 );
+        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, LocalDate.now(),deadline = DAY24 );
         delivery = delivery( TODAY, IN_PORT, ROUTED, leg1 );
         cargo = CARGOS.createCargo( routeSpec, delivery, "Claimed_CARGO" );
         trackingId = cargo.trackingId().get();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/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 09cc757..2dd657a 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
@@ -19,7 +19,7 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.context.test.handling.inspection.event;
 
-import java.util.Date;
+import java.time.LocalDate;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -430,7 +430,7 @@ public class InspectLoadedCargoTest extends TestApplication
 
         Leg currentCarrierMovement = itinerary.leg( delivery.itineraryProgressIndex().get() );
         assertThat( currentCarrierMovement.unloadLocation().get(), is( equalTo( DALLAS ) ) );
-        assertThat( currentCarrierMovement.unloadTime().get(), is( equalTo( DAY8 ) ) );
+        assertThat( currentCarrierMovement.unloadDate().get(), is( equalTo( DAY8 ) ) );
         assertThat( currentCarrierMovement.voyage().get(), is( equalTo( V202 ) ) );
 
         assertDelivery( LOAD, NEWYORK, DAY7, V202,
@@ -446,7 +446,7 @@ public class InspectLoadedCargoTest extends TestApplication
         success_Load();
 
         // Risk zone destination
-        routeSpec = routeSpecFactory.build( HANGZHOU, ROTTERDAM, new Date(), deadline = DAY24 );
+        routeSpec = routeSpecFactory.build( HANGZHOU, ROTTERDAM, LocalDate.now(),deadline = DAY24 );
         delivery = delivery( TODAY, ONBOARD_CARRIER, ROUTED, leg1 );
         cargo = CARGOS.createCargo( routeSpec, delivery, "Naive" );
         trackingId = cargo.trackingId().get();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/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 3ea6dfe..1d7b2d8 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
@@ -275,7 +275,7 @@ public class InspectReceivedCargoTest extends TestApplication
         // Itinerary calculations
         NextHandlingEvent nextLoad = cargo.delivery().get().nextHandlingEvent().get();
         assertThat( nextLoad.location().get(), is( equalTo( itinerary.firstLeg().loadLocation().get() ) ) );
-        assertThat( nextLoad.time().get(), is( equalTo( itinerary.firstLeg().loadTime().get() ) ) );
+        assertThat( nextLoad.date().get(), is( equalTo( itinerary.firstLeg().loadDate().get() ) ) );
         assertThat( nextLoad.voyage().get(), is( equalTo( itinerary.firstLeg().voyage().get() ) ) );
 
         assertDelivery( RECEIVE, HONGKONG, DAY1, noVoyage,

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/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 30fb843..2697b36 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
@@ -19,7 +19,7 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.context.test.handling.inspection.event;
 
-import java.util.Date;
+import java.time.LocalDate;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -54,7 +54,7 @@ public class InspectUnhandledCargoTest extends TestApplication
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 
         // Create new cargo
-        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, new Date(), deadline = DAY24 );
+        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, LocalDate.now(), deadline = DAY24 );
         delivery = delivery( TODAY, NOT_RECEIVED, NOT_ROUTED, leg1 );
         cargo = CARGOS.createCargo( routeSpec, delivery, "Claimed_CARGO" );
         trackingId = cargo.trackingId().get();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/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 c05b5cd..3c7d7a0 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
@@ -19,7 +19,7 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.context.test.handling.inspection.event;
 
-import java.util.Date;
+import java.time.LocalDate;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -62,7 +62,7 @@ public class InspectUnloadedCargoTest extends TestApplication
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 
         // Create new cargo
-        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, new Date(), deadline = DAY24 );
+        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, LocalDate.now(), deadline = DAY24 );
         delivery = delivery( TODAY, ONBOARD_CARRIER, ROUTED, leg1 );
         cargo = CARGOS.createCargo( routeSpec, delivery, "Unloaded_CARGO" );
         trackingId = cargo.trackingId().get();
@@ -334,7 +334,7 @@ public class InspectUnloadedCargoTest extends TestApplication
         // Itinerary should have progressed to leg 5
         Leg nextCarrierMovement = itinerary.leg( cargo.delivery().get().itineraryProgressIndex().get() );
         assertThat( nextCarrierMovement.loadLocation().get(), is( equalTo( ROTTERDAM ) ) );
-        assertThat( nextCarrierMovement.loadTime().get(), is( equalTo( DAY20 ) ) );
+        assertThat( nextCarrierMovement.loadDate().get(), is( equalTo( DAY20 ) ) );
         assertThat( nextCarrierMovement.voyage().get(), is( equalTo( V203 ) ) );
 
         assertDelivery( UNLOAD, ROTTERDAM, DAY17, V202,

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/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 0c0c574..751bd11 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
@@ -19,8 +19,8 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.context.test.handling.parsing;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.constraint.ConstraintViolationException;
@@ -39,8 +39,8 @@ import static org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.T
  */
 public class ParseHandlingEventDataTest extends TestApplication
 {
-    static ParseHandlingEventData handlingEventParser;
-    static String completionTime;
+    private static ParseHandlingEventData handlingEventParser;
+    private static String completionDate;
 
     @Before
     public void prepareTest()
@@ -52,13 +52,13 @@ public class ParseHandlingEventDataTest extends TestApplication
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 
         // Create new cargo
-        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, new Date(), deadline = DAY24 );
+        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, LocalDate.now(), deadline = DAY24 );
         delivery = delivery( TODAY, NOT_RECEIVED, ROUTED, unknownLeg );
         cargo = CARGOS.createCargo( routeSpec, delivery, "ABC" );
         trackingId = cargo.trackingId().get();
         trackingIdString = trackingId.id().get();
         cargo.itinerary().set( itinerary );
-        completionTime = new SimpleDateFormat( "yyyy-MM-dd HH:mm" ).format( new Date() );
+        completionDate = LocalDate.now().toString();
 
         // Start ParseHandlingEventData service
         ServiceReference<ParseHandlingEventData> ParseHandlingEventDataRef =
@@ -81,7 +81,7 @@ public class ParseHandlingEventDataTest extends TestApplication
         throws Exception
     {
         thrown.expect( ConstraintViolationException.class, "constraint \"not optional(param2)\", for value 'null'" );
-        handlingEventParser.parse( completionTime, null, "RECEIVE", "CNHKG", null );
+        handlingEventParser.parse( completionDate, null, "RECEIVE", "CNHKG", null );
     }
 
     // etc...
@@ -91,7 +91,7 @@ public class ParseHandlingEventDataTest extends TestApplication
         throws Exception
     {
         // No voyage number string is ok
-        handlingEventParser.parse( completionTime, trackingIdString, "RECEIVE", "CNHKG", null );
+        handlingEventParser.parse( completionDate, trackingIdString, "RECEIVE", "CNHKG", null );
     }
 
     // Empty
@@ -109,7 +109,7 @@ public class ParseHandlingEventDataTest extends TestApplication
         throws Exception
     {
         // Empty voyage number string is ok
-        handlingEventParser.parse( completionTime, trackingIdString, "RECEIVE", "CNHKG", " " );
+        handlingEventParser.parse( completionDate, trackingIdString, "RECEIVE", "CNHKG", " " );
     }
 
     // Basic type conversion
@@ -128,7 +128,7 @@ public class ParseHandlingEventDataTest extends TestApplication
         throws Exception
     {
         thrown.expect( InvalidHandlingEventDataException.class, "No enum const" );
-        handlingEventParser.parse( completionTime, trackingIdString, "HAND_OVER", "CNHKG", null );
+        handlingEventParser.parse( completionDate, trackingIdString, "HAND_OVER", "CNHKG", null );
     }
 
     // Successful parsing
@@ -137,6 +137,6 @@ public class ParseHandlingEventDataTest extends TestApplication
     public void success_Parsing()
         throws Exception
     {
-        handlingEventParser.parse( completionTime, trackingIdString, "RECEIVE", "CNHKG", null );
+        handlingEventParser.parse( completionDate, trackingIdString, "RECEIVE", "CNHKG", null );
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/registration/RegisterHandlingEventTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/registration/RegisterHandlingEventTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/registration/RegisterHandlingEventTest.java
index f496136..acf47e6 100644
--- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/registration/RegisterHandlingEventTest.java
+++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/registration/RegisterHandlingEventTest.java
@@ -19,9 +19,7 @@
  */
 package org.apache.zest.sample.dcicargo.sample_b.context.test.handling.registration;
 
-import java.util.Date;
-import org.junit.Before;
-import org.junit.Test;
+import java.time.LocalDate;
 import org.apache.zest.api.query.Query;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.sample.dcicargo.sample_b.bootstrap.test.TestApplication;
@@ -37,6 +35,8 @@ import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.CargoAggregat
 import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.HandlingEventAggregateRoot;
 import org.apache.zest.sample.dcicargo.sample_b.data.entity.HandlingEventEntity;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEvent;
+import org.junit.Before;
+import org.junit.Test;
 
 import static org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.RoutingStatus.ROUTED;
 import static org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.TransportStatus.IN_PORT;
@@ -67,7 +67,7 @@ public class RegisterHandlingEventTest extends TestApplication
         CargoAggregateRoot CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
 
         // Create new cargo
-        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, new Date(), deadline = DAY24 );
+        routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, LocalDate.now(), deadline = DAY24 );
         delivery = delivery( TODAY, NOT_RECEIVED, ROUTED, unknownLeg );
         cargo = CARGOS.createCargo( routeSpec, delivery, "ABC" );
         cargo.itinerary().set( itinerary );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/forum/src/main/java/org/apache/zest/sample/forum/context/view/ViewPost.java
----------------------------------------------------------------------
diff --git a/samples/forum/src/main/java/org/apache/zest/sample/forum/context/view/ViewPost.java b/samples/forum/src/main/java/org/apache/zest/sample/forum/context/view/ViewPost.java
index 203bae6..7480607 100644
--- a/samples/forum/src/main/java/org/apache/zest/sample/forum/context/view/ViewPost.java
+++ b/samples/forum/src/main/java/org/apache/zest/sample/forum/context/view/ViewPost.java
@@ -19,7 +19,7 @@
  */
 package org.apache.zest.sample.forum.context.view;
 
-import java.util.Date;
+import java.time.Instant;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.Uses;
 import org.apache.zest.api.property.Numbers;
@@ -33,12 +33,12 @@ import org.apache.zest.sample.forum.data.entity.User;
 /**
  * TODO
  */
-public class ViewPost
+class ViewPost
     implements ResourceIndex<Post>
 {
-    PostView viewPost = new PostView();
-    ReplyTopic replyTopic = new ReplyTopic();
-    Poster poster = new Poster();
+    private PostView viewPost = new PostView();
+    private ReplyTopic replyTopic = new ReplyTopic();
+    private Poster poster = new Poster();
 
     public ViewPost bind( @Uses Topic topic, @Uses Post post, @Uses User user )
     {
@@ -59,18 +59,18 @@ public class ViewPost
         return replyTopic.reply( message, viewPost );
     }
 
-    protected class ReplyTopic
+    private class ReplyTopic
         extends Role<Topic>
     {
         @Structure
         UnitOfWorkFactory uowf;
 
-        public Post reply( String message, PostView viewPost )
+        Post reply( String message, PostView viewPost )
         {
             Post post = uowf.currentUnitOfWork().newEntity( Post.class );
             post.message().set( message );
             post.createdBy().set( poster.self() );
-            post.createdOn().set( new Date( uowf.currentUnitOfWork().currentTime() ) );
+            post.createdOn().set( Instant.ofEpochMilli( uowf.currentUnitOfWork().currentTime()) );
             post.replyTo().set( viewPost.self() );
 
             self().lastPost().set( post );
@@ -80,12 +80,12 @@ public class ViewPost
         }
     }
 
-    protected class PostView
+    private class PostView
         extends Role<Post>
     {
     }
 
-    protected class Poster
+    private class Poster
         extends Role<User>
     {
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/forum/src/main/java/org/apache/zest/sample/forum/data/entity/Post.java
----------------------------------------------------------------------
diff --git a/samples/forum/src/main/java/org/apache/zest/sample/forum/data/entity/Post.java b/samples/forum/src/main/java/org/apache/zest/sample/forum/data/entity/Post.java
index dc1bee1..67a56b4 100644
--- a/samples/forum/src/main/java/org/apache/zest/sample/forum/data/entity/Post.java
+++ b/samples/forum/src/main/java/org/apache/zest/sample/forum/data/entity/Post.java
@@ -19,7 +19,7 @@
  */
 package org.apache.zest.sample.forum.data.entity;
 
-import java.util.Date;
+import java.time.Instant;
 import org.apache.zest.api.association.Association;
 import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.entity.EntityComposite;
@@ -50,5 +50,5 @@ public interface Post
 
     Property<User> createdBy();
 
-    Property<Date> createdOn();
+    Property<Instant> createdOn();
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Booking.java
----------------------------------------------------------------------
diff --git a/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Booking.java b/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Booking.java
index 11cd3cd..4499171 100644
--- a/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Booking.java
+++ b/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Booking.java
@@ -20,7 +20,7 @@
 
 package org.apache.zest.sample.rental.domain;
 
-import java.util.Date;
+import java.time.Instant;
 import org.apache.zest.api.association.Association;
 import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.entity.EntityComposite;
@@ -39,9 +39,9 @@ public interface Booking
 
     @Optional
         // if not set, the pickup has not occurred yet.
-    Property<Date> pickedupTime();
+    Property<Instant> pickedupTime();
 
     @Optional
         // if not set, the return has not occurred yet.
-    Property<Date> returnedTime();
+    Property<Instant> returnedTime();
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Car.java
----------------------------------------------------------------------
diff --git a/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Car.java b/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Car.java
index 7eea948..a0faa04 100644
--- a/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Car.java
+++ b/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Car.java
@@ -20,7 +20,7 @@
 
 package org.apache.zest.sample.rental.domain;
 
-import java.util.Date;
+import java.time.LocalDate;
 import org.apache.zest.api.association.Association;
 import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.entity.EntityComposite;
@@ -39,10 +39,10 @@ public interface Car
     Association<CarCategory> category();
 
     @Optional
-    Property<Date> purchasedDate();
+    Property<LocalDate> purchasedDate();
 
     @Optional
-    Property<Date> soldDate();
+    Property<LocalDate> soldDate();
 
     Booking currentBooking();
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Period.java
----------------------------------------------------------------------
diff --git a/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Period.java b/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Period.java
index 308f1f3..bff5564 100644
--- a/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Period.java
+++ b/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/Period.java
@@ -20,14 +20,14 @@
 
 package org.apache.zest.sample.rental.domain;
 
-import java.util.Date;
+import java.time.LocalDate;
 import org.apache.zest.api.property.Property;
 import org.apache.zest.api.value.ValueComposite;
 
 public interface Period
     extends ValueComposite
 {
-    Property<Date> startOfPeriod();
+    Property<LocalDate> startOfPeriod();
 
-    Property<Date> endOfPeriod();
+    Property<LocalDate> endOfPeriod();
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/RentalShop.java
----------------------------------------------------------------------
diff --git a/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/RentalShop.java b/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/RentalShop.java
index d8a75e9..def525e 100644
--- a/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/RentalShop.java
+++ b/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/RentalShop.java
@@ -22,10 +22,12 @@ package org.apache.zest.sample.rental.domain;
 
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
-import java.util.Date;
+import java.time.Instant;
+import java.time.LocalDate;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.stream.Collectors;
 import org.apache.zest.api.association.ManyAssociation;
 import org.apache.zest.api.entity.EntityBuilder;
 import org.apache.zest.api.entity.EntityComposite;
@@ -55,13 +57,13 @@ public interface RentalShop
 
     Booking book( Customer customer, Car car, Period plannedPeriod );
 
-    void pickup( Booking booking, Date time );
+    void pickup( Booking booking, Instant time );
 
-    void returned( Booking booking, Date time );
+    void returned( Booking booking, Instant time );
 
-    void boughtCar( Car car, Date purchasedate );
+    void boughtCar( Car car, LocalDate purchasedate );
 
-    void soldCar( Car car, Date soldDate );
+    void soldCar( Car car, LocalDate soldDate );
 
     Car createCar( String category, String modelName, String licensePlate );
 
@@ -143,12 +145,11 @@ public interface RentalShop
 
         public Set<String> findAllCarModels()
         {
-            HashSet<String> result = new HashSet<String>();
-            for( Car car : state.carsOwned().toList() )
-            {
-                result.add( car.model().get() );
-            }
-            return result;
+            return state.carsOwned()
+                .toList()
+                .stream()
+                .map( car -> car.model().get() )
+                .collect( Collectors.toSet() );
         }
 
         public Booking book( Customer customer, Car car, Period plannedPeriod )
@@ -161,7 +162,7 @@ public interface RentalShop
                 MessageDigest md;
                 md = MessageDigest.getInstance( "MD5" );
                 md.update( instance.identity().get().getBytes() );
-                StringBuffer buf = new StringBuffer();
+                StringBuilder buf = new StringBuilder();
                 byte[] data = md.digest();
                 for( int i = 0; i < 4; i++ )
                 {
@@ -192,23 +193,23 @@ public interface RentalShop
             return booking;
         }
 
-        public void pickup( Booking booking, Date time )
+        public void pickup( Booking booking, Instant time )
         {
             booking.pickedupTime().set( time );
         }
 
-        public void returned( Booking booking, Date time )
+        public void returned( Booking booking, Instant time )
         {
             booking.returnedTime().set( time );
         }
 
-        public void boughtCar( Car car, Date purchaseDate )
+        public void boughtCar( Car car, LocalDate purchaseDate )
         {
             state.carsOwned().add( car );
             car.purchasedDate().set( purchaseDate );
         }
 
-        public void soldCar( Car car, Date soldDate )
+        public void soldCar( Car car, LocalDate soldDate )
         {
             state.carsOwned().remove( car );
             car.soldDate().set( soldDate );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/dev/InitialData.java
----------------------------------------------------------------------
diff --git a/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/dev/InitialData.java b/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/dev/InitialData.java
index 2ef7738..37ce428 100644
--- a/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/dev/InitialData.java
+++ b/samples/rental/src/main/java/org/apache/zest/sample/rental/domain/dev/InitialData.java
@@ -20,9 +20,9 @@
 
 package org.apache.zest.sample.rental.domain.dev;
 
+import java.time.LocalDate;
 import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
+import java.util.Random;
 import org.apache.zest.api.composite.TransientComposite;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.mixin.Mixins;
@@ -44,12 +44,16 @@ public interface InitialData
     abstract class Mixin
         implements DataInitializer
     {
+        private static final Random random = new Random();
+
         @Structure
         UnitOfWorkFactory uowf;
+
         @Structure
         ValueBuilderFactory vbf;
-        private ArrayList<Customer> customers = new ArrayList<Customer>();
-        private ArrayList<Car> cars = new ArrayList<Car>();
+
+        private ArrayList<Customer> customers = new ArrayList<>();
+        private ArrayList<Car> cars = new ArrayList<>();
 
         public void initialize()
             throws Exception
@@ -108,22 +112,12 @@ public interface InitialData
 
         private Period createRandomPeriod()
         {
-            Calendar cal = Calendar.getInstance();
-            cal.setTime( new Date() );
-            cal.add( Calendar.DATE, Math.abs( (int) ( Math.random() * 5.0 ) ) );
-            cal.set( Calendar.HOUR_OF_DAY, 15 );
-            cal.set( Calendar.MINUTE, 0 );
-            cal.set( Calendar.SECOND, 0 );
-            Date earliestPickup = cal.getTime();
-
-            cal.add( Calendar.DATE, Math.abs( (int) ( Math.random() * 30.0 ) ) );
-            cal.set( Calendar.HOUR_OF_DAY, 12 );
-            cal.set( Calendar.MINUTE, 0 );
-            cal.set( Calendar.SECOND, 0 );
-            Date latestReturn = cal.getTime();
+            LocalDate start = LocalDate.now().plusDays( random.nextInt( 5));
+            LocalDate end = start.plusDays( random.nextInt(30));
+
             ValueBuilder<Period> builder = vbf.newValueBuilder( Period.class );
-            builder.prototype().startOfPeriod().set( earliestPickup );
-            builder.prototype().endOfPeriod().set( latestReturn );
+            builder.prototype().startOfPeriod().set( start );
+            builder.prototype().endOfPeriod().set( end );
             return builder.newInstance();
         }
 
@@ -143,58 +137,63 @@ public interface InitialData
         {
             Car car;
             car = shop.createCar( "SUV", "Volvo XC90", "WHO 7878" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "SUV", "BMW X5", "WIT 23" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "SUV", "Volvo XC90", "WHO 7879" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "SUV", "Volvo XC90", "WHO 7880" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "SUV", "BMW X5", "WIT 24" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "SUV", "BMW X5", "WIT 25" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "SUV", "BMW X5", "WIT 26" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "SUV", "BMW X5", "WIT 27" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "Compact", "Mini Cooper S", "WMY 40" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "Compact", "Mini Cooper S", "WMY 41" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "Compact", "Mini Cooper S", "WMY 42" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "Compact", "Mini Cooper S", "WMY 43" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "Compact", "Mini Cooper S", "WMY 44" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "Compact", "Mini Cooper S", "WMY 45" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "Sedan", "BMW 318i", "WRY 900" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "Sedan", "BMW 318i", "WRY 901" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
             car = shop.createCar( "Sedan", "BMW 318i", "WRY 902" );
-            shop.boughtCar( car, new Date() );
+            shop.boughtCar( car, randomPastDate() );
             cars.add( car );
         }
 
+        private LocalDate randomPastDate()
+        {
+            return LocalDate.now().minusDays( random.nextInt( 700 ) );
+        }
+
         private RentalShop createShop( UnitOfWork uow )
             throws UnitOfWorkCompletionException
         {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/samples/rental/src/main/java/org/apache/zest/sample/rental/web/MainPage.java
----------------------------------------------------------------------
diff --git a/samples/rental/src/main/java/org/apache/zest/sample/rental/web/MainPage.java b/samples/rental/src/main/java/org/apache/zest/sample/rental/web/MainPage.java
index 5a9aeb3..3e4efee 100644
--- a/samples/rental/src/main/java/org/apache/zest/sample/rental/web/MainPage.java
+++ b/samples/rental/src/main/java/org/apache/zest/sample/rental/web/MainPage.java
@@ -21,7 +21,7 @@
 package org.apache.zest.sample.rental.web;
 
 import java.text.MessageFormat;
-import java.text.SimpleDateFormat;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
@@ -44,7 +44,7 @@ public interface MainPage
     abstract class BodyContributorMixin
         implements MainPage
     {
-        private SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm" );
+        private DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern( "yyyy-MM-dd HH:mm" );
 
         @Service
         BookingPage bookingPage;
@@ -90,9 +90,9 @@ public interface MainPage
         {
 
             return " / " +
-                   sdf.format( period.startOfPeriod().get() ) +
+                   dateTimeFormatter.format( period.startOfPeriod().get() ) +
                    " - " +
-                   sdf.format( period.endOfPeriod().get() );
+                   dateTimeFormatter.format( period.endOfPeriod().get() );
         }
 
         private Element createElement( Document dom, String element )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/tools/shell/src/dist/bin/zest-boot
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/bin/zest-boot b/tools/shell/src/dist/bin/zest-boot
index 2706289..cc1aaf2 100644
--- a/tools/shell/src/dist/bin/zest-boot
+++ b/tools/shell/src/dist/bin/zest-boot
@@ -75,3 +75,5 @@ else
 
     java -Dzest.home=$ZESTPATH -jar $ZESTPATH/$JARFILE "$@"
 fi
+
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/37910017/tutorials/introduction/thirtyminutes/src/main/java/org/apache/zest/demo/thirtyminutes/ThirtyMinutesDocs.java
----------------------------------------------------------------------
diff --git a/tutorials/introduction/thirtyminutes/src/main/java/org/apache/zest/demo/thirtyminutes/ThirtyMinutesDocs.java b/tutorials/introduction/thirtyminutes/src/main/java/org/apache/zest/demo/thirtyminutes/ThirtyMinutesDocs.java
index db7269c..109eed4 100644
--- a/tutorials/introduction/thirtyminutes/src/main/java/org/apache/zest/demo/thirtyminutes/ThirtyMinutesDocs.java
+++ b/tutorials/introduction/thirtyminutes/src/main/java/org/apache/zest/demo/thirtyminutes/ThirtyMinutesDocs.java
@@ -21,8 +21,8 @@ package org.apache.zest.demo.thirtyminutes;
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
+import java.time.LocalDate;
 import java.util.Calendar;
-import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 import org.apache.zest.api.common.Optional;
@@ -103,10 +103,7 @@ public class ThirtyMinutesDocs
 // START SNIPPET: 7
         QueryBuilder<Order> builder = queryBuilderFactory.newQueryBuilder( Order.class );
 
-        Calendar cal = Calendar.getInstance();
-        cal.setTime( new Date() );
-        cal.roll( Calendar.DAY_OF_MONTH, -90 );
-        Date last90days = cal.getTime();
+        LocalDate last90days = LocalDate.now().minusDays( 90 );
         Order template = templateFor( Order.class );
         builder.where( gt( template.createdDate(), last90days ) );
         Query<Order> query = uow.newQuery(builder);
@@ -125,10 +122,7 @@ public class ThirtyMinutesDocs
 // START SNIPPET: 8
         QueryBuilder<HasCustomer> builder = queryBuilderFactory.newQueryBuilder( HasCustomer.class );
 
-        Calendar cal = Calendar.getInstance();
-        cal.setTime( new Date() );
-        cal.roll( Calendar.MONTH, -1 );
-        Date lastMonth = cal.getTime();
+        LocalDate lastMonth = LocalDate.now().minusMonths( 1 );
         Order template1 = templateFor( Order.class );
         builder.where( gt( template1.createdDate(), lastMonth ) );
         Query<HasCustomer> query = uow.newQuery(builder);
@@ -149,7 +143,7 @@ public class ThirtyMinutesDocs
 
         void completed();
 
-        Property<Date> createdDate();
+        Property<LocalDate> createdDate();
     }
 
 


Mime
View raw message