Search in sources :

Example 31 with IdmIdentityContractDto

use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto in project CzechIdMng by bcvsolutions.

the class HrContractExclusionProcessIntegrationTest method testExclusion3.

@Test
public void testExclusion3() {
    IdmIdentityContractDto dto = prepareTestData3();
    assertEquals(false, identityService.get(dto.getIdentity()).isDisabled());
    // 
    process(lrt, dto);
    // 
    Page<IdmProcessedTaskItemDto> queueItems = itemService.findQueueItems(scheduledTask, null);
    Page<IdmProcessedTaskItemDto> logItems = itemService.findLogItems(lrt, null);
    // 
    assertEquals(true, identityService.get(dto.getIdentity()).isDisabled());
    assertEquals(1, queueItems.getTotalElements());
    assertEquals(1, logItems.getTotalElements());
    SchedulerTestUtils.checkLogItems(lrt, IdmIdentityContractDto.class, logItems);
    SchedulerTestUtils.checkQueueItems(scheduledTask, IdmIdentityContractDto.class, queueItems);
}
Also used : IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Test(org.junit.Test)

Example 32 with IdmIdentityContractDto

use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto in project CzechIdMng by bcvsolutions.

the class HrEnableContractProcessIntegrationTest method testEnable2.

/**
 * Disabled identity, two contracts, one gets enabled => must enable identity.
 */
@Test
public void testEnable2() {
    IdmIdentityContractDto dto = prepareTestData2();
    assertEquals(true, identityService.get(dto.getIdentity()).isDisabled());
    // 
    process(lrt, dto);
    // 
    Page<IdmProcessedTaskItemDto> queueItems = itemService.findQueueItems(scheduledTask, null);
    Page<IdmProcessedTaskItemDto> logItems = itemService.findLogItems(lrt, null);
    // 
    assertEquals(false, identityService.get(dto.getIdentity()).isDisabled());
    assertEquals(1, queueItems.getTotalElements());
    assertEquals(1, logItems.getTotalElements());
    SchedulerTestUtils.checkLogItems(lrt, IdmIdentityContractDto.class, logItems);
    SchedulerTestUtils.checkQueueItems(scheduledTask, IdmIdentityContractDto.class, queueItems);
}
Also used : IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Test(org.junit.Test)

Example 33 with IdmIdentityContractDto

use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto in project CzechIdMng by bcvsolutions.

the class HrEnableContractProcessIntegrationTest method testEnableWithEnabledProcessor.

@Test
public void testEnableWithEnabledProcessor() {
    helper.enable(IdentityContractEnableProcessor.class);
    // 
    IdmIdentityContractDto dto = prepareTestData1();
    // identity is enabled by processor
    assertEquals(false, identityService.get(dto.getIdentity()).isDisabled());
    // 
    process(lrt, dto);
    // 
    Page<IdmProcessedTaskItemDto> queueItems = itemService.findQueueItems(scheduledTask, null);
    Page<IdmProcessedTaskItemDto> logItems = itemService.findLogItems(lrt, null);
    // 
    assertEquals(false, identityService.get(dto.getIdentity()).isDisabled());
    assertEquals(1, queueItems.getTotalElements());
    assertEquals(1, logItems.getTotalElements());
    SchedulerTestUtils.checkLogItems(lrt, IdmIdentityContractDto.class, logItems);
    SchedulerTestUtils.checkQueueItems(scheduledTask, IdmIdentityContractDto.class, queueItems);
}
Also used : IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Test(org.junit.Test)

Example 34 with IdmIdentityContractDto

use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto in project CzechIdMng by bcvsolutions.

the class HrEnableContractProcessIntegrationTest method testGetItemsToProcessAddValidContracts.

@Test
public void testGetItemsToProcessAddValidContracts() {
    final long originalCount = executor.getItemsToProcess(null).getTotalElements();
    // 
    IdmIdentityContractDto contract = getTestContract(createTestIdentity(UUID.randomUUID().toString()), false);
    contract.setValidTill(LocalDate.now().plusDays(1));
    contract = identityContractService.save(contract);
    assertTrue(contract.isValid());
    // 
    long currentCount = executor.getItemsToProcess(null).getTotalElements();
    // 
    assertEquals(originalCount + 1, currentCount);
    // 
    contract.setValidTill(null);
    contract.setValidFrom(LocalDate.now().minusDays(10));
    contract = identityContractService.save(contract);
    assertTrue(contract.isValid());
    // 
    currentCount = executor.getItemsToProcess(null).getTotalElements();
    // 
    assertEquals(originalCount + 1, currentCount);
}
Also used : IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Test(org.junit.Test)

Example 35 with IdmIdentityContractDto

use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto in project CzechIdMng by bcvsolutions.

the class HrEnableContractProcessIntegrationTest method testEnable1.

/**
 * Disabled identity, one contract gets enabled => must enable identity.
 */
@Test
public void testEnable1() {
    IdmIdentityContractDto dto = prepareTestData1();
    assertEquals(true, identityService.get(dto.getIdentity()).isDisabled());
    // 
    process(lrt, dto);
    // 
    Page<IdmProcessedTaskItemDto> queueItems = itemService.findQueueItems(scheduledTask, null);
    Page<IdmProcessedTaskItemDto> logItems = itemService.findLogItems(lrt, null);
    // 
    assertEquals(false, identityService.get(dto.getIdentity()).isDisabled());
    assertEquals(1, queueItems.getTotalElements());
    assertEquals(1, logItems.getTotalElements());
    SchedulerTestUtils.checkLogItems(lrt, IdmIdentityContractDto.class, logItems);
    SchedulerTestUtils.checkQueueItems(scheduledTask, IdmIdentityContractDto.class, queueItems);
}
Also used : IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Test(org.junit.Test)

Aggregations

IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)220 Test (org.junit.Test)170 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)156 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)92 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)91 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)53 IdmRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto)48 IdmConceptRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto)45 AbstractCoreWorkflowIntegrationTest (eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest)44 WorkflowFilterDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto)36 WorkflowTaskInstanceDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto)35 LocalDate (org.joda.time.LocalDate)34 ArrayList (java.util.ArrayList)31 List (java.util.List)29 IdmTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)28 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)24 UUID (java.util.UUID)19 IdmTreeTypeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto)18