use of eu.bcvsolutions.idm.core.eav.api.domain.PersistentType in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleAttributeServiceIntegrationTest method testEndWithContractEav.
@Test
public void testEndWithContractEav() {
String value = getHelper().createName();
PersistentType persistentType = PersistentType.SHORTTEXT;
IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.CONTRACT_EAV, persistentType, false);
IdmAutomaticRoleAttributeDto automaticRole = createAutomaticRuleForEav(AutomaticRoleAttributeRuleComparison.END_WITH, 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(value));
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
saveEavValue(contract, attribute, persistentType, Lists.newArrayList(value + "a"));
recalculateSync(automaticRole.getId());
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(value.substring(0, 5)));
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
}
use of eu.bcvsolutions.idm.core.eav.api.domain.PersistentType in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleAttributeServiceIntegrationTest method testEqualsMultivaluedContractEav.
@Test
public void testEqualsMultivaluedContractEav() {
String value = getHelper().createName();
PersistentType persistentType = PersistentType.SHORTTEXT;
IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.CONTRACT_EAV, persistentType, true);
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(getHelper().createName()));
checkIdentityRoles(identity, 0);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
saveEavValue(contract, attribute, persistentType, Lists.newArrayList(getHelper().createName(), getHelper().createName(), value, getHelper().createName()));
checkIdentityRoles(identity, 1);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
}
use of eu.bcvsolutions.idm.core.eav.api.domain.PersistentType in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleAttributeServiceIntegrationTest method testNotEndWithIdentityEav.
@Test
public void testNotEndWithIdentityEav() {
String value = getHelper().createName();
PersistentType persistentType = PersistentType.SHORTTEXT;
IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.IDENTITY_EAV, persistentType, false);
IdmAutomaticRoleAttributeDto automaticRole = createAutomaticRuleForEav(AutomaticRoleAttributeRuleComparison.NOT_END_WITH, AutomaticRoleAttributeRuleType.IDENTITY_EAV, attribute, value);
IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
saveEavValue(identity, attribute, persistentType, Lists.newArrayList(value));
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
saveEavValue(identity, attribute, persistentType, Lists.newArrayList(""));
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
saveEavValue(identity, attribute, persistentType, Lists.newArrayList(getHelper() + value));
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
saveEavValue(identity, attribute, persistentType, Lists.newArrayList());
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
saveEavValue(identity, attribute, persistentType, Lists.newArrayList(value + getHelper()));
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
}
use of eu.bcvsolutions.idm.core.eav.api.domain.PersistentType in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleAttributeServiceIntegrationTest method testContainsIdentityEav.
@Test
public void testContainsIdentityEav() {
String value = "666";
PersistentType persistentType = PersistentType.LONG;
IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.IDENTITY_EAV, persistentType, false);
IdmAutomaticRoleAttributeDto automaticRole = createAutomaticRuleForEav(AutomaticRoleAttributeRuleComparison.CONTAINS, 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(666));
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
saveEavValue(identity, attribute, persistentType, Lists.newArrayList());
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
saveEavValue(identity, attribute, persistentType, Lists.newArrayList(123666123));
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
saveEavValue(identity, attribute, persistentType, Lists.newArrayList(1666));
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
saveEavValue(identity, attribute, persistentType, Lists.newArrayList(123));
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
saveEavValue(identity, attribute, persistentType, Lists.newArrayList(6662));
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 1);
}
use of eu.bcvsolutions.idm.core.eav.api.domain.PersistentType in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleAttributeServiceIntegrationTest method testGreaterAndLessSameContractEav.
@Test
public void testGreaterAndLessSameContractEav() {
String valueOne = "5";
String valueTwo = "5";
PersistentType persistentType = PersistentType.LONG;
IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.CONTRACT_EAV, persistentType, false);
IdmAutomaticRoleAttributeDto automaticRole = createAutomaticRuleForEav(AutomaticRoleAttributeRuleComparison.GREATER_THAN_OR_EQUAL, AutomaticRoleAttributeRuleType.CONTRACT_EAV, attribute, valueOne);
createAutomaticRuleForEav(automaticRole, AutomaticRoleAttributeRuleComparison.LESS_THAN_OR_EQUAL, AutomaticRoleAttributeRuleType.CONTRACT_EAV, attribute, valueTwo);
IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
IdmIdentityContractDto contract = getHelper().getPrimeContract(identity);
checkIdentityRoles(identity, 0);
recalculateAllSync(automaticRole);
checkIdentityRoles(identity, 0);
saveEavValue(contract, attribute, persistentType, Lists.newArrayList(5));
recalculateAllSync(automaticRole);
checkIdentityRoles(identity, 1);
recalculateAllSync(automaticRole);
checkIdentityRoles(identity, 1);
saveEavValue(contract, attribute, persistentType, Lists.newArrayList(2));
recalculateAllSync(automaticRole);
checkIdentityRoles(identity, 0);
recalculateAllSync(automaticRole);
checkIdentityRoles(identity, 0);
saveEavValue(contract, attribute, persistentType, Lists.newArrayList(6));
recalculateAllSync(automaticRole);
checkIdentityRoles(identity, 0);
recalculateAllSync(automaticRole);
checkIdentityRoles(identity, 0);
saveEavValue(contract, attribute, persistentType, Lists.newArrayList());
recalculateAllSync(automaticRole);
checkIdentityRoles(identity, 0);
recalculateAllSync(automaticRole);
checkIdentityRoles(identity, 0);
}
Aggregations