use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleAttributeIntegrationTest method testAutomaticRoleDateTimeEav.
@Test
public void testAutomaticRoleDateTimeEav() {
DateTime testValue = new DateTime(System.currentTimeMillis());
IdmIdentityDto identity = testHelper.createIdentity();
//
IdmFormAttributeDto createEavAttribute = testHelper.createEavAttribute("testingEav" + System.currentTimeMillis(), IdmIdentity.class, PersistentType.DATETIME);
//
IdmRoleDto role = testHelper.createRole();
IdmAutomaticRoleAttributeDto automaticRole = testHelper.createAutomaticRole(role.getId());
testHelper.createAutomaticRoleRule(automaticRole.getId(), AutomaticRoleAttributeRuleComparison.EQUALS, AutomaticRoleAttributeRuleType.IDENTITY_EAV, null, createEavAttribute.getId(), testValue.toString());
//
List<IdmIdentityRoleDto> identityRoles = identityRoleService.findAllByIdentity(identity.getId());
assertEquals(0, identityRoles.size());
//
// change eav value
testHelper.setEavValue(identity, createEavAttribute, IdmIdentity.class, testValue, PersistentType.DATETIME);
//
identityRoles = identityRoleService.findAllByIdentity(identity.getId());
assertEquals(1, identityRoles.size());
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleAttributeIntegrationTest method testTextTypeInEav.
@Test(expected = ResultCodeException.class)
public void testTextTypeInEav() {
String testValue = "123!@#" + System.currentTimeMillis();
IdmIdentityDto identity = testHelper.createIdentity();
//
IdmFormAttributeDto createEavAttribute = testHelper.createEavAttribute("testingEav" + System.currentTimeMillis(), IdmIdentity.class, PersistentType.TEXT);
testHelper.setEavValue(identity, createEavAttribute, IdmIdentity.class, testValue, PersistentType.TEXT);
//
//
IdmRoleDto role = testHelper.createRole();
IdmAutomaticRoleAttributeDto automaticRole = testHelper.createAutomaticRole(role.getId());
testHelper.createAutomaticRoleRule(automaticRole.getId(), AutomaticRoleAttributeRuleComparison.EQUALS, AutomaticRoleAttributeRuleType.IDENTITY_EAV, null, createEavAttribute.getId(), testValue);
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleAttributeIntegrationTest method testAutomaticRoleDateEav.
@Test
public void testAutomaticRoleDateEav() {
DateTime testValue = new DateTime(1514764800);
IdmIdentityDto identity = testHelper.createIdentity();
//
IdmFormAttributeDto createEavAttribute = testHelper.createEavAttribute("testingEav" + System.currentTimeMillis(), IdmIdentity.class, PersistentType.DATE);
//
IdmRoleDto role = testHelper.createRole();
IdmAutomaticRoleAttributeDto automaticRole = testHelper.createAutomaticRole(role.getId());
testHelper.createAutomaticRoleRule(automaticRole.getId(), AutomaticRoleAttributeRuleComparison.EQUALS, AutomaticRoleAttributeRuleType.IDENTITY_EAV, null, createEavAttribute.getId(), testValue.toString());
//
List<IdmIdentityRoleDto> identityRoles = identityRoleService.findAllByIdentity(identity.getId());
assertEquals(0, identityRoles.size());
//
// change eav value
testHelper.setEavValue(identity, createEavAttribute, IdmIdentity.class, testValue, PersistentType.DATE);
//
identityRoles = identityRoleService.findAllByIdentity(identity.getId());
assertEquals(1, identityRoles.size());
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleAttributeIntegrationTest method testAutomaticRoleBooleanEav.
@Test
public void testAutomaticRoleBooleanEav() {
Boolean testValue = true;
IdmIdentityDto identity = testHelper.createIdentity();
//
IdmFormAttributeDto createEavAttribute = testHelper.createEavAttribute("testingEav" + System.currentTimeMillis(), IdmIdentity.class, PersistentType.BOOLEAN);
//
IdmRoleDto role = testHelper.createRole();
IdmAutomaticRoleAttributeDto automaticRole = testHelper.createAutomaticRole(role.getId());
testHelper.createAutomaticRoleRule(automaticRole.getId(), AutomaticRoleAttributeRuleComparison.EQUALS, AutomaticRoleAttributeRuleType.IDENTITY_EAV, null, createEavAttribute.getId(), testValue.toString());
//
List<IdmIdentityRoleDto> identityRoles = identityRoleService.findAllByIdentity(identity.getId());
assertEquals(0, identityRoles.size());
//
// change eav value
testHelper.setEavValue(identity, createEavAttribute, IdmIdentity.class, testValue, PersistentType.BOOLEAN);
//
identityRoles = identityRoleService.findAllByIdentity(identity.getId());
assertEquals(1, identityRoles.size());
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleAttributeIntegrationTest method testAutomaticRoleIntegerEav.
@Test
public void testAutomaticRoleIntegerEav() {
Integer testValue = 123456;
IdmIdentityDto identity = testHelper.createIdentity();
//
IdmFormAttributeDto createEavAttribute = testHelper.createEavAttribute("testingEav" + System.currentTimeMillis(), IdmIdentity.class, PersistentType.INT);
//
IdmRoleDto role = testHelper.createRole();
IdmAutomaticRoleAttributeDto automaticRole = testHelper.createAutomaticRole(role.getId());
testHelper.createAutomaticRoleRule(automaticRole.getId(), AutomaticRoleAttributeRuleComparison.EQUALS, AutomaticRoleAttributeRuleType.IDENTITY_EAV, null, createEavAttribute.getId(), testValue.toString());
//
List<IdmIdentityRoleDto> identityRoles = identityRoleService.findAllByIdentity(identity.getId());
assertEquals(0, identityRoles.size());
//
// change eav value
testHelper.setEavValue(identity, createEavAttribute, IdmIdentity.class, testValue, PersistentType.INT);
//
identityRoles = identityRoleService.findAllByIdentity(identity.getId());
assertEquals(1, identityRoles.size());
}
Aggregations