Search in sources :

Example 1 with RoleCodeEnvironmentProcessor

use of eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor in project CzechIdMng by bcvsolutions.

the class DefaultIdmRoleServiceUnitTest method testCreateSuccessWithNameOnly.

@Test
public void testCreateSuccessWithNameOnly() {
    IdmRoleDto role = new IdmRoleDto();
    role.setName("code");
    // 
    RoleCodeEnvironmentProcessor roleCodeEnvironmentProcessor = new RoleCodeEnvironmentProcessor(service);
    IdmRoleDto content = roleCodeEnvironmentProcessor.process(new CoreEvent<IdmRoleDto>(CoreEventType.CREATE, role)).getEvent().getContent();
    // 
    Assert.assertEquals("code", content.getCode());
    Assert.assertEquals("code", content.getBaseCode());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) RoleCodeEnvironmentProcessor(eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

Example 2 with RoleCodeEnvironmentProcessor

use of eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor in project CzechIdMng by bcvsolutions.

the class DefaultIdmRoleServiceUnitTest method testUpdateRoleWitCodeAndEnvironmentConflict.

@Test(expected = ResultCodeException.class)
public void testUpdateRoleWitCodeAndEnvironmentConflict() {
    IdmRoleDto role = new IdmRoleDto();
    role.setCode("code" + RoleConfiguration.DEFAULT_CODE_ENVIRONMENT_SEPARATOR + "env");
    role.setBaseCode("code");
    role.setEnvironment("env");
    // 
    IdmRoleDto roleUpdate = new IdmRoleDto();
    roleUpdate.setCode("code" + RoleConfiguration.DEFAULT_CODE_ENVIRONMENT_SEPARATOR + "env2");
    roleUpdate.setBaseCode("code");
    roleUpdate.setEnvironment("env2");
    // 
    RoleCodeEnvironmentProcessor roleCodeEnvironmentProcessor = new RoleCodeEnvironmentProcessor(service);
    CoreEvent<IdmRoleDto> updateEvent = new CoreEvent<IdmRoleDto>(CoreEventType.UPDATE, roleUpdate);
    updateEvent.setOriginalSource(role);
    roleCodeEnvironmentProcessor.process(updateEvent);
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) CoreEvent(eu.bcvsolutions.idm.core.api.event.CoreEvent) RoleCodeEnvironmentProcessor(eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

Example 3 with RoleCodeEnvironmentProcessor

use of eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor in project CzechIdMng by bcvsolutions.

the class DefaultIdmRoleServiceUnitTest method testCreateRoleWitCodeAndEnvironmentConflict.

@Test(expected = ResultCodeException.class)
public void testCreateRoleWitCodeAndEnvironmentConflict() {
    when(roleConfiguration.getCodeEnvironmentSeperator()).thenReturn(RoleConfiguration.DEFAULT_CODE_ENVIRONMENT_SEPARATOR);
    // 
    IdmRoleDto role = new IdmRoleDto();
    role.setCode("code");
    role.setBaseCode("code");
    role.setEnvironment("env");
    // 
    RoleCodeEnvironmentProcessor roleCodeEnvironmentProcessor = new RoleCodeEnvironmentProcessor(service);
    roleCodeEnvironmentProcessor.process(new CoreEvent<IdmRoleDto>(CoreEventType.CREATE, role));
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) RoleCodeEnvironmentProcessor(eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

Example 4 with RoleCodeEnvironmentProcessor

use of eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor in project CzechIdMng by bcvsolutions.

the class DefaultIdmRoleServiceUnitTest method testCreateSuccessWithCodeOnly.

@Test
public void testCreateSuccessWithCodeOnly() {
    IdmRoleDto role = new IdmRoleDto();
    role.setCode("code");
    // 
    RoleCodeEnvironmentProcessor roleCodeEnvironmentProcessor = new RoleCodeEnvironmentProcessor(service);
    IdmRoleDto content = roleCodeEnvironmentProcessor.process(new CoreEvent<IdmRoleDto>(CoreEventType.CREATE, role)).getEvent().getContent();
    // 
    Assert.assertEquals("code", content.getCode());
    Assert.assertEquals("code", content.getBaseCode());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) RoleCodeEnvironmentProcessor(eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

Example 5 with RoleCodeEnvironmentProcessor

use of eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor in project CzechIdMng by bcvsolutions.

the class DefaultIdmRoleServiceUnitTest method testCreateSuccessWithEnvironment.

@Test
public void testCreateSuccessWithEnvironment() {
    when(roleConfiguration.getCodeEnvironmentSeperator()).thenReturn(RoleConfiguration.DEFAULT_CODE_ENVIRONMENT_SEPARATOR);
    // 
    IdmRoleDto role = new IdmRoleDto();
    role.setCode("code" + RoleConfiguration.DEFAULT_CODE_ENVIRONMENT_SEPARATOR + "env");
    role.setBaseCode("code");
    role.setEnvironment("env");
    // 
    RoleCodeEnvironmentProcessor roleCodeEnvironmentProcessor = new RoleCodeEnvironmentProcessor(service);
    IdmRoleDto content = roleCodeEnvironmentProcessor.process(new CoreEvent<IdmRoleDto>(CoreEventType.CREATE, role)).getEvent().getContent();
    // 
    Assert.assertEquals("code" + RoleConfiguration.DEFAULT_CODE_ENVIRONMENT_SEPARATOR + "env", content.getCode());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) RoleCodeEnvironmentProcessor(eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

Aggregations

IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)13 RoleCodeEnvironmentProcessor (eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor)13 AbstractUnitTest (eu.bcvsolutions.idm.test.api.AbstractUnitTest)13 Test (org.junit.Test)13 CoreEvent (eu.bcvsolutions.idm.core.api.event.CoreEvent)6