瀏覽代碼

Using Voyage.Builder to create sample voyages.

peter_backlund 18 年之前
父節點
當前提交
efa598eb67
共有 1 個文件被更改,包括 63 次插入0 次删除
  1. 63
    0
      dddsample/src/test/java/se/citerus/dddsample/domain/model/carrier/SampleVoyages.java

+ 63
- 0
dddsample/src/test/java/se/citerus/dddsample/domain/model/carrier/SampleVoyages.java 查看文件

1
 package se.citerus.dddsample.domain.model.carrier;
1
 package se.citerus.dddsample.domain.model.carrier;
2
 
2
 
3
+import static se.citerus.dddsample.DateTestUtil.toDate;
3
 import se.citerus.dddsample.domain.model.location.Location;
4
 import se.citerus.dddsample.domain.model.location.Location;
4
 import static se.citerus.dddsample.domain.model.location.SampleLocations.*;
5
 import static se.citerus.dddsample.domain.model.location.SampleLocations.*;
5
 
6
 
25
     )));
26
     )));
26
   }
27
   }
27
 
28
 
29
+  // TODO CM00[1-6] and createVoyage are deprecated. Remove and refactor tests.
30
+
31
+  /**
32
+   * Voyage number 0100S (by ship)
33
+   *
34
+   * Hongkong - Hangzou - Tokyo - Melbourne - New York
35
+   */
36
+  public static final Voyage HONGKONG_TO_NEW_YORK =
37
+    new Voyage.Builder(new VoyageNumber("0100S"), HONGKONG).
38
+      addMovement(HANGZOU, toDate("2008-10-01", "12:00"), toDate("2008-10-03", "14:30")).
39
+      addMovement(TOKYO, toDate("2008-10-03", "21:00"), toDate("2008-10-06", "06:15")).
40
+      addMovement(MELBOURNE, toDate("2008-10-06", "11:00"), toDate("2008-10-12", "11:30")).
41
+      addMovement(NEWYORK, toDate("2008-10-14", "12:00"), toDate("2008-10-23", "23:10")).
42
+      build();
43
+
44
+
45
+  /**
46
+   * Voyage number 0200T (by train)
47
+   *
48
+   * New York - Chicago - Dallas
49
+   */
50
+  public static final Voyage NEW_YORK_TO_DALLAS =
51
+    new Voyage.Builder(new VoyageNumber("0200T"), NEWYORK).
52
+      addMovement(CHICAGO, toDate("2008-10-24", "07:00"), toDate("2008-10-24", "17:45")).
53
+      addMovement(DALLAS, toDate("2008-10-24", "21:25"), toDate("2008-10-25", "19:30")).
54
+      build();
55
+
56
+  /**
57
+   * Voyage number 0300A (by airplane)
58
+   *
59
+   * Dallas - Hamburg - Stockholm - Helsinki
60
+   */
61
+  public static final Voyage DALLAS_TO_HELSINKI =
62
+    new Voyage.Builder(new VoyageNumber("0300A"), DALLAS).
63
+      addMovement(HAMBURG, toDate("2008-10-29", "03:30"), toDate("2008-10-31", "14:00")).
64
+      addMovement(STOCKHOLM, toDate("2008-11-01", "15:20"), toDate("2008-11-01", "18:40")).
65
+      addMovement(HELSINKI, toDate("2008-11-02", "09:00"), toDate("2008-11-02", "11:15")).
66
+      build();
67
+
68
+  /**
69
+   * Voyage number 0301S (by ship)
70
+   *
71
+   * Dallas - Hamburg - Stockholm - Helsinki, alternate route
72
+   */
73
+  public static final Voyage DALLAS_TO_HELSINKI_ALT =
74
+    new Voyage.Builder(new VoyageNumber("0301S"), DALLAS).
75
+      addMovement(HELSINKI, toDate("2008-10-29", "03:30"), toDate("2008-11-05", "15:45")).
76
+      build();
77
+
78
+  /**
79
+   * Voyage number 0400S (by ship)
80
+   *
81
+   * Helsinki - Rotterdam - Shanghai - Hongkong
82
+   *
83
+   */
84
+  public static final Voyage HELSINKI_TO_HONGKONG =
85
+    new Voyage.Builder(new VoyageNumber("0400S"), HELSINKI).
86
+      addMovement(ROTTERDAM, toDate("2008-11-04", "05:50"), toDate("2008-11-06", "14:10")).
87
+      addMovement(SHANGHAI, toDate("2008-11-10", "21:45"), toDate("2008-11-22", "16:40")).
88
+      addMovement(HONGKONG, toDate("2008-11-24", "07:00"), toDate("2008-11-28", "13:37")).
89
+      build();
90
+
28
   public static final Map<VoyageNumber, Voyage> ALL = new HashMap();
91
   public static final Map<VoyageNumber, Voyage> ALL = new HashMap();
29
 
92
 
30
   static {
93
   static {