use of org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateUserRemovedEventImpl in project activiti-cloud by Activiti.
the class AuditServiceIT method getTestUserCandidatesEvents.
private List<CloudRuntimeEvent> getTestUserCandidatesEvents() {
List<CloudRuntimeEvent> testEvents = new ArrayList<>();
TaskCandidateUserImpl taskCandidateUser = new TaskCandidateUserImpl("userId", "1234-abc-5678-def");
CloudTaskCandidateUserAddedEventImpl candidateUserAddedEvent = new CloudTaskCandidateUserAddedEventImpl("TaskCandidateUserAddedEventId", System.currentTimeMillis(), taskCandidateUser);
testEvents.add(candidateUserAddedEvent);
taskCandidateUser = new TaskCandidateUserImpl("userId", "1234-abc-5678-def");
CloudTaskCandidateUserRemovedEventImpl candidateUserRemovedEvent = new CloudTaskCandidateUserRemovedEventImpl("TaskCandidateUserRemovedEventId", System.currentTimeMillis(), taskCandidateUser);
testEvents.add(candidateUserRemovedEvent);
return testEvents;
}
use of org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateUserRemovedEventImpl 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.CloudTaskCandidateUserRemovedEventImpl in project activiti-cloud by Activiti.
the class QueryTasksIT method shouldGetAddRemoveTaskUserCandidates.
@Test
public void shouldGetAddRemoveTaskUserCandidates() {
// given
Task createdTask = taskEventContainedBuilder.aTaskWithUserCandidate("task with user candidate", "testuser", runningProcessInstance);
eventsAggregator.sendAll();
keycloakTokenProducer.setKeycloakTestUser("testuser");
// when
ResponseEntity<List<String>> responseEntity = getCandidateUsers(createdTask.getId());
// then
assertThat(responseEntity).isNotNull();
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(responseEntity.getBody()).isNotNull();
assertThat(responseEntity.getBody().size()).isEqualTo(1);
assertThat(responseEntity.getBody().get(0)).isEqualTo("testuser");
// Check adding user candidate
// when
TaskCandidateUserImpl addCandidateUser = new TaskCandidateUserImpl("hruser", createdTask.getId());
producer.send(new CloudTaskCandidateUserAddedEventImpl(addCandidateUser));
// then
responseEntity = getCandidateUsers(createdTask.getId());
assertThat(responseEntity).isNotNull();
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(responseEntity.getBody()).isNotNull();
assertThat(responseEntity.getBody().size()).isEqualTo(2);
assertThat(responseEntity.getBody().get(0)).isIn("hruser", "testuser");
assertThat(responseEntity.getBody().get(1)).isIn("hruser", "testuser");
// Check deleting user candidate
// when
TaskCandidateUserImpl deleteCandidateUser = new TaskCandidateUserImpl("hruser", createdTask.getId());
producer.send(new CloudTaskCandidateUserRemovedEventImpl(deleteCandidateUser));
// then
responseEntity = getCandidateUsers(createdTask.getId());
assertThat(responseEntity).isNotNull();
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(responseEntity.getBody()).isNotNull();
assertThat(responseEntity.getBody().size()).isEqualTo(1);
assertThat(responseEntity.getBody().get(0)).isEqualTo("testuser");
}
use of org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateUserRemovedEventImpl in project activiti-cloud by Activiti.
the class QueryTasksIT method shouldGetTaskUserCandidatesAfterTaskCompleted.
@Test
public void shouldGetTaskUserCandidatesAfterTaskCompleted() {
// given
Task task = taskEventContainedBuilder.aTaskWithUserCandidate("task with user candidate", "testuser", runningProcessInstance);
eventsAggregator.sendAll();
keycloakTokenProducer.setKeycloakTestUser("testuser");
// when
ResponseEntity<List<String>> responseEntity = getCandidateUsers(task.getId());
ResponseEntity<Task> taskResponseEntity = executeRequestGetTasksById(task.getId());
// then
assertThat(responseEntity).isNotNull();
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(responseEntity.getBody()).isNotNull();
assertThat(responseEntity.getBody()).hasSize(1);
assertThat(responseEntity.getBody()).containsExactly("testuser");
assertThat(taskResponseEntity.getBody().getCandidateUsers()).hasSize(1);
assertThat(taskResponseEntity.getBody().getCandidateUsers()).containsExactly("testuser");
// when
((TaskImpl) task).setAssignee("testuser");
((TaskImpl) task).setStatus(Task.TaskStatus.ASSIGNED);
eventsAggregator.addEvents(new CloudTaskAssignedEventImpl(task));
eventsAggregator.sendAll();
responseEntity = getCandidateUsers(task.getId());
taskResponseEntity = executeRequestGetTasksById(task.getId());
// then
assertThat(responseEntity).isNotNull();
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(responseEntity.getBody()).isNotNull();
assertThat(responseEntity.getBody()).hasSize(1);
assertThat(responseEntity.getBody()).containsExactly("testuser");
assertThat(taskResponseEntity.getBody().getCandidateUsers()).hasSize(1);
assertThat(taskResponseEntity.getBody().getCandidateUsers()).containsExactly("testuser");
((TaskImpl) task).setStatus(Task.TaskStatus.COMPLETED);
eventsAggregator.addEvents(new CloudTaskCompletedEventImpl(UUID.randomUUID().toString(), new Date().getTime(), task));
eventsAggregator.sendAll();
TaskCandidateUserImpl candidateUser = new TaskCandidateUserImpl("testuser", task.getId());
producer.send(new CloudTaskCandidateUserRemovedEventImpl(candidateUser));
// then
responseEntity = getCandidateUsers(task.getId());
taskResponseEntity = executeRequestGetTasksById(task.getId());
// then
assertThat(responseEntity).isNotNull();
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(responseEntity.getBody()).isNotNull();
assertThat(responseEntity.getBody()).hasSize(1);
assertThat(responseEntity.getBody()).containsExactly("testuser");
assertThat(taskResponseEntity.getBody().getCandidateUsers()).hasSize(1);
assertThat(taskResponseEntity.getBody().getCandidateUsers()).containsExactly("testuser");
}
use of org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateUserRemovedEventImpl in project activiti-cloud by Activiti.
the class ToCloudTaskRuntimeEventConverter method from.
public CloudTaskCandidateUserRemovedEvent from(TaskCandidateUserRemovedEvent event) {
CloudTaskCandidateUserRemovedEventImpl cloudEvent = new CloudTaskCandidateUserRemovedEventImpl(event.getEntity());
runtimeBundleInfoAppender.appendRuntimeBundleInfoTo(cloudEvent);
return cloudEvent;
}
Aggregations