Search in sources :

Example 66 with Assert.assertEquals

use of org.junit.Assert.assertEquals in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningServiceTest method compileAttributesOverrloadedStrategyMergeAuthoDisableTest.

@Test
@Transactional
public void compileAttributesOverrloadedStrategyMergeAuthoDisableTest() {
    List<SysRoleSystemAttributeDto> overloadingAttributes = new ArrayList<>();
    List<AttributeMapping> defaultAttributes = new ArrayList<>();
    initDataSystem();
    initOverloadedAttributes(overloadingAttributes, defaultAttributes);
    // roleOne
    SysRoleSystemDto roleSystem1 = roleSystemService.get(overloadingAttributes.get(0).getRoleSystem());
    IdmRoleDto roleDto = roleService.get(roleSystem1.getRole());
    roleDto.setPriority(200);
    roleDto = roleService.save(roleDto);
    // roleTwo
    SysRoleSystemDto roleSystem2 = roleSystemService.get(overloadingAttributes.get(1).getRoleSystem());
    roleDto = roleService.get(roleSystem2.getRole());
    roleDto.setPriority(500);
    roleDto = roleService.save(roleDto);
    // overloadedRoleOne
    SysRoleSystemAttributeDto attribute1 = overloadingAttributes.get(0);
    attribute1.setStrategyType(AttributeMappingStrategyType.AUTHORITATIVE_MERGE);
    attribute1 = roleSystemAttributeService.save(attribute1);
    overloadingAttributes.set(0, attribute1);
    // overloadedRoleTwo
    SysRoleSystemAttributeDto attribute2 = overloadingAttributes.get(1);
    attribute2.setStrategyType(AttributeMappingStrategyType.AUTHORITATIVE_MERGE);
    attribute2.setDisabledDefaultAttribute(true);
    attribute2 = roleSystemAttributeService.save(attribute2);
    overloadingAttributes.set(1, attribute2);
    List<AttributeMapping> compilledAttributes = provisioningService.compileAttributes(defaultAttributes, overloadingAttributes, SystemEntityType.IDENTITY);
    Assert.assertEquals(2, compilledAttributes.size());
    Assert.assertTrue(compilledAttributes.stream().filter(attribute -> {
        return "defOneOverloaded".equals(attribute.getName());
    }).findFirst().isPresent());
}
Also used : MethodSorters(org.junit.runners.MethodSorters) IdmPasswordPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) AccIdentityAccount_(eu.bcvsolutions.idm.acc.entity.AccIdentityAccount_) ConfigurationService(eu.bcvsolutions.idm.core.api.service.ConfigurationService) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) SysRoleSystemService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemService) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) After(org.junit.After) ProvisioningConfiguration(eu.bcvsolutions.idm.acc.config.domain.ProvisioningConfiguration) Assert.fail(org.junit.Assert.fail) AccIdentityAccountDto(eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) UUID(java.util.UUID) Page(org.springframework.data.domain.Page) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) List(java.util.List) AccAccountService(eu.bcvsolutions.idm.acc.service.api.AccAccountService) AccountType(eu.bcvsolutions.idm.acc.domain.AccountType) AccIdentityAccountService(eu.bcvsolutions.idm.acc.service.api.AccIdentityAccountService) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) AccAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccAccountFilter) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) FixMethodOrder(org.junit.FixMethodOrder) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) IdmTreeNodeService(eu.bcvsolutions.idm.core.api.service.IdmTreeNodeService) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) SystemEvent(eu.bcvsolutions.idm.acc.event.SystemEvent) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SystemEventType(eu.bcvsolutions.idm.acc.event.SystemEvent.SystemEventType) SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) IdmAccountDto(eu.bcvsolutions.idm.core.api.dto.IdmAccountDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ArrayList(java.util.ArrayList) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) IdmPasswordPolicyGenerateType(eu.bcvsolutions.idm.core.api.domain.IdmPasswordPolicyGenerateType) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) ImmutableList(com.google.common.collect.ImmutableList) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) ProvisioningOperationType(eu.bcvsolutions.idm.acc.domain.ProvisioningOperationType) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) Before(org.junit.Before) ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) SysRoleSystemAttributeService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemAttributeService) SysProvisioningArchiveService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningArchiveService) IdmPasswordPolicyType(eu.bcvsolutions.idm.core.api.domain.IdmPasswordPolicyType) AccIdentityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter) Assert.assertNotNull(org.junit.Assert.assertNotNull) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) IdmTreeTypeService(eu.bcvsolutions.idm.core.api.service.IdmTreeTypeService) Test(org.junit.Test) EntityManager(javax.persistence.EntityManager) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) CoreEntityManager(eu.bcvsolutions.idm.core.api.config.datasource.CoreEntityManager) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) Assert.assertNull(org.junit.Assert.assertNull) AccAccount_(eu.bcvsolutions.idm.acc.entity.AccAccount_) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) ProvisioningService(eu.bcvsolutions.idm.acc.service.api.ProvisioningService) IdmIdentity_(eu.bcvsolutions.idm.core.model.entity.IdmIdentity_) TestHelper(eu.bcvsolutions.idm.acc.TestHelper) Assert(org.junit.Assert) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) Assert.assertEquals(org.junit.Assert.assertEquals) PasswordChangeDto(eu.bcvsolutions.idm.core.api.dto.PasswordChangeDto) Transactional(org.springframework.transaction.annotation.Transactional) IdmPasswordPolicyService(eu.bcvsolutions.idm.core.api.service.IdmPasswordPolicyService) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) ArrayList(java.util.ArrayList) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 67 with Assert.assertEquals

use of org.junit.Assert.assertEquals in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningServiceTest method compileAttributesOverrloadedDiffPriorityTest.

@Test
@Transactional
public void compileAttributesOverrloadedDiffPriorityTest() {
    List<SysRoleSystemAttributeDto> overloadingAttributes = new ArrayList<>();
    List<AttributeMapping> defaultAttributes = new ArrayList<>();
    initDataSystem();
    initOverloadedAttributes(overloadingAttributes, defaultAttributes);
    // roleOne
    SysRoleSystemDto roleSystem1 = roleSystemService.get(overloadingAttributes.get(0).getRoleSystem());
    IdmRoleDto roleDto = roleService.get(roleSystem1.getRole());
    roleDto.setPriority(200);
    roleDto = roleService.save(roleDto);
    // roleTwo
    SysRoleSystemDto roleSystem2 = roleSystemService.get(overloadingAttributes.get(1).getRoleSystem());
    roleDto = roleService.get(roleSystem2.getRole());
    roleDto.setPriority(100);
    roleDto = roleService.save(roleDto);
    List<SysRoleSystemAttributeDto> freshOverloadingAttributes = new ArrayList<>();
    overloadingAttributes.forEach(attribute -> {
        freshOverloadingAttributes.add(roleSystemAttributeService.get(attribute.getId()));
    });
    List<AttributeMapping> compilledAttributes = provisioningService.compileAttributes(defaultAttributes, freshOverloadingAttributes, SystemEntityType.IDENTITY);
    Assert.assertEquals(2, compilledAttributes.size());
    Assert.assertTrue(compilledAttributes.stream().filter(attribute -> {
        return "defOneOverloaded".equals(attribute.getName());
    }).findFirst().isPresent());
}
Also used : MethodSorters(org.junit.runners.MethodSorters) IdmPasswordPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) AccIdentityAccount_(eu.bcvsolutions.idm.acc.entity.AccIdentityAccount_) ConfigurationService(eu.bcvsolutions.idm.core.api.service.ConfigurationService) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) SysRoleSystemService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemService) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) After(org.junit.After) ProvisioningConfiguration(eu.bcvsolutions.idm.acc.config.domain.ProvisioningConfiguration) Assert.fail(org.junit.Assert.fail) AccIdentityAccountDto(eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) UUID(java.util.UUID) Page(org.springframework.data.domain.Page) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) List(java.util.List) AccAccountService(eu.bcvsolutions.idm.acc.service.api.AccAccountService) AccountType(eu.bcvsolutions.idm.acc.domain.AccountType) AccIdentityAccountService(eu.bcvsolutions.idm.acc.service.api.AccIdentityAccountService) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) AccAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccAccountFilter) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) FixMethodOrder(org.junit.FixMethodOrder) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) IdmTreeNodeService(eu.bcvsolutions.idm.core.api.service.IdmTreeNodeService) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) SystemEvent(eu.bcvsolutions.idm.acc.event.SystemEvent) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SystemEventType(eu.bcvsolutions.idm.acc.event.SystemEvent.SystemEventType) SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) IdmAccountDto(eu.bcvsolutions.idm.core.api.dto.IdmAccountDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ArrayList(java.util.ArrayList) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) IdmPasswordPolicyGenerateType(eu.bcvsolutions.idm.core.api.domain.IdmPasswordPolicyGenerateType) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) ImmutableList(com.google.common.collect.ImmutableList) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) ProvisioningOperationType(eu.bcvsolutions.idm.acc.domain.ProvisioningOperationType) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) Before(org.junit.Before) ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) SysRoleSystemAttributeService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemAttributeService) SysProvisioningArchiveService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningArchiveService) IdmPasswordPolicyType(eu.bcvsolutions.idm.core.api.domain.IdmPasswordPolicyType) AccIdentityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter) Assert.assertNotNull(org.junit.Assert.assertNotNull) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) IdmTreeTypeService(eu.bcvsolutions.idm.core.api.service.IdmTreeTypeService) Test(org.junit.Test) EntityManager(javax.persistence.EntityManager) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) CoreEntityManager(eu.bcvsolutions.idm.core.api.config.datasource.CoreEntityManager) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) Assert.assertNull(org.junit.Assert.assertNull) AccAccount_(eu.bcvsolutions.idm.acc.entity.AccAccount_) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) ProvisioningService(eu.bcvsolutions.idm.acc.service.api.ProvisioningService) IdmIdentity_(eu.bcvsolutions.idm.core.model.entity.IdmIdentity_) TestHelper(eu.bcvsolutions.idm.acc.TestHelper) Assert(org.junit.Assert) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) Assert.assertEquals(org.junit.Assert.assertEquals) PasswordChangeDto(eu.bcvsolutions.idm.core.api.dto.PasswordChangeDto) Transactional(org.springframework.transaction.annotation.Transactional) IdmPasswordPolicyService(eu.bcvsolutions.idm.core.api.service.IdmPasswordPolicyService) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) ArrayList(java.util.ArrayList) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 68 with Assert.assertEquals

use of org.junit.Assert.assertEquals in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningServiceTest method compileAttributesOverrloadedStrategyCreateTest.

@Test
@Transactional
public void compileAttributesOverrloadedStrategyCreateTest() {
    List<SysRoleSystemAttributeDto> overloadingAttributes = new ArrayList<>();
    List<AttributeMapping> defaultAttributes = new ArrayList<>();
    initDataSystem();
    initOverloadedAttributes(overloadingAttributes, defaultAttributes);
    // roleOne
    SysRoleSystemDto roleSystem1 = roleSystemService.get(overloadingAttributes.get(0).getRoleSystem());
    IdmRoleDto roleDto = roleService.get(roleSystem1.getRole());
    roleDto.setPriority(200);
    roleDto = roleService.save(roleDto);
    // roleTwo
    SysRoleSystemDto roleSystem2 = roleSystemService.get(overloadingAttributes.get(1).getRoleSystem());
    roleDto = roleService.get(roleSystem2.getRole());
    roleDto.setPriority(500);
    roleDto = roleService.save(roleDto);
    // overloadedRoleOne
    SysRoleSystemAttributeDto attribute1 = overloadingAttributes.get(0);
    attribute1.setStrategyType(AttributeMappingStrategyType.CREATE);
    attribute1 = roleSystemAttributeService.save(attribute1);
    overloadingAttributes.set(0, attribute1);
    // overloadedRoleTwo
    SysRoleSystemAttributeDto attribute2 = overloadingAttributes.get(1);
    attribute2.setStrategyType(AttributeMappingStrategyType.CREATE);
    attribute2 = roleSystemAttributeService.save(attribute2);
    overloadingAttributes.set(1, attribute2);
    List<AttributeMapping> compilledAttributes = provisioningService.compileAttributes(defaultAttributes, overloadingAttributes, SystemEntityType.IDENTITY);
    Assert.assertEquals(2, compilledAttributes.size());
    Assert.assertTrue(compilledAttributes.stream().filter(attribute -> {
        return "defOneOverloadedRoleTwo".equals(attribute.getName());
    }).findFirst().isPresent());
}
Also used : MethodSorters(org.junit.runners.MethodSorters) IdmPasswordPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) AccIdentityAccount_(eu.bcvsolutions.idm.acc.entity.AccIdentityAccount_) ConfigurationService(eu.bcvsolutions.idm.core.api.service.ConfigurationService) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) SysRoleSystemService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemService) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) After(org.junit.After) ProvisioningConfiguration(eu.bcvsolutions.idm.acc.config.domain.ProvisioningConfiguration) Assert.fail(org.junit.Assert.fail) AccIdentityAccountDto(eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) UUID(java.util.UUID) Page(org.springframework.data.domain.Page) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) List(java.util.List) AccAccountService(eu.bcvsolutions.idm.acc.service.api.AccAccountService) AccountType(eu.bcvsolutions.idm.acc.domain.AccountType) AccIdentityAccountService(eu.bcvsolutions.idm.acc.service.api.AccIdentityAccountService) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) AccAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccAccountFilter) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) FixMethodOrder(org.junit.FixMethodOrder) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) IdmTreeNodeService(eu.bcvsolutions.idm.core.api.service.IdmTreeNodeService) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) SystemEvent(eu.bcvsolutions.idm.acc.event.SystemEvent) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SystemEventType(eu.bcvsolutions.idm.acc.event.SystemEvent.SystemEventType) SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) IdmAccountDto(eu.bcvsolutions.idm.core.api.dto.IdmAccountDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ArrayList(java.util.ArrayList) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) IdmPasswordPolicyGenerateType(eu.bcvsolutions.idm.core.api.domain.IdmPasswordPolicyGenerateType) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) ImmutableList(com.google.common.collect.ImmutableList) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) ProvisioningOperationType(eu.bcvsolutions.idm.acc.domain.ProvisioningOperationType) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) Before(org.junit.Before) ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) SysRoleSystemAttributeService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemAttributeService) SysProvisioningArchiveService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningArchiveService) IdmPasswordPolicyType(eu.bcvsolutions.idm.core.api.domain.IdmPasswordPolicyType) AccIdentityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter) Assert.assertNotNull(org.junit.Assert.assertNotNull) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) IdmTreeTypeService(eu.bcvsolutions.idm.core.api.service.IdmTreeTypeService) Test(org.junit.Test) EntityManager(javax.persistence.EntityManager) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) CoreEntityManager(eu.bcvsolutions.idm.core.api.config.datasource.CoreEntityManager) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) Assert.assertNull(org.junit.Assert.assertNull) AccAccount_(eu.bcvsolutions.idm.acc.entity.AccAccount_) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) ProvisioningService(eu.bcvsolutions.idm.acc.service.api.ProvisioningService) IdmIdentity_(eu.bcvsolutions.idm.core.model.entity.IdmIdentity_) TestHelper(eu.bcvsolutions.idm.acc.TestHelper) Assert(org.junit.Assert) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) Assert.assertEquals(org.junit.Assert.assertEquals) PasswordChangeDto(eu.bcvsolutions.idm.core.api.dto.PasswordChangeDto) Transactional(org.springframework.transaction.annotation.Transactional) IdmPasswordPolicyService(eu.bcvsolutions.idm.core.api.service.IdmPasswordPolicyService) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) ArrayList(java.util.ArrayList) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 69 with Assert.assertEquals

use of org.junit.Assert.assertEquals in project CzechIdMng by bcvsolutions.

the class IdentityPasswordProvisioningTest method testSendPasswordNotificationCreateCancelled.

@Test
public void testSendPasswordNotificationCreateCancelled() {
    // init readOnly system
    SysSystemDto system = initSystem();
    system.setReadonly(true);
    system = systemService.save(system);
    IdmRoleDto role = initRole(system);
    IdmIdentityDto identity = helper.createIdentity();
    // CREATE operation
    IdmIdentityRoleDto identityRole = helper.createIdentityRole(identity, role);
    checkIdentityAccount(identity, identityRole, 1);
    // => new password is sent for valid identity only
    identity.setState(IdentityState.VALID);
    identity.setFirstName(getHelper().createName());
    // UPDATE operation
    identityService.save(identity);
    // 
    AccAccountDto account = accountService.getAccount(identity.getUsername(), system.getId());
    Assert.assertNotNull(account);
    TestResource entityOnSystem = helper.findResource(account.getUid());
    Assert.assertNull(entityOnSystem);
    // 
    // Check for send password notification
    IdmNotificationFilter notificationFilter = new IdmNotificationFilter();
    notificationFilter.setTopic(AccModuleDescriptor.TOPIC_NEW_PASSWORD);
    notificationFilter.setRecipient(identity.getUsername());
    List<IdmNotificationLogDto> notifications = // 
    notificationLogService.find(notificationFilter, null).getContent().stream().filter(// 
    notification -> IdmEmailLog.NOTIFICATION_TYPE.equals(notification.getType())).collect(Collectors.toList());
    Assert.assertTrue(notifications.isEmpty());
    // 
    // cancel the first provisioning operation
    SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
    filter.setEntityType(SystemEntityType.IDENTITY);
    filter.setEntityIdentifier(identity.getId());
    List<SysProvisioningOperationDto> operations = provisioningOperationService.find(filter, null).getContent();
    Assert.assertEquals(2, operations.size());
    // ~ readonly
    Assert.assertTrue(operations.stream().allMatch(o -> o.getResultState() == OperationState.NOT_EXECUTED));
    SysProvisioningOperationDto createOperation = operations.stream().filter(o -> o.getOperationType() == ProvisioningEventType.CREATE).findFirst().get();
    SysProvisioningOperationDto updateOperation = operations.stream().filter(o -> o.getOperationType() == ProvisioningEventType.UPDATE).findFirst().get();
    // 
    // active system
    system.setReadonly(false);
    system = systemService.save(system);
    // 
    // cancel the first operation
    provisioningExecutor.cancel(createOperation);
    operations = provisioningOperationService.find(filter, null).getContent();
    Assert.assertEquals(1, operations.size());
    notifications = // 
    notificationLogService.find(notificationFilter, null).getContent().stream().filter(// 
    notification -> IdmEmailLog.NOTIFICATION_TYPE.equals(notification.getType())).collect(Collectors.toList());
    Assert.assertTrue(notifications.isEmpty());
    // 
    provisioningExecutor.execute(updateOperation);
    operations = provisioningOperationService.find(filter, null).getContent();
    Assert.assertTrue(operations.isEmpty());
    notifications = // 
    notificationLogService.find(notificationFilter, null).getContent().stream().filter(// 
    notification -> IdmEmailLog.NOTIFICATION_TYPE.equals(notification.getType())).collect(Collectors.toList());
    Assert.assertEquals(1, notifications.size());
}
Also used : ProvisioningExecutor(eu.bcvsolutions.idm.acc.service.api.ProvisioningExecutor) IdmPasswordPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) StringUtils(org.apache.commons.lang3.StringUtils) ConfidentialString(eu.bcvsolutions.idm.core.security.api.domain.ConfidentialString) SysRoleSystemService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemService) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) Map(java.util.Map) After(org.junit.After) Assert.fail(org.junit.Assert.fail) AccIdentityAccountDto(eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) SysProvisioningOperationService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningOperationService) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) Collectors(java.util.stream.Collectors) IdentityState(eu.bcvsolutions.idm.core.api.domain.IdentityState) Serializable(java.io.Serializable) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) List(java.util.List) AccAccountService(eu.bcvsolutions.idm.acc.service.api.AccAccountService) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) Assert.assertFalse(org.junit.Assert.assertFalse) IdentityProvisioningExecutor(eu.bcvsolutions.idm.acc.service.impl.IdentityProvisioningExecutor) Entry(java.util.Map.Entry) AccIdentityAccountService(eu.bcvsolutions.idm.acc.service.api.AccIdentityAccountService) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) ProvisioningEventType(eu.bcvsolutions.idm.acc.domain.ProvisioningEventType) IdmAccountDto(eu.bcvsolutions.idm.core.api.dto.IdmAccountDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ConfidentialStorage(eu.bcvsolutions.idm.core.api.service.ConfidentialStorage) Lists(com.google.common.collect.Lists) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) Before(org.junit.Before) AccModuleDescriptor(eu.bcvsolutions.idm.acc.AccModuleDescriptor) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) SysProvisioningArchiveService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningArchiveService) IdmPasswordPolicyType(eu.bcvsolutions.idm.core.api.domain.IdmPasswordPolicyType) AccIdentityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter) Assert.assertNotNull(org.junit.Assert.assertNotNull) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) Assert.assertTrue(org.junit.Assert.assertTrue) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) Test(org.junit.Test) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IdmNotificationLogService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationLogService) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) Assert.assertNull(org.junit.Assert.assertNull) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) IdmEmailLog(eu.bcvsolutions.idm.core.notification.entity.IdmEmailLog) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) ProvisioningService(eu.bcvsolutions.idm.acc.service.api.ProvisioningService) IdmIdentity_(eu.bcvsolutions.idm.core.model.entity.IdmIdentity_) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) TestHelper(eu.bcvsolutions.idm.acc.TestHelper) Assert(org.junit.Assert) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) Assert.assertEquals(org.junit.Assert.assertEquals) PasswordChangeDto(eu.bcvsolutions.idm.core.api.dto.PasswordChangeDto) IdmPasswordPolicyService(eu.bcvsolutions.idm.core.api.service.IdmPasswordPolicyService) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 70 with Assert.assertEquals

use of org.junit.Assert.assertEquals 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) CoreEntityManager(eu.bcvsolutions.idm.core.api.config.datasource.CoreEntityManager) 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

Assert.assertEquals (org.junit.Assert.assertEquals)282 Assert (org.junit.Assert)277 Test (org.junit.Test)276 List (java.util.List)233 Assert.assertTrue (org.junit.Assert.assertTrue)191 Before (org.junit.Before)166 ArrayList (java.util.ArrayList)134 Assert.assertNotNull (org.junit.Assert.assertNotNull)133 Map (java.util.Map)121 Assert.assertFalse (org.junit.Assert.assertFalse)116 Arrays (java.util.Arrays)113 UUID (java.util.UUID)108 Autowired (org.springframework.beans.factory.annotation.Autowired)105 Collections (java.util.Collections)102 After (org.junit.After)99 HashMap (java.util.HashMap)96 Assert.assertNull (org.junit.Assert.assertNull)94 Collectors (java.util.stream.Collectors)93 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)91 IOException (java.io.IOException)85