Search in sources :

Example 6 with WorkflowTaskInstanceDto

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

the class SendNotificationToApplicantAndImplementerTest method checkAndCompleteOneTask.

/**
 * Completes one task (as helpdesk/manager/user manager/security)
 *
 * @param taskFilter, userName, decision
 */
private void checkAndCompleteOneTask(WorkflowFilterDto taskFilter, String userName, String decision) {
    IdmIdentityDto identity = identityService.getByUsername(userName);
    List<WorkflowTaskInstanceDto> tasks;
    tasks = (List<WorkflowTaskInstanceDto>) workflowTaskInstanceService.search(taskFilter).getResources();
    assertEquals(1, tasks.size());
    assertEquals(identity.getId().toString(), tasks.get(0).getApplicant());
    workflowTaskInstanceService.completeTask(tasks.get(0).getId(), decision);
}
Also used : WorkflowTaskInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)

Example 7 with WorkflowTaskInstanceDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto 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());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) WorkflowTaskInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) ArrayList(java.util.ArrayList) List(java.util.List) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) 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 8 with WorkflowTaskInstanceDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto 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());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) WorkflowTaskInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) ArrayList(java.util.ArrayList) List(java.util.List) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) 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 9 with WorkflowTaskInstanceDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto 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());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) WorkflowTaskInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) ArrayList(java.util.ArrayList) List(java.util.List) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) 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 10 with WorkflowTaskInstanceDto

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

the class SendNotificationToApplicantAndImplementerTest method requestRejectedByHelpdeskApplicantNotSameTest.

@Test
public void requestRejectedByHelpdeskApplicantNotSameTest() {
    loginAsAdmin(InitTestData.TEST_ADMIN_USERNAME);
    configurationService.setValue(SENT_TO_APPLICANT, "true");
    configurationService.setValue(SENT_TO_IMPLEMENTER, "false");
    // 
    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(), "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(1, notifications.size());
    assertEquals(CoreModuleDescriptor.TOPIC_DISAPPROVE_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(0, notifications.size());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) WorkflowTaskInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) ArrayList(java.util.ArrayList) List(java.util.List) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) 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)44 WorkflowFilterDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto)39 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)38 AbstractCoreWorkflowIntegrationTest (eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest)35 IdmConceptRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto)35 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)35 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)35 IdmRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto)35 Test (org.junit.Test)35 ArrayList (java.util.ArrayList)26 List (java.util.List)25 IdmNotificationLogDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto)24 IdmNotificationFilter (eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter)24 Transactional (org.springframework.transaction.annotation.Transactional)11 IdmRoleGuaranteeDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleGuaranteeDto)6 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)2 IdmIdentityRoleFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter)2 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)2 BaseDto (eu.bcvsolutions.idm.core.api.dto.BaseDto)1 ResourcesWrapper (eu.bcvsolutions.idm.core.api.rest.domain.ResourcesWrapper)1