@Test public void shouldRejectDeploymentIfUsedInvalidMessage() throws IOException { // given final BpmnModelInstance process = Bpmn.createExecutableProcess().startEvent().intermediateCatchEvent("invalidmessage").done(); // when final ExecuteCommandResponse resp = apiRule.partitionClient().deployWithResponse(process); // then assertThat(resp.getRecordType()).isEqualTo(RecordType.COMMAND_REJECTION); }
@Test public void shouldRejectDeploymentIfUsedInvalidMessage() throws IOException { // given final BpmnModelInstance process = Bpmn.createExecutableProcess().startEvent().intermediateCatchEvent("invalidmessage").done(); // when final ExecuteCommandResponse resp = apiRule.partitionClient().deployWithResponse(process); // then assertThat(resp.getRecordType()).isEqualTo(RecordType.COMMAND_REJECTION); }
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .intermediateCatchEvent(elementId()) .timerWithDuration("PT0.01S") .done(); } },
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .intermediateCatchEvent(elementId()) .timerWithDuration("PT0.01S") .done(); } },
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .intermediateCatchEvent(elementId()) .message(b -> b.name(messageName()).zeebeCorrelationKey("$.id")) .done(); }
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .intermediateCatchEvent(elementId()) .message(b -> b.name(messageName()).zeebeCorrelationKey("$.id")) .done(); }
@Test public void shouldCancelIntermediateCatchEvent() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .intermediateCatchEvent("catch-event") .message(b -> b.name("msg").zeebeCorrelationKey("$.id")) .done()); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("id", "123")); testClient.receiveElementInState("catch-event", WorkflowInstanceIntent.EVENT_ACTIVATED); final ExecuteCommandResponse response = cancelWorkflowInstance(workflowInstanceKey); // then assertThat(response.getIntent()).isEqualTo(WorkflowInstanceIntent.ELEMENT_TERMINATING); final Record<WorkflowInstanceRecordValue> terminatedEvent = testClient.receiveElementInState(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_TERMINATED); assertWorkflowInstanceRecord(workflowInstanceKey, PROCESS_ID, terminatedEvent); }
@Test public void shouldCancelIntermediateCatchEvent() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .intermediateCatchEvent("catch-event") .message(b -> b.name("msg").zeebeCorrelationKey("$.id")) .done()); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("id", "123")); testClient.receiveElementInState("catch-event", WorkflowInstanceIntent.ELEMENT_ACTIVATED); final ExecuteCommandResponse response = cancelWorkflowInstance(workflowInstanceKey); // then assertThat(response.getIntent()).isEqualTo(WorkflowInstanceIntent.ELEMENT_TERMINATING); final Record<WorkflowInstanceRecordValue> terminatedEvent = testClient.receiveElementInState(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_TERMINATED); assertWorkflowInstanceRecord(workflowInstanceKey, PROCESS_ID, terminatedEvent); }
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .eventBasedGateway(elementId()) .intermediateCatchEvent() .message(b -> b.name(messageName()).zeebeCorrelationKey("$.id")) .moveToLastGateway() .intermediateCatchEvent() .timerWithDuration("PT0.01S") .done(); }
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .eventBasedGateway(elementId()) .intermediateCatchEvent() .message(b -> b.name(messageName()).zeebeCorrelationKey("$.id")) .moveToLastGateway() .intermediateCatchEvent() .timerWithDuration("PT0.01S") .done(); }
.intermediateCatchEvent("message2") .message(m -> m.name("ping").zeebeCorrelationKey("$.key")) .done());
.intermediateCatchEvent("message2") .message(m -> m.name("ping").zeebeCorrelationKey("$.key")) .done());
@Test public void shouldUpdatePayloadWhenCatchEventIsEntered() { // given testClient.deploy( Bpmn.createExecutableProcess("wf") .startEvent() .intermediateCatchEvent("catch-event") .message(b -> b.name("msg").zeebeCorrelationKey("$.id")) .done()); testClient.createWorkflowInstance("wf", asMsgPack("id", "123")); final Record<WorkflowInstanceRecordValue> catchEventEntered = testClient.receiveFirstWorkflowInstanceEvent(WorkflowInstanceIntent.ELEMENT_ACTIVATED); // when updatePayload( catchEventEntered.getKey(), MsgPackUtil.asMsgPackReturnArray("{'id':'123', 'x': 1}")); testClient.receiveFirstWorkflowInstanceEvent(WorkflowInstanceIntent.PAYLOAD_UPDATED); testClient.publishMessage("msg", "123", asMsgPack("y", 2)); // then final Record<WorkflowInstanceRecordValue> catchEventOccurred = testClient.receiveFirstWorkflowInstanceEvent(WorkflowInstanceIntent.ELEMENT_COMPLETED); assertWorkflowInstancePayload(catchEventOccurred, "{'id':'123', 'x': 1, 'y': 2}"); }
@Test public void shouldUpdatePayloadWhenCatchEventIsEntered() { // given testClient.deploy( Bpmn.createExecutableProcess("wf") .startEvent() .intermediateCatchEvent("catch-event") .message(b -> b.name("msg").zeebeCorrelationKey("$.id")) .done()); testClient.createWorkflowInstance("wf", asMsgPack("id", "123")); final Record<WorkflowInstanceRecordValue> catchEventEntered = testClient.receiveFirstWorkflowInstanceEvent( WorkflowInstanceIntent.ELEMENT_ACTIVATED, BpmnElementType.INTERMEDIATE_CATCH_EVENT); // when updatePayload( catchEventEntered.getKey(), MsgPackUtil.asMsgPackReturnArray("{'id':'123', 'x': 1}")); testClient.receiveFirstWorkflowInstanceEvent(WorkflowInstanceIntent.PAYLOAD_UPDATED); testClient.publishMessage("msg", "123", asMsgPack("y", 2)); // then final Record<WorkflowInstanceRecordValue> catchEventOccurred = testClient.receiveFirstWorkflowInstanceEvent( WorkflowInstanceIntent.ELEMENT_COMPLETED, BpmnElementType.INTERMEDIATE_CATCH_EVENT); assertWorkflowInstancePayload(catchEventOccurred, "{'id':'123', 'x': 1, 'y': 2}"); }