public static DeploymentRecordStream deploymentRecords(final DeploymentIntent intent) { return deploymentRecords().withIntent(intent); }
public DeploymentRecordStream receiveDeployments() { return RecordingExporter.deploymentRecords().withPartitionId(partitionId); }
public static DeploymentRecordStream deploymentRecords(final DeploymentIntent intent) { return deploymentRecords().withIntent(intent); }
public DeploymentRecordStream receiveDeployments() { return RecordingExporter.deploymentRecords().withPartitionId(partitionId); }
@Test public void shouldCreateTimer() { // when testClient.deploy(SIMPLE_MODEL); // then assertThat(RecordingExporter.deploymentRecords(DeploymentIntent.CREATED).exists()).isTrue(); final TimerRecordValue timerRecord = RecordingExporter.timerRecords(TimerIntent.CREATED).getFirst().getValue(); Assertions.assertThat(timerRecord) .hasDueDate(brokerRule.getClock().getCurrentTimeInMillis() + 1000) .hasHandlerFlowNodeId("start_1") .hasElementInstanceKey(NO_ELEMENT_INSTANCE); }
@Test public void shouldCreateTimer() { // when testClient.deploy(SIMPLE_MODEL); // then assertThat(RecordingExporter.deploymentRecords(DeploymentIntent.CREATED).exists()).isTrue(); final TimerRecordValue timerRecord = RecordingExporter.timerRecords(TimerIntent.CREATED).getFirst().getValue(); Assertions.assertThat(timerRecord) .hasDueDate(brokerRule.getClock().getCurrentTimeInMillis() + 1000) .hasHandlerFlowNodeId("start_1") .hasElementInstanceKey(NO_ELEMENT_INSTANCE); }
@Test public void shouldReplaceTimerStartWithNoneStart() { // when testClient.deploy(REPEATING_MODEL); assertThat(RecordingExporter.timerRecords(TimerIntent.CREATED).exists()).isTrue(); brokerRule.getClock().addTime(Duration.ofSeconds(1)); // then assertThat(RecordingExporter.timerRecords(TimerIntent.TRIGGERED).exists()).isTrue(); // when final BpmnModelInstance nonTimerModel = Bpmn.createExecutableProcess("process").startEvent("start_4").endEvent("end_4").done(); testClient.deploy(nonTimerModel); assertThat(RecordingExporter.deploymentRecords(DeploymentIntent.CREATED).limit(2).count()) .isEqualTo(2); brokerRule.getClock().addTime(Duration.ofSeconds(2)); // then assertThat(RecordingExporter.timerRecords(TimerIntent.CANCELED).exists()).isTrue(); assertThat(RecordingExporter.timerRecords(TimerIntent.TRIGGERED).exists()).isTrue(); final long workflowInstanceKey = testClient.createWorkflowInstance("process"); final WorkflowInstanceRecordValue lastRecord = RecordingExporter.workflowInstanceRecords(EVENT_ACTIVATED) .withElementId("end_4") .getFirst() .getValue(); Assertions.assertThat(lastRecord) .hasVersion(2) .hasBpmnProcessId("process") .hasWorkflowInstanceKey(workflowInstanceKey); }
@Test public void shouldReplaceTimerStartWithNoneStart() { // when testClient.deploy(REPEATING_MODEL); assertThat(RecordingExporter.timerRecords(TimerIntent.CREATED).exists()).isTrue(); brokerRule.getClock().addTime(Duration.ofSeconds(1)); // then assertThat(RecordingExporter.timerRecords(TimerIntent.TRIGGERED).exists()).isTrue(); // when final BpmnModelInstance nonTimerModel = Bpmn.createExecutableProcess("process").startEvent("start_4").endEvent("end_4").done(); testClient.deploy(nonTimerModel); assertThat(RecordingExporter.deploymentRecords(DeploymentIntent.CREATED).limit(2).count()) .isEqualTo(2); brokerRule.getClock().addTime(Duration.ofSeconds(2)); // then assertThat(RecordingExporter.timerRecords(TimerIntent.CANCELED).exists()).isTrue(); assertThat(RecordingExporter.timerRecords(TimerIntent.TRIGGERED).exists()).isTrue(); final long workflowInstanceKey = testClient.createWorkflowInstance("process"); final WorkflowInstanceRecordValue lastRecord = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATED) .withElementId("end_4") .getFirst() .getValue(); Assertions.assertThat(lastRecord) .hasVersion(2) .hasBpmnProcessId("process") .hasWorkflowInstanceKey(workflowInstanceKey); }
@Test public void shouldStartWorkflowInstanceAtNoneStartEvent() { // given apiRule .partitionClient() .deploy(Bpmn.createExecutableProcess("process").startEvent("foo").endEvent().done()); // when TestUtil.waitUntil(() -> RecordingExporter.deploymentRecords().withPartitionId(2).exists()); final ExecuteCommandResponse workflowInstanceWithResponse = apiRule.partitionClient(2).createWorkflowInstanceWithResponse("process"); // then partition id is encoded in the returned getKey final long key = workflowInstanceWithResponse.getKey(); final int partitionId = Protocol.decodePartitionId(key); assertThat(partitionId).isEqualTo(2); } }
@Test public void shouldStartWorkflowInstanceAtNoneStartEvent() { // given apiRule .partitionClient() .deploy(Bpmn.createExecutableProcess("process").startEvent("foo").endEvent().done()); // when TestUtil.waitUntil(() -> RecordingExporter.deploymentRecords().withPartitionId(2).exists()); final ExecuteCommandResponse workflowInstanceWithResponse = apiRule.partitionClient(2).createWorkflowInstanceWithResponse("process"); // then partition id is encoded in the returned getKey final long key = workflowInstanceWithResponse.getKey(); final int partitionId = Protocol.decodePartitionId(key); assertThat(partitionId).isEqualTo(2); } }