use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto in project CzechIdMng by bcvsolutions.
the class HistoryProcessAndTaskTest method completeTasksAndCheckHistory.
private void completeTasksAndCheckHistory() {
WorkflowFilterDto filter = new WorkflowFilterDto();
filter.setProcessDefinitionKey(PROCESS_KEY);
List<WorkflowTaskInstanceDto> tasks = (List<WorkflowTaskInstanceDto>) taskInstanceService.search(filter).getResources();
assertEquals(1, tasks.size());
assertEquals("userTaskFirst", tasks.get(0).getName());
String taskId = tasks.get(0).getId();
String processId = tasks.get(0).getProcessInstanceId();
taskInstanceService.completeTask(taskId, null);
// Check task history
checkTaskHistory(taskId, InitTestData.TEST_USER_1);
// Second task is for testUser2 (is candidate) for testUser1 must be null
filter.setCandidateOrAssigned(InitTestData.TEST_USER_1);
tasks = (List<WorkflowTaskInstanceDto>) taskInstanceService.search(filter).getResources();
assertEquals(0, tasks.size());
this.logout();
this.loginAsAdmin(InitTestData.TEST_USER_2);
filter.setCandidateOrAssigned(InitTestData.TEST_USER_2);
tasks = (List<WorkflowTaskInstanceDto>) taskInstanceService.search(filter).getResources();
assertEquals(1, tasks.size());
assertEquals("userTaskSecond", tasks.get(0).getName());
taskId = tasks.get(0).getId();
taskInstanceService.completeTask(taskId, null);
// Check task history
checkTaskHistory(taskId, InitTestData.TEST_USER_2);
tasks = (List<WorkflowTaskInstanceDto>) taskInstanceService.search(filter).getResources();
assertEquals(0, tasks.size());
// Find history of process. Historic process must exist and must be ended.
WorkflowHistoricProcessInstanceDto historicProcess = historicProcessService.get(processId);
assertNotNull(historicProcess);
assertNotNull(historicProcess.getEndTime());
}
use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto in project CzechIdMng by bcvsolutions.
the class SendNotificationToApplicantAndImplementerTest method requestReturnedByHelpdeskImplementerNotSameTest.
@Test
public void requestReturnedByHelpdeskImplementerNotSameTest() {
loginAsAdmin(InitTestData.TEST_ADMIN_USERNAME);
configurationService.setValue(SENT_TO_APPLICANT, "false");
configurationService.setValue(SENT_TO_IMPLEMENTER, "true");
//
IdmIdentityDto testUser3 = createTestUser();
loginAsAdmin(testUser3.getUsername());
IdmIdentityDto test1 = createTestUser();
IdmRoleDto test_role = createRole("test_role" + System.currentTimeMillis());
//
IdmIdentityContractDto contract = identityContractService.getPrimeContract(test1.getId());
IdmRoleRequestDto request = createRoleRequest(test1);
request = roleRequestService.save(request);
IdmConceptRoleRequestDto concept = createRoleConcept(test_role, contract, request);
concept = conceptRoleRequestService.save(concept);
roleRequestService.startRequestInternal(request.getId(), true);
request = roleRequestService.get(request.getId());
assertEquals(RoleRequestState.IN_PROGRESS, request.getState());
WorkflowFilterDto taskFilter = new WorkflowFilterDto();
List<WorkflowTaskInstanceDto> tasks = (List<WorkflowTaskInstanceDto>) workflowTaskInstanceService.search(taskFilter).getResources();
assertEquals(0, tasks.size());
loginAsAdmin(InitTestData.TEST_ADMIN_USERNAME);
// HELPDESK
checkAndCompleteOneTask(taskFilter, test1.getUsername(), "backToApplicant");
// test notification to applicant
IdmNotificationFilter filter = new IdmNotificationFilter();
filter.setRecipient(test1.getUsername());
filter.setNotificationType(IdmNotificationLog.class);
List<IdmNotificationLogDto> notifications = notificationLogService.find(filter, null).getContent();
assertEquals(0, notifications.size());
// test notification to implementer
filter = new IdmNotificationFilter();
filter.setRecipient(testUser3.getUsername());
filter.setNotificationType(IdmNotificationLog.class);
notifications = notificationLogService.find(filter, null).getContent();
assertEquals(1, notifications.size());
assertEquals(CoreModuleDescriptor.TOPIC_RETURN_REQUEST_IDENTITY_ROLES_IMPLEMENTER, notifications.get(0).getTopic());
}
use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto in project CzechIdMng by bcvsolutions.
the class SendNotificationToApplicantAndImplementerTest method requestRejectedByHelpdeskImplementerSameTest.
@Test
public void requestRejectedByHelpdeskImplementerSameTest() {
loginAsAdmin(InitTestData.TEST_ADMIN_USERNAME);
configurationService.setValue(SENT_TO_APPLICANT, "false");
configurationService.setValue(SENT_TO_IMPLEMENTER, "true");
//
IdmIdentityDto test1 = createTestUser();
IdmRoleDto test_role = createRole("test_role" + System.currentTimeMillis());
loginAsAdmin(test1.getUsername());
IdmIdentityContractDto contract = identityContractService.getPrimeContract(test1.getId());
IdmRoleRequestDto request = createRoleRequest(test1);
request = roleRequestService.save(request);
IdmConceptRoleRequestDto concept = createRoleConcept(test_role, contract, request);
concept = conceptRoleRequestService.save(concept);
roleRequestService.startRequestInternal(request.getId(), true);
request = roleRequestService.get(request.getId());
assertEquals(RoleRequestState.IN_PROGRESS, request.getState());
WorkflowFilterDto taskFilter = new WorkflowFilterDto();
List<WorkflowTaskInstanceDto> tasks = (List<WorkflowTaskInstanceDto>) workflowTaskInstanceService.search(taskFilter).getResources();
assertEquals(0, tasks.size());
loginAsAdmin(InitTestData.TEST_ADMIN_USERNAME);
// HELPDESK
checkAndCompleteOneTask(taskFilter, test1.getUsername(), "disapprove");
// test notification
IdmNotificationFilter filter = new IdmNotificationFilter();
filter.setRecipient(test1.getUsername());
filter.setNotificationType(IdmNotificationLog.class);
List<IdmNotificationLogDto> notifications = notificationLogService.find(filter, null).getContent();
assertEquals(1, notifications.size());
assertEquals(CoreModuleDescriptor.TOPIC_DISAPPROVE_IDENTITY_ROLES_IMPLEMENTER, notifications.get(0).getTopic());
}
use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto in project CzechIdMng by bcvsolutions.
the class SendNotificationToApplicantAndImplementerTest method requestReturnedByHelpdeskApplicantImplementerSameTest.
@Test
public void requestReturnedByHelpdeskApplicantImplementerSameTest() {
loginAsAdmin(InitTestData.TEST_ADMIN_USERNAME);
configurationService.setValue(SENT_TO_APPLICANT, "true");
configurationService.setValue(SENT_TO_IMPLEMENTER, "true");
//
IdmIdentityDto test1 = createTestUser();
IdmRoleDto test_role = createRole("test_role" + System.currentTimeMillis());
loginAsAdmin(test1.getUsername());
IdmIdentityContractDto contract = identityContractService.getPrimeContract(test1.getId());
IdmRoleRequestDto request = createRoleRequest(test1);
request = roleRequestService.save(request);
IdmConceptRoleRequestDto concept = createRoleConcept(test_role, contract, request);
concept = conceptRoleRequestService.save(concept);
roleRequestService.startRequestInternal(request.getId(), true);
request = roleRequestService.get(request.getId());
assertEquals(RoleRequestState.IN_PROGRESS, request.getState());
WorkflowFilterDto taskFilter = new WorkflowFilterDto();
List<WorkflowTaskInstanceDto> tasks = (List<WorkflowTaskInstanceDto>) workflowTaskInstanceService.search(taskFilter).getResources();
assertEquals(0, tasks.size());
loginAsAdmin(InitTestData.TEST_ADMIN_USERNAME);
// HELPDESK
checkAndCompleteOneTask(taskFilter, test1.getUsername(), "backToApplicant");
// test notification
IdmNotificationFilter filter = new IdmNotificationFilter();
filter.setRecipient(test1.getUsername());
filter.setNotificationType(IdmNotificationLog.class);
List<IdmNotificationLogDto> notifications = notificationLogService.find(filter, null).getContent();
assertEquals(1, notifications.size());
assertEquals(CoreModuleDescriptor.TOPIC_RETURN_REQUEST_IDENTITY_ROLES_IMPLEMENTER, notifications.get(0).getTopic());
}
use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto in project CzechIdMng by bcvsolutions.
the class SendNotificationToApplicantAndImplementerTest method requestApprovedImplementerNotSameTest.
@Test
public void requestApprovedImplementerNotSameTest() {
loginAsAdmin(InitTestData.TEST_ADMIN_USERNAME);
configurationService.setValue(SENT_TO_APPLICANT, "false");
configurationService.setValue(SENT_TO_IMPLEMENTER, "true");
//
IdmIdentityDto testUser3 = createTestUser();
loginAsAdmin(testUser3.getUsername());
IdmIdentityDto test1 = createTestUser();
IdmRoleDto test_role = createRole("test_role" + System.currentTimeMillis());
//
IdmIdentityContractDto contract = identityContractService.getPrimeContract(test1.getId());
IdmRoleRequestDto request = createRoleRequest(test1);
request = roleRequestService.save(request);
IdmConceptRoleRequestDto concept = createRoleConcept(test_role, contract, request);
concept = conceptRoleRequestService.save(concept);
roleRequestService.startRequestInternal(request.getId(), true);
request = roleRequestService.get(request.getId());
assertEquals(RoleRequestState.IN_PROGRESS, request.getState());
WorkflowFilterDto taskFilter = new WorkflowFilterDto();
List<WorkflowTaskInstanceDto> tasks = (List<WorkflowTaskInstanceDto>) workflowTaskInstanceService.search(taskFilter).getResources();
assertEquals(0, tasks.size());
loginAsAdmin(InitTestData.TEST_ADMIN_USERNAME);
// HELPDESK
checkAndCompleteOneTask(taskFilter, test1.getUsername(), "approve");
// MANAGER
loginAsAdmin(testUser2.getUsername());
checkAndCompleteOneTask(taskFilter, test1.getUsername(), "approve");
// USER MANAGER
loginAsAdmin(InitTestData.TEST_ADMIN_USERNAME);
checkAndCompleteOneTask(taskFilter, test1.getUsername(), "approve");
// SECURITY
checkAndCompleteOneTask(taskFilter, test1.getUsername(), "approve");
// test notification to applicant
IdmNotificationFilter filter = new IdmNotificationFilter();
filter.setRecipient(test1.getUsername());
filter.setNotificationType(IdmNotificationLog.class);
List<IdmNotificationLogDto> notifications = notificationLogService.find(filter, null).getContent();
assertEquals(0, notifications.size());
// test notification to implementer
filter = new IdmNotificationFilter();
filter.setRecipient(testUser3.getUsername());
filter.setNotificationType(IdmNotificationLog.class);
notifications = notificationLogService.find(filter, null).getContent();
assertEquals(1, notifications.size());
assertEquals(CoreModuleDescriptor.TOPIC_CHANGE_IDENTITY_ROLES_IMPLEMENTER, notifications.get(0).getTopic());
}
Aggregations