Search in sources :

Example 96 with Assert.assertEquals

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

the class DefaultAuthorizationManagerIntegrationTest method testDefaultRoleSubRoles.

@Test
@Transactional
public void testDefaultRoleSubRoles() {
    IdmIdentityDto identity = getHelper().createIdentity();
    // create new default role with two enabled sub roles + one disabled.
    IdmRoleDto defaultRole = getHelper().createRole();
    IdmRoleDto subRoleOne = getHelper().createRole();
    IdmRoleDto subRoleTwo = getHelper().createRole();
    IdmRoleDto role = getHelper().createRole();
    role.setDisabled(true);
    IdmRoleDto disabledSubRole = roleService.save(role);
    getHelper().createRoleComposition(defaultRole, subRoleOne);
    getHelper().createRoleComposition(subRoleOne, subRoleTwo);
    getHelper().createRoleComposition(defaultRole, disabledSubRole);
    // 
    // create distinct authorization policies
    IdmAuthorizationPolicyDto policyDefault = getHelper().createBasePolicy(defaultRole.getId(), CoreGroupPermission.IDENTITY, IdmIdentity.class, IdmBasePermission.CREATE);
    IdmAuthorizationPolicyDto policyOne = getHelper().createBasePolicy(subRoleOne.getId(), CoreGroupPermission.IDENTITY, IdmIdentity.class, IdmBasePermission.UPDATE);
    IdmAuthorizationPolicyDto policyTwo = getHelper().createBasePolicy(subRoleTwo.getId(), CoreGroupPermission.IDENTITY, IdmIdentity.class, IdmBasePermission.READ);
    IdmAuthorizationPolicyDto policyDisabled = getHelper().createBasePolicy(disabledSubRole.getId(), CoreGroupPermission.IDENTITY, IdmIdentity.class, IdmBasePermission.DELETE);
    // 
    getHelper().setConfigurationValue(RoleConfiguration.PROPERTY_DEFAULT_ROLE, defaultRole.getCode());
    // 
    List<IdmAuthorizationPolicyDto> enabledDistinctPolicies = manager.getEnabledDistinctPolicies(identity.getId(), IdmIdentity.class);
    Assert.assertEquals(3, enabledDistinctPolicies.size());
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policyDefault.getId())));
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policyOne.getId())));
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policyTwo.getId())));
    Assert.assertTrue(enabledDistinctPolicies.stream().allMatch(p -> !p.getId().equals(policyDisabled.getId())));
    // 
    Set<String> authorities = manager.getAuthorities(identity.getId(), IdmIdentity.class);
    Assert.assertEquals(3, authorities.size());
    Assert.assertTrue(authorities.stream().anyMatch(a -> a.equals(IdmBasePermission.CREATE.getName())));
    Assert.assertTrue(authorities.stream().anyMatch(a -> a.equals(IdmBasePermission.UPDATE.getName())));
    Assert.assertTrue(authorities.stream().anyMatch(a -> a.equals(IdmBasePermission.READ.getName())));
    Assert.assertTrue(authorities.stream().allMatch(a -> !a.equals(IdmBasePermission.DELETE.getName())));
    // 
    try {
        getHelper().login(identity);
        Set<String> permissions = identityService.getPermissions(identity.getId());
        Assert.assertEquals(3, permissions.size());
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.CREATE.getName())));
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.UPDATE.getName())));
        Assert.assertTrue(permissions.stream().anyMatch(p -> p.equals(IdmBasePermission.READ.getName())));
        Assert.assertTrue(permissions.stream().allMatch(p -> !p.equals(IdmBasePermission.DELETE.getName())));
    } finally {
        logout();
    }
}
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) IdmAuthorizationPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmAuthorizationPolicyDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) Test(org.junit.Test) AbstractEvaluatorIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractEvaluatorIntegrationTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 97 with Assert.assertEquals

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

the class DefaultAuthorizationManagerIntegrationTest method testCacheAfterContractIsChanged.

@Test
@Transactional
@SuppressWarnings({ "rawtypes", "unchecked" })
public void testCacheAfterContractIsChanged() {
    // create and login identity
    IdmIdentityDto identity = getHelper().createIdentity();
    UUID mockIdentity = UUID.randomUUID();
    // prepare role
    IdmRoleDto role = getHelper().createRole();
    getHelper().createBasePolicy(role.getId(), IdmBasePermission.AUTOCOMPLETE, IdmBasePermission.READ);
    getHelper().createIdentityRole(identity, role);
    // 
    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_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<UUID> 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 contract => evict cache of logged identity
        getHelper().createContract(identity);
        // 
        // check cache is evicted only for logged identity
        Assert.assertNotNull(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));
    } finally {
        logout();
    }
}
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) BasePermissionEvaluator(eu.bcvsolutions.idm.core.security.evaluator.BasePermissionEvaluator) List(java.util.List) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) 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 98 with Assert.assertEquals

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

the class DefaultAuthorizationManagerIntegrationTest method testDistictPolicies.

@Test
@Transactional
public void testDistictPolicies() {
    IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
    IdmRoleDto role = getHelper().createRole();
    IdmRoleDto roleTwo = getHelper().createRole();
    IdmAuthorizationPolicyDto policy = getHelper().createBasePolicy(role.getId(), CoreGroupPermission.IDENTITY, IdmIdentity.class, IdmBasePermission.AUTOCOMPLETE, IdmBasePermission.READ);
    getHelper().createIdentityRole(identity, role);
    getHelper().createIdentityRole(identity, role);
    getHelper().createIdentityRole(identity, roleTwo);
    getHelper().createIdentityRole(identity, roleTwo);
    // 
    List<IdmAuthorizationPolicyDto> enabledDistinctPolicies = manager.getEnabledDistinctPolicies(identity.getId(), IdmIdentity.class);
    Assert.assertEquals(1, enabledDistinctPolicies.size());
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policy.getId())));
    // 
    IdmAuthorizationPolicyDto policyTwo = getHelper().createBasePolicy(role.getId(), CoreGroupPermission.IDENTITY, IdmIdentity.class, IdmBasePermission.READ, IdmBasePermission.AUTOCOMPLETE);
    // 
    enabledDistinctPolicies = manager.getEnabledDistinctPolicies(identity.getId(), IdmIdentity.class);
    Assert.assertEquals(1, enabledDistinctPolicies.size());
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policy.getId()) || p.getId().equals(policyTwo.getId())));
    // 
    IdmAuthorizationPolicyDto policyThree = getHelper().createBasePolicy(role.getId(), CoreGroupPermission.IDENTITY, IdmIdentity.class, IdmBasePermission.AUTOCOMPLETE);
    // 
    enabledDistinctPolicies = manager.getEnabledDistinctPolicies(identity.getId(), IdmIdentity.class);
    Assert.assertEquals(2, enabledDistinctPolicies.size());
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policy.getId()) || p.getId().equals(policyTwo.getId())));
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policyThree.getId())));
    // 
    // with parameters
    ConfigurationMap propsFour = new ConfigurationMap();
    propsFour.put("one", "valueOne");
    propsFour.put("two", "valueTwo");
    IdmAuthorizationPolicyDto policyFour = getHelper().createAuthorizationPolicy(roleTwo.getId(), CoreGroupPermission.IDENTITY, IdmIdentity.class, UuidEvaluator.class, propsFour, IdmBasePermission.READ, IdmBasePermission.AUTOCOMPLETE);
    // 
    ConfigurationMap propsFive = new ConfigurationMap();
    propsFive.put("two", "valueTwo");
    propsFive.put("one", "valueOne");
    IdmAuthorizationPolicyDto policyFive = getHelper().createAuthorizationPolicy(roleTwo.getId(), CoreGroupPermission.IDENTITY, IdmIdentity.class, UuidEvaluator.class, propsFive, IdmBasePermission.AUTOCOMPLETE, IdmBasePermission.READ);
    // 
    enabledDistinctPolicies = manager.getEnabledDistinctPolicies(identity.getId(), IdmIdentity.class);
    Assert.assertEquals(3, enabledDistinctPolicies.size());
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policy.getId()) || p.getId().equals(policyTwo.getId())));
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policyThree.getId())));
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policyFour.getId()) || p.getId().equals(policyFive.getId())));
    // 
    ConfigurationMap propsSix = new ConfigurationMap();
    propsSix.put("one", "valueOneU");
    propsSix.put("two", "valueTwo");
    IdmAuthorizationPolicyDto policySix = getHelper().createAuthorizationPolicy(roleTwo.getId(), CoreGroupPermission.IDENTITY, IdmIdentity.class, UuidEvaluator.class, propsSix, IdmBasePermission.AUTOCOMPLETE, IdmBasePermission.READ);
    // 
    ConfigurationMap propsSeven = new ConfigurationMap();
    propsSeven.put("one", "valueOneU");
    propsSeven.put("two", "valueTwo");
    IdmAuthorizationPolicyDto policySeven = getHelper().createAuthorizationPolicy(roleTwo.getId(), CoreGroupPermission.IDENTITY, IdmIdentity.class, UuidEvaluator.class, propsSeven, IdmBasePermission.READ);
    // 
    enabledDistinctPolicies = manager.getEnabledDistinctPolicies(identity.getId(), IdmIdentity.class);
    Assert.assertEquals(5, enabledDistinctPolicies.size());
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policy.getId()) || p.getId().equals(policyTwo.getId())));
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policyThree.getId())));
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policyFour.getId()) || p.getId().equals(policyFive.getId())));
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policySix.getId())));
    Assert.assertTrue(enabledDistinctPolicies.stream().anyMatch(p -> p.getId().equals(policySeven.getId())));
}
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) IdmAuthorizationPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmAuthorizationPolicyDto) ConfigurationMap(eu.bcvsolutions.idm.core.api.domain.ConfigurationMap) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) Test(org.junit.Test) AbstractEvaluatorIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractEvaluatorIntegrationTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 99 with Assert.assertEquals

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

the class DefaultFormServiceIntegrationTest method testMinMaxDateValidation.

@Test
public void testMinMaxDateValidation() {
    ZonedDateTime now = ZonedDateTime.now();
    // prepare form definition a test saving form values
    IdmFormAttributeDto attributeDate = new IdmFormAttributeDto();
    String attributeDateCode = getHelper().createName();
    attributeDate.setCode(attributeDateCode);
    attributeDate.setName(attributeDateCode);
    attributeDate.setPersistentType(PersistentType.DATE);
    attributeDate.setMin(new BigDecimal("3"));
    attributeDate.setMax(new BigDecimal("5"));
    IdmFormAttributeDto attributeDateTime = new IdmFormAttributeDto();
    String attributeDateTimeCode = getHelper().createName();
    attributeDateTime.setCode(attributeDateTimeCode);
    attributeDateTime.setName(attributeDateTimeCode);
    attributeDateTime.setPersistentType(PersistentType.DATETIME);
    attributeDateTime.setMin(new BigDecimal("6"));
    attributeDateTime.setMax(new BigDecimal("8"));
    IdmFormDefinitionDto formDefinitionOne = formService.createDefinition(IdmIdentity.class.getCanonicalName(), getHelper().createName(), Lists.newArrayList(attributeDate, attributeDateTime));
    attributeDate = formDefinitionOne.getMappedAttributeByCode(attributeDate.getCode());
    attributeDateTime = formDefinitionOne.getMappedAttributeByCode(attributeDateTime.getCode());
    // 
    IdmFormValueDto valueDate = new IdmFormValueDto(attributeDate);
    IdmFormValueDto valueDateTime = new IdmFormValueDto(attributeDateTime);
    // 
    IdmFormInstanceDto formInstance = new IdmFormInstanceDto();
    formInstance.setFormDefinition(formDefinitionOne);
    formInstance.setValues(Lists.newArrayList(valueDate, valueDateTime));
    // 
    List<InvalidFormAttributeDto> validationErrors = formService.validate(formInstance);
    // 
    Assert.assertTrue(validationErrors.isEmpty());
    // 
    valueDate.setDateValue(now.plusDays(2));
    valueDateTime.setDateValue(now.plusDays(5));
    // 
    validationErrors = formService.validate(formInstance);
    Assert.assertEquals(2, validationErrors.size());
    Assert.assertTrue(validationErrors.stream().allMatch(e -> e.getMinValue() != null));
    Assert.assertTrue(validationErrors.stream().anyMatch(e -> e.getMinValue().equals(new BigDecimal("3")) && e.getAttributeCode().equals(attributeDateCode)));
    Assert.assertTrue(validationErrors.stream().anyMatch(e -> e.getMinValue().equals(new BigDecimal("6")) && e.getAttributeCode().equals(attributeDateTimeCode)));
    // 
    valueDate.setDateValue(now.plusDays(6));
    valueDateTime.setDateValue(now.plusDays(9));
    // 
    validationErrors = formService.validate(formInstance);
    Assert.assertEquals(2, validationErrors.size());
    Assert.assertTrue(validationErrors.stream().allMatch(e -> e.getMaxValue() != null));
    Assert.assertTrue(validationErrors.stream().anyMatch(e -> e.getMaxValue().equals(new BigDecimal("5")) && e.getAttributeCode().equals(attributeDateCode)));
    Assert.assertTrue(validationErrors.stream().anyMatch(e -> e.getMaxValue().equals(new BigDecimal("8")) && e.getAttributeCode().equals(attributeDateTimeCode)));
    // 
    valueDate.setDateValue(now.plusDays(5));
    valueDateTime.setDateValue(now.plusDays(8));
    // 
    validationErrors = formService.validate(formInstance);
    Assert.assertTrue(validationErrors.isEmpty());
    // 
    valueDate.setDateValue(now.plusDays(3));
    valueDateTime.setDateValue(now.plusDays(6).plusMinutes(2));
    // 
    validationErrors = formService.validate(formInstance);
    Assert.assertTrue(validationErrors.isEmpty());
}
Also used : IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IdmEntityEventDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto) ZonedDateTime(java.time.ZonedDateTime) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmIdentityContract(eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) FormDefinitionCache(eu.bcvsolutions.idm.core.eav.api.domain.FormDefinitionCache) IdmRoleFormValue_(eu.bcvsolutions.idm.core.model.entity.eav.IdmRoleFormValue_) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) BigDecimal(java.math.BigDecimal) CoreEvent(eu.bcvsolutions.idm.core.api.event.CoreEvent) CoreGroupPermission(eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) Predicate(javax.persistence.criteria.Predicate) IdmFormDefinition(eu.bcvsolutions.idm.core.eav.entity.IdmFormDefinition) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) Map(java.util.Map) ChangePersistentTypeException(eu.bcvsolutions.idm.core.eav.api.exception.ChangePersistentTypeException) IdmIdentityFormValue(eu.bcvsolutions.idm.core.model.entity.eav.IdmIdentityFormValue) CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) IdmFormAttributeService(eu.bcvsolutions.idm.core.eav.api.service.IdmFormAttributeService) IdentityEventType(eu.bcvsolutions.idm.core.model.event.IdentityEvent.IdentityEventType) Sort(org.springframework.data.domain.Sort) CriteriaQuery(javax.persistence.criteria.CriteriaQuery) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) AbstractEntity(eu.bcvsolutions.idm.core.api.entity.AbstractEntity) PageRequest(org.springframework.data.domain.PageRequest) UUID(java.util.UUID) IdmRoleRepository(eu.bcvsolutions.idm.core.model.repository.IdmRoleRepository) Page(org.springframework.data.domain.Page) PriorityType(eu.bcvsolutions.idm.core.api.domain.PriorityType) Serializable(java.io.Serializable) ChangeConfidentialException(eu.bcvsolutions.idm.core.eav.api.exception.ChangeConfidentialException) List(java.util.List) EventConfiguration(eu.bcvsolutions.idm.core.api.config.domain.EventConfiguration) IdmFormAttribute(eu.bcvsolutions.idm.core.eav.entity.IdmFormAttribute) Specification(org.springframework.data.jpa.domain.Specification) Identifiable(eu.bcvsolutions.idm.core.api.domain.Identifiable) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) FormableDto(eu.bcvsolutions.idm.core.api.dto.FormableDto) IdmFormAttribute_(eu.bcvsolutions.idm.core.eav.entity.IdmFormAttribute_) IdmRole(eu.bcvsolutions.idm.core.model.entity.IdmRole) IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) ArrayList(java.util.ArrayList) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) IdmFormValueFilter(eu.bcvsolutions.idm.core.eav.api.dto.filter.IdmFormValueFilter) AbstractDto(eu.bcvsolutions.idm.core.api.dto.AbstractDto) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) Lists(com.google.common.collect.Lists) LookupService(eu.bcvsolutions.idm.core.api.service.LookupService) AbstractFormValueEvaluator(eu.bcvsolutions.idm.core.security.evaluator.eav.AbstractFormValueEvaluator) CoreModuleDescriptor(eu.bcvsolutions.idm.core.CoreModuleDescriptor) DefaultFormableFilter(eu.bcvsolutions.idm.core.api.dto.filter.DefaultFormableFilter) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Direction(org.springframework.data.domain.Sort.Direction) IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Root(javax.persistence.criteria.Root) Before(org.junit.Before) IdentityFormValueEvaluator(eu.bcvsolutions.idm.core.security.evaluator.eav.IdentityFormValueEvaluator) Assert.assertNotNull(org.junit.Assert.assertNotNull) AttachmentManager(eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmEntityEventFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityEventFilter) IdmCacheManager(eu.bcvsolutions.idm.core.api.service.IdmCacheManager) IdmRoleFormValue(eu.bcvsolutions.idm.core.model.entity.eav.IdmRoleFormValue) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) ApplicationContext(org.springframework.context.ApplicationContext) ConfigurationMap(eu.bcvsolutions.idm.core.api.domain.ConfigurationMap) InitDemoDataProcessor(eu.bcvsolutions.idm.core.model.event.processor.module.InitDemoDataProcessor) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmTreeNode(eu.bcvsolutions.idm.core.model.entity.IdmTreeNode) IdmEntityEventService(eu.bcvsolutions.idm.core.api.service.IdmEntityEventService) Assert.assertNull(org.junit.Assert.assertNull) ChronoUnit(java.time.temporal.ChronoUnit) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) FormValueService(eu.bcvsolutions.idm.core.eav.api.service.FormValueService) IdmFormDefinitionService(eu.bcvsolutions.idm.core.eav.api.service.IdmFormDefinitionService) IdmEntityEvent_(eu.bcvsolutions.idm.core.model.entity.IdmEntityEvent_) CoreEventType(eu.bcvsolutions.idm.core.api.event.CoreEvent.CoreEventType) AbstractFormableService(eu.bcvsolutions.idm.core.eav.api.service.AbstractFormableService) Subquery(javax.persistence.criteria.Subquery) Assert(org.junit.Assert) FormAttributeValidateProcessor(eu.bcvsolutions.idm.core.eav.processor.FormAttributeValidateProcessor) Assert.assertEquals(org.junit.Assert.assertEquals) EntityEventManager(eu.bcvsolutions.idm.core.api.service.EntityEventManager) Transactional(org.springframework.transaction.annotation.Transactional) FormDefinitionAttributes(eu.bcvsolutions.idm.core.eav.api.dto.FormDefinitionAttributes) InvalidFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.InvalidFormAttributeDto) ZonedDateTime(java.time.ZonedDateTime) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) InvalidFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.InvalidFormAttributeDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) BigDecimal(java.math.BigDecimal) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 100 with Assert.assertEquals

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

the class DefaultFormServiceIntegrationTest method testUniqueValidation.

@Test
public void testUniqueValidation() {
    // prepare form definition a test saving form values
    IdmFormAttributeDto attribute = new IdmFormAttributeDto();
    String attributeName = getHelper().createName();
    attribute.setCode(attributeName);
    attribute.setName(attributeName);
    attribute.setPersistentType(PersistentType.TEXT);
    attribute.setUnique(Boolean.TRUE);
    IdmFormDefinitionDto formDefinitionOne = formService.createDefinition(IdmIdentity.class.getCanonicalName(), getHelper().createName(), Lists.newArrayList(attribute));
    attribute = formDefinitionOne.getMappedAttributeByCode(attribute.getCode());
    // 
    IdmIdentityDto owner = getHelper().createIdentity((GuardedString) null);
    IdmFormValueDto value = new IdmFormValueDto(attribute);
    value.setValue("one");
    // 
    IdmFormInstanceDto formInstance = new IdmFormInstanceDto(owner, formDefinitionOne, Lists.newArrayList(value));
    // 
    List<InvalidFormAttributeDto> validationErrors = formService.validate(formInstance);
    Assert.assertTrue(validationErrors.isEmpty());
    // 
    IdmFormInstanceDto savedFormInstance = formService.saveFormInstance(owner, formDefinitionOne, Lists.newArrayList(value));
    IdmFormValueDto savedValue = savedFormInstance.toValueMap().get(attributeName).get(0);
    // 
    validationErrors = formService.validate(formInstance);
    Assert.assertEquals(1, validationErrors.size());
    Assert.assertTrue(validationErrors.stream().allMatch(e -> e.getUniqueValue().equals("one")));
    // 
    value.setId(savedValue.getId());
    validationErrors = formService.validate(formInstance);
    Assert.assertTrue(validationErrors.isEmpty());
    // 
    value.setId(UUID.randomUUID());
    validationErrors = formService.validate(formInstance);
    Assert.assertEquals(1, validationErrors.size());
    Assert.assertTrue(validationErrors.stream().allMatch(e -> e.getUniqueValue().equals("one")));
}
Also used : IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IdmEntityEventDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto) ZonedDateTime(java.time.ZonedDateTime) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmIdentityContract(eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) FormDefinitionCache(eu.bcvsolutions.idm.core.eav.api.domain.FormDefinitionCache) IdmRoleFormValue_(eu.bcvsolutions.idm.core.model.entity.eav.IdmRoleFormValue_) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) BigDecimal(java.math.BigDecimal) CoreEvent(eu.bcvsolutions.idm.core.api.event.CoreEvent) CoreGroupPermission(eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) Predicate(javax.persistence.criteria.Predicate) IdmFormDefinition(eu.bcvsolutions.idm.core.eav.entity.IdmFormDefinition) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) Map(java.util.Map) ChangePersistentTypeException(eu.bcvsolutions.idm.core.eav.api.exception.ChangePersistentTypeException) IdmIdentityFormValue(eu.bcvsolutions.idm.core.model.entity.eav.IdmIdentityFormValue) CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) IdmFormAttributeService(eu.bcvsolutions.idm.core.eav.api.service.IdmFormAttributeService) IdentityEventType(eu.bcvsolutions.idm.core.model.event.IdentityEvent.IdentityEventType) Sort(org.springframework.data.domain.Sort) CriteriaQuery(javax.persistence.criteria.CriteriaQuery) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) AbstractEntity(eu.bcvsolutions.idm.core.api.entity.AbstractEntity) PageRequest(org.springframework.data.domain.PageRequest) UUID(java.util.UUID) IdmRoleRepository(eu.bcvsolutions.idm.core.model.repository.IdmRoleRepository) Page(org.springframework.data.domain.Page) PriorityType(eu.bcvsolutions.idm.core.api.domain.PriorityType) Serializable(java.io.Serializable) ChangeConfidentialException(eu.bcvsolutions.idm.core.eav.api.exception.ChangeConfidentialException) List(java.util.List) EventConfiguration(eu.bcvsolutions.idm.core.api.config.domain.EventConfiguration) IdmFormAttribute(eu.bcvsolutions.idm.core.eav.entity.IdmFormAttribute) Specification(org.springframework.data.jpa.domain.Specification) Identifiable(eu.bcvsolutions.idm.core.api.domain.Identifiable) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) FormableDto(eu.bcvsolutions.idm.core.api.dto.FormableDto) IdmFormAttribute_(eu.bcvsolutions.idm.core.eav.entity.IdmFormAttribute_) IdmRole(eu.bcvsolutions.idm.core.model.entity.IdmRole) IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) ArrayList(java.util.ArrayList) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) IdmFormValueFilter(eu.bcvsolutions.idm.core.eav.api.dto.filter.IdmFormValueFilter) AbstractDto(eu.bcvsolutions.idm.core.api.dto.AbstractDto) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) Lists(com.google.common.collect.Lists) LookupService(eu.bcvsolutions.idm.core.api.service.LookupService) AbstractFormValueEvaluator(eu.bcvsolutions.idm.core.security.evaluator.eav.AbstractFormValueEvaluator) CoreModuleDescriptor(eu.bcvsolutions.idm.core.CoreModuleDescriptor) DefaultFormableFilter(eu.bcvsolutions.idm.core.api.dto.filter.DefaultFormableFilter) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Direction(org.springframework.data.domain.Sort.Direction) IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Root(javax.persistence.criteria.Root) Before(org.junit.Before) IdentityFormValueEvaluator(eu.bcvsolutions.idm.core.security.evaluator.eav.IdentityFormValueEvaluator) Assert.assertNotNull(org.junit.Assert.assertNotNull) AttachmentManager(eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmEntityEventFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityEventFilter) IdmCacheManager(eu.bcvsolutions.idm.core.api.service.IdmCacheManager) IdmRoleFormValue(eu.bcvsolutions.idm.core.model.entity.eav.IdmRoleFormValue) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) ApplicationContext(org.springframework.context.ApplicationContext) ConfigurationMap(eu.bcvsolutions.idm.core.api.domain.ConfigurationMap) InitDemoDataProcessor(eu.bcvsolutions.idm.core.model.event.processor.module.InitDemoDataProcessor) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmTreeNode(eu.bcvsolutions.idm.core.model.entity.IdmTreeNode) IdmEntityEventService(eu.bcvsolutions.idm.core.api.service.IdmEntityEventService) Assert.assertNull(org.junit.Assert.assertNull) ChronoUnit(java.time.temporal.ChronoUnit) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) FormValueService(eu.bcvsolutions.idm.core.eav.api.service.FormValueService) IdmFormDefinitionService(eu.bcvsolutions.idm.core.eav.api.service.IdmFormDefinitionService) IdmEntityEvent_(eu.bcvsolutions.idm.core.model.entity.IdmEntityEvent_) CoreEventType(eu.bcvsolutions.idm.core.api.event.CoreEvent.CoreEventType) AbstractFormableService(eu.bcvsolutions.idm.core.eav.api.service.AbstractFormableService) Subquery(javax.persistence.criteria.Subquery) Assert(org.junit.Assert) FormAttributeValidateProcessor(eu.bcvsolutions.idm.core.eav.processor.FormAttributeValidateProcessor) Assert.assertEquals(org.junit.Assert.assertEquals) EntityEventManager(eu.bcvsolutions.idm.core.api.service.EntityEventManager) Transactional(org.springframework.transaction.annotation.Transactional) FormDefinitionAttributes(eu.bcvsolutions.idm.core.eav.api.dto.FormDefinitionAttributes) InvalidFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.InvalidFormAttributeDto) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) InvalidFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.InvalidFormAttributeDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) 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