use of org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCompletedEventImpl in project activiti-cloud by Activiti.
the class QueryProcessDiagramIT method shouldHandleBPMNDiagramEvents.
@Test
public void shouldHandleBPMNDiagramEvents() throws InterruptedException {
// given
ProcessInstanceImpl process = new ProcessInstanceImpl();
process.setId(UUID.randomUUID().toString());
process.setName("process");
process.setProcessDefinitionKey("mySimpleProcess2");
process.setProcessDefinitionId(processDefinitionId2);
process.setProcessDefinitionVersion(1);
BPMNActivityImpl startActivity = new BPMNActivityImpl("startEvent1", "", "startEvent");
startActivity.setProcessDefinitionId(process.getProcessDefinitionId());
startActivity.setProcessInstanceId(process.getId());
BPMNSequenceFlowImpl sequenceFlow = new BPMNSequenceFlowImpl("sid-68945AF1-396F-4B8A-B836-FC318F62313F", "startEvent1", "sid-CDFE7219-4627-43E9-8CA8-866CC38EBA94");
sequenceFlow.setProcessDefinitionId(process.getProcessDefinitionId());
sequenceFlow.setProcessInstanceId(process.getId());
BPMNActivityImpl taskActivity = new BPMNActivityImpl("sid-CDFE7219-4627-43E9-8CA8-866CC38EBA94", "Perform Action", "userTask");
taskActivity.setProcessDefinitionId(process.getProcessDefinitionId());
taskActivity.setProcessInstanceId(process.getId());
eventsAggregator.addEvents(new CloudProcessCreatedEventImpl(process), new CloudProcessStartedEventImpl(process, null, null), new CloudBPMNActivityStartedEventImpl(startActivity, processDefinitionId, process.getId()), new CloudBPMNActivityCompletedEventImpl(startActivity, processDefinitionId, process.getId()), new CloudSequenceFlowTakenEventImpl(sequenceFlow), new CloudBPMNActivityStartedEventImpl(taskActivity, processDefinitionId, process.getId()));
// when
eventsAggregator.sendAll();
// then
await().untilAsserted(() -> {
List<BPMNActivityEntity> activities = bpmnActivityRepository.findByProcessInstanceId(process.getId());
assertThat(activities).hasSize(2);
assertThat(activities).extracting(BPMNActivityEntity::getElementId, BPMNActivityEntity::getActivityType, BPMNActivityEntity::getStatus).containsExactly(tuple(startActivity.getElementId(), startActivity.getActivityType(), BPMNActivityEntity.BPMNActivityStatus.COMPLETED), tuple(taskActivity.getElementId(), taskActivity.getActivityType(), BPMNActivityEntity.BPMNActivityStatus.STARTED));
List<BPMNSequenceFlowEntity> sequenceFlows = bpmnSequenceFlowRepository.findByProcessInstanceId(process.getId());
assertThat(sequenceFlows).hasSize(1);
assertThat(sequenceFlows).extracting(BPMNSequenceFlowEntity::getElementId, BPMNSequenceFlowEntity::getSourceActivityElementId, BPMNSequenceFlowEntity::getTargetActivityElementId).containsExactly(tuple(sequenceFlow.getElementId(), sequenceFlow.getSourceActivityElementId(), sequenceFlow.getTargetActivityElementId()));
});
}
use of org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCompletedEventImpl in project activiti-cloud by Activiti.
the class QueryProcessDiagramIT method startAnotherProcessInstance.
protected ProcessInstanceImpl startAnotherProcessInstance() {
ProcessInstanceImpl process = new ProcessInstanceImpl();
process.setId(UUID.randomUUID().toString());
process.setName("process");
process.setProcessDefinitionKey("mySimpleProcess2");
process.setProcessDefinitionId(processDefinitionId2);
process.setProcessDefinitionVersion(1);
BPMNActivityImpl startActivity = new BPMNActivityImpl("startEvent1", "", "startEvent");
startActivity.setProcessDefinitionId(process.getProcessDefinitionId());
startActivity.setProcessInstanceId(process.getId());
startActivity.setExecutionId(UUID.randomUUID().toString());
BPMNSequenceFlowImpl sequenceFlow = new BPMNSequenceFlowImpl("sid-68945AF1-396F-4B8A-B836-FC318F62313F", "startEvent1", "sid-CDFE7219-4627-43E9-8CA8-866CC38EBA94");
sequenceFlow.setProcessDefinitionId(process.getProcessDefinitionId());
sequenceFlow.setProcessInstanceId(process.getId());
BPMNActivityImpl taskActivity = new BPMNActivityImpl("sid-CDFE7219-4627-43E9-8CA8-866CC38EBA94", "Perform Action", "userTask");
taskActivity.setProcessDefinitionId(process.getProcessDefinitionId());
taskActivity.setProcessInstanceId(process.getId());
taskActivity.setExecutionId(UUID.randomUUID().toString());
eventsAggregator.addEvents(new CloudProcessCreatedEventImpl(process), new CloudProcessStartedEventImpl(process, null, null), new CloudBPMNActivityStartedEventImpl(startActivity, processDefinitionId, process.getId()), new CloudBPMNActivityCompletedEventImpl(startActivity, processDefinitionId, process.getId()), new CloudSequenceFlowTakenEventImpl(sequenceFlow), new CloudBPMNActivityStartedEventImpl(taskActivity, processDefinitionId, process.getId()));
return process;
}
use of org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCompletedEventImpl in project activiti-cloud by Activiti.
the class QueryAdminProcessDiagramIT method startSimpleProcessInstance.
protected ProcessInstanceImpl startSimpleProcessInstance() {
ProcessInstanceImpl process = new ProcessInstanceImpl();
process.setId(UUID.randomUUID().toString());
process.setName("process");
process.setProcessDefinitionKey("mySimpleProcess");
process.setProcessDefinitionId(processDefinitionId);
process.setProcessDefinitionVersion(1);
BPMNActivityImpl startActivity = new BPMNActivityImpl("startEvent1", "", "startEvent");
startActivity.setProcessDefinitionId(process.getProcessDefinitionId());
startActivity.setProcessInstanceId(process.getId());
startActivity.setExecutionId(UUID.randomUUID().toString());
BPMNSequenceFlowImpl sequenceFlow = new BPMNSequenceFlowImpl("sid-68945AF1-396F-4B8A-B836-FC318F62313F", "startEvent1", "sid-CDFE7219-4627-43E9-8CA8-866CC38EBA94");
sequenceFlow.setProcessDefinitionId(process.getProcessDefinitionId());
sequenceFlow.setProcessInstanceId(process.getId());
BPMNActivityImpl taskActivity = new BPMNActivityImpl("sid-CDFE7219-4627-43E9-8CA8-866CC38EBA94", "Perform Action", "userTask");
taskActivity.setProcessDefinitionId(process.getProcessDefinitionId());
taskActivity.setProcessInstanceId(process.getId());
taskActivity.setExecutionId(UUID.randomUUID().toString());
eventsAggregator.addEvents(new CloudProcessCreatedEventImpl(process), new CloudProcessStartedEventImpl(process, null, null), new CloudBPMNActivityStartedEventImpl(startActivity, processDefinitionId, process.getId()), new CloudBPMNActivityCompletedEventImpl(startActivity, processDefinitionId, process.getId()), new CloudSequenceFlowTakenEventImpl(sequenceFlow), new CloudBPMNActivityStartedEventImpl(taskActivity, processDefinitionId, process.getId()));
return process;
}
use of org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCompletedEventImpl in project activiti-cloud by Activiti.
the class ToCloudProcessRuntimeEventConverter method from.
public CloudBPMNActivityCompletedEvent from(BPMNActivityCompletedEvent event) {
CloudBPMNActivityCompletedEventImpl cloudEvent = new CloudBPMNActivityCompletedEventImpl(event.getEntity(), event.getEntity().getProcessDefinitionId(), event.getEntity().getProcessInstanceId());
runtimeBundleInfoAppender.appendRuntimeBundleInfoTo(cloudEvent);
return cloudEvent;
}
use of org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCompletedEventImpl in project activiti-cloud by Activiti.
the class CloudRuntimeEventRegistry method buildRegistry.
public Map<String, Class<?>> buildRegistry() {
List<RuntimeEvent<?, ?>> eventImplementations = new ArrayList<>();
eventImplementations.add(new CloudBPMNActivityStartedEventImpl());
eventImplementations.add(new CloudBPMNActivityCancelledEventImpl());
eventImplementations.add(new CloudBPMNActivityCompletedEventImpl());
eventImplementations.add(new CloudBPMNErrorReceivedEventImpl());
eventImplementations.add(new CloudBPMNSignalReceivedEventImpl());
eventImplementations.add(new CloudBPMNTimerFiredEventImpl());
eventImplementations.add(new CloudBPMNTimerCancelledEventImpl());
eventImplementations.add(new CloudBPMNTimerScheduledEventImpl());
eventImplementations.add(new CloudBPMNTimerExecutedEventImpl());
eventImplementations.add(new CloudBPMNTimerFailedEventImpl());
eventImplementations.add(new CloudBPMNTimerRetriesDecrementedEventImpl());
eventImplementations.add(new CloudBPMNMessageWaitingEventImpl());
eventImplementations.add(new CloudBPMNMessageReceivedEventImpl());
eventImplementations.add(new CloudBPMNMessageSentEventImpl());
eventImplementations.add(new CloudIntegrationRequestedEventImpl());
eventImplementations.add(new CloudIntegrationResultReceivedEventImpl());
eventImplementations.add(new CloudIntegrationErrorReceivedEventImpl());
eventImplementations.add(new CloudProcessDeployedEventImpl());
eventImplementations.add(new CloudProcessCreatedEventImpl());
eventImplementations.add(new CloudProcessStartedEventImpl());
eventImplementations.add(new CloudProcessCompletedEventImpl());
eventImplementations.add(new CloudProcessCancelledEventImpl());
eventImplementations.add(new CloudProcessSuspendedEventImpl());
eventImplementations.add(new CloudProcessResumedEventImpl());
eventImplementations.add(new CloudProcessUpdatedEventImpl());
eventImplementations.add(new CloudSequenceFlowTakenEventImpl());
eventImplementations.add(new CloudStartMessageDeployedEventImpl());
eventImplementations.add(new CloudMessageSubscriptionCancelledEventImpl());
eventImplementations.add(new CloudTaskCreatedEventImpl());
eventImplementations.add(new CloudTaskUpdatedEventImpl());
eventImplementations.add(new CloudTaskAssignedEventImpl());
eventImplementations.add(new CloudTaskCompletedEventImpl());
eventImplementations.add(new CloudTaskSuspendedEventImpl());
eventImplementations.add(new CloudTaskActivatedEventImpl());
eventImplementations.add(new CloudTaskCancelledEventImpl());
eventImplementations.add(new CloudTaskCandidateUserAddedEventImpl());
eventImplementations.add(new CloudTaskCandidateUserRemovedEventImpl());
eventImplementations.add(new CloudTaskCandidateGroupAddedEventImpl());
eventImplementations.add(new CloudTaskCandidateGroupRemovedEventImpl());
eventImplementations.add(new CloudVariableCreatedEventImpl());
eventImplementations.add(new CloudVariableUpdatedEventImpl());
eventImplementations.add(new CloudVariableDeletedEventImpl());
return eventImplementations.stream().collect(Collectors.toMap(event -> event.getEventType().name(), this::findInterface));
}
Aggregations