Search in sources :

Example 26 with PersistentType

use of eu.bcvsolutions.idm.core.eav.api.domain.PersistentType in project CzechIdMng by bcvsolutions.

the class DefaultIdmAutomaticRoleAttributeServiceIntegrationTest method testEqualsBooleanContractEav.

@Test
public void testEqualsBooleanContractEav() {
    String value = Boolean.TRUE.toString();
    PersistentType persistentType = PersistentType.BOOLEAN;
    IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.CONTRACT_EAV, persistentType, false);
    IdmAutomaticRoleAttributeDto automaticRole = createAutomaticRuleForEav(AutomaticRoleAttributeRuleComparison.EQUALS, AutomaticRoleAttributeRuleType.CONTRACT_EAV, attribute, value);
    IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
    IdmIdentityContractDto contract = getHelper().getPrimeContract(identity);
    saveEavValue(contract, attribute, persistentType, Lists.newArrayList(value));
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    saveEavValue(contract, attribute, persistentType, Lists.newArrayList(Boolean.FALSE.toString()));
    checkIdentityRoles(identity, 0);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 0);
}
Also used : PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmAutomaticRoleAttributeDto(eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 27 with PersistentType

use of eu.bcvsolutions.idm.core.eav.api.domain.PersistentType in project CzechIdMng by bcvsolutions.

the class DefaultIdmAutomaticRoleAttributeServiceIntegrationTest method testStartWithIdentityEav.

@Test
public void testStartWithIdentityEav() {
    String value = "150";
    PersistentType persistentType = PersistentType.LONG;
    IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.IDENTITY_EAV, persistentType, false);
    IdmAutomaticRoleAttributeDto automaticRole = createAutomaticRuleForEav(AutomaticRoleAttributeRuleComparison.START_WITH, AutomaticRoleAttributeRuleType.IDENTITY_EAV, attribute, value);
    IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
    checkIdentityRoles(identity, 0);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 0);
    saveEavValue(identity, attribute, persistentType, Lists.newArrayList(value));
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    saveEavValue(identity, attribute, persistentType, Lists.newArrayList(1505));
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
}
Also used : PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmAutomaticRoleAttributeDto(eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 28 with PersistentType

use of eu.bcvsolutions.idm.core.eav.api.domain.PersistentType in project CzechIdMng by bcvsolutions.

the class DefaultIdmAutomaticRoleAttributeServiceIntegrationTest method testContainsContractEav.

@Test
public void testContainsContractEav() {
    String value = getHelper().createName();
    PersistentType persistentType = PersistentType.SHORTTEXT;
    IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.CONTRACT_EAV, persistentType, false);
    IdmAutomaticRoleAttributeDto automaticRole = createAutomaticRuleForEav(AutomaticRoleAttributeRuleComparison.CONTAINS, AutomaticRoleAttributeRuleType.CONTRACT_EAV, attribute, value);
    IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
    IdmIdentityContractDto contract = getHelper().getPrimeContract(identity);
    checkIdentityRoles(identity, 0);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 0);
    saveEavValue(contract, attribute, persistentType, Lists.newArrayList(getHelper().createName() + value));
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    saveEavValue(contract, attribute, persistentType, Lists.newArrayList(""));
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 0);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 0);
    saveEavValue(contract, attribute, persistentType, Lists.newArrayList(getHelper().createName() + value + getHelper().createName()));
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    saveEavValue(contract, attribute, persistentType, Lists.newArrayList());
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 0);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 0);
    saveEavValue(contract, attribute, persistentType, Lists.newArrayList(value));
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
}
Also used : PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmAutomaticRoleAttributeDto(eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 29 with PersistentType

use of eu.bcvsolutions.idm.core.eav.api.domain.PersistentType in project CzechIdMng by bcvsolutions.

the class DefaultIdmAutomaticRoleAttributeServiceIntegrationTest method testNotEndWithContractEav.

@Test
public void testNotEndWithContractEav() {
    String value = getHelper().createName();
    PersistentType persistentType = PersistentType.SHORTTEXT;
    IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.CONTRACT_EAV, persistentType, false);
    IdmAutomaticRoleAttributeDto automaticRole = createAutomaticRuleForEav(AutomaticRoleAttributeRuleComparison.NOT_END_WITH, AutomaticRoleAttributeRuleType.CONTRACT_EAV, attribute, value);
    IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
    IdmIdentityContractDto contract = getHelper().getPrimeContract(identity);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    saveEavValue(contract, attribute, persistentType, Lists.newArrayList(value));
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 0);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 0);
    saveEavValue(contract, attribute, persistentType, Lists.newArrayList(value + "a"));
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    saveEavValue(contract, attribute, persistentType, Lists.newArrayList(getHelper().createName() + value));
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 0);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 0);
    saveEavValue(contract, attribute, persistentType, Lists.newArrayList());
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    saveEavValue(contract, attribute, persistentType, Lists.newArrayList(""));
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    saveEavValue(contract, attribute, persistentType, Lists.newArrayList(value.substring(0, 5)));
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
    recalculateSync(automaticRole.getId());
    checkIdentityRoles(identity, 1);
}
Also used : PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmAutomaticRoleAttributeDto(eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 30 with PersistentType

use of eu.bcvsolutions.idm.core.eav.api.domain.PersistentType in project CzechIdMng by bcvsolutions.

the class DefaultIdmAutomaticRoleAttributeServiceIntegrationTest method testIncompatibleContainsMultivaluedContractEav.

@Test(expected = ResultCodeException.class)
public void testIncompatibleContainsMultivaluedContractEav() {
    String value = getHelper().createName();
    PersistentType persistentType = PersistentType.SHORTTEXT;
    IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.CONTRACT_EAV, persistentType, true);
    createAutomaticRuleForEav(AutomaticRoleAttributeRuleComparison.CONTAINS, AutomaticRoleAttributeRuleType.CONTRACT_EAV, attribute, value);
}
Also used : PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

PersistentType (eu.bcvsolutions.idm.core.eav.api.domain.PersistentType)47 IdmFormAttributeDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto)45 Test (org.junit.Test)44 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)43 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)38 IdmAutomaticRoleAttributeDto (eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto)32 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)32 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)17 AutomaticRoleAttributeRuleComparison (eu.bcvsolutions.idm.core.api.domain.AutomaticRoleAttributeRuleComparison)2 AutomaticRoleAttributeRuleType (eu.bcvsolutions.idm.core.api.domain.AutomaticRoleAttributeRuleType)2 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)2 Transactional (org.springframework.transaction.annotation.Transactional)2 AutomaticRoleAttributeRuleEvent (eu.bcvsolutions.idm.core.model.event.AutomaticRoleAttributeRuleEvent)1 AbstractUnitTest (eu.bcvsolutions.idm.test.api.AbstractUnitTest)1 Serializable (java.io.Serializable)1 BigDecimal (java.math.BigDecimal)1 ZonedDateTime (java.time.ZonedDateTime)1 UUID (java.util.UUID)1 Predicate (javax.persistence.criteria.Predicate)1