22
33declare (strict_types=1 );
44
5- namespace Integration ;
5+ namespace Test \ Ecotone \ EventSourcing \ Integration ;
66
77use Doctrine \DBAL \Connection ;
88use Ecotone \Dbal \Configuration \DbalConfiguration ;
@@ -54,35 +54,37 @@ protected function setUp(): void
5454 $ this ->missingEvent = $ connection ->fetchAssociative (sprintf ('select * from %s where no = ? ' , $ streamName ), [2 ]);
5555 $ connection ->delete ($ streamName , ['no ' => 2 ]);
5656
57- $ initialTimestamp = 1712501960 ;
57+ $ initialTimestamp = time () ;
5858
5959 $ metadata = json_decode ($ connection ->fetchOne (sprintf ('select metadata from %s where no = ? ' , $ streamName ), [1 ]), true );
6060 $ metadata ['timestamp ' ] = $ initialTimestamp ;
6161 $ connection ->update ($ streamName , ['metadata ' => json_encode ($ metadata ), 'created_at ' => date (DATE_ATOM , $ initialTimestamp )], ['no ' => 1 ]);
6262
6363 $ metadata = json_decode ($ connection ->fetchOne (sprintf ('select metadata from %s where no = ? ' , $ streamName ), [3 ]), true );
64- $ metadata ['timestamp ' ] = $ initialTimestamp + 100 ;
65- $ connection ->update ($ streamName , ['metadata ' => json_encode ($ metadata ), 'created_at ' => date (DATE_ATOM , $ initialTimestamp + 100 )], ['no ' => 3 ]);
64+ $ metadata ['timestamp ' ] = $ initialTimestamp + 10 ;
65+ $ connection ->update ($ streamName , ['metadata ' => json_encode ($ metadata ), 'created_at ' => date (DATE_ATOM , $ initialTimestamp + 10 )], ['no ' => 3 ]);
6666
6767 $ metadata = json_decode ($ connection ->fetchOne (sprintf ('select metadata from %s where no = ? ' , $ streamName ), [4 ]), true );
68- $ metadata ['timestamp ' ] = $ initialTimestamp + 200 ;
69- $ connection ->update ($ streamName , ['metadata ' => json_encode ($ metadata ), 'created_at ' => date (DATE_ATOM , $ initialTimestamp + 200 )], ['no ' => 4 ]);
68+ $ metadata ['timestamp ' ] = $ initialTimestamp + 20 ;
69+ $ connection ->update ($ streamName , ['metadata ' => json_encode ($ metadata ), 'created_at ' => date (DATE_ATOM , $ initialTimestamp + 20 )], ['no ' => 4 ]);
7070 }
7171
7272 public function test_detecting_gaps_without_detection_window (): void
7373 {
74- $ ecotone = $ this ->bootstrapEcotoneWithGapDetection (new GapDetection ([10 , 20 , 50 ], null ));
74+ $ ecotone = $ this ->bootstrapEcotoneWithGapDetection (new GapDetection ([0 ], null ));
7575 $ ecotone ->sendCommand (new CloseTicket ('124 ' ));
7676
7777 self ::assertEquals (
7878 [
7979 ['ticket_id ' => '123 ' , 'ticket_type ' => 'alert ' ],
80+ ['ticket_id ' => '125 ' , 'ticket_type ' => 'warning ' ],
8081 ],
8182 $ ecotone ->sendQueryWithRouting ('getInProgressTickets ' )
8283 );
8384
8485 $ this ->addMissingEvent ();
8586
87+ $ ecotone ->resetProjection (InProgressTicketList::IN_PROGRESS_TICKET_PROJECTION );
8688 $ ecotone ->triggerProjection (InProgressTicketList::IN_PROGRESS_TICKET_PROJECTION );
8789
8890 self ::assertEquals (
@@ -95,7 +97,7 @@ public function test_detecting_gaps_without_detection_window(): void
9597
9698 public function test_detecting_gaps_with_detection_window (): void
9799 {
98- $ ecotone = $ this ->bootstrapEcotoneWithGapDetection (new GapDetection ([10 , 20 , 50 ], new DateInterval ('PT10S ' )));
100+ $ ecotone = $ this ->bootstrapEcotoneWithGapDetection (new GapDetection ([0 ], new DateInterval ('PT1S ' )));
99101 $ ecotone ->sendCommand (new CloseTicket ('124 ' ));
100102
101103 self ::assertEquals (
0 commit comments