Search in sources :

Example 6 with ProcessSkippedAutomaticRoleByTreeForContractTaskExecutor

use of eu.bcvsolutions.idm.core.scheduler.task.impl.ProcessSkippedAutomaticRoleByTreeForContractTaskExecutor in project CzechIdMng by bcvsolutions.

the class DefaultIdmIdentityContractServiceIntegrationTest method testRecountAutomaticRoleWithMissingContent.

@Test
@Transactional
public void testRecountAutomaticRoleWithMissingContent() {
    // create state with missing content
    IdmEntityStateDto state = new IdmEntityStateDto();
    UUID stateId = UUID.randomUUID();
    state.setOwnerId(stateId);
    state.setOwnerType(entityStateManager.getOwnerType(IdmIdentityContractDto.class));
    state.setResult(new OperationResultDto.Builder(OperationState.BLOCKED).setModel(new DefaultResultModel(CoreResultCode.AUTOMATIC_ROLE_SKIPPED)).build());
    entityStateManager.saveState(null, state);
    state = new IdmEntityStateDto();
    state.setOwnerId(stateId);
    state.setOwnerType(entityStateManager.getOwnerType(IdmIdentityContractDto.class));
    state.setResult(new OperationResultDto.Builder(OperationState.BLOCKED).setModel(new DefaultResultModel(CoreResultCode.AUTOMATIC_ROLE_SKIPPED)).build());
    entityStateManager.saveState(null, state);
    // 
    state = new IdmEntityStateDto();
    state.setOwnerId(UUID.randomUUID());
    state.setOwnerType(entityStateManager.getOwnerType(IdmContractPositionDto.class));
    state.setResult(new OperationResultDto.Builder(OperationState.BLOCKED).setModel(new DefaultResultModel(CoreResultCode.AUTOMATIC_ROLE_SKIPPED)).build());
    entityStateManager.saveState(null, state);
    // 
    // recount skipped automatic roles
    LongRunningFutureTask<Boolean> executor = longRunningTaskManager.execute(new ProcessSkippedAutomaticRoleByTreeForContractTaskExecutor());
    IdmLongRunningTaskDto longRunningTask = longRunningTaskManager.getLongRunningTask(executor);
    Assert.assertTrue(longRunningTask.getWarningItemCount() > 1);
}
Also used : IdmEntityStateDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto) IdmLongRunningTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) ProcessSkippedAutomaticRoleByTreeForContractTaskExecutor(eu.bcvsolutions.idm.core.scheduler.task.impl.ProcessSkippedAutomaticRoleByTreeForContractTaskExecutor) IdmContractPositionDto(eu.bcvsolutions.idm.core.api.dto.IdmContractPositionDto) OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) UUID(java.util.UUID) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

DefaultResultModel (eu.bcvsolutions.idm.core.api.dto.DefaultResultModel)4 IdmContractPositionDto (eu.bcvsolutions.idm.core.api.dto.IdmContractPositionDto)4 IdmEntityStateDto (eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto)4 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)4 OperationResultDto (eu.bcvsolutions.idm.core.api.dto.OperationResultDto)4 ProcessSkippedAutomaticRoleByTreeForContractTaskExecutor (eu.bcvsolutions.idm.core.scheduler.task.impl.ProcessSkippedAutomaticRoleByTreeForContractTaskExecutor)4 EventConfiguration (eu.bcvsolutions.idm.core.api.config.domain.EventConfiguration)3 IdentityConfiguration (eu.bcvsolutions.idm.core.api.config.domain.IdentityConfiguration)3 PrivateIdentityConfiguration (eu.bcvsolutions.idm.core.api.config.domain.PrivateIdentityConfiguration)3 AutomaticRoleAttributeRuleComparison (eu.bcvsolutions.idm.core.api.domain.AutomaticRoleAttributeRuleComparison)3 AutomaticRoleAttributeRuleType (eu.bcvsolutions.idm.core.api.domain.AutomaticRoleAttributeRuleType)3 ContractState (eu.bcvsolutions.idm.core.api.domain.ContractState)3 CoreResultCode (eu.bcvsolutions.idm.core.api.domain.CoreResultCode)3 OperationState (eu.bcvsolutions.idm.core.api.domain.OperationState)3 RecursionType (eu.bcvsolutions.idm.core.api.domain.RecursionType)3 TransactionContextHolder (eu.bcvsolutions.idm.core.api.domain.TransactionContextHolder)3 IdmAutomaticRoleAttributeDto (eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto)3 IdmContractGuaranteeDto (eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto)3 IdmEntityEventDto (eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto)3 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)3