Search in sources :

Example 1 with CloudTaskCompletedEventImpl

use of org.activiti.cloud.api.task.model.impl.events.CloudTaskCompletedEventImpl in project activiti-cloud by Activiti.

the class TaskEntityCompletedEventHandlerTest method handleShouldUpdateTaskStatusToCompleted.

@Test
public void handleShouldUpdateTaskStatusToCompleted() {
    // given
    CloudTaskCompletedEventImpl event = buildTaskCompletedEvent();
    String taskId = event.getEntity().getId();
    TaskEntity eventTaskEntity = aTask().withId(taskId).withCreatedDate(new Date(System.currentTimeMillis() - 86400000L)).withCompletedDate(new Date()).build();
    given(taskRepository.findById(taskId)).willReturn(Optional.of(eventTaskEntity));
    // when
    handler.handle(event);
    // then
    verify(taskRepository).save(eventTaskEntity);
    verify(eventTaskEntity).setStatus(Task.TaskStatus.COMPLETED);
    verify(eventTaskEntity).setLastModified(any(Date.class));
}
Also used : TaskEntity(org.activiti.cloud.services.query.model.TaskEntity) Date(java.util.Date) CloudTaskCompletedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCompletedEventImpl) Test(org.junit.jupiter.api.Test)

Example 2 with CloudTaskCompletedEventImpl

use of org.activiti.cloud.api.task.model.impl.events.CloudTaskCompletedEventImpl in project activiti-cloud by Activiti.

the class QueryEventHandlerContextTest method handleShouldDoNothingWhenNoHandlerIsFoundForTheGivenEvent.

@Test
public void handleShouldDoNothingWhenNoHandlerIsFoundForTheGivenEvent() {
    // given
    CloudTaskCompletedEvent event = new CloudTaskCompletedEventImpl();
    // when
    context.handle(event);
    // then
    verify(handler, never()).handle(any());
}
Also used : CloudTaskCompletedEvent(org.activiti.cloud.api.task.model.events.CloudTaskCompletedEvent) CloudTaskCompletedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCompletedEventImpl) Test(org.junit.jupiter.api.Test)

Example 3 with CloudTaskCompletedEventImpl

use of org.activiti.cloud.api.task.model.impl.events.CloudTaskCompletedEventImpl 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));
}
Also used : CloudBPMNMessageReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNMessageReceivedEventImpl) CloudBPMNTimerRetriesDecrementedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerRetriesDecrementedEventImpl) CloudBPMNMessageWaitingEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNMessageWaitingEventImpl) Arrays(java.util.Arrays) CloudTaskCreatedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCreatedEventImpl) CloudProcessDeployedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessDeployedEventImpl) CloudProcessStartedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessStartedEventImpl) CloudProcessCompletedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessCompletedEventImpl) CloudTaskCandidateUserAddedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateUserAddedEventImpl) CloudVariableCreatedEventImpl(org.activiti.cloud.api.model.shared.impl.events.CloudVariableCreatedEventImpl) CloudProcessResumedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessResumedEventImpl) CloudBPMNMessageSentEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNMessageSentEventImpl) CloudBPMNTimerExecutedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerExecutedEventImpl) CloudProcessCreatedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessCreatedEventImpl) CloudTaskCancelledEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCancelledEventImpl) ArrayList(java.util.ArrayList) Map(java.util.Map) CloudIntegrationRequestedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudIntegrationRequestedEventImpl) CloudTaskCandidateUserRemovedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateUserRemovedEventImpl) CloudIntegrationErrorReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudIntegrationErrorReceivedEventImpl) CloudTaskSuspendedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskSuspendedEventImpl) CloudTaskCandidateGroupAddedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateGroupAddedEventImpl) CloudBPMNTimerFailedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerFailedEventImpl) CloudProcessUpdatedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessUpdatedEventImpl) CloudBPMNTimerCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerCancelledEventImpl) CloudIntegrationResultReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudIntegrationResultReceivedEventImpl) CloudSequenceFlowTakenEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudSequenceFlowTakenEventImpl) CloudBPMNSignalReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNSignalReceivedEventImpl) RuntimeEvent(org.activiti.api.model.shared.event.RuntimeEvent) CloudTaskAssignedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskAssignedEventImpl) CloudProcessCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessCancelledEventImpl) CloudBPMNActivityCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCancelledEventImpl) Collectors(java.util.stream.Collectors) CloudTaskUpdatedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskUpdatedEventImpl) CloudStartMessageDeployedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudStartMessageDeployedEventImpl) CloudTaskCandidateGroupRemovedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateGroupRemovedEventImpl) List(java.util.List) CloudProcessSuspendedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessSuspendedEventImpl) CloudTaskCompletedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCompletedEventImpl) CloudVariableDeletedEventImpl(org.activiti.cloud.api.model.shared.impl.events.CloudVariableDeletedEventImpl) CloudBPMNActivityStartedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityStartedEventImpl) CloudBPMNMessageReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNMessageReceivedEventImpl) CloudBPMNTimerScheduledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerScheduledEventImpl) CloudTaskActivatedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskActivatedEventImpl) CloudBPMNErrorReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNErrorReceivedEventImpl) CloudBPMNTimerFiredEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerFiredEventImpl) CloudVariableUpdatedEventImpl(org.activiti.cloud.api.model.shared.impl.events.CloudVariableUpdatedEventImpl) CloudBPMNActivityCompletedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCompletedEventImpl) CloudMessageSubscriptionCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudMessageSubscriptionCancelledEventImpl) CloudBPMNActivityCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCancelledEventImpl) CloudBPMNMessageWaitingEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNMessageWaitingEventImpl) CloudProcessResumedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessResumedEventImpl) CloudTaskAssignedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskAssignedEventImpl) CloudMessageSubscriptionCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudMessageSubscriptionCancelledEventImpl) CloudTaskCandidateGroupRemovedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateGroupRemovedEventImpl) CloudVariableCreatedEventImpl(org.activiti.cloud.api.model.shared.impl.events.CloudVariableCreatedEventImpl) ArrayList(java.util.ArrayList) CloudBPMNTimerScheduledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerScheduledEventImpl) CloudTaskCandidateUserAddedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateUserAddedEventImpl) CloudIntegrationResultReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudIntegrationResultReceivedEventImpl) CloudBPMNTimerFailedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerFailedEventImpl) CloudTaskSuspendedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskSuspendedEventImpl) CloudTaskCancelledEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCancelledEventImpl) CloudStartMessageDeployedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudStartMessageDeployedEventImpl) CloudProcessCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessCancelledEventImpl) CloudProcessSuspendedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessSuspendedEventImpl) CloudProcessCreatedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessCreatedEventImpl) CloudProcessUpdatedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessUpdatedEventImpl) CloudBPMNActivityCompletedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCompletedEventImpl) CloudBPMNTimerCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerCancelledEventImpl) CloudBPMNMessageSentEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNMessageSentEventImpl) CloudVariableUpdatedEventImpl(org.activiti.cloud.api.model.shared.impl.events.CloudVariableUpdatedEventImpl) CloudSequenceFlowTakenEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudSequenceFlowTakenEventImpl) CloudIntegrationErrorReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudIntegrationErrorReceivedEventImpl) CloudBPMNActivityStartedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityStartedEventImpl) CloudBPMNTimerRetriesDecrementedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerRetriesDecrementedEventImpl) CloudIntegrationRequestedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudIntegrationRequestedEventImpl) CloudProcessDeployedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessDeployedEventImpl) CloudProcessCompletedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessCompletedEventImpl) CloudTaskCreatedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCreatedEventImpl) CloudTaskUpdatedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskUpdatedEventImpl) CloudBPMNTimerFiredEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerFiredEventImpl) CloudTaskCandidateGroupAddedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateGroupAddedEventImpl) CloudTaskActivatedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskActivatedEventImpl) CloudProcessStartedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessStartedEventImpl) CloudBPMNTimerExecutedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerExecutedEventImpl) CloudTaskCandidateUserRemovedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateUserRemovedEventImpl) CloudVariableDeletedEventImpl(org.activiti.cloud.api.model.shared.impl.events.CloudVariableDeletedEventImpl) CloudBPMNErrorReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNErrorReceivedEventImpl) CloudBPMNSignalReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNSignalReceivedEventImpl) RuntimeEvent(org.activiti.api.model.shared.event.RuntimeEvent) CloudTaskCompletedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCompletedEventImpl)

Example 4 with CloudTaskCompletedEventImpl

use of org.activiti.cloud.api.task.model.impl.events.CloudTaskCompletedEventImpl in project activiti-cloud by Activiti.

the class AuditServiceIT method getTestEvents.

private List<CloudRuntimeEvent> getTestEvents() {
    List<CloudRuntimeEvent> testEvents = new ArrayList<>();
    testEvents.add(new CloudProcessDeployedEventImpl(buildDefaultProcessDefinition()));
    BPMNActivityImpl bpmnActivityCancelled = new BPMNActivityImpl();
    bpmnActivityCancelled.setElementId("elementId");
    testEvents.add(new CloudBPMNActivityCancelledEventImpl("ActivityCancelledEventId", System.currentTimeMillis(), bpmnActivityCancelled, "103", "104", "manually cancelled"));
    BPMNActivityImpl bpmnActivityStarted = new BPMNActivityImpl("1", "My Service Task", "Service Task");
    CloudBPMNActivityStartedEventImpl cloudBPMNActivityStartedEvent = new CloudBPMNActivityStartedEventImpl("ActivityStartedEventId", System.currentTimeMillis(), bpmnActivityStarted, "3", "4");
    testEvents.add(cloudBPMNActivityStartedEvent);
    BPMNActivityImpl bpmnActivityStarted2 = new BPMNActivityImpl("2", "My User Task", "User Task");
    CloudBPMNActivityStartedEventImpl cloudBPMNActivityStartedEvent2 = new CloudBPMNActivityStartedEventImpl("ActivityStartedEventId2", System.currentTimeMillis(), bpmnActivityStarted2, "3", "4");
    testEvents.add(cloudBPMNActivityStartedEvent2);
    BPMNActivityImpl bpmnActivityStarted3 = new BPMNActivityImpl("2", "My User Task", "User Task");
    CloudBPMNActivityStartedEventImpl cloudBPMNActivityStartedEvent3 = new CloudBPMNActivityStartedEventImpl("ActivityStartedEventId3", System.currentTimeMillis(), bpmnActivityStarted3, "3", "5");
    testEvents.add(cloudBPMNActivityStartedEvent3);
    BPMNActivityImpl bpmnActivityCompleted = new BPMNActivityImpl();
    bpmnActivityCompleted.setElementId("elementId");
    testEvents.add(new CloudBPMNActivityCompletedEventImpl("ActivityCompletedEventId", System.currentTimeMillis(), bpmnActivityCompleted, "23", "42"));
    ProcessInstanceImpl processInstanceCompleted = new ProcessInstanceImpl();
    processInstanceCompleted.setId("24");
    processInstanceCompleted.setProcessDefinitionId("43");
    CloudProcessCompletedEventImpl cloudProcessCompletedEvent = new CloudProcessCompletedEventImpl("ProcessCompletedEventId", System.currentTimeMillis(), processInstanceCompleted);
    testEvents.add(cloudProcessCompletedEvent);
    ProcessInstanceImpl processInstanceCancelled = new ProcessInstanceImpl();
    processInstanceCancelled.setId("124");
    processInstanceCancelled.setProcessDefinitionId("143");
    CloudProcessCancelledEventImpl cloudProcessCancelledEvent = new CloudProcessCancelledEventImpl("ProcessCancelledEventId", System.currentTimeMillis(), processInstanceCancelled);
    testEvents.add(cloudProcessCancelledEvent);
    ProcessInstanceImpl processInstanceStarted = new ProcessInstanceImpl();
    processInstanceStarted.setId("25");
    processInstanceStarted.setProcessDefinitionId("44");
    CloudProcessStartedEventImpl cloudProcessStartedEvent = new CloudProcessStartedEventImpl("ProcessStartedEventId", System.currentTimeMillis(), processInstanceStarted);
    testEvents.add(cloudProcessStartedEvent);
    testEvents.add(new CloudProcessSuspendedEventImpl("ProcessStartedEventId", System.currentTimeMillis(), processInstanceStarted));
    TaskImpl taskAssigned = new TaskImpl("1234-abc-5678-def", "task assigned", Task.TaskStatus.ASSIGNED);
    taskAssigned.setProcessDefinitionId("27");
    taskAssigned.setProcessInstanceId("46");
    CloudTaskAssignedEventImpl cloudTaskAssignedEvent = new CloudTaskAssignedEventImpl("TaskAssignedEventId", System.currentTimeMillis(), taskAssigned);
    testEvents.add(cloudTaskAssignedEvent);
    taskAssigned.setPriority(10);
    testEvents.add(new CloudTaskUpdatedEventImpl("TaskUpdatedEventId", System.currentTimeMillis(), taskAssigned));
    TaskImpl taskCompleted = new TaskImpl("1234-abc-5678-def", "task completed", Task.TaskStatus.COMPLETED);
    taskCompleted.setProcessDefinitionId("28");
    taskCompleted.setProcessInstanceId("47");
    CloudTaskCompletedEventImpl cloudTaskCompletedEvent = new CloudTaskCompletedEventImpl("TaskCompletedEventId", System.currentTimeMillis(), taskCompleted);
    testEvents.add(cloudTaskCompletedEvent);
    TaskImpl taskCreated = new TaskImpl("1234-abc-5678-def", "task created", Task.TaskStatus.CREATED);
    taskCreated.setProcessDefinitionId("28");
    taskCreated.setProcessInstanceId("47");
    taskCreated.setTaskDefinitionKey("taskDefinitionKey");
    CloudTaskCreatedEventImpl cloudTaskCreatedEvent = new CloudTaskCreatedEventImpl("TaskCreatedEventId", System.currentTimeMillis(), taskCreated);
    testEvents.add(cloudTaskCreatedEvent);
    TaskImpl taskCancelled = new TaskImpl("1234-abc-5678-def", "task cancelled", Task.TaskStatus.CANCELLED);
    taskCancelled.setProcessDefinitionId("28");
    taskCancelled.setProcessInstanceId("47");
    CloudTaskCancelledEventImpl cloudTaskCancelledEvent = new CloudTaskCancelledEventImpl("TaskCancelledEventId", System.currentTimeMillis(), taskCancelled);
    testEvents.add(cloudTaskCancelledEvent);
    IntegrationContextImpl integrationContext = new IntegrationContextImpl();
    integrationContext.setProcessDefinitionId("28");
    integrationContext.setProcessInstanceId("47");
    integrationContext.setClientId("elementId");
    integrationContext.setClientName("Connector Task");
    integrationContext.setClientType("serviceTask");
    CloudIntegrationRequestedEventImpl cloudIntegrationRequestedEvent = new CloudIntegrationRequestedEventImpl(integrationContext);
    testEvents.add(cloudIntegrationRequestedEvent);
    CloudIntegrationResultReceivedEventImpl cloudIntegrationResultReceivedEvent = new CloudIntegrationResultReceivedEventImpl(integrationContext);
    testEvents.add(cloudIntegrationResultReceivedEvent);
    Error error = new Error("Error Message");
    error.fillInStackTrace();
    CloudIntegrationErrorReceivedEventImpl cloudIntegrationErrorReceivedEvent = new CloudIntegrationErrorReceivedEventImpl(integrationContext, error.getMessage(), error.getClass().getName(), Arrays.asList(error.getStackTrace()));
    testEvents.add(cloudIntegrationErrorReceivedEvent);
    return testEvents;
}
Also used : CloudBPMNActivityCompletedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCompletedEventImpl) CloudBPMNActivityCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCancelledEventImpl) CloudTaskAssignedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskAssignedEventImpl) ProcessInstanceImpl(org.activiti.api.runtime.model.impl.ProcessInstanceImpl) TaskImpl(org.activiti.api.task.model.impl.TaskImpl) ArrayList(java.util.ArrayList) CloudIntegrationErrorReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudIntegrationErrorReceivedEventImpl) CloudBPMNActivityStartedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityStartedEventImpl) IntegrationContextImpl(org.activiti.api.runtime.model.impl.IntegrationContextImpl) CloudIntegrationResultReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudIntegrationResultReceivedEventImpl) CloudIntegrationRequestedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudIntegrationRequestedEventImpl) CloudProcessDeployedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessDeployedEventImpl) CloudProcessCompletedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessCompletedEventImpl) CloudTaskUpdatedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskUpdatedEventImpl) CloudTaskCreatedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCreatedEventImpl) CloudTaskCancelledEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCancelledEventImpl) BPMNActivityImpl(org.activiti.api.runtime.model.impl.BPMNActivityImpl) CloudProcessStartedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessStartedEventImpl) CloudProcessCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessCancelledEventImpl) CloudProcessSuspendedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessSuspendedEventImpl) CloudRuntimeEvent(org.activiti.cloud.api.model.shared.events.CloudRuntimeEvent) CloudTaskCompletedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCompletedEventImpl)

Example 5 with CloudTaskCompletedEventImpl

use of org.activiti.cloud.api.task.model.impl.events.CloudTaskCompletedEventImpl in project activiti-cloud by Activiti.

the class QueryTasksIT method shouldGetTaskGroupCandidatesAfterTaskCompleted.

@Test
public void shouldGetTaskGroupCandidatesAfterTaskCompleted() {
    // given
    Task task = taskEventContainedBuilder.aTaskWithGroupCandidate("task with group candidate", "testgroup", runningProcessInstance);
    eventsAggregator.sendAll();
    await().untilAsserted(() -> {
        // when
        ResponseEntity<List<String>> response = getCandidateGroups(task.getId());
        ResponseEntity<Task> taskResponseEntity = executeRequestGetTasksById(task.getId());
        // then
        assertThat(response).isNotNull();
        assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
        assertThat(response.getBody()).isNotNull();
        assertThat(response.getBody()).hasSize(1);
        assertThat(response.getBody()).containsExactly("testgroup");
        assertThat(taskResponseEntity.getBody().getCandidateGroups()).containsExactly("testgroup");
    });
    keycloakTokenProducer.setKeycloakTestUser("testuser");
    ((TaskImpl) task).setAssignee("testuser");
    ((TaskImpl) task).setStatus(Task.TaskStatus.ASSIGNED);
    eventsAggregator.addEvents(new CloudTaskAssignedEventImpl(task));
    eventsAggregator.sendAll();
    await().untilAsserted(() -> {
        // when
        ResponseEntity<List<String>> response = getCandidateGroups(task.getId());
        ResponseEntity<Task> taskResponseEntity = executeRequestGetTasksById(task.getId());
        // then
        assertThat(response).isNotNull();
        assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
        assertThat(response.getBody()).isNotNull();
        assertThat(response.getBody()).hasSize(1);
        assertThat(response.getBody()).containsExactly("testgroup");
        assertThat(taskResponseEntity.getBody().getCandidateGroups()).containsExactly("testgroup");
    });
    ((TaskImpl) task).setStatus(Task.TaskStatus.COMPLETED);
    eventsAggregator.addEvents(new CloudTaskCompletedEventImpl(UUID.randomUUID().toString(), new Date().getTime(), task));
    eventsAggregator.sendAll();
    TaskCandidateGroupImpl candidateGroup = new TaskCandidateGroupImpl("hrgroup", task.getId());
    producer.send(new CloudTaskCandidateGroupRemovedEventImpl(candidateGroup));
    await().untilAsserted(() -> {
        // when
        ResponseEntity<List<String>> response = getCandidateGroups(task.getId());
        ResponseEntity<Task> taskResponseEntity = executeRequestGetTasksById(task.getId());
        // then
        assertThat(response).isNotNull();
        assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
        assertThat(response.getBody()).isNotNull();
        assertThat(response.getBody()).hasSize(1);
        assertThat(response.getBody()).containsExactly("testgroup");
        assertThat(taskResponseEntity.getBody().getCandidateGroups()).containsExactly("testgroup");
    });
}
Also used : Task(org.activiti.api.task.model.Task) CloudTask(org.activiti.cloud.api.task.model.CloudTask) CloudTaskAssignedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskAssignedEventImpl) TaskImpl(org.activiti.api.task.model.impl.TaskImpl) TaskCandidateGroupImpl(org.activiti.api.task.model.impl.TaskCandidateGroupImpl) CloudTaskCandidateGroupRemovedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateGroupRemovedEventImpl) List(java.util.List) Date(java.util.Date) CloudTaskCompletedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCompletedEventImpl) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

CloudTaskCompletedEventImpl (org.activiti.cloud.api.task.model.impl.events.CloudTaskCompletedEventImpl)9 Test (org.junit.jupiter.api.Test)6 Date (java.util.Date)4 TaskImpl (org.activiti.api.task.model.impl.TaskImpl)4 CloudTaskAssignedEventImpl (org.activiti.cloud.api.task.model.impl.events.CloudTaskAssignedEventImpl)4 List (java.util.List)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 ArrayList (java.util.ArrayList)2 Task (org.activiti.api.task.model.Task)2 CloudVariableCreatedEventImpl (org.activiti.cloud.api.model.shared.impl.events.CloudVariableCreatedEventImpl)2 CloudVariableDeletedEventImpl (org.activiti.cloud.api.model.shared.impl.events.CloudVariableDeletedEventImpl)2 CloudBPMNActivityCancelledEventImpl (org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCancelledEventImpl)2 CloudBPMNActivityCompletedEventImpl (org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCompletedEventImpl)2 CloudBPMNActivityStartedEventImpl (org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityStartedEventImpl)2 CloudIntegrationErrorReceivedEventImpl (org.activiti.cloud.api.process.model.impl.events.CloudIntegrationErrorReceivedEventImpl)2 CloudIntegrationRequestedEventImpl (org.activiti.cloud.api.process.model.impl.events.CloudIntegrationRequestedEventImpl)2 CloudIntegrationResultReceivedEventImpl (org.activiti.cloud.api.process.model.impl.events.CloudIntegrationResultReceivedEventImpl)2 CloudProcessCancelledEventImpl (org.activiti.cloud.api.process.model.impl.events.CloudProcessCancelledEventImpl)2 CloudProcessCompletedEventImpl (org.activiti.cloud.api.process.model.impl.events.CloudProcessCompletedEventImpl)2 CloudProcessDeployedEventImpl (org.activiti.cloud.api.process.model.impl.events.CloudProcessDeployedEventImpl)2