@Test public void shouldUpdateTimerPeriod() { // when long beginTime = brokerRule.getClock().getCurrentTimeInMillis(); testClient.deploy(THREE_SEC_MODEL); assertThat(RecordingExporter.timerRecords(TimerIntent.CREATED).exists()).isTrue(); brokerRule.getClock().addTime(Duration.ofSeconds(3)); // then TimerRecordValue timerRecord = RecordingExporter.timerRecords(TimerIntent.TRIGGERED).getFirst().getValue(); Assertions.assertThat(timerRecord).hasDueDate(beginTime + 3000); // when beginTime = brokerRule.getClock().getCurrentTimeInMillis(); final BpmnModelInstance slowerModel = Bpmn.createExecutableProcess("process_3") .startEvent("start_4") .timerWithCycle("R2/PT4S") .endEvent("end_4") .done(); testClient.deploy(slowerModel); // then assertThat(RecordingExporter.timerRecords(TimerIntent.CANCELED).getFirst()).isNotNull(); timerRecord = RecordingExporter.timerRecords(TimerIntent.CREATED).skip(2).getFirst().getValue(); Assertions.assertThat(timerRecord).hasDueDate(beginTime + 4000); brokerRule.getClock().addTime(Duration.ofSeconds(3)); assertThat(RecordingExporter.timerRecords(TimerIntent.TRIGGERED).limit(1).count()).isEqualTo(1); brokerRule.getClock().addTime(Duration.ofSeconds(1)); assertThat(RecordingExporter.timerRecords(TimerIntent.TRIGGERED).limit(2).count()).isEqualTo(2); }
@Test public void shouldUpdateTimerPeriod() { // when long beginTime = brokerRule.getClock().getCurrentTimeInMillis(); testClient.deploy(THREE_SEC_MODEL); assertThat(RecordingExporter.timerRecords(TimerIntent.CREATED).exists()).isTrue(); brokerRule.getClock().addTime(Duration.ofSeconds(3)); // then TimerRecordValue timerRecord = RecordingExporter.timerRecords(TimerIntent.TRIGGERED).getFirst().getValue(); Assertions.assertThat(timerRecord).hasDueDate(beginTime + 3000); // when beginTime = brokerRule.getClock().getCurrentTimeInMillis(); final BpmnModelInstance slowerModel = Bpmn.createExecutableProcess("process_3") .startEvent("start_4") .timerWithCycle("R2/PT4S") .endEvent("end_4") .done(); testClient.deploy(slowerModel); // then assertThat(RecordingExporter.timerRecords(TimerIntent.CANCELED).getFirst()).isNotNull(); timerRecord = RecordingExporter.timerRecords(TimerIntent.CREATED).skip(2).getFirst().getValue(); Assertions.assertThat(timerRecord).hasDueDate(beginTime + 4000); brokerRule.getClock().addTime(Duration.ofSeconds(3)); assertThat(RecordingExporter.timerRecords(TimerIntent.TRIGGERED).limit(1).count()).isEqualTo(1); brokerRule.getClock().addTime(Duration.ofSeconds(1)); assertThat(RecordingExporter.timerRecords(TimerIntent.TRIGGERED).limit(2).count()).isEqualTo(2); }