Search in sources :

Example 46 with WorkflowTaskInstanceDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto in project CzechIdMng by bcvsolutions.

the class SendNotificationToApplicantAndImplementerTest method requestRejectedByHelpdeskImplementerNotSameTest.

@Test
public void requestRejectedByHelpdeskImplementerNotSameTest() {
    ZonedDateTime now = ZonedDateTime.now().truncatedTo(ChronoUnit.MILLIS);
    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();
    // 
    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();
    taskFilter.setCandidateOrAssigned(securityService.getCurrentId().toString());
    taskFilter.setCreatedAfter(now);
    List<WorkflowTaskInstanceDto> tasks = (List<WorkflowTaskInstanceDto>) workflowTaskInstanceService.find(taskFilter, null, IdmBasePermission.READ).getContent();
    assertEquals(0, tasks.size());
    loginAsAdmin();
    taskFilter.setCandidateOrAssigned(securityService.getCurrentId().toString());
    // HELPDESK
    checkAndCompleteOneTask(taskFilter, test1.getUsername(), "disapprove");
    // 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_DISAPPROVE_IDENTITY_ROLES_IMPLEMENTER, notifications.get(0).getTopic());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) WorkflowTaskInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) ZonedDateTime(java.time.ZonedDateTime) WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) List(java.util.List) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) AbstractCoreWorkflowIntegrationTest(eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest) Test(org.junit.Test)

Example 47 with WorkflowTaskInstanceDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto in project CzechIdMng by bcvsolutions.

the class SendNotificationToApplicantAndImplementerTest method requestApprovedApplicantImplementerNotSameTest.

@Test
public void requestApprovedApplicantImplementerNotSameTest() {
    ZonedDateTime now = ZonedDateTime.now().truncatedTo(ChronoUnit.MILLIS);
    configurationService.setValue(SENT_TO_APPLICANT, "true");
    configurationService.setValue(SENT_TO_IMPLEMENTER, "true");
    // 
    IdmIdentityDto testUser3 = createTestUser();
    loginAsAdmin(testUser3.getUsername());
    IdmIdentityDto test1 = createTestUser();
    IdmRoleDto test_role = createRole();
    // 
    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();
    taskFilter.setCandidateOrAssigned(securityService.getCurrentId().toString());
    taskFilter.setCreatedAfter(now);
    List<WorkflowTaskInstanceDto> tasks = (List<WorkflowTaskInstanceDto>) workflowTaskInstanceService.find(taskFilter, null, IdmBasePermission.READ).getContent();
    assertEquals(0, tasks.size());
    loginAsAdmin();
    taskFilter.setCandidateOrAssigned(securityService.getCurrentId().toString());
    // HELPDESK
    checkAndCompleteOneTask(taskFilter, test1.getUsername(), "approve");
    // MANAGER
    loginAsAdmin(testUser2.getUsername());
    taskFilter.setCandidateOrAssigned(securityService.getCurrentId().toString());
    checkAndCompleteOneTask(taskFilter, test1.getUsername(), "approve");
    // USER MANAGER
    loginAsAdmin();
    taskFilter.setCandidateOrAssigned(securityService.getCurrentId().toString());
    checkAndCompleteOneTask(taskFilter, test1.getUsername(), "approve");
    // SECURITY
    checkAndCompleteOneTask(taskFilter, test1.getUsername(), "approve");
    // 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_CHANGE_IDENTITY_ROLES, notifications.get(0).getTopic());
    // 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());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) WorkflowTaskInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) ZonedDateTime(java.time.ZonedDateTime) WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) List(java.util.List) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) AbstractCoreWorkflowIntegrationTest(eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest) Test(org.junit.Test)

Example 48 with WorkflowTaskInstanceDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto in project CzechIdMng by bcvsolutions.

the class SendNotificationToApplicantAndImplementerTest method requestRejectedByHelpdeskApplicantImplementerSameTest.

@Test
public void requestRejectedByHelpdeskApplicantImplementerSameTest() {
    ZonedDateTime now = ZonedDateTime.now().truncatedTo(ChronoUnit.MILLIS);
    configurationService.setValue(SENT_TO_APPLICANT, "true");
    configurationService.setValue(SENT_TO_IMPLEMENTER, "true");
    // 
    IdmIdentityDto test1 = createTestUser();
    IdmRoleDto test_role = createRole();
    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();
    taskFilter.setCandidateOrAssigned(securityService.getCurrentId().toString());
    taskFilter.setCreatedAfter(now);
    List<WorkflowTaskInstanceDto> tasks = (List<WorkflowTaskInstanceDto>) workflowTaskInstanceService.find(taskFilter, null, IdmBasePermission.READ).getContent();
    assertEquals(0, tasks.size());
    loginAsAdmin();
    taskFilter.setCandidateOrAssigned(securityService.getCurrentId().toString());
    // 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());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) WorkflowTaskInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) ZonedDateTime(java.time.ZonedDateTime) WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) List(java.util.List) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) AbstractCoreWorkflowIntegrationTest(eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest) Test(org.junit.Test)

Example 49 with WorkflowTaskInstanceDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto in project CzechIdMng by bcvsolutions.

the class SendNotificationToApplicantAndImplementerTest method requestRejectedByHelpdeskSameTest.

@Test
public void requestRejectedByHelpdeskSameTest() {
    ZonedDateTime now = ZonedDateTime.now().truncatedTo(ChronoUnit.MILLIS);
    configurationService.setValue(SENT_TO_APPLICANT, "false");
    configurationService.setValue(SENT_TO_IMPLEMENTER, "false");
    // 
    IdmIdentityDto test1 = createTestUser();
    IdmRoleDto test_role = createRole();
    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();
    taskFilter.setCandidateOrAssigned(securityService.getCurrentId().toString());
    taskFilter.setCreatedAfter(now);
    List<WorkflowTaskInstanceDto> tasks = (List<WorkflowTaskInstanceDto>) workflowTaskInstanceService.find(taskFilter, null, IdmBasePermission.READ).getContent();
    assertEquals(0, tasks.size());
    loginAsAdmin();
    taskFilter.setCandidateOrAssigned(securityService.getCurrentId().toString());
    // 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(0, notifications.size());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) WorkflowTaskInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) ZonedDateTime(java.time.ZonedDateTime) WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) List(java.util.List) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) AbstractCoreWorkflowIntegrationTest(eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest) Test(org.junit.Test)

Example 50 with WorkflowTaskInstanceDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto in project CzechIdMng by bcvsolutions.

the class SendNotificationToApplicantAndImplementerTest method requestReturnedByHelpdeskImplementerSameTest.

@Test
public void requestReturnedByHelpdeskImplementerSameTest() {
    ZonedDateTime now = ZonedDateTime.now().truncatedTo(ChronoUnit.MILLIS);
    configurationService.setValue(SENT_TO_APPLICANT, "false");
    configurationService.setValue(SENT_TO_IMPLEMENTER, "true");
    // 
    IdmIdentityDto test1 = createTestUser();
    IdmRoleDto test_role = createRole();
    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();
    taskFilter.setCandidateOrAssigned(securityService.getCurrentId().toString());
    taskFilter.setCreatedAfter(now);
    List<WorkflowTaskInstanceDto> tasks = (List<WorkflowTaskInstanceDto>) workflowTaskInstanceService.find(taskFilter, null, IdmBasePermission.READ).getContent();
    assertEquals(0, tasks.size());
    loginAsAdmin();
    taskFilter.setCandidateOrAssigned(securityService.getCurrentId().toString());
    // 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());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) WorkflowTaskInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) ZonedDateTime(java.time.ZonedDateTime) WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) List(java.util.List) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) AbstractCoreWorkflowIntegrationTest(eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest) Test(org.junit.Test)

Aggregations

WorkflowTaskInstanceDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto)81 WorkflowFilterDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto)69 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)63 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)56 Test (org.junit.Test)56 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)55 IdmRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto)54 AbstractCoreWorkflowIntegrationTest (eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest)49 IdmConceptRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto)48 ZonedDateTime (java.time.ZonedDateTime)43 List (java.util.List)39 IdmNotificationLogDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto)28 IdmNotificationFilter (eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter)28 UUID (java.util.UUID)17 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)12 IdentityLinkDto (eu.bcvsolutions.idm.core.workflow.model.dto.IdentityLinkDto)12 WorkflowTaskInstanceService (eu.bcvsolutions.idm.core.workflow.service.WorkflowTaskInstanceService)12 Autowired (org.springframework.beans.factory.annotation.Autowired)12 IdentityLinkType (org.activiti.engine.task.IdentityLinkType)11 WorkflowHistoricTaskInstanceDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowHistoricTaskInstanceDto)9