use of org.activiti.cloud.api.task.model.impl.events.CloudTaskUpdatedEventImpl in project activiti-cloud by Activiti.
the class QueryTasksIT method shouldGetTaskWithUpdatedInfo.
@Test
public void shouldGetTaskWithUpdatedInfo() {
// given
Task assignedTask = taskEventContainedBuilder.anAssignedTask("Assigned task", "testuser", runningProcessInstance);
eventsAggregator.sendAll();
TaskImpl updatedTask = new TaskImpl(assignedTask.getId(), assignedTask.getName(), assignedTask.getStatus());
updatedTask.setProcessInstanceId(assignedTask.getProcessInstanceId());
updatedTask.setName("Updated name");
updatedTask.setDescription("Updated description");
updatedTask.setPriority(42);
updatedTask.setFormKey("FormKey");
// when
producer.send(new CloudTaskUpdatedEventImpl(updatedTask));
await().untilAsserted(() -> {
ResponseEntity<Task> responseEntity = testRestTemplate.exchange(TASKS_URL + "/" + assignedTask.getId(), HttpMethod.GET, keycloakTokenProducer.entityWithAuthorizationHeader(), new ParameterizedTypeReference<Task>() {
});
// then
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(responseEntity.getBody()).isNotNull();
Task task = responseEntity.getBody();
assertThat(task.getName()).isEqualTo(updatedTask.getName());
assertThat(task.getDescription()).isEqualTo(updatedTask.getDescription());
assertThat(task.getPriority()).isEqualTo(updatedTask.getPriority());
assertThat(task.getFormKey()).isEqualTo(updatedTask.getFormKey());
});
}
use of org.activiti.cloud.api.task.model.impl.events.CloudTaskUpdatedEventImpl in project activiti-cloud by Activiti.
the class TaskEntityUpdatedEventHandlerTest method handleShouldThrowAnExceptionWhenNoTaskIsFoundForTheGivenId.
@Test
public void handleShouldThrowAnExceptionWhenNoTaskIsFoundForTheGivenId() {
// given
CloudTaskUpdatedEventImpl event = buildTaskUpdateEvent();
String taskId = event.getEntity().getId();
given(taskRepository.findById(taskId)).willReturn(Optional.empty());
// then
// when
assertThatExceptionOfType(QueryException.class).isThrownBy(() -> handler.handle(event)).withMessageContaining("Unable to find task with id: " + taskId);
}
use of org.activiti.cloud.api.task.model.impl.events.CloudTaskUpdatedEventImpl in project activiti-cloud by Activiti.
the class ToCloudTaskRuntimeEventConverter method from.
public CloudTaskUpdatedEvent from(TaskUpdatedEvent event) {
CloudTaskUpdatedEventImpl cloudEvent = new CloudTaskUpdatedEventImpl(event.getEntity());
runtimeBundleInfoAppender.appendRuntimeBundleInfoTo(cloudEvent);
return cloudEvent;
}
use of org.activiti.cloud.api.task.model.impl.events.CloudTaskUpdatedEventImpl 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));
}
use of org.activiti.cloud.api.task.model.impl.events.CloudTaskUpdatedEventImpl 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;
}
Aggregations