Search in sources :

Example 21 with Assert.assertNotNull

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

the class DefaultAuthorizationManagerIntegrationTest method testCache.

@Test
@Transactional
@SuppressWarnings({ "rawtypes", "unchecked" })
public void testCache() {
    // create and login identity
    IdmIdentityDto identity = getHelper().createIdentity();
    UUID mockIdentity = UUID.randomUUID();
    // prepare role
    IdmRoleDto role = getHelper().createRole();
    IdmAuthorizationPolicyDto policy = getHelper().createBasePolicy(role.getId(), IdmBasePermission.AUTOCOMPLETE, IdmBasePermission.READ);
    getHelper().createIdentityRole(identity, role);
    // 
    Assert.assertNull(cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_DEFINITION_CACHE_NAME, identity.getId()));
    Assert.assertNull(cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_CACHE_NAME, identity.getId()));
    Assert.assertNull(cacheManager.getValue(AuthorizationManager.PERMISSION_CACHE_NAME, identity.getId()));
    Assert.assertNull(cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_CACHE_NAME, mockIdentity));
    Assert.assertNull(cacheManager.getValue(AuthorizationManager.PERMISSION_CACHE_NAME, mockIdentity));
    // 
    cacheManager.cacheValue(AuthorizationManager.AUTHORIZATION_POLICY_CACHE_NAME, mockIdentity, new HashMap<>());
    cacheManager.cacheValue(AuthorizationManager.PERMISSION_CACHE_NAME, mockIdentity, new HashMap<>());
    Assert.assertNotNull(cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_CACHE_NAME, mockIdentity));
    Assert.assertNotNull(cacheManager.getValue(AuthorizationManager.PERMISSION_CACHE_NAME, mockIdentity));
    // 
    // without login
    Set<String> permissions = manager.getPermissions(role);
    Assert.assertTrue(permissions.isEmpty());
    // 
    try {
        getHelper().login(identity);
        // 
        // new entity is not supported with cache, but permissions are evaluated
        permissions = manager.getPermissions(new IdmRoleDto());
        Assert.assertEquals(2, permissions.size());
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.AUTOCOMPLETE.getName())));
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.READ.getName())));
        Assert.assertNull(cacheManager.getValue(AuthorizationManager.PERMISSION_CACHE_NAME, identity.getId()));
        // 
        // load from db
        permissions = manager.getPermissions(role);
        Assert.assertEquals(2, permissions.size());
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.AUTOCOMPLETE.getName())));
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.READ.getName())));
        Assert.assertNotNull(cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_CACHE_NAME, identity.getId()));
        Assert.assertNotNull(cacheManager.getValue(AuthorizationManager.PERMISSION_CACHE_NAME, identity.getId()));
        // load from cache
        permissions = manager.getPermissions(role);
        Assert.assertEquals(2, permissions.size());
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.AUTOCOMPLETE.getName())));
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.READ.getName())));
        Assert.assertNotNull(cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_DEFINITION_CACHE_NAME, policy.getId()));
        Assert.assertNotNull(cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_CACHE_NAME, identity.getId()));
        Assert.assertNotNull(cacheManager.getValue(AuthorizationManager.PERMISSION_CACHE_NAME, identity.getId()));
        // check cache content - one
        ValueWrapper cacheValue = cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_CACHE_NAME, identity.getId());
        List<IdmAuthorizationPolicyDto> cachedPolicies = (List) ((Map) cacheValue.get()).get(role.getClass());
        Assert.assertEquals(1, cachedPolicies.size());
        Assert.assertEquals(BasePermissionEvaluator.class.getCanonicalName(), ((IdmAuthorizationPolicyDto) cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_DEFINITION_CACHE_NAME, cachedPolicies.get(0)).get()).getEvaluatorType());
        cacheValue = cacheManager.getValue(AuthorizationManager.PERMISSION_CACHE_NAME, identity.getId());
        permissions = (Set) ((Map) cacheValue.get()).get(role.getId());
        Assert.assertEquals(2, permissions.size());
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.AUTOCOMPLETE.getName())));
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.READ.getName())));
        // 
        // change policy => evict whole cache
        policy.setPermissions(IdmBasePermission.AUTOCOMPLETE, IdmBasePermission.READ, IdmBasePermission.UPDATE);
        authorizationPolicyService.save(policy);
        Assert.assertNull(cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_DEFINITION_CACHE_NAME, policy.getId()));
        Assert.assertNull(cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_CACHE_NAME, identity.getId()));
        Assert.assertNull(cacheManager.getValue(AuthorizationManager.PERMISSION_CACHE_NAME, identity.getId()));
        Assert.assertNull(cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_CACHE_NAME, mockIdentity));
        Assert.assertNull(cacheManager.getValue(AuthorizationManager.PERMISSION_CACHE_NAME, mockIdentity));
        // 
        cacheManager.cacheValue(AuthorizationManager.AUTHORIZATION_POLICY_CACHE_NAME, mockIdentity, new HashMap<>());
        cacheManager.cacheValue(AuthorizationManager.PERMISSION_CACHE_NAME, mockIdentity, new HashMap<>());
        permissions = manager.getPermissions(role);
        Assert.assertEquals(3, permissions.size());
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.AUTOCOMPLETE.getName())));
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.READ.getName())));
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.UPDATE.getName())));
        Assert.assertNotNull(cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_CACHE_NAME, identity.getId()));
        Assert.assertNotNull(cacheManager.getValue(AuthorizationManager.PERMISSION_CACHE_NAME, identity.getId()));
    } finally {
        // evict logged identity cache only
        logout();
    }
    // check cache is evicted only for logged identity
    Assert.assertNull(cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_CACHE_NAME, identity.getId()));
    Assert.assertNull(cacheManager.getValue(AuthorizationManager.PERMISSION_CACHE_NAME, identity.getId()));
    Assert.assertNotNull(cacheManager.getValue(AuthorizationManager.AUTHORIZATION_POLICY_CACHE_NAME, mockIdentity));
    Assert.assertNotNull(cacheManager.getValue(AuthorizationManager.PERMISSION_CACHE_NAME, mockIdentity));
}
Also used : IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) Autowired(org.springframework.beans.factory.annotation.Autowired) HashMap(java.util.HashMap) ValueWrapper(eu.bcvsolutions.idm.core.api.config.cache.domain.ValueWrapper) CoreGroupPermission(eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) Map(java.util.Map) UuidEvaluator(eu.bcvsolutions.idm.core.security.evaluator.UuidEvaluator) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) BasePermissionEvaluator(eu.bcvsolutions.idm.core.security.evaluator.BasePermissionEvaluator) Before(org.junit.Before) AuthorizationManager(eu.bcvsolutions.idm.core.security.api.service.AuthorizationManager) IdmIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) Assert.assertNotNull(org.junit.Assert.assertNotNull) ContractState(eu.bcvsolutions.idm.core.api.domain.ContractState) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmCacheManager(eu.bcvsolutions.idm.core.api.service.IdmCacheManager) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) Assert.assertTrue(org.junit.Assert.assertTrue) Set(java.util.Set) Test(org.junit.Test) UUID(java.util.UUID) RoleConfiguration(eu.bcvsolutions.idm.core.api.config.domain.RoleConfiguration) ApplicationContext(org.springframework.context.ApplicationContext) ConfigurationMap(eu.bcvsolutions.idm.core.api.domain.ConfigurationMap) List(java.util.List) AuthorizationEvaluatorDto(eu.bcvsolutions.idm.core.security.api.dto.AuthorizationEvaluatorDto) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) Assert.assertFalse(org.junit.Assert.assertFalse) IdmAuthorizationPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmAuthorizationPolicyDto) LocalDate(java.time.LocalDate) AbstractEvaluatorIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractEvaluatorIntegrationTest) IdmAuthorizationPolicyService(eu.bcvsolutions.idm.core.api.service.IdmAuthorizationPolicyService) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) Assert(org.junit.Assert) Assert.assertEquals(org.junit.Assert.assertEquals) AuthorizableType(eu.bcvsolutions.idm.core.security.api.dto.AuthorizableType) Transactional(org.springframework.transaction.annotation.Transactional) IdmRole(eu.bcvsolutions.idm.core.model.entity.IdmRole) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) ValueWrapper(eu.bcvsolutions.idm.core.api.config.cache.domain.ValueWrapper) IdmAuthorizationPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmAuthorizationPolicyDto) BasePermissionEvaluator(eu.bcvsolutions.idm.core.security.evaluator.BasePermissionEvaluator) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) List(java.util.List) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) UUID(java.util.UUID) HashMap(java.util.HashMap) Map(java.util.Map) ConfigurationMap(eu.bcvsolutions.idm.core.api.domain.ConfigurationMap) Test(org.junit.Test) AbstractEvaluatorIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractEvaluatorIntegrationTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 22 with Assert.assertNotNull

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

the class IdentitySyncTest method testDefaultRoleToAllContracts.

@Test
public void testDefaultRoleToAllContracts() {
    IdmIdentityDto identityDto = helper.createIdentity((GuardedString) null);
    SysSystemDto system = initData(identityDto.getUsername());
    Assert.assertNotNull(system);
    IdmRoleDto defaultRole = helper.createRole();
    // 
    SysSyncIdentityConfigDto config = doCreateSyncConfig(system);
    // Set default role to sync configuration
    config.setDefaultRole(defaultRole.getId());
    config.setInactiveOwnerBehavior(SynchronizationInactiveOwnerBehaviorType.LINK);
    config.setCreateDefaultContract(false);
    config.setAssignDefaultRoleToAll(true);
    config = (SysSyncIdentityConfigDto) syncConfigService.save(config);
    // 
    // create default mapping for provisioning
    helper.createMapping(system);
    helper.createRoleSystem(defaultRole, system);
    IdmIdentityContractDto validContract = helper.getPrimeContract(identityDto);
    IdmIdentityContractDto validFutureContract = helper.createContract(identityDto, null, LocalDate.now().plusDays(10), null);
    helper.createContract(identityDto, null, null, LocalDate.now().minusDays(1));
    List<IdmIdentityContractDto> contracts = contractService.findAllByIdentity(identityDto.getId());
    Assert.assertEquals(3, contracts.size());
    helper.startSynchronization(config);
    // Have to be in the success state, because default role will be assigned to the valid contracts.
    SysSyncLogDto log = checkSyncLog(config, SynchronizationActionType.LINK, 1, OperationResultType.SUCCESS);
    Assert.assertFalse(log.isRunning());
    Assert.assertFalse(log.isContainsError());
    IdmIdentityDto identity = identityService.get(identityDto);
    List<IdmIdentityRoleDto> roles = identityRoleService.findAllByIdentity(identity.getId());
    Assert.assertEquals(2, roles.size());
    long identityRolesWithDefaultRole = roles.stream().filter(role -> role.getRole().equals(defaultRole.getId())).count();
    Assert.assertEquals(2, identityRolesWithDefaultRole);
    // Valid contract must have default role
    long identityRolesWithValidContract = roles.stream().filter(role -> role.getIdentityContract().equals(validContract.getId())).count();
    Assert.assertEquals(1, identityRolesWithValidContract);
    // Future contract must have default role
    long identityRolesWithFutureContract = roles.stream().filter(role -> role.getIdentityContract().equals(validFutureContract.getId())).count();
    Assert.assertEquals(1, identityRolesWithFutureContract);
    // Check only one identity account is created.
    // Only one identity-account relation can exists, because only one
    // current valid identity-role exists now (the second is future valid).
    AccIdentityAccountFilter accountFilter = new AccIdentityAccountFilter();
    accountFilter.setIdentityId(identity.getId());
    List<AccIdentityAccountDto> identityAccounts = identityAccountService.find(accountFilter, null).getContent();
    // !!!!To delete - Test doesn't pass on the Jenkins, we need to more information
    if (identityAccounts.size() > 1) {
        identityAccounts.forEach(identityAccountDtoOne -> {
            System.out.println("Id - identityAccount: " + identityAccountDtoOne.getId());
            System.out.println("Account: " + identityAccountDtoOne.getAccount());
            System.out.println("RoleSystem: " + identityAccountDtoOne.getRoleSystem());
            System.out.println("Identity: " + identityAccountDtoOne.getIdentity());
            System.out.println("IdentityRole: " + identityAccountDtoOne.getIdentityRole());
            System.out.println("----");
        });
    }
    // !!!
    Assert.assertEquals(1, identityAccounts.size());
    // Delete log
    syncLogService.delete(log);
    syncConfigService.delete(config);
}
Also used : IdmScriptCategory(eu.bcvsolutions.idm.core.api.domain.IdmScriptCategory) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) ZonedDateTime(java.time.ZonedDateTime) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) ConfigurationService(eu.bcvsolutions.idm.core.api.service.ConfigurationService) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) SynchronizationUnlinkedActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationUnlinkedActionType) Task(eu.bcvsolutions.idm.core.scheduler.api.dto.Task) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) AccIdentityAccountDto(eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto) AutomaticRoleAttributeRuleType(eu.bcvsolutions.idm.core.api.domain.AutomaticRoleAttributeRuleType) 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) Page(org.springframework.data.domain.Page) ReconciliationMissingAccountActionType(eu.bcvsolutions.idm.acc.domain.ReconciliationMissingAccountActionType) IdentityState(eu.bcvsolutions.idm.core.api.domain.IdentityState) ZoneId(java.time.ZoneId) Assert.assertFalse(org.junit.Assert.assertFalse) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) SynchronizationSchedulableTaskExecutor(eu.bcvsolutions.idm.acc.scheduler.task.impl.SynchronizationSchedulableTaskExecutor) SynchronizationInactiveOwnerBehaviorType(eu.bcvsolutions.idm.acc.domain.SynchronizationInactiveOwnerBehaviorType) SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) ObserveLongRunningTaskEndProcessor(eu.bcvsolutions.idm.core.scheduler.ObserveLongRunningTaskEndProcessor) IdmFormProjectionService(eu.bcvsolutions.idm.core.eav.api.service.IdmFormProjectionService) SynchronizationLinkedActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationLinkedActionType) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) SysSyncActionLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto) SchedulerConfiguration(eu.bcvsolutions.idm.core.scheduler.api.config.SchedulerConfiguration) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) 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) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) DefaultSynchronizationServiceTest(eu.bcvsolutions.idm.acc.service.impl.DefaultSynchronizationServiceTest) ScriptAuthorityType(eu.bcvsolutions.idm.core.api.domain.ScriptAuthorityType) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) PrivateIdentityConfiguration(eu.bcvsolutions.idm.core.api.config.domain.PrivateIdentityConfiguration) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) AutomaticRoleAttributeRuleComparison(eu.bcvsolutions.idm.core.api.domain.AutomaticRoleAttributeRuleComparison) IdmIdentity_(eu.bcvsolutions.idm.core.model.entity.IdmIdentity_) Assert(org.junit.Assert) SysSyncActionLogService(eu.bcvsolutions.idm.acc.service.api.SysSyncActionLogService) Assert.assertEquals(org.junit.Assert.assertEquals) OperationResultType(eu.bcvsolutions.idm.acc.domain.OperationResultType) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) DependentTaskTrigger(eu.bcvsolutions.idm.core.scheduler.api.dto.DependentTaskTrigger) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) IdmAutomaticRoleAttributeDto(eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) After(org.junit.After) SynchronizationMissingEntityActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationMissingEntityActionType) ProvisioningConfiguration(eu.bcvsolutions.idm.acc.config.domain.ProvisioningConfiguration) SysSyncConfigService(eu.bcvsolutions.idm.acc.service.api.SysSyncConfigService) SysSyncLogService(eu.bcvsolutions.idm.acc.service.api.SysSyncLogService) IdmScriptAuthorityDto(eu.bcvsolutions.idm.core.api.dto.IdmScriptAuthorityDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) IdmFormProjectionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormProjectionDto) UUID(java.util.UUID) SchedulerManager(eu.bcvsolutions.idm.core.scheduler.api.service.SchedulerManager) Lists(com.beust.jcommander.internal.Lists) SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) List(java.util.List) Query(javax.persistence.Query) EventConfiguration(eu.bcvsolutions.idm.core.api.config.domain.EventConfiguration) AccAccountService(eu.bcvsolutions.idm.acc.service.api.AccAccountService) LocalDate(java.time.LocalDate) AccIdentityAccountService(eu.bcvsolutions.idm.acc.service.api.AccIdentityAccountService) AccAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccAccountFilter) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) IdmScriptService(eu.bcvsolutions.idm.core.api.service.IdmScriptService) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) MessageFormat(java.text.MessageFormat) ProcessEngine(org.activiti.engine.ProcessEngine) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) 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) IdmIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) 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) ApplicationContext(org.springframework.context.ApplicationContext) IdmScriptDto(eu.bcvsolutions.idm.core.api.dto.IdmScriptDto) SysSyncItemLogFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncItemLogFilter) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSyncActionLogFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncActionLogFilter) SynchronizationService(eu.bcvsolutions.idm.acc.service.api.SynchronizationService) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSyncItemLogService(eu.bcvsolutions.idm.acc.service.api.SysSyncItemLogService) TestHelper(eu.bcvsolutions.idm.acc.TestHelper) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) IdmScriptAuthorityService(eu.bcvsolutions.idm.core.api.service.IdmScriptAuthorityService) Transactional(org.springframework.transaction.annotation.Transactional) SysSyncItemLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) AccIdentityAccountDto(eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AccIdentityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) 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) DefaultSynchronizationServiceTest(eu.bcvsolutions.idm.acc.service.impl.DefaultSynchronizationServiceTest)

Example 23 with Assert.assertNotNull

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

the class ContractSliceManagerTest method testDeleteEAVOnSlice.

@Test
public void testDeleteEAVOnSlice() {
    IdmIdentityDto identity = helper.createIdentity();
    String contractCode = "contract-one";
    IdmContractSliceDto slice = helper.createContractSlice(identity, null, null, null, null);
    slice.setContractCode(contractCode);
    slice = contractSliceService.save(slice);
    // Init form definition for identity-contract
    IdmFormDefinitionDto definition = this.initIdentityContractFormDefinition();
    // Create slice with EAV values
    IdmFormInstanceDto formInstanceDto = formService.getFormInstance(slice, definition);
    Assert.assertNotNull(formInstanceDto);
    Assert.assertNotNull(formInstanceDto.getFormDefinition());
    Assert.assertEquals(0, formInstanceDto.getValues().size());
    IdmFormAttributeDto attribute = formInstanceDto.getMappedAttributeByCode(NUMBER_OF_FINGERS);
    formService.saveValues(slice, attribute, Lists.newArrayList(BigDecimal.TEN));
    // We need to save slice for invoke save slice to the contract
    slice = contractSliceService.save(slice);
    formInstanceDto = formService.getFormInstance(slice, definition);
    Assert.assertNotNull(formInstanceDto);
    Assert.assertNotNull(formInstanceDto.getFormDefinition());
    Assert.assertEquals(1, formInstanceDto.getValues().size());
    Assert.assertEquals(BigDecimal.TEN.longValue(), ((BigDecimal) formInstanceDto.getValues().get(0).getValue()).longValue());
    IdmContractSliceFilter filter = new IdmContractSliceFilter();
    filter.setIdentity(identity.getId());
    List<IdmContractSliceDto> results = contractSliceService.find(filter, null).getContent();
    assertEquals(1, results.size());
    IdmContractSliceDto createdSlice = results.get(0);
    assertTrue(createdSlice.isValid());
    assertEquals(null, createdSlice.getValidTill());
    // Check created contract by that slice
    IdmIdentityContractFilter contractFilter = new IdmIdentityContractFilter();
    contractFilter.setIdentity(identity.getId());
    List<IdmIdentityContractDto> resultsContract = // 
    contractService.find(filter, null).getContent().stream().filter(// 
    c -> contractService.get(c.getId()).getControlledBySlices()).collect(Collectors.toList());
    // 
    assertEquals(1, resultsContract.size());
    IdmIdentityContractDto contract = resultsContract.get(0);
    assertEquals(slice.getContractValidFrom(), contract.getValidFrom());
    assertEquals(slice.getContractValidTill(), contract.getValidTill());
    assertTrue(contract.isValidNowOrInFuture());
    IdmFormInstanceDto contractFormInstanceDto = formService.getFormInstance(contract);
    Assert.assertNotNull(contractFormInstanceDto);
    Assert.assertNotNull(contractFormInstanceDto.getFormDefinition());
    Assert.assertEquals(1, contractFormInstanceDto.getValues().size());
    Assert.assertEquals(BigDecimal.TEN.longValue(), ((BigDecimal) contractFormInstanceDto.getValues().get(0).getValue()).longValue());
    formService.saveValues(slice, attribute, null);
    // We need to save slice for invoke save slice to the contract
    slice = contractSliceService.save(slice);
    contractFormInstanceDto = formService.getFormInstance(contract);
    Assert.assertNotNull(contractFormInstanceDto);
    Assert.assertNotNull(contractFormInstanceDto.getFormDefinition());
    Assert.assertEquals(0, contractFormInstanceDto.getValues().size());
}
Also used : IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IdmContractSliceGuaranteeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractSliceGuaranteeFilter) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmIdentityContract(eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract) ContractSliceEventType(eu.bcvsolutions.idm.core.model.event.ContractSliceEvent.ContractSliceEventType) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) ClearDirtyStateForContractSliceTaskExecutor(eu.bcvsolutions.idm.core.scheduler.task.impl.ClearDirtyStateForContractSliceTaskExecutor) ConfigurationService(eu.bcvsolutions.idm.core.api.service.ConfigurationService) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) ContractSliceEvent(eu.bcvsolutions.idm.core.model.event.ContractSliceEvent) AutowireHelper(eu.bcvsolutions.idm.core.api.utils.AutowireHelper) BigDecimal(java.math.BigDecimal) Map(java.util.Map) After(org.junit.After) ContractSliceConfiguration(eu.bcvsolutions.idm.core.api.config.domain.ContractSliceConfiguration) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) ImmutableMap(com.google.common.collect.ImmutableMap) IdmEntityStateFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityStateFilter) UUID(java.util.UUID) Page(org.springframework.data.domain.Page) Collectors(java.util.stream.Collectors) IdmEntityStateDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto) SelectCurrentContractSliceTaskExecutor(eu.bcvsolutions.idm.core.scheduler.task.impl.SelectCurrentContractSliceTaskExecutor) List(java.util.List) Assert.assertFalse(org.junit.Assert.assertFalse) LocalDate(java.time.LocalDate) IdmContractSliceFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractSliceFilter) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) IdmContractSliceService(eu.bcvsolutions.idm.core.api.service.IdmContractSliceService) HashMap(java.util.HashMap) IdmContractSliceGuaranteeDto(eu.bcvsolutions.idm.core.api.dto.IdmContractSliceGuaranteeDto) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) IdmContractSliceDto(eu.bcvsolutions.idm.core.api.dto.IdmContractSliceDto) EntityStateManager(eu.bcvsolutions.idm.core.api.service.EntityStateManager) Lists(com.google.common.collect.Lists) OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) TestHelper(eu.bcvsolutions.idm.test.api.TestHelper) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) IdmContractSliceGuaranteeService(eu.bcvsolutions.idm.core.api.service.IdmContractSliceGuaranteeService) IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IdmLongRunningTaskService(eu.bcvsolutions.idm.core.scheduler.api.service.IdmLongRunningTaskService) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Before(org.junit.Before) IdmContractSlice(eu.bcvsolutions.idm.core.model.entity.IdmContractSlice) LongRunningTaskManager(eu.bcvsolutions.idm.core.scheduler.api.service.LongRunningTaskManager) Assert.assertNotNull(org.junit.Assert.assertNotNull) 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) EventContext(eu.bcvsolutions.idm.core.api.event.EventContext) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) Assert.assertNull(org.junit.Assert.assertNull) IdmLongRunningTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) Assert(org.junit.Assert) Assert.assertEquals(org.junit.Assert.assertEquals) ContractSliceManager(eu.bcvsolutions.idm.core.api.service.ContractSliceManager) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmContractSliceFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractSliceFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmContractSliceDto(eu.bcvsolutions.idm.core.api.dto.IdmContractSliceDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 24 with Assert.assertNotNull

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

the class ContractSliceManagerTest method testModifiedEAVOnSlice.

@Test
public void testModifiedEAVOnSlice() {
    IdmIdentityDto identity = helper.createIdentity();
    String contractCode = "contract-one";
    IdmContractSliceDto slice = helper.createContractSlice(identity, null, null, null, null);
    slice.setContractCode(contractCode);
    slice = contractSliceService.save(slice);
    // Init form definition for identity-contract
    IdmFormDefinitionDto definition = this.initIdentityContractFormDefinition();
    // Create slice with EAV values
    IdmFormInstanceDto formInstanceDto = formService.getFormInstance(slice, definition);
    Assert.assertNotNull(formInstanceDto);
    Assert.assertNotNull(formInstanceDto.getFormDefinition());
    Assert.assertEquals(0, formInstanceDto.getValues().size());
    IdmFormAttributeDto attribute = formInstanceDto.getMappedAttributeByCode(NUMBER_OF_FINGERS);
    formService.saveValues(slice, attribute, Lists.newArrayList(BigDecimal.TEN));
    // We need to save slice for invoke save slice to the contract
    slice = contractSliceService.save(slice);
    formInstanceDto = formService.getFormInstance(slice, definition);
    Assert.assertNotNull(formInstanceDto);
    Assert.assertNotNull(formInstanceDto.getFormDefinition());
    Assert.assertEquals(1, formInstanceDto.getValues().size());
    Assert.assertEquals(BigDecimal.TEN.longValue(), ((BigDecimal) formInstanceDto.getValues().get(0).getValue()).longValue());
    formService.saveValues(slice, attribute, Lists.newArrayList(BigDecimal.ONE));
    // We need to save slice for invoke save slice to the contract
    slice = contractSliceService.save(slice);
    IdmContractSliceFilter filter = new IdmContractSliceFilter();
    filter.setIdentity(identity.getId());
    List<IdmContractSliceDto> results = contractSliceService.find(filter, null).getContent();
    assertEquals(1, results.size());
    IdmContractSliceDto createdSlice = results.get(0);
    assertTrue(createdSlice.isValid());
    assertEquals(null, createdSlice.getValidTill());
    // Check created contract by that slice
    IdmIdentityContractFilter contractFilter = new IdmIdentityContractFilter();
    contractFilter.setIdentity(identity.getId());
    List<IdmIdentityContractDto> resultsContract = // 
    contractService.find(filter, null).getContent().stream().filter(// 
    c -> contractService.get(c.getId()).getControlledBySlices()).collect(Collectors.toList());
    // 
    assertEquals(1, resultsContract.size());
    IdmIdentityContractDto contract = resultsContract.get(0);
    assertEquals(slice.getContractValidFrom(), contract.getValidFrom());
    assertEquals(slice.getContractValidTill(), contract.getValidTill());
    assertTrue(contract.isValidNowOrInFuture());
    IdmFormInstanceDto contractFormInstanceDto = formService.getFormInstance(contract);
    Assert.assertNotNull(contractFormInstanceDto);
    Assert.assertNotNull(contractFormInstanceDto.getFormDefinition());
    Assert.assertEquals(1, contractFormInstanceDto.getValues().size());
    Assert.assertEquals(BigDecimal.ONE.longValue(), ((BigDecimal) contractFormInstanceDto.getValues().get(0).getValue()).longValue());
}
Also used : IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IdmContractSliceGuaranteeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractSliceGuaranteeFilter) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmIdentityContract(eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract) ContractSliceEventType(eu.bcvsolutions.idm.core.model.event.ContractSliceEvent.ContractSliceEventType) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) ClearDirtyStateForContractSliceTaskExecutor(eu.bcvsolutions.idm.core.scheduler.task.impl.ClearDirtyStateForContractSliceTaskExecutor) ConfigurationService(eu.bcvsolutions.idm.core.api.service.ConfigurationService) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) ContractSliceEvent(eu.bcvsolutions.idm.core.model.event.ContractSliceEvent) AutowireHelper(eu.bcvsolutions.idm.core.api.utils.AutowireHelper) BigDecimal(java.math.BigDecimal) Map(java.util.Map) After(org.junit.After) ContractSliceConfiguration(eu.bcvsolutions.idm.core.api.config.domain.ContractSliceConfiguration) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) ImmutableMap(com.google.common.collect.ImmutableMap) IdmEntityStateFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityStateFilter) UUID(java.util.UUID) Page(org.springframework.data.domain.Page) Collectors(java.util.stream.Collectors) IdmEntityStateDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto) SelectCurrentContractSliceTaskExecutor(eu.bcvsolutions.idm.core.scheduler.task.impl.SelectCurrentContractSliceTaskExecutor) List(java.util.List) Assert.assertFalse(org.junit.Assert.assertFalse) LocalDate(java.time.LocalDate) IdmContractSliceFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractSliceFilter) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) IdmContractSliceService(eu.bcvsolutions.idm.core.api.service.IdmContractSliceService) HashMap(java.util.HashMap) IdmContractSliceGuaranteeDto(eu.bcvsolutions.idm.core.api.dto.IdmContractSliceGuaranteeDto) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) IdmContractSliceDto(eu.bcvsolutions.idm.core.api.dto.IdmContractSliceDto) EntityStateManager(eu.bcvsolutions.idm.core.api.service.EntityStateManager) Lists(com.google.common.collect.Lists) OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) TestHelper(eu.bcvsolutions.idm.test.api.TestHelper) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) IdmContractSliceGuaranteeService(eu.bcvsolutions.idm.core.api.service.IdmContractSliceGuaranteeService) IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IdmLongRunningTaskService(eu.bcvsolutions.idm.core.scheduler.api.service.IdmLongRunningTaskService) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Before(org.junit.Before) IdmContractSlice(eu.bcvsolutions.idm.core.model.entity.IdmContractSlice) LongRunningTaskManager(eu.bcvsolutions.idm.core.scheduler.api.service.LongRunningTaskManager) Assert.assertNotNull(org.junit.Assert.assertNotNull) 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) EventContext(eu.bcvsolutions.idm.core.api.event.EventContext) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) Assert.assertNull(org.junit.Assert.assertNull) IdmLongRunningTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) Assert(org.junit.Assert) Assert.assertEquals(org.junit.Assert.assertEquals) ContractSliceManager(eu.bcvsolutions.idm.core.api.service.ContractSliceManager) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmContractSliceFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractSliceFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmContractSliceDto(eu.bcvsolutions.idm.core.api.dto.IdmContractSliceDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 25 with Assert.assertNotNull

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

the class IdentityPasswordProvisioningTest method testSendPasswordNotificationProvisioningFailed.

@Test
public void testSendPasswordNotificationProvisioningFailed() {
    SysSystemDto system = initSystem();
    IdmRoleDto role = initRole(system);
    IdmIdentityDto identity = helper.createIdentity();
    // => new password is sent for valid identity only
    identity.setState(IdentityState.VALID);
    identityService.save(identity);
    // Break the system (change the password column to not exists) - we need make a exception.
    IdmFormDefinitionDto savedFormDefinition = systemService.getConnectorFormDefinition(system);
    IdmFormAttributeDto formAttribute = savedFormDefinition.getMappedAttributeByCode("passwordColumn");
    formService.saveValues(system, formAttribute, Lists.newArrayList("not-exist-column-password"));
    IdmIdentityRoleDto identityRole = helper.createIdentityRole(identity, role);
    checkIdentityAccount(identity, identityRole, 1);
    AccAccountDto account = accountService.getAccount(identity.getUsername(), system.getId());
    Assert.assertNotNull(account);
    Assert.assertFalse(account.isInProtection());
    TestResource entityOnSystem = helper.findResource(account.getUid());
    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());
    assertEquals(0, 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) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

List (java.util.List)38 Assert (org.junit.Assert)38 Assert.assertNotNull (org.junit.Assert.assertNotNull)38 Test (org.junit.Test)38 Assert.assertEquals (org.junit.Assert.assertEquals)36 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)28 Autowired (org.springframework.beans.factory.annotation.Autowired)28 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)26 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)25 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)24 FormService (eu.bcvsolutions.idm.core.eav.api.service.FormService)24 Before (org.junit.Before)24 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)23 IdmFormAttributeDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto)23 Assert.assertTrue (org.junit.Assert.assertTrue)23 IdmFormDefinitionDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto)22 LocalDate (java.time.LocalDate)22 Assert.assertNull (org.junit.Assert.assertNull)22 Lists (com.google.common.collect.Lists)21 IdmIdentityRoleService (eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService)20