use of org.activiti.engine.delegate.event.ActivitiMessageEvent in project Activiti by Activiti.
the class MessageThrowEventTest method testThrowMessageEndEventCorrelationKeyExpression.
@Deployment
public void testThrowMessageEndEventCorrelationKeyExpression() throws Exception {
ProcessInstance pi = runtimeService.createProcessInstanceBuilder().variable("foo", "bar").processDefinitionKey("process").start();
assertProcessEnded(pi.getProcessInstanceId());
assertThat(listenerExecuted).isTrue();
assertThat(message.getCorrelationKey().isPresent()).isTrue();
assertThat(message.getCorrelationKey().get()).isEqualTo("bar");
assertThat(receivedEvents).hasSize(1);
ActivitiMessageEvent event = (ActivitiMessageEvent) receivedEvents.get(0);
assertThat(event.getActivityId()).isEqualTo("theEnd");
assertThat(event.getActivityType()).isEqualTo("endEvent");
assertThat(event.getActivityName()).isEqualTo("Throw Message");
assertThat(event.getBehaviorClass()).isEqualTo(ThrowMessageEndEventActivityBehavior.class.getName());
assertThat(event.getMessageName()).isEqualTo("endMessage");
assertThat(event.getMessageData()).isNull();
assertThat(event.getMessageCorrelationKey()).isEqualTo("bar");
assertThat(event.getProcessDefinitionId()).isEqualTo(pi.getProcessDefinitionId());
assertThat(event.getProcessInstanceId()).isEqualTo(pi.getId());
assertThat(event.getType()).isEqualTo(ActivitiEventType.ACTIVITY_MESSAGE_SENT);
assertThat(event.getExecutionId()).isNotNull();
}
use of org.activiti.engine.delegate.event.ActivitiMessageEvent in project Activiti by Activiti.
the class MessageThrowEventTest method testThrowMessageEndEventJavaDelegate.
@Deployment
public void testThrowMessageEndEventJavaDelegate() throws Exception {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("testThrowMessageEndEventJavaDelegate");
assertProcessEnded(pi.getProcessInstanceId());
assertThat(message.getName()).isEqualTo("endMessage");
assertThat(delegateExecuted).isTrue();
assertThat(receivedEvents).hasSize(1);
ActivitiMessageEvent event = (ActivitiMessageEvent) receivedEvents.get(0);
assertThat(event.getActivityId()).isEqualTo("theEnd");
assertThat(event.getActivityType()).isEqualTo("endEvent");
assertThat(event.getActivityName()).isEqualTo("Throw Message");
assertThat(event.getBehaviorClass()).isEqualTo(ThrowMessageEndEventActivityBehavior.class.getName());
assertThat(event.getMessageName()).isEqualTo("endMessage");
assertThat(event.getMessageData()).isNotNull();
assertThat(event.getProcessDefinitionId()).isEqualTo(pi.getProcessDefinitionId());
assertThat(event.getProcessInstanceId()).isEqualTo(pi.getId());
assertThat(event.getType()).isEqualTo(ActivitiEventType.ACTIVITY_MESSAGE_SENT);
assertThat(event.getExecutionId()).isNotNull();
}
use of org.activiti.engine.delegate.event.ActivitiMessageEvent in project Activiti by Activiti.
the class MessageThrowEventTest method testIntermediateThrowMessageEventFieldExtensions.
@Deployment
public void testIntermediateThrowMessageEventFieldExtensions() throws Exception {
ProcessInstance pi = runtimeService.createProcessInstanceBuilder().processDefinitionKey("process").variable("foo", "bar").businessKey("customerId").start();
assertProcessEnded(pi.getProcessInstanceId());
assertThat(message.getName()).isEqualTo("bpmnMessage");
assertThat(delegateExecuted);
assertThat(receivedEvents.size() > 0);
ActivitiMessageEvent event = (ActivitiMessageEvent) receivedEvents.get(0);
assertThat(event.getActivityId()).isEqualTo("messageThrow");
assertThat(event.getActivityType()).isEqualTo("throwEvent");
assertThat(event.getActivityName()).isEqualTo("Throw Message");
assertThat(event.getBehaviorClass()).isEqualTo(IntermediateThrowMessageEventActivityBehavior.class.getName());
assertThat(event.getMessageName()).isEqualTo("bpmnMessage");
assertThat(event.getMessageBusinessKey()).isEqualTo("customerId");
assertThat(event.getMessageData()).as("should map payload from field extensions").isInstanceOf(Map.class).extracting("foo", "businessKey", "key", "bar").containsExactly("bar", "customerId", "value", null);
assertThat(event.getProcessDefinitionId()).isEqualTo(pi.getProcessDefinitionId());
assertThat(event.getProcessInstanceId()).isEqualTo(pi.getId());
assertThat(event.getType()).isEqualTo(ActivitiEventType.ACTIVITY_MESSAGE_SENT);
assertThat(event.getExecutionId()).isNotNull();
}
use of org.activiti.engine.delegate.event.ActivitiMessageEvent in project Activiti by Activiti.
the class MessageThrowEventTest method testIntermediateThrowMessageEventExpression.
@Deployment
public void testIntermediateThrowMessageEventExpression() throws Exception {
ProcessInstance pi = runtimeService.createProcessInstanceBuilder().processDefinitionKey("testIntermediateThrowMessageEventExpression").businessKey("foo").start();
assertProcessEnded(pi.getProcessInstanceId());
assertThat(message.getName()).isEqualTo("bpmnMessage-foo");
assertThat(delegateExecuted).isTrue();
assertThat(receivedEvents).hasSize(1);
ActivitiMessageEvent event = (ActivitiMessageEvent) receivedEvents.get(0);
assertThat(event.getActivityId()).isEqualTo("messageThrow");
assertThat(event.getActivityType()).isEqualTo("throwEvent");
assertThat(event.getActivityName()).isEqualTo("Throw Message");
assertThat(event.getBehaviorClass()).isEqualTo(IntermediateThrowMessageEventActivityBehavior.class.getName());
assertThat(event.getMessageName()).isEqualTo("bpmnMessage-foo");
assertThat(event.getMessageData()).isNotNull();
assertThat(event.getMessageBusinessKey()).isEqualTo("foo");
assertThat(event.getProcessDefinitionId()).isEqualTo(pi.getProcessDefinitionId());
assertThat(event.getProcessInstanceId()).isEqualTo(pi.getId());
assertThat(event.getType()).isEqualTo(ActivitiEventType.ACTIVITY_MESSAGE_SENT);
assertThat(event.getExecutionId()).isNotNull();
}
use of org.activiti.engine.delegate.event.ActivitiMessageEvent in project Activiti by Activiti.
the class MessageThrowEventTest method testIntermediateThrowMessageEventCorrelationKeyExpression.
@Deployment
public void testIntermediateThrowMessageEventCorrelationKeyExpression() throws Exception {
ProcessInstance pi = runtimeService.createProcessInstanceBuilder().variable("foo", "bar").processDefinitionKey("process").start();
assertProcessEnded(pi.getProcessInstanceId());
assertThat(listenerExecuted).isTrue();
assertThat(message.getCorrelationKey().isPresent()).isTrue();
assertThat(message.getCorrelationKey().get()).isEqualTo("bar");
assertThat(receivedEvents).hasSize(1);
ActivitiMessageEvent event = (ActivitiMessageEvent) receivedEvents.get(0);
assertThat(event.getActivityId()).isEqualTo("messageThrow");
assertThat(event.getActivityType()).isEqualTo("throwEvent");
assertThat(event.getActivityName()).isEqualTo("Throw Message");
assertThat(event.getBehaviorClass()).isEqualTo(IntermediateThrowMessageEventActivityBehavior.class.getName());
assertThat(event.getMessageName()).isEqualTo("bpmnMessage");
assertThat(event.getMessageCorrelationKey()).isEqualTo("bar");
assertThat(event.getMessageData()).isNull();
assertThat(event.getMessageBusinessKey()).isNull();
assertThat(event.getProcessDefinitionId()).isEqualTo(pi.getProcessDefinitionId());
assertThat(event.getProcessInstanceId()).isEqualTo(pi.getId());
assertThat(event.getType()).isEqualTo(ActivitiEventType.ACTIVITY_MESSAGE_SENT);
assertThat(event.getExecutionId()).isNotNull();
}
Aggregations