Search in sources :

Example 1 with TestContractResource

use of eu.bcvsolutions.idm.acc.entity.TestContractResource in project CzechIdMng by bcvsolutions.

the class ComplexHrProcessIntegrationTest method updateContractHRTable.

/*
	 * Updates existing record with the new values.
	 * If updated record doesn't exist an assertion is thrown
	 * Id is the primary key of the table i.e. extId Map key
	 */
@Transactional
public void updateContractHRTable(String id, Map<String, String> contract) {
    TestContractResource resource = entityManager.find(TestContractResource.class, id);
    Assert.assertNotNull(resource);
    if (contract.containsKey("extId")) {
        resource.setId(contract.get("extId"));
    }
    if (contract.containsKey("workPosition")) {
        resource.setWorkposition(contract.get("workPosition"));
    }
    if (contract.containsKey("contractType")) {
        resource.setPositions(contract.get("contractType"));
    }
    if (contract.containsKey("validFrom")) {
        resource.setValidFrom(LocalDate.parse(contract.get("validFrom")));
    }
    if (contract.containsKey("validTill")) {
        resource.setValidTill(LocalDate.parse(contract.get("validTill")));
    }
    if (contract.containsKey("personalNumber")) {
        // name used for personalNumber of Identity
        resource.setName(contract.get("personalNumber"));
    }
    if (!contract.isEmpty()) {
        resource.setModified(ZonedDateTime.now());
    }
}
Also used : TestContractResource(eu.bcvsolutions.idm.acc.entity.TestContractResource) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with TestContractResource

use of eu.bcvsolutions.idm.acc.entity.TestContractResource in project CzechIdMng by bcvsolutions.

the class ComplexHrProcessIntegrationTest method addContractToHRTable.

/**
 * Method for insertion of a new record into corresponding database table
 */
@Transactional
public void addContractToHRTable(Map<String, String> contract) {
    TestContractResource resource = new TestContractResource();
    resource.setId(contract.get("extId"));
    resource.setState(null);
    resource.setWorkposition(contract.get("workPosition"));
    resource.setPositions(contract.get("contractType"));
    resource.setValidFrom(LocalDate.parse(contract.get("validFrom")));
    resource.setValidTill(LocalDate.parse(contract.get("validTill")));
    // name used for personalNumber of Identity
    resource.setName(contract.get("personalNumber"));
    resource.setModified(ZonedDateTime.now());
    entityManager.persist(resource);
}
Also used : TestContractResource(eu.bcvsolutions.idm.acc.entity.TestContractResource) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with TestContractResource

use of eu.bcvsolutions.idm.acc.entity.TestContractResource in project CzechIdMng by bcvsolutions.

the class DefaultUniformPasswordManagerIntegrationTest method testCreateEntityState.

@Test
public void testCreateEntityState() {
    try {
        // Turn on an async execution.
        getHelper().enableAsynchronousProcessing();
        SysSystemDto system = initData();
        Assert.assertNotNull(system);
        AbstractSysSyncConfigDto config = doCreateSyncConfig(system, null);
        Assert.assertTrue(config instanceof SysSyncContractConfigDto);
        IdmIdentityDto ownerOne = helper.createIdentity();
        IdmIdentityDto ownerTwo = helper.createIdentity();
        List<TestContractResource> contractResources = Lists.newArrayList(this.createContract("1", ownerOne.getUsername(), null, "true", null, null, null, null), this.createContract("2", ownerTwo.getUsername(), null, "false", null, null, null, null));
        this.getBean().initContractData(contractResources);
        IdmIdentityContractFilter contractFilter = new IdmIdentityContractFilter();
        contractFilter.setIdentity(ownerOne.getId());
        contractService.find(contractFilter, null).getContent().forEach(contract -> contractService.delete(contract));
        Assert.assertEquals(0, contractService.find(contractFilter, null).getTotalElements());
        contractFilter.setIdentity(ownerTwo.getId());
        contractService.find(contractFilter, null).getContent().forEach(contract -> contractService.delete(contract));
        Assert.assertEquals(0, contractService.find(contractFilter, null).getTotalElements());
        ownerOne = identityService.get(ownerOne.getId());
        ownerTwo = identityService.get(ownerTwo.getId());
        // Identities should be in the CREATED state.
        Assert.assertEquals(IdentityState.NO_CONTRACT, ownerOne.getState());
        Assert.assertEquals(IdentityState.NO_CONTRACT, ownerTwo.getState());
        SynchronizationSchedulableTaskExecutor lrt = new SynchronizationSchedulableTaskExecutor(config.getId());
        LongRunningFutureTask<Boolean> longRunningFutureTask = longRunningTaskManager.execute(lrt);
        UUID transactionIdLrt = longRunningTaskService.get(longRunningFutureTask.getExecutor().getLongRunningTaskId()).getTransactionId();
        // Waiting for the LRT will be running.
        getHelper().waitForResult(res -> {
            return !longRunningTaskService.get(longRunningFutureTask.getExecutor().getLongRunningTaskId()).isRunning();
        }, 50, 40);
        // Waiting for the LRT will be EXECUTED.
        getHelper().waitForResult(res -> {
            return longRunningTaskService.get(longRunningFutureTask.getExecutor().getLongRunningTaskId()).getResultState() != OperationState.EXECUTED;
        }, 250, 100);
        Assert.assertEquals(OperationState.EXECUTED, longRunningTaskService.get(longRunningFutureTask.getExecutor().getLongRunningTaskId()).getResultState());
        SysSyncLogDto log = helper.checkSyncLog(config, SynchronizationActionType.CREATE_ENTITY, 2, OperationResultType.SUCCESS);
        Assert.assertFalse(log.isRunning());
        Assert.assertFalse(log.isContainsError());
        UUID transactionId = log.getTransactionId();
        Assert.assertNotNull(transactionId);
        Assert.assertEquals(transactionIdLrt, transactionId);
        contractFilter.setIdentity(ownerOne.getId());
        Assert.assertEquals(1, contractService.count(contractFilter));
        contractFilter.setIdentity(ownerTwo.getId());
        Assert.assertEquals(1, contractService.count(contractFilter));
        ownerOne = identityService.get(ownerOne.getId());
        ownerTwo = identityService.get(ownerTwo.getId());
        // Identities should have a valid state.
        Assert.assertEquals(IdentityState.VALID, ownerOne.getState());
        Assert.assertEquals(IdentityState.VALID, ownerTwo.getState());
        // LRT ended, entityStates must be removed.
        IdmEntityStateDto entityStateDtoOwnerOne = uniformPasswordManager.getEntityState(ownerOne.getId(), IdmIdentityDto.class, transactionId);
        Assert.assertNull(entityStateDtoOwnerOne);
        IdmEntityStateDto entityStateDtoOwnerTwo = uniformPasswordManager.getEntityState(ownerTwo.getId(), IdmIdentityDto.class, transactionId);
        Assert.assertNull(entityStateDtoOwnerTwo);
        contractFilter.setValue("1");
        Assert.assertEquals(1, contractService.find(contractFilter, null).getTotalElements());
        contractFilter.setValue("2");
        List<IdmIdentityContractDto> contractsTwo = contractService.find(contractFilter, null).getContent();
        Assert.assertEquals(1, contractsTwo.size());
        // Delete log
        syncLogService.delete(log);
        // Delete identities.
        identityService.delete(ownerOne);
        identityService.delete(ownerTwo);
    } finally {
        // Turn off an async execution.
        getHelper().disableAsynchronousProcessing();
    }
}
Also used : IdmEntityStateDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) TestContractResource(eu.bcvsolutions.idm.acc.entity.TestContractResource) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSyncContractConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) SynchronizationSchedulableTaskExecutor(eu.bcvsolutions.idm.acc.scheduler.task.impl.SynchronizationSchedulableTaskExecutor) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) UUID(java.util.UUID) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 4 with TestContractResource

use of eu.bcvsolutions.idm.acc.entity.TestContractResource in project CzechIdMng by bcvsolutions.

the class DefaultUniformPasswordManagerIntegrationTest method testUniformPasswordInIdM.

@Test
public void testUniformPasswordInIdM() {
    try {
        // Turn on an async execution.
        getHelper().setConfigurationValue(EventConfiguration.PROPERTY_EVENT_ASYNCHRONOUS_ENABLED, true);
        getHelper().setConfigurationValue(SchedulerConfiguration.PROPERTY_TASK_ASYNCHRONOUS_ENABLED, true);
        SysSystemDto contractSystem = initData();
        Assert.assertNotNull(contractSystem);
        IdmTreeTypeDto treeType = helper.createTreeType();
        AbstractSysSyncConfigDto config = doCreateSyncConfig(contractSystem, treeType);
        Assert.assertTrue(config instanceof SysSyncContractConfigDto);
        SysSystemDto targetSystemOne = helper.createTestResourceSystem(true);
        // Create system two with account suffix "_targetSystemTwo".
        String targetSystemTwoSuffix = "_targetSystemTwo";
        SysSystemDto targetSystemTwo = helper.createTestResourceSystem(true);
        // Create uniform password definition.
        AccUniformPasswordDto uniformPasswordDef = createUniformPasswordDef(targetSystemOne, targetSystemTwo);
        // Enable change in the IdM.
        uniformPasswordDef.setChangeInIdm(true);
        uniformPasswordService.save(uniformPasswordDef);
        SysSystemMappingDto provisioningMapping = systemMappingService.findProvisioningMapping(targetSystemTwo.getId(), SystemEntityType.IDENTITY);
        List<SysSystemAttributeMappingDto> attributeMappingDtos = schemaAttributeMappingService.findBySystemMapping(provisioningMapping);
        SysSystemAttributeMappingDto uidAttribute = schemaAttributeMappingService.getUidAttribute(attributeMappingDtos, targetSystemTwo);
        uidAttribute.setTransformToResourceScript("return attributeValue + \"" + targetSystemTwoSuffix + "\"");
        schemaAttributeMappingService.save(uidAttribute);
        IdmRoleDto automaticRoleTreeOne = helper.createRole();
        helper.createRoleSystem(automaticRoleTreeOne, targetSystemOne);
        IdmTreeNodeDto treeNodeOne = helper.createTreeNode(treeType, null);
        helper.createAutomaticRole(automaticRoleTreeOne, treeNodeOne);
        IdmRoleDto automaticRoleTreeTwo = helper.createRole();
        helper.createRoleSystem(automaticRoleTreeTwo, targetSystemTwo);
        IdmTreeNodeDto treeNodeTwo = helper.createTreeNode(treeType, null);
        helper.createAutomaticRole(automaticRoleTreeTwo, treeNodeTwo);
        IdmIdentityDto ownerOne = helper.createIdentityOnly();
        List<TestContractResource> contractResources = Lists.newArrayList(this.createContract("1", ownerOne.getUsername(), null, "true", treeNodeOne.getCode(), null, null, null), this.createContract("2", ownerOne.getUsername(), null, "false", treeNodeTwo.getCode(), null, null, null));
        this.getBean().initContractData(contractResources);
        IdmIdentityContractFilter contractFilter = new IdmIdentityContractFilter();
        contractFilter.setIdentity(ownerOne.getId());
        contractService.find(contractFilter, null).getContent().forEach(contract -> contractService.delete(contract));
        Assert.assertEquals(0, contractService.find(contractFilter, null).getTotalElements());
        IdmIdentityFilter identityFilter = new IdmIdentityFilter();
        identityFilter.setAddPasswordMetadata(true);
        ownerOne = identityService.get(ownerOne.getId(), identityFilter);
        // Identities should be in the CREATED state.
        Assert.assertEquals(IdentityState.CREATED, ownerOne.getState());
        Assert.assertNull(ownerOne.getPassword());
        Assert.assertNull(ownerOne.getPasswordMetadata());
        SynchronizationSchedulableTaskExecutor lrt = new SynchronizationSchedulableTaskExecutor(config.getId());
        LongRunningFutureTask<Boolean> longRunningFutureTask = longRunningTaskManager.execute(lrt);
        UUID transactionIdLrt = longRunningTaskService.get(longRunningFutureTask.getExecutor().getLongRunningTaskId()).getTransactionId();
        // Waiting for the LRT will be running.
        getHelper().waitForResult(res -> {
            return !longRunningTaskService.get(longRunningFutureTask.getExecutor().getLongRunningTaskId()).isRunning();
        }, 50, 40);
        // Waiting for the LRT will be EXECUTED.
        getHelper().waitForResult(res -> {
            return longRunningTaskService.get(longRunningFutureTask.getExecutor().getLongRunningTaskId()).getResultState() != OperationState.EXECUTED;
        }, 250, 100);
        Assert.assertEquals(longRunningTaskService.get(longRunningFutureTask.getExecutor().getLongRunningTaskId()).getResultState(), OperationState.EXECUTED);
        SysSyncLogDto log = helper.checkSyncLog(config, SynchronizationActionType.CREATE_ENTITY, 2, OperationResultType.SUCCESS);
        Assert.assertFalse(log.isRunning());
        Assert.assertFalse(log.isContainsError());
        UUID transactionId = log.getTransactionId();
        Assert.assertNotNull(transactionId);
        Assert.assertEquals(transactionIdLrt, transactionId);
        contractFilter.setIdentity(ownerOne.getId());
        Assert.assertEquals(2, contractService.count(contractFilter));
        ownerOne = identityService.get(ownerOne.getId());
        // Identities should have a valid state.
        Assert.assertEquals(IdentityState.VALID, ownerOne.getState());
        // Waiting for removing entity state.
        IdmIdentityDto finalOwnerOne = ownerOne;
        getHelper().waitForResult(res -> {
            return uniformPasswordManager.getEntityState(finalOwnerOne.getId(), IdmIdentityDto.class, transactionId) != null;
        }, 50, 100);
        // LRT ended, entityStates must be removed.
        IdmEntityStateDto entityStateDtoOwnerOne = uniformPasswordManager.getEntityState(ownerOne.getId(), IdmIdentityDto.class, transactionId);
        Assert.assertNull(entityStateDtoOwnerOne);
        TestResource resourceOwnerOne = helper.findResource(ownerOne.getUsername());
        Assert.assertNotNull(resourceOwnerOne);
        TestResource resourceOwnerTwo = helper.findResource(ownerOne.getUsername() + targetSystemTwoSuffix);
        Assert.assertNotNull(resourceOwnerTwo);
        String passwordOwnerOne = resourceOwnerOne.getPassword();
        String passwordOwnerTwo = resourceOwnerTwo.getPassword();
        Assert.assertNotNull(passwordOwnerOne);
        Assert.assertNotNull(passwordOwnerTwo);
        Assert.assertEquals(passwordOwnerOne, passwordOwnerTwo);
        // Change in the IdM is enabled.
        ownerOne = identityService.get(ownerOne.getId(), identityFilter);
        Assert.assertNotNull(ownerOne.getPasswordMetadata());
        // One uniform password notification was send.
        IdmNotificationFilter notificationFilter = new IdmNotificationFilter();
        notificationFilter.setRecipient(ownerOne.getUsername());
        notificationFilter.setNotificationType(IdmEmailLog.class);
        notificationFilter.setTopic(CoreModule.TOPIC_UNIFORM_PASSWORD_SET);
        List<IdmNotificationLogDto> notificationLogDtos = notificationLogService.find(notificationFilter, null).getContent();
        Assert.assertEquals(1, notificationLogDtos.size());
        // None a new password notification was send.
        notificationFilter.setTopic(AccModuleDescriptor.TOPIC_NEW_PASSWORD);
        notificationLogDtos = notificationLogService.find(notificationFilter, null).getContent();
        Assert.assertEquals(0, notificationLogDtos.size());
        // None password set notification was send.
        notificationFilter.setTopic(CoreModule.TOPIC_PASSWORD_SET);
        notificationLogDtos = notificationLogService.find(notificationFilter, null).getContent();
        Assert.assertEquals(0, notificationLogDtos.size());
        // None password change notification was send.
        notificationFilter.setTopic(CoreModule.TOPIC_PASSWORD_CHANGED);
        notificationLogDtos = notificationLogService.find(notificationFilter, null).getContent();
        Assert.assertEquals(0, notificationLogDtos.size());
        // Delete log
        syncLogService.delete(log);
        // Delete identities.
        identityService.delete(ownerOne);
        // Delete uniform password def.
        uniformPasswordService.delete(uniformPasswordDef);
    } finally {
        // Turn off an async execution.
        getHelper().setConfigurationValue(EventConfiguration.PROPERTY_EVENT_ASYNCHRONOUS_ENABLED, false);
        getHelper().setConfigurationValue(SchedulerConfiguration.PROPERTY_TASK_ASYNCHRONOUS_ENABLED, false);
    }
}
Also used : IdmEntityStateDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) AccUniformPasswordDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) TestContractResource(eu.bcvsolutions.idm.acc.entity.TestContractResource) SysSyncContractConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto) SynchronizationSchedulableTaskExecutor(eu.bcvsolutions.idm.acc.scheduler.task.impl.SynchronizationSchedulableTaskExecutor) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) UUID(java.util.UUID) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 5 with TestContractResource

use of eu.bcvsolutions.idm.acc.entity.TestContractResource in project CzechIdMng by bcvsolutions.

the class IdentityContractSyncTest method testInvalidateAndCreateAnotherContractWithAutomaticRoles.

@Test
public void testInvalidateAndCreateAnotherContractWithAutomaticRoles() {
    SysSystemDto system = initData();
    SysSystemDto systemProvisioning = helper.createTestResourceSystem(true);
    Assert.assertNotNull(system);
    AbstractSysSyncConfigDto config = doCreateSyncConfig(system);
    Assert.assertTrue(config instanceof SysSyncContractConfigDto);
    IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
    contractService.delete(getHelper().getPrimeContract(identity));
    // 
    // create first contract with validity and automatic role
    String positionCode = getHelper().createName();
    IdmTreeNodeDto node = getHelper().createTreeNode();
    IdmRoleDto role = getHelper().createRole();
    helper.createRoleSystem(role, systemProvisioning);
    getHelper().createAutomaticRole(role, node);
    IdmIdentityContractDto contract = new IdmIdentityContractDto();
    contract.setIdentity(identity.getId());
    contract.setValidFrom(LocalDate.now().minusMonths(1));
    contract.setValidTill(LocalDate.now().plusMonths(1));
    contract.setDescription(positionCode);
    contract.setPosition(positionCode);
    contract.setWorkPosition(node.getId());
    contract = contractService.save(contract);
    IdmIdentityContractFilter contractFilter = new IdmIdentityContractFilter();
    contractFilter.setIdentity(identity.getId());
    Assert.assertEquals(1, contractService.find(contractFilter, null).getTotalElements());
    IdmIdentityRoleFilter identityRoleFilter = new IdmIdentityRoleFilter();
    identityRoleFilter.setIdentityId(identity.getId());
    List<IdmIdentityRoleDto> assignedRoles = identityRoleService.find(identityRoleFilter, null).getContent();
    Assert.assertEquals(1, assignedRoles.size());
    Assert.assertNotNull(assignedRoles.get(0).getValidFrom());
    Assert.assertNotNull(assignedRoles.get(0).getValidTill());
    Assert.assertEquals(contract.getValidFrom(), assignedRoles.get(0).getValidFrom());
    Assert.assertEquals(contract.getValidTill(), assignedRoles.get(0).getValidTill());
    // create target system entity - invalid
    TestContractResource invalidContractResource = new TestContractResource();
    invalidContractResource.setId(positionCode);
    invalidContractResource.setName(positionCode);
    invalidContractResource.setOwner(identity.getUsername());
    invalidContractResource.setMain(Boolean.TRUE.toString());
    invalidContractResource.setWorkposition(node.getId().toString());
    invalidContractResource.setDescription(positionCode);
    invalidContractResource.setValidTill(LocalDate.now().minusDays(1));
    this.getBean().createContractData(invalidContractResource);
    // 
    String validPositionCode = getHelper().createName();
    TestContractResource validContractResource = new TestContractResource();
    validContractResource.setId(validPositionCode);
    validContractResource.setName(validPositionCode);
    validContractResource.setOwner(identity.getUsername());
    validContractResource.setMain(Boolean.FALSE.toString());
    validContractResource.setWorkposition(node.getId().toString());
    validContractResource.setDescription(validPositionCode);
    this.getBean().createContractData(validContractResource);
    // 
    helper.startSynchronization(config);
    SysSyncLogDto log = checkSyncLog(config, SynchronizationActionType.LINK_AND_UPDATE_ENTITY, 1);
    checkSyncLog(config, SynchronizationActionType.CREATE_ENTITY, 1);
    UUID transactionId = log.getTransactionId();
    Assert.assertFalse(log.isRunning());
    List<IdmIdentityContractDto> contracts = contractService.find(contractFilter, null).getContent();
    Assert.assertEquals(2, contracts.size());
    Assert.assertTrue(contracts.stream().allMatch(c -> c.getTransactionId().equals(transactionId)));
    Assert.assertTrue(contracts.stream().anyMatch(c -> c.isValid()));
    Assert.assertTrue(contracts.stream().anyMatch(c -> !c.isValid()));
    assignedRoles = identityRoleService.find(identityRoleFilter, null).getContent();
    Assert.assertEquals(1, assignedRoles.size());
    Assert.assertNull(assignedRoles.get(0).getValidFrom());
    Assert.assertNull(assignedRoles.get(0).getValidTill());
    Assert.assertEquals(transactionId, assignedRoles.get(0).getTransactionId());
    // find provisioning archive => prevent drop and create => update only in this transaction id
    SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
    filter.setSystemId(systemProvisioning.getId());
    filter.setTransactionId(transactionId);
    List<SysProvisioningArchiveDto> executedOperations = provisioningArchiveService.find(filter, null).getContent();
    Assert.assertFalse(executedOperations.isEmpty());
    Assert.assertTrue(executedOperations.stream().allMatch(o -> o.getOperationType() != ProvisioningEventType.DELETE));
    Assert.assertTrue(executedOperations.stream().allMatch(o -> o.getResultState() == OperationState.EXECUTED));
    // Delete log
    syncLogService.delete(log);
}
Also used : DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) IdmTreeNodeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmTreeNodeFilter) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) IdmContractPosition_(eu.bcvsolutions.idm.core.model.entity.IdmContractPosition_) SynchronizationUnlinkedActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationUnlinkedActionType) Task(eu.bcvsolutions.idm.core.scheduler.api.dto.Task) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) AutomaticRoleAttributeRuleType(eu.bcvsolutions.idm.core.api.domain.AutomaticRoleAttributeRuleType) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) AccContractAccountService(eu.bcvsolutions.idm.acc.service.api.AccContractAccountService) HrEndContractProcess(eu.bcvsolutions.idm.core.scheduler.task.impl.hr.HrEndContractProcess) Page(org.springframework.data.domain.Page) ReconciliationMissingAccountActionType(eu.bcvsolutions.idm.acc.domain.ReconciliationMissingAccountActionType) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) Assert.assertFalse(org.junit.Assert.assertFalse) IdentityContractEvent(eu.bcvsolutions.idm.core.model.event.IdentityContractEvent) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) HrEnableContractProcess(eu.bcvsolutions.idm.core.scheduler.task.impl.hr.HrEnableContractProcess) AccContractAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccContractAccountFilter) IdmContractPositionService(eu.bcvsolutions.idm.core.api.service.IdmContractPositionService) IdmTreeNodeService(eu.bcvsolutions.idm.core.api.service.IdmTreeNodeService) ProvisioningEventType(eu.bcvsolutions.idm.acc.domain.ProvisioningEventType) IdmContractGuaranteeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractGuaranteeFilter) ContractSynchronizationExecutor(eu.bcvsolutions.idm.acc.service.impl.ContractSynchronizationExecutor) SynchronizationLinkedActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationLinkedActionType) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Before(org.junit.Before) IdmScheduledTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto) HrContractExclusionProcess(eu.bcvsolutions.idm.core.scheduler.task.impl.hr.HrContractExclusionProcess) Assert.assertTrue(org.junit.Assert.assertTrue) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) Test(org.junit.Test) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) EntityManager(javax.persistence.EntityManager) IdmIdentityContract_(eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract_) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) SysSyncContractConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto) Assert.assertNull(org.junit.Assert.assertNull) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) AutomaticRoleAttributeRuleComparison(eu.bcvsolutions.idm.core.api.domain.AutomaticRoleAttributeRuleComparison) Assert(org.junit.Assert) AccContractAccountDto(eu.bcvsolutions.idm.acc.dto.AccContractAccountDto) Assert.assertEquals(org.junit.Assert.assertEquals) OperationResultType(eu.bcvsolutions.idm.acc.domain.OperationResultType) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) TestContractResource(eu.bcvsolutions.idm.acc.entity.TestContractResource) IdmAutomaticRoleAttributeDto(eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto) After(org.junit.After) SynchronizationMissingEntityActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationMissingEntityActionType) SysSyncConfigService(eu.bcvsolutions.idm.acc.service.api.SysSyncConfigService) SysSyncLogService(eu.bcvsolutions.idm.acc.service.api.SysSyncLogService) ContractState(eu.bcvsolutions.idm.core.api.domain.ContractState) IdentityContractEventType(eu.bcvsolutions.idm.core.model.event.IdentityContractEvent.IdentityContractEventType) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) UUID(java.util.UUID) SchedulerManager(eu.bcvsolutions.idm.core.scheduler.api.service.SchedulerManager) IdmContractPositionDto(eu.bcvsolutions.idm.core.api.dto.IdmContractPositionDto) IdmContractGuaranteeDto(eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto) IdmScheduledTaskService(eu.bcvsolutions.idm.core.scheduler.api.service.IdmScheduledTaskService) List(java.util.List) Query(javax.persistence.Query) AccAccountService(eu.bcvsolutions.idm.acc.service.api.AccAccountService) LocalDate(java.time.LocalDate) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) IdmContractPositionFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractPositionFilter) SynchronizationActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationActionType) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) InitApplicationData(eu.bcvsolutions.idm.InitApplicationData) SysProvisioningArchiveService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningArchiveService) IdmIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmTreeTypeService(eu.bcvsolutions.idm.core.api.service.IdmTreeTypeService) IdmContractGuarantee_(eu.bcvsolutions.idm.core.model.entity.IdmContractGuarantee_) IdmContractGuaranteeService(eu.bcvsolutions.idm.core.api.service.IdmContractGuaranteeService) SchedulableTaskExecutor(eu.bcvsolutions.idm.core.scheduler.api.service.SchedulableTaskExecutor) ApplicationContext(org.springframework.context.ApplicationContext) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) TestHelper(eu.bcvsolutions.idm.acc.TestHelper) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) Transactional(org.springframework.transaction.annotation.Transactional) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) TestContractResource(eu.bcvsolutions.idm.acc.entity.TestContractResource) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSyncContractConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) UUID(java.util.UUID) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

TestContractResource (eu.bcvsolutions.idm.acc.entity.TestContractResource)11 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)6 SysSyncContractConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto)6 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)6 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)6 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)6 IdmIdentityContractFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter)6 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)6 UUID (java.util.UUID)6 Test (org.junit.Test)6 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)5 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)5 SynchronizationSchedulableTaskExecutor (eu.bcvsolutions.idm.acc.scheduler.task.impl.SynchronizationSchedulableTaskExecutor)5 IdmEntityStateDto (eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto)5 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)5 IdmTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)5 IdmTreeTypeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto)5 Transactional (org.springframework.transaction.annotation.Transactional)4 AccUniformPasswordDto (eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto)3 TestResource (eu.bcvsolutions.idm.acc.entity.TestResource)3