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);
}
Aggregations