use of org.activiti.api.process.model.events.BPMNMessageEvent in project Activiti by Activiti.
the class ProcessRuntimeBPMNMessageIT method shouldTestBoundaryMessageExpression.
@Test
public void shouldTestBoundaryMessageExpression() {
ProcessInstance process = processRuntime.start(ProcessPayloadBuilder.start().withVariable("correlationKey", "correlationId").withProcessDefinitionKey("testBoundaryMessageExpression").build());
// when
processRuntime.receive(MessagePayloadBuilder.receive("int-boundary-message").withCorrelationKey("correlationId").build());
// then
assertThat(MessageTestConfiguration.messageEvents).isNotEmpty().extracting(BPMNMessageEvent::getEventType, BPMNMessageEvent::getProcessDefinitionId, BPMNMessageEvent::getProcessInstanceId, event -> event.getEntity().getProcessDefinitionId(), event -> event.getEntity().getProcessInstanceId(), event -> event.getEntity().getMessagePayload().getName(), event -> event.getEntity().getMessagePayload().getCorrelationKey(), event -> event.getEntity().getMessagePayload().getBusinessKey(), event -> event.getEntity().getMessagePayload().getVariables()).contains(Tuple.tuple(BPMNMessageEvent.MessageEvents.MESSAGE_WAITING, process.getProcessDefinitionId(), process.getId(), process.getProcessDefinitionId(), process.getId(), "int-boundary-message", "correlationId", process.getBusinessKey(), null), Tuple.tuple(BPMNMessageEvent.MessageEvents.MESSAGE_RECEIVED, process.getProcessDefinitionId(), process.getId(), process.getProcessDefinitionId(), process.getId(), "int-boundary-message", "correlationId", process.getBusinessKey(), null));
}
use of org.activiti.api.process.model.events.BPMNMessageEvent in project Activiti by Activiti.
the class ProcessRuntimeBPMNMessageIT method shouldReceiveCatchMessageWithCorrelationKeyAndMappedPayload.
@Test
public void shouldReceiveCatchMessageWithCorrelationKeyAndMappedPayload() {
ProcessInstance process = processRuntime.start(ProcessPayloadBuilder.start().withBusinessKey("businessKey").withVariable("correlationKey", "foo").withVariable("process_variable_name", "").withProcessDefinitionKey(CATCH_MESSAGE_PAYLOAD).build());
// when
processRuntime.receive(MessagePayloadBuilder.receive(TEST_MESSAGE).withVariable("message_variable_name", "value").withCorrelationKey("foo").build());
// then
assertThat(MessageTestConfiguration.messageEvents).isNotEmpty().extracting(BPMNMessageEvent::getEventType, BPMNMessageEvent::getProcessDefinitionId, BPMNMessageEvent::getProcessInstanceId, event -> event.getEntity().getProcessDefinitionId(), event -> event.getEntity().getProcessInstanceId(), event -> event.getEntity().getMessagePayload().getName(), event -> event.getEntity().getMessagePayload().getCorrelationKey(), event -> event.getEntity().getMessagePayload().getBusinessKey(), event -> event.getEntity().getMessagePayload().getVariables()).contains(Tuple.tuple(BPMNMessageEvent.MessageEvents.MESSAGE_WAITING, process.getProcessDefinitionId(), process.getId(), process.getProcessDefinitionId(), process.getId(), "testMessage", "foo", process.getBusinessKey(), null), Tuple.tuple(BPMNMessageEvent.MessageEvents.MESSAGE_RECEIVED, process.getProcessDefinitionId(), process.getId(), process.getProcessDefinitionId(), process.getId(), "testMessage", "foo", process.getBusinessKey(), singletonMap("message_variable_name", "value")));
// and
List<VariableInstance> variables = processRuntime.variables(ProcessPayloadBuilder.variables().withProcessInstanceId(process.getId()).build());
assertThat(variables).extracting(VariableInstance::getName, VariableInstance::getValue).contains(tuple("process_variable_name", "value"));
}
use of org.activiti.api.process.model.events.BPMNMessageEvent in project Activiti by Activiti.
the class ProcessRuntimeBPMNMessageIT method shouldThrowIntermediateMessageEvent.
@Test
public void shouldThrowIntermediateMessageEvent() {
ProcessInstance process = processRuntime.start(ProcessPayloadBuilder.start().withBusinessKey("businessKey").withProcessDefinitionKey(PROCESS_INTERMEDIATE_THROW_MESSAGE_EVENT).build());
assertThat(MessageTestConfiguration.messageEvents).isNotEmpty().extracting(BPMNMessageEvent::getEventType, BPMNMessageEvent::getProcessDefinitionId, BPMNMessageEvent::getProcessInstanceId, event -> event.getEntity().getProcessDefinitionId(), event -> event.getEntity().getProcessInstanceId(), event -> event.getEntity().getMessagePayload().getName(), event -> event.getEntity().getMessagePayload().getCorrelationKey(), event -> event.getEntity().getMessagePayload().getBusinessKey(), event -> event.getEntity().getMessagePayload().getVariables()).contains(Tuple.tuple(BPMNMessageEvent.MessageEvents.MESSAGE_SENT, process.getProcessDefinitionId(), process.getId(), process.getProcessDefinitionId(), process.getId(), "Test Message", "value", "businessKey", singletonMap("message_payload_variable", "value")));
}
use of org.activiti.api.process.model.events.BPMNMessageEvent in project Activiti by Activiti.
the class ProcessRuntimeBPMNMessageIT method shouldReceiveBoundaryMessageWithCorrelationKey.
@Test
public void shouldReceiveBoundaryMessageWithCorrelationKey() {
ProcessInstance process = processRuntime.start(ProcessPayloadBuilder.start().withBusinessKey("businessKey").withVariable("correlationKey", "foo").withProcessDefinitionKey(BOUNDARY_MESSAGE).build());
// when
processRuntime.receive(MessagePayloadBuilder.receive(TEST_MESSAGE).withVariable("key", "value").withCorrelationKey("foo").build());
// then
assertThat(MessageTestConfiguration.messageEvents).isNotEmpty().extracting(BPMNMessageEvent::getEventType, BPMNMessageEvent::getProcessDefinitionId, BPMNMessageEvent::getProcessInstanceId, event -> event.getEntity().getProcessDefinitionId(), event -> event.getEntity().getProcessInstanceId(), event -> event.getEntity().getMessagePayload().getName(), event -> event.getEntity().getMessagePayload().getCorrelationKey(), event -> event.getEntity().getMessagePayload().getBusinessKey(), event -> event.getEntity().getMessagePayload().getVariables()).contains(Tuple.tuple(BPMNMessageEvent.MessageEvents.MESSAGE_WAITING, process.getProcessDefinitionId(), process.getId(), process.getProcessDefinitionId(), process.getId(), "testMessage", "foo", process.getBusinessKey(), null), Tuple.tuple(BPMNMessageEvent.MessageEvents.MESSAGE_RECEIVED, process.getProcessDefinitionId(), process.getId(), process.getProcessDefinitionId(), process.getId(), "testMessage", "foo", process.getBusinessKey(), singletonMap("key", "value")));
}
use of org.activiti.api.process.model.events.BPMNMessageEvent in project Activiti by Activiti.
the class ProcessRuntimeBPMNMessageIT method should_getMessageSubscriptionCancelledEvent_when_processIsDeleted.
@Test
public void should_getMessageSubscriptionCancelledEvent_when_processIsDeleted() {
// when
ProcessInstance process = processRuntime.start(ProcessPayloadBuilder.start().withBusinessKey("businessKey").withVariable("correlationKey", "correlationKey").withProcessDefinitionKey(CATCH_MESSAGE).build());
// then
assertThat(MessageTestConfiguration.messageEvents).isNotEmpty().extracting(BPMNMessageEvent::getEventType, BPMNMessageEvent::getProcessDefinitionId, BPMNMessageEvent::getProcessInstanceId, event -> event.getEntity().getProcessDefinitionId(), event -> event.getEntity().getProcessInstanceId(), event -> event.getEntity().getMessagePayload().getName(), event -> event.getEntity().getMessagePayload().getCorrelationKey(), event -> event.getEntity().getMessagePayload().getBusinessKey(), event -> event.getEntity().getMessagePayload().getVariables()).contains(Tuple.tuple(BPMNMessageEvent.MessageEvents.MESSAGE_WAITING, process.getProcessDefinitionId(), process.getId(), process.getProcessDefinitionId(), process.getId(), "testMessage", "correlationKey", process.getBusinessKey(), null));
// when
processRuntime.delete(ProcessPayloadBuilder.delete(process.getId()));
// then
assertThat(MessageTestConfiguration.messageSubscriptionCancelledEvents).isNotEmpty().extracting(MessageSubscriptionCancelledEvent::getEventType, MessageSubscriptionCancelledEvent::getProcessDefinitionId, MessageSubscriptionCancelledEvent::getProcessInstanceId, event -> event.getEntity().getProcessDefinitionId(), event -> event.getEntity().getProcessInstanceId(), event -> event.getEntity().getEventName(), event -> event.getEntity().getConfiguration(), event -> event.getEntity().getBusinessKey()).contains(Tuple.tuple(MessageSubscriptionEvent.MessageSubscriptionEvents.MESSAGE_SUBSCRIPTION_CANCELLED, process.getProcessDefinitionId(), process.getId(), process.getProcessDefinitionId(), process.getId(), "testMessage", "correlationKey", process.getBusinessKey()));
}
Aggregations