Ver código fonte

Added some more test data

jorgen_falk 18 anos atrás
pai
commit
b8a12b0e84

+ 2
- 0
dddsample/src/main/java/se/citerus/dddsample/domain/CarrierMovementId.java Ver arquivo

@@ -32,4 +32,6 @@ public class CarrierMovementId implements Serializable {
32 32
     return HashCodeBuilder.reflectionHashCode(this);
33 33
   }
34 34
 
35
+  // needed by hibernate
36
+  public CarrierMovementId() {}
35 37
 }

+ 46
- 8
dddsample/src/main/java/se/citerus/dddsample/util/SampleDataGenerator.java Ver arquivo

@@ -28,8 +28,30 @@ public class SampleDataGenerator implements ServletContextListener {
28 28
       "insert into HandlingEvent (id, completionTime, registrationTime, type, location_id, carrierMovement_id, cargo_id) " +
29 29
       "values (?, ?, ?, ?, ?, ?, ?)";
30 30
     Object[][] handlingEventArgs = {
31
-            {UUID.randomUUID().toString().getBytes(), new Timestamp(10), new Timestamp(11), "CLAIM", 1, null, "XYZ"},
32
-            {UUID.randomUUID().toString().getBytes(), new Timestamp(20), new Timestamp(21), "CLAIM", 2, null, "ABC"}
31
+        //XYZ (SESTO-FIHEL-DEHAM-CNHKG-JPTOK-AUMEL)
32
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(0), new Timestamp(1), "RECEIVE", 1, null, "XYZ"},  
33
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(10), new Timestamp(11), "LOAD", 1, "CAR_001", "XYZ"},
34
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(20), new Timestamp(21), "UNLOAD", 5, "CAR_001", "XYZ"},
35
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(30), new Timestamp(31), "LOAD", 5, "CAR_002", "XYZ"},
36
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(40), new Timestamp(41), "UNLOAD", 6, "CAR_002", "XYZ"},
37
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(50), new Timestamp(51), "LOAD", 6, "CAR_003", "XYZ"},
38
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(60), new Timestamp(61), "UNLOAD", 3, "CAR_003", "XYZ"},
39
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(70), new Timestamp(71), "LOAD", 3, "CAR_004", "XYZ"},
40
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(80), new Timestamp(81), "UNLOAD", 4, "CAR_004", "XYZ"},
41
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(90), new Timestamp(91), "LOAD", 4, "CAR_005", "XYZ"},
42
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(100), new Timestamp(101), "UNLOAD", 2, "CAR_005", "XYZ"},        
43
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(110), new Timestamp(111), "CLAIM", 2, null, "XYZ"},
44
+            
45
+        //ZYX (AUMEL - USCHI - DEHAM - SESTO)
46
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(0), new Timestamp(1), "RECEIVE", 2, null, "ZYX"},  
47
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(10), new Timestamp(11), "LOAD", 2, "CAR_007", "ZYX"},
48
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(20), new Timestamp(21), "UNLOAD", 7, "CAR_007", "ZYX"},
49
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(30), new Timestamp(31), "LOAD", 7, "CAR_008", "ZYX"},
50
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(40), new Timestamp(41), "UNLOAD", 6, "CAR_008", "ZYX"},
51
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(50), new Timestamp(51), "LOAD", 6, "CAR_009", "ZYX"},
52
+        
53
+        //ABC
54
+        {UUID.randomUUID().toString().getBytes(), new Timestamp(20), new Timestamp(21), "CLAIM", 2, null, "ABC"}
33 55
     };
34 56
     for (Object[] handlingEventArg : handlingEventArgs) {
35 57
       jdbcTemplate.update(handlingEventSql, handlingEventArg);
@@ -39,9 +61,20 @@ public class SampleDataGenerator implements ServletContextListener {
39 61
   private static void loadCarrierMovementData(JdbcTemplate jdbcTemplate) {
40 62
     String carrierMovementSql = "insert into CarrierMovement (id, from_id, to_id) values (?,?,?)";
41 63
     Object[][] carrierMovementArgs = {
42
-      {"CAR_001",1,2},
43
-      {"CAR_002",2,3},
44
-      {"CAR_003",3,1}
64
+     // SESTO-FIHEL-DEHAM-CNHKG-JPTOK-AUMEL
65
+      {"CAR_001",1,5}, 
66
+      {"CAR_002",5,6},
67
+      {"CAR_003",6,3},
68
+      {"CAR_004",3,4},
69
+      {"CAR_005",4,2},
70
+      
71
+      // FIHEL - SESTO
72
+      {"CAR_006",5,1},
73
+      
74
+      // AUMEL - USCHI - DEHAM - SESTO
75
+      {"CAR_007",2,7}, 
76
+      {"CAR_008",7,6},
77
+      {"CAR_009",6,1}
45 78
     };
46 79
     for (Object[] carrierMovementArg : carrierMovementArgs) {
47 80
       jdbcTemplate.update(carrierMovementSql, carrierMovementArg);
@@ -52,8 +85,9 @@ public class SampleDataGenerator implements ServletContextListener {
52 85
     String cargoSql = "insert into Cargo (id, origin_id, finalDestination_id) values (?, ?, ?)";
53 86
     Object[][] cargoArgs = {
54 87
       {"XYZ",1,2},
55
-      {"ABC",3,1},
56
-      {"ZYX",2,3}
88
+      {"ABC",1,5},
89
+      {"ZYX",2,1},
90
+      {"CBA",5,1}
57 91
     };
58 92
     for (Object[] cargoArg : cargoArgs) {
59 93
       jdbcTemplate.update(cargoSql, cargoArg);
@@ -65,7 +99,11 @@ public class SampleDataGenerator implements ServletContextListener {
65 99
     Object[][] locationArgs = {
66 100
       {1L, "SESTO"},
67 101
       {2L, "AUMEL"},
68
-      {3L, "CNHKG"}
102
+      {3L, "CNHKG"},
103
+      {4L, "JPTOK"},
104
+      {5L, "FIHEL"},
105
+      {6L, "DEHAM"},
106
+      {7L, "USCHI"}
69 107
     };
70 108
     for (Object[] locationArg : locationArgs) {
71 109
       jdbcTemplate.update(locationSql, locationArg);