Search in sources :

Example 1 with TestRoleResource

use of eu.bcvsolutions.idm.acc.entity.TestRoleResource in project CzechIdMng by bcvsolutions.

the class DefaultRoleSynchronizationServiceTest method provisioningD_UpdateAccount_Extended_Attribute.

@Test
public void provisioningD_UpdateAccount_Extended_Attribute() {
    IdmRoleFilter filter = new IdmRoleFilter();
    filter.setProperty(IdmRole_.name.getName());
    filter.setValue(ROLE_NAME_TEN);
    IdmRoleDto roleTen = roleService.find(filter, null).getContent().get(0);
    Assert.assertNotNull(roleTen);
    Assert.assertTrue(formService.getValues(roleTen.getId(), IdmRole.class, "changed").isEmpty());
    // Check state before provisioning
    TestRoleResource ten = entityManager.find(TestRoleResource.class, ROLE_NAME_TEN);
    Assert.assertNotNull(ten);
    Assert.assertEquals(null, ten.getModified());
    // Create extended attribute
    LocalDateTime now = LocalDateTime.now();
    formService.saveValues(roleTen.getId(), IdmRole.class, "changed", ImmutableList.of(now.toString(DATE_TABLE_CONNECTOR_FORMAT)));
    // Save IDM changed node (must invoke provisioning)
    roleService.save(roleTen);
    // Check state after provisioning
    ten = entityManager.find(TestRoleResource.class, ROLE_NAME_TEN);
    Assert.assertNotNull(ten);
    Assert.assertEquals(now.toString(DATE_TABLE_CONNECTOR_FORMAT), ten.getModified().toString(DATE_TABLE_CONNECTOR_FORMAT));
}
Also used : LocalDateTime(org.joda.time.LocalDateTime) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) TestRoleResource(eu.bcvsolutions.idm.acc.entity.TestRoleResource) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 2 with TestRoleResource

use of eu.bcvsolutions.idm.acc.entity.TestRoleResource in project CzechIdMng by bcvsolutions.

the class DefaultRoleSynchronizationServiceTest method createRole.

private TestRoleResource createRole(String code, String type, LocalDateTime changed, int priority) {
    TestRoleResource role = new TestRoleResource();
    role.setType(type);
    role.setName(code);
    role.setPriority(priority);
    role.setModified(changed);
    role.setDescription(code);
    return role;
}
Also used : TestRoleResource(eu.bcvsolutions.idm.acc.entity.TestRoleResource)

Example 3 with TestRoleResource

use of eu.bcvsolutions.idm.acc.entity.TestRoleResource in project CzechIdMng by bcvsolutions.

the class DefaultRoleSynchronizationServiceTest method provisioningA_CreateAccount_withOutMapping.

@Test
@Transactional
public void provisioningA_CreateAccount_withOutMapping() {
    // Delete all resource data
    this.deleteAllResourceData();
    // Create role in IDM tree
    IdmRoleDto roleTen = new IdmRoleDto();
    roleTen.setName(ROLE_NAME_TEN);
    roleTen.setPriority(2);
    roleTen = roleService.save(roleTen);
    // Check state before provisioning
    TestRoleResource one = entityManager.find(TestRoleResource.class, ROLE_NAME_TEN);
    Assert.assertNull(one);
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) TestRoleResource(eu.bcvsolutions.idm.acc.entity.TestRoleResource) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with TestRoleResource

use of eu.bcvsolutions.idm.acc.entity.TestRoleResource in project CzechIdMng by bcvsolutions.

the class DefaultRoleSynchronizationServiceTest method provisioningB_CreateAccounts.

@Test
public void provisioningB_CreateAccounts() {
    IdmRoleFilter filter = new IdmRoleFilter();
    filter.setProperty(IdmRole_.name.getName());
    filter.setValue(ROLE_NAME_TEN);
    IdmRoleDto roleTen = roleService.find(filter, null).getContent().get(0);
    Assert.assertNotNull(roleTen);
    // Check state before provisioning
    TestRoleResource ten = entityManager.find(TestRoleResource.class, ROLE_NAME_TEN);
    Assert.assertNull(ten);
    // Create mapping for provisioning
    this.createProvisionigMapping();
    // Save IDM role (must invoke provisioning)
    roleService.save(roleTen);
    // Check state before provisioning
    ten = entityManager.find(TestRoleResource.class, ROLE_NAME_TEN);
    Assert.assertNotNull(ten);
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) TestRoleResource(eu.bcvsolutions.idm.acc.entity.TestRoleResource) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 5 with TestRoleResource

use of eu.bcvsolutions.idm.acc.entity.TestRoleResource in project CzechIdMng by bcvsolutions.

the class DefaultRoleSynchronizationServiceTest method removeOne.

@Transactional
public void removeOne() {
    TestRoleResource one = entityManager.find(TestRoleResource.class, "1");
    entityManager.remove(one);
}
Also used : TestRoleResource(eu.bcvsolutions.idm.acc.entity.TestRoleResource) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

TestRoleResource (eu.bcvsolutions.idm.acc.entity.TestRoleResource)8 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)5 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)5 Test (org.junit.Test)5 IdmRoleFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter)4 Transactional (org.springframework.transaction.annotation.Transactional)3 LocalDateTime (org.joda.time.LocalDateTime)1