@Test public void shouldCreateVariableByWorkflowInstanceCreation() { // given testClient.deploy(WORKFLOW); // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, "{'x':1}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.CREATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeInstanceKey(workflowInstanceKey) .hasName("x") .hasValue("1"); }
@Test public void shouldCreateVariableByWorkflowInstanceCreation() { // given testClient.deploy(WORKFLOW); // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, "{'x':1}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.CREATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeKey(workflowInstanceKey) .hasName("x") .hasValue("1"); }
@Test public void shouldUpdateVariableByUpdatePayload() { // given testClient.deploy(WORKFLOW); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, "{'x':1}"); // when testClient.updatePayload(workflowInstanceKey, "{'x':2}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.UPDATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeInstanceKey(workflowInstanceKey) .hasName("x") .hasValue("2"); }
@Test public void shouldWriteVariableCreatedEvent() { // given testClient.deploy(WORKFLOW); // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, payload); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.CREATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeInstanceKey(workflowInstanceKey) .hasName("x") .hasValue(expectedValue); } }
@Test public void shouldWriteVariableCreatedEvent() { // given testClient.deploy(WORKFLOW); // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, payload); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.CREATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeKey(workflowInstanceKey) .hasName("x") .hasValue(expectedValue); } }
@Test public void shouldCreateVariableByUpdatePayload() { // given testClient.deploy(WORKFLOW); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID); // when testClient.updatePayload(workflowInstanceKey, "{'x':1}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.CREATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeKey(workflowInstanceKey) .hasName("x") .hasValue("1"); }
@Test public void shouldCreateVariableByJobCompletion() { // given testClient.deploy(WORKFLOW); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID); // when testClient.completeJobOfType("test", "{'x':1}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.CREATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeInstanceKey(workflowInstanceKey) .hasName("x") .hasValue("1"); }
@Test public void shouldUpdateVariableByJobCompletion() { // given testClient.deploy(WORKFLOW); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, "{'x':1}"); // when testClient.completeJobOfType("test", "{'x':2}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.UPDATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeInstanceKey(workflowInstanceKey) .hasName("x") .hasValue("2"); }
@Test public void shouldCreateVariableByUpdatePayload() { // given testClient.deploy(WORKFLOW); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID); // when testClient.updatePayload(workflowInstanceKey, "{'x':1}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.CREATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeInstanceKey(workflowInstanceKey) .hasName("x") .hasValue("1"); }
@Test public void shouldUpdateVariableByUpdatePayload() { // given testClient.deploy(WORKFLOW); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, "{'x':1}"); // when testClient.updatePayload(workflowInstanceKey, "{'x':2}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.UPDATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeKey(workflowInstanceKey) .hasName("x") .hasValue("2"); }
@Test public void shouldCreateVariableByJobCompletion() { // given testClient.deploy(WORKFLOW); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID); // when testClient.completeJobOfType("test", "{'x':1}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.CREATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeKey(workflowInstanceKey) .hasName("x") .hasValue("1"); }
@Test public void shouldUpdateVariableByJobCompletion() { // given testClient.deploy(WORKFLOW); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, "{'x':1}"); // when testClient.completeJobOfType("test", "{'x':2}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.UPDATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeKey(workflowInstanceKey) .hasName("x") .hasValue("2"); }
@Test public void shouldUpdateVariableByOutputMapping() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .serviceTask("task", t -> t.zeebeTaskType("test").zeebeOutput("$.x", "$.y")) .endEvent() .done()); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, "{'y':1}"); // when testClient.completeJobOfType("test", "{'x':2}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.UPDATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeInstanceKey(workflowInstanceKey) .hasName("y") .hasValue("2"); }
@Test public void shouldCreateVariableByOutputMapping() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .serviceTask("task", t -> t.zeebeTaskType("test").zeebeOutput("$.x", "$.y")) .endEvent() .done()); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID); // when testClient.completeJobOfType("test", "{'x':1}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.CREATED).withName("y").getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeInstanceKey(workflowInstanceKey) .hasName("y") .hasValue("1"); }
@Test public void shouldCreateVariableByOutputMapping() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .serviceTask("task", t -> t.zeebeTaskType("test").zeebeOutput("$.x", "$.y")) .endEvent() .done()); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID); // when testClient.completeJobOfType("test", "{'x':1}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.CREATED).withName("y").getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeKey(workflowInstanceKey) .hasName("y") .hasValue("1"); }
@Test public void shouldUpdateVariableByOutputMapping() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .serviceTask("task", t -> t.zeebeTaskType("test").zeebeOutput("$.x", "$.y")) .endEvent() .done()); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, "{'y':1}"); // when testClient.completeJobOfType("test", "{'x':2}"); // then final Record<VariableRecordValue> variableRecord = RecordingExporter.variableRecords(VariableIntent.UPDATED).getFirst(); Assertions.assertThat(variableRecord.getValue()) .hasScopeKey(workflowInstanceKey) .hasName("y") .hasValue("2"); }