use of eu.bcvsolutions.idm.core.eav.api.domain.PersistentType in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleAttributeServiceIntegrationTest method testNotEqualsIdentityEav.
@Test
public void testNotEqualsIdentityEav() {
String value = "150";
PersistentType persistentType = PersistentType.LONG;
IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.IDENTITY_EAV, persistentType, false);
IdmAutomaticRoleAttributeDto automaticRole = createAutomaticRuleForEav(AutomaticRoleAttributeRuleComparison.NOT_EQUALS, 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(155));
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 testStartWithContractEav.
@Test
public void testStartWithContractEav() {
String value = getHelper().createName();
PersistentType persistentType = PersistentType.SHORTTEXT;
IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.CONTRACT_EAV, persistentType, false);
IdmAutomaticRoleAttributeDto automaticRole = createAutomaticRuleForEav(AutomaticRoleAttributeRuleComparison.START_WITH, AutomaticRoleAttributeRuleType.CONTRACT_EAV, attribute, value);
IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
IdmIdentityContractDto contract = getHelper().getPrimeContract(identity);
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);
saveEavValue(contract, attribute, persistentType, Lists.newArrayList(getHelper().createName()));
recalculateSync(automaticRole.getId());
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
saveEavValue(contract, attribute, persistentType, Lists.newArrayList(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(getHelper().createName() + value));
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 testIsNotEmptyContractEav.
@Test
public void testIsNotEmptyContractEav() {
PersistentType persistentType = PersistentType.SHORTTEXT;
IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.CONTRACT_EAV, persistentType, false);
IdmAutomaticRoleAttributeDto automaticRole = createAutomaticRuleForEav(AutomaticRoleAttributeRuleComparison.IS_NOT_EMPTY, AutomaticRoleAttributeRuleType.CONTRACT_EAV, attribute, null);
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()));
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("00000"));
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);
}
use of eu.bcvsolutions.idm.core.eav.api.domain.PersistentType in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleAttributeServiceIntegrationTest method testEndWithIdentityEav.
@Test
public void testEndWithIdentityEav() {
String value = getHelper().createName();
PersistentType persistentType = PersistentType.SHORTTEXT;
IdmFormAttributeDto attribute = createFormAttribute(AutomaticRoleAttributeRuleType.IDENTITY_EAV, persistentType, false);
IdmAutomaticRoleAttributeDto automaticRole = createAutomaticRuleForEav(AutomaticRoleAttributeRuleComparison.END_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(""));
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
recalculateSync(automaticRole.getId());
checkIdentityRoles(identity, 0);
saveEavValue(identity, attribute, persistentType, Lists.newArrayList(getHelper() + value));
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(value + getHelper()));
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 IdmFormValueDtoUnitTest method testNullValues.
@Test
public void testNullValues() {
for (PersistentType persistentType : PersistentType.values()) {
IdmFormValueDto formValue = new IdmFormValueDto();
formValue.setPersistentType(persistentType);
formValue.setValue(null);
//
Assert.assertNull(formValue.getValue());
Assert.assertTrue(formValue.isEmpty());
Assert.assertTrue(formValue.isNull());
}
}
Aggregations