Search in sources :

Example 1 with BPMNActivityImpl

use of org.activiti.api.runtime.model.impl.BPMNActivityImpl in project Activiti by Activiti.

the class SignalThrowCatchTest method testProcessWithIntermediateCatchEventSignal.

@Test
public void testProcessWithIntermediateCatchEventSignal() {
    securityUtil.logInAs("user1");
    ProcessInstance processInstance = startIntermediateCatchEventSignalProcess();
    assertThat(RuntimeTestConfiguration.collectedEvents).extracting(RuntimeEvent::getEventType).containsExactly(ProcessRuntimeEvent.ProcessEvents.PROCESS_CREATED, ProcessRuntimeEvent.ProcessEvents.PROCESS_STARTED, BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED, BPMNActivityEvent.ActivityEvents.ACTIVITY_COMPLETED, BPMNSequenceFlowTakenEvent.SequenceFlowEvents.SEQUENCE_FLOW_TAKEN, BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED);
    BPMNActivityImpl signalCatchEvent = (BPMNActivityImpl) RuntimeTestConfiguration.collectedEvents.get(5).getEntity();
    assertThat(signalCatchEvent.getActivityType()).isEqualTo("intermediateCatchEvent");
    clearEvents();
    SignalPayload signalPayload = ProcessPayloadBuilder.signal().withName("Test").withVariable("signal_variable", "test").build();
    processRuntime.signal(signalPayload);
    assertThat(RuntimeTestConfiguration.collectedEvents).extracting(RuntimeEvent::getEventType).containsExactly(BPMNSignalEvent.SignalEvents.SIGNAL_RECEIVED, VariableEvent.VariableEvents.VARIABLE_CREATED, BPMNActivityEvent.ActivityEvents.ACTIVITY_COMPLETED, BPMNSequenceFlowTakenEvent.SequenceFlowEvents.SEQUENCE_FLOW_TAKEN, BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED, BPMNActivityEvent.ActivityEvents.ACTIVITY_COMPLETED, ProcessRuntimeEvent.ProcessEvents.PROCESS_COMPLETED);
    BPMNSignalReceivedEvent event = (BPMNSignalReceivedEvent) RuntimeTestConfiguration.collectedEvents.get(0);
    assertThat(event.getEntity()).isNotNull();
    assertThat(event.getProcessInstanceId()).isEqualTo(processInstance.getId());
    assertThat(event.getEntity().getSignalPayload()).isNotNull();
    assertThat(event.getEntity().getSignalPayload().getName()).isEqualTo(signalPayload.getName());
    assertThat(event.getEntity().getSignalPayload().getVariables()).hasSize(signalPayload.getVariables().size());
    assertThat(event.getEntity().getSignalPayload().getVariables().get("signal_variable")).isEqualTo("test");
}
Also used : BPMNActivityImpl(org.activiti.api.runtime.model.impl.BPMNActivityImpl) BPMNSignalReceivedEvent(org.activiti.api.process.model.events.BPMNSignalReceivedEvent) ProcessInstance(org.activiti.api.process.model.ProcessInstance) SignalPayload(org.activiti.api.process.model.payloads.SignalPayload) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with BPMNActivityImpl

use of org.activiti.api.runtime.model.impl.BPMNActivityImpl in project Activiti by Activiti.

the class SignalThrowCatchTest method testProcessesWithThrowCatchSignal.

@Test
public void testProcessesWithThrowCatchSignal() {
    securityUtil.logInAs("user1");
    ProcessInstance processInstanceCatch = startIntermediateCatchEventSignalProcess();
    assertThat(RuntimeTestConfiguration.collectedEvents).extracting(RuntimeEvent::getEventType).contains(ProcessRuntimeEvent.ProcessEvents.PROCESS_CREATED, ProcessRuntimeEvent.ProcessEvents.PROCESS_STARTED, BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED, BPMNActivityEvent.ActivityEvents.ACTIVITY_COMPLETED, BPMNSequenceFlowTakenEvent.SequenceFlowEvents.SEQUENCE_FLOW_TAKEN, BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED);
    BPMNActivityImpl signalCatchEvent = (BPMNActivityImpl) RuntimeTestConfiguration.collectedEvents.get(5).getEntity();
    assertThat(signalCatchEvent.getActivityType()).isEqualTo("intermediateCatchEvent");
    clearEvents();
    startThrowSignalProcess();
    assertThat(RuntimeTestConfiguration.collectedEvents).extracting(RuntimeEvent::getEventType).contains(ProcessRuntimeEvent.ProcessEvents.PROCESS_CREATED, ProcessRuntimeEvent.ProcessEvents.PROCESS_STARTED, BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED, BPMNActivityEvent.ActivityEvents.ACTIVITY_COMPLETED, BPMNSequenceFlowTakenEvent.SequenceFlowEvents.SEQUENCE_FLOW_TAKEN, BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED, BPMNSignalEvent.SignalEvents.SIGNAL_RECEIVED, BPMNActivityEvent.ActivityEvents.ACTIVITY_COMPLETED, BPMNActivityEvent.ActivityEvents.ACTIVITY_COMPLETED, BPMNSequenceFlowTakenEvent.SequenceFlowEvents.SEQUENCE_FLOW_TAKEN, BPMNSequenceFlowTakenEvent.SequenceFlowEvents.SEQUENCE_FLOW_TAKEN, BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED, BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED, BPMNActivityEvent.ActivityEvents.ACTIVITY_COMPLETED, BPMNActivityEvent.ActivityEvents.ACTIVITY_COMPLETED, ProcessRuntimeEvent.ProcessEvents.PROCESS_COMPLETED, ProcessRuntimeEvent.ProcessEvents.PROCESS_COMPLETED);
    assertThat(RuntimeTestConfiguration.collectedEvents).filteredOn(event -> BPMNSignalEvent.SignalEvents.SIGNAL_RECEIVED.name().equals(event.getEventType().name())).extracting(RuntimeEvent::getEventType, RuntimeEvent::getProcessInstanceId).contains(tuple(BPMNSignalEvent.SignalEvents.SIGNAL_RECEIVED, processInstanceCatch.getId()));
}
Also used : BPMNActivityImpl(org.activiti.api.runtime.model.impl.BPMNActivityImpl) ProcessInstance(org.activiti.api.process.model.ProcessInstance) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with BPMNActivityImpl

use of org.activiti.api.runtime.model.impl.BPMNActivityImpl in project Activiti by Activiti.

the class SignalThrowCatchTest method testProcessWithBoundaryEventSignal.

@Test
public void testProcessWithBoundaryEventSignal() {
    securityUtil.logInAs("user1");
    ProcessInstance processInstance = startBoundaryEventSignalProcess();
    assertThat(RuntimeTestConfiguration.collectedEvents).extracting(RuntimeEvent::getEventType).containsExactly(ProcessRuntimeEvent.ProcessEvents.PROCESS_CREATED, ProcessRuntimeEvent.ProcessEvents.PROCESS_STARTED, BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED, BPMNActivityEvent.ActivityEvents.ACTIVITY_COMPLETED, BPMNSequenceFlowTakenEvent.SequenceFlowEvents.SEQUENCE_FLOW_TAKEN, BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED, TaskRuntimeEvent.TaskEvents.TASK_CREATED);
    BPMNActivityImpl signalCatchEvent = (BPMNActivityImpl) RuntimeTestConfiguration.collectedEvents.get(5).getEntity();
    assertThat(signalCatchEvent.getActivityType()).isEqualTo("userTask");
    assertThat(signalCatchEvent.getActivityName()).isEqualTo("Boundary container");
    clearEvents();
    SignalPayload signalPayload = ProcessPayloadBuilder.signal().withName("Test").withVariable("signal_variable", "test").build();
    processRuntime.signal(signalPayload);
    assertThat(RuntimeTestConfiguration.collectedEvents).extracting(RuntimeEvent::getEventType).containsExactlyInAnyOrder(BPMNSignalEvent.SignalEvents.SIGNAL_RECEIVED, VariableEvent.VariableEvents.VARIABLE_CREATED, TaskRuntimeEvent.TaskEvents.TASK_CANCELLED, BPMNActivityEvent.ActivityEvents.ACTIVITY_CANCELLED, BPMNActivityEvent.ActivityEvents.ACTIVITY_COMPLETED, BPMNSequenceFlowTakenEvent.SequenceFlowEvents.SEQUENCE_FLOW_TAKEN, BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED, VariableEvent.VariableEvents.VARIABLE_CREATED, TaskRuntimeEvent.TaskEvents.TASK_CREATED);
    BPMNSignalReceivedEvent event = (BPMNSignalReceivedEvent) RuntimeTestConfiguration.collectedEvents.get(0);
    assertThat(event.getEntity()).isNotNull();
    assertThat(event.getProcessInstanceId()).isEqualTo(processInstance.getId());
    assertThat(event.getEntity().getSignalPayload()).isNotNull();
    assertThat(event.getEntity().getSignalPayload().getName()).isEqualTo(signalPayload.getName());
    assertThat(event.getEntity().getSignalPayload().getVariables()).hasSize(signalPayload.getVariables().size());
    assertThat(event.getEntity().getSignalPayload().getVariables().get("signal_variable")).isEqualTo("test");
    clearEvents();
}
Also used : BPMNActivityImpl(org.activiti.api.runtime.model.impl.BPMNActivityImpl) BPMNSignalReceivedEvent(org.activiti.api.process.model.events.BPMNSignalReceivedEvent) ProcessInstance(org.activiti.api.process.model.ProcessInstance) SignalPayload(org.activiti.api.process.model.payloads.SignalPayload) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 4 with BPMNActivityImpl

use of org.activiti.api.runtime.model.impl.BPMNActivityImpl in project Activiti by Activiti.

the class ToActivityConverter method from.

public BPMNActivity from(ActivitiActivityEvent internalEvent) {
    BPMNActivityImpl activity = new BPMNActivityImpl(internalEvent.getActivityId(), internalEvent.getActivityName(), internalEvent.getActivityType());
    activity.setProcessDefinitionId(internalEvent.getProcessDefinitionId());
    activity.setProcessInstanceId(internalEvent.getProcessInstanceId());
    activity.setExecutionId(internalEvent.getExecutionId());
    return activity;
}
Also used : BPMNActivityImpl(org.activiti.api.runtime.model.impl.BPMNActivityImpl)

Aggregations

BPMNActivityImpl (org.activiti.api.runtime.model.impl.BPMNActivityImpl)4 ProcessInstance (org.activiti.api.process.model.ProcessInstance)3 Test (org.junit.jupiter.api.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 BPMNSignalReceivedEvent (org.activiti.api.process.model.events.BPMNSignalReceivedEvent)2 SignalPayload (org.activiti.api.process.model.payloads.SignalPayload)2