public void printWorkflowInstanceEvents(final long key) { RecordingExporter.workflowInstanceRecords() .withWorkflowInstanceKey(key) .forEach( event -> { System.out.println("> " + event.toJson()); }); }
public void printWorkflowInstanceEvents(final long key) { RecordingExporter.workflowInstanceRecords() .withWorkflowInstanceKey(key) .forEach( event -> { System.out.println("> " + event.toJson()); }); }
public WorkflowInstanceAssert hasEntered(String... elementIds) { final List<String> ids = Arrays.asList(elementIds); final List<String> enteredElements = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATED) .withWorkflowInstanceKey(workflowInstanceKey) .filter(elementId(ids)) .map(r -> r.getValue().getElementId()) .limit(ids.size()) .collect(Collectors.toList()); if (enteredElements.size() < ids.size()) { final List<String> notEntered = new ArrayList<>(ids); notEntered.removeAll(enteredElements); failWithMessage("Expected <%s> to be entered but could not find <%s>", ids, notEntered); } return this; }
public WorkflowInstanceAssert hasCompleted(String... elementIds) { final List<String> ids = Arrays.asList(elementIds); final List<String> completedElements = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED) .withWorkflowInstanceKey(workflowInstanceKey) .filter(elementId(ids)) .map(r -> r.getValue().getElementId()) .limit(ids.size()) .collect(Collectors.toList()); if (completedElements.size() < ids.size()) { final List<String> notCompleted = new ArrayList<>(ids); notCompleted.removeAll(completedElements); failWithMessage("Expected <%s> to be completed but could not find <%s>", ids, notCompleted); } return this; }
public WorkflowInstanceAssert hasEntered(String... elementIds) { final List<String> ids = Arrays.asList(elementIds); final List<String> enteredElements = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATED) .withWorkflowInstanceKey(workflowInstanceKey) .filter(elementId(ids)) .map(r -> r.getValue().getElementId()) .limit(ids.size()) .collect(Collectors.toList()); if (enteredElements.size() < ids.size()) { final List<String> notEntered = new ArrayList<>(ids); notEntered.removeAll(enteredElements); failWithMessage("Expected <%s> to be entered but could not find <%s>", ids, notEntered); } return this; }
public WorkflowInstanceAssert hasCompleted(String... elementIds) { final List<String> ids = Arrays.asList(elementIds); final List<String> completedElements = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED) .withWorkflowInstanceKey(workflowInstanceKey) .filter(elementId(ids)) .map(r -> r.getValue().getElementId()) .limit(ids.size()) .collect(Collectors.toList()); if (completedElements.size() < ids.size()) { final List<String> notCompleted = new ArrayList<>(ids); notCompleted.removeAll(completedElements); failWithMessage("Expected <%s> to be completed but could not find <%s>", ids, notCompleted); } return this; }
public Record<WorkflowInstanceRecordValue> receiveFirstWorkflowInstanceEvent( final long wfInstanceKey, final Intent intent) { return receiveWorkflowInstances() .withIntent(intent) .withWorkflowInstanceKey(wfInstanceKey) .getFirst(); }
public WorkflowInstanceAssert hasPassed(String... elementIds) { final List<String> ids = Arrays.asList(elementIds); final List<String> passedElements = RecordingExporter.workflowInstanceRecords() .withWorkflowInstanceKey(workflowInstanceKey) .filter(intent(ELEMENT_PASSED_INTENTS)) .filter(elementId(ids)) .map(r -> r.getValue().getElementId()) .limit(ids.size()) .collect(Collectors.toList()); if (passedElements.size() < ids.size()) { final List<String> notPassed = new ArrayList<>(ids); notPassed.removeAll(passedElements); failWithMessage("Expected <%s> to be passed but could not find <%s>", ids, notPassed); } return this; }
public Record<WorkflowInstanceRecordValue> receiveFirstWorkflowInstanceEvent( final long wfInstanceKey, final Intent intent) { return receiveWorkflowInstances() .withIntent(intent) .withWorkflowInstanceKey(wfInstanceKey) .getFirst(); }
public WorkflowInstanceAssert hasPassed(String... elementIds) { final List<String> ids = Arrays.asList(elementIds); final List<String> passedElements = RecordingExporter.workflowInstanceRecords() .withWorkflowInstanceKey(workflowInstanceKey) .filter(intent(ELEMENT_PASSED_INTENTS)) .filter(elementId(ids)) .map(r -> r.getValue().getElementId()) .limit(ids.size()) .collect(Collectors.toList()); if (passedElements.size() < ids.size()) { final List<String> notPassed = new ArrayList<>(ids); notPassed.removeAll(passedElements); failWithMessage("Expected <%s> to be passed but could not find <%s>", ids, notPassed); } return this; }
public Record<WorkflowInstanceRecordValue> receiveFirstWorkflowInstanceEvent( final long wfInstanceKey, final String elementId, final Intent intent) { return receiveWorkflowInstances() .withIntent(intent) .withWorkflowInstanceKey(wfInstanceKey) .withElementId(elementId) .getFirst(); }
public Record<WorkflowInstanceRecordValue> receiveFirstWorkflowInstanceEvent( final long wfInstanceKey, final String elementId, final Intent intent) { return receiveWorkflowInstances() .withIntent(intent) .withWorkflowInstanceKey(wfInstanceKey) .withElementId(elementId) .getFirst(); }
public Record<WorkflowInstanceRecordValue> receiveFirstWorkflowInstanceEvent( final long wfInstanceKey, final Intent intent, BpmnElementType elementType) { return receiveWorkflowInstances() .withIntent(intent) .withWorkflowInstanceKey(wfInstanceKey) .withElementType(elementType) .getFirst(); }
public WorkflowInstanceAssert hasElementPayload( String elementId, String key, Object expectedValue) { final Optional<Record<WorkflowInstanceRecordValue>> record = RecordingExporter.workflowInstanceRecords() .withWorkflowInstanceKey(workflowInstanceKey) .withElementId(elementId) .filter(r -> ELEMENT_PASSED_INTENTS.contains(r.getMetadata().getIntent())) .findFirst(); if (record.isPresent()) { hasPayload(record.get(), key, expectedValue); } else { failWithMessage("Expected <%s> to contain payload but element was not passed", elementId); } return this; }
public WorkflowInstanceAssert hasPayload(String key, Object expectedValue) { final Optional<Record<WorkflowInstanceRecordValue>> record = RecordingExporter.workflowInstanceRecords() .withWorkflowInstanceKey(workflowInstanceKey) .withKey(workflowInstanceKey) .filter(intent(INSTANCE_ENDED_INTENTS)) .findFirst(); if (record.isPresent()) { hasPayload(record.get(), key, expectedValue); } else { failWithMessage("Expected workflow instance to contain payload but instance is not ended"); } return this; }
public WorkflowInstanceAssert hasPayload(String key, Object expectedValue) { final Optional<Record<WorkflowInstanceRecordValue>> record = RecordingExporter.workflowInstanceRecords() .withWorkflowInstanceKey(workflowInstanceKey) .withKey(workflowInstanceKey) .filter(intent(INSTANCE_ENDED_INTENTS)) .findFirst(); if (record.isPresent()) { hasPayload(record.get(), key, expectedValue); } else { failWithMessage("Expected workflow instance to contain payload but instance is not ended"); } return this; }
public WorkflowInstanceAssert hasElementPayload( String elementId, String key, Object expectedValue) { final Optional<Record<WorkflowInstanceRecordValue>> record = RecordingExporter.workflowInstanceRecords() .withWorkflowInstanceKey(workflowInstanceKey) .withElementId(elementId) .filter(r -> ELEMENT_PASSED_INTENTS.contains(r.getMetadata().getIntent())) .findFirst(); if (record.isPresent()) { hasPayload(record.get(), key, expectedValue); } else { failWithMessage("Expected <%s> to contain payload but element was not passed", elementId); } return this; }
public WorkflowInstanceAssert isEnded() { final boolean isEnded = exists( RecordingExporter.workflowInstanceRecords() .withWorkflowInstanceKey(workflowInstanceKey) .withKey(workflowInstanceKey) .filter(intent(INSTANCE_ENDED_INTENTS))); if (!isEnded) { failWithMessage("Expected workflow instance to be <ended> but was <active>"); } return this; }
public WorkflowInstanceAssert isEnded() { final boolean isEnded = exists( RecordingExporter.workflowInstanceRecords() .withWorkflowInstanceKey(workflowInstanceKey) .withKey(workflowInstanceKey) .filter(intent(INSTANCE_ENDED_INTENTS))); if (!isEnded) { failWithMessage("Expected workflow instance to be <ended> but was <active>"); } return this; }
RecordingExporter.workflowInstanceRecords(EVENT_ACTIVATED) .withElementId("timer_end") .withWorkflowInstanceKey(timerInstanceKey) .exists()) .isTrue(); RecordingExporter.workflowInstanceRecords(EVENT_ACTIVATED) .withElementId("msg_end") .withWorkflowInstanceKey(messageInstanceKey) .exists()) .isTrue();