in ddm-bpm-extension/src/it/java/com/epam/digital/data/platform/bpms/extension/it/StartProcessByMessageDelegateIT.java [36:72]
void startBpByMessage() throws JSONException {
var sendMessage = runtimeService
.startProcessInstanceByKey("sendMessage");
assertThat(sendMessage).isEnded();
var processInstances = historyService.createHistoricProcessInstanceQuery()
.processDefinitionKey("receiveMessage").list();
Assertions.assertThat(processInstances).hasSize(1);
var processCaller = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(processInstances.get(0).getId())
.variableName(CallerProcessInstanceIdVariable.CALLER_PROCESS_INSTANCE_ID_VARIABLE_NAME)
.singleResult();
Assertions.assertThat(processCaller)
.hasFieldOrPropertyWithValue("value", sendMessage.getId());
var messagePayload = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(processInstances.get(0).getId())
.variableName(
StartMessagePayloadStorageKeyVariable.START_MESSAGE_PAYLOAD_STORAGE_KEY_VARIABLE_NAME)
.singleResult();
Assertions.assertThat(messagePayload)
.hasFieldOrProperty("value")
.extracting(HistoricVariableInstance::getValue)
.asString().startsWith("process-definition/receiveMessage/start-message/");
Assertions.assertThat(messagePayloadStorageService.getMessagePayload(
(String) messagePayload.getValue())).isPresent();
var actual = objectMapper.writeValueAsString(
messagePayloadStorageService.getMessagePayload((String) messagePayload.getValue()).get());
JSONAssert.assertEquals("{\"data\":{\"payloadPart\":\"payloadPartValue\"}}",
actual, true);
}