use of eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor in project CzechIdMng by bcvsolutions.
the class DefaultIdmRoleServiceUnitTest method testUpdateSuccessCodeChange.
@Test
public void testUpdateSuccessCodeChange() {
IdmRoleDto role = new IdmRoleDto();
role.setCode("code");
role.setBaseCode("code");
//
IdmRoleDto roleUpdate = new IdmRoleDto();
roleUpdate.setCode("code2");
roleUpdate.setBaseCode("code");
//
RoleCodeEnvironmentProcessor roleCodeEnvironmentProcessor = new RoleCodeEnvironmentProcessor(service);
CoreEvent<IdmRoleDto> updateEvent = new CoreEvent<IdmRoleDto>(CoreEventType.CREATE, roleUpdate);
updateEvent.setOriginalSource(role);
IdmRoleDto content = roleCodeEnvironmentProcessor.process(updateEvent).getEvent().getContent();
//
//
Assert.assertEquals("code2", content.getCode());
Assert.assertEquals("code2", content.getBaseCode());
}
use of eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor in project CzechIdMng by bcvsolutions.
the class DefaultIdmRoleServiceUnitTest method testUpdateSuccessWithBaseCodeEvironment.
@Test
public void testUpdateSuccessWithBaseCodeEvironment() {
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");
//
IdmRoleDto roleUpdate = new IdmRoleDto();
roleUpdate.setCode("code" + RoleConfiguration.DEFAULT_CODE_ENVIRONMENT_SEPARATOR + "env");
roleUpdate.setBaseCode("code");
roleUpdate.setEnvironment("env2");
//
RoleCodeEnvironmentProcessor roleCodeEnvironmentProcessor = new RoleCodeEnvironmentProcessor(service);
CoreEvent<IdmRoleDto> updateEvent = new CoreEvent<IdmRoleDto>(CoreEventType.CREATE, roleUpdate);
updateEvent.setOriginalSource(role);
IdmRoleDto content = roleCodeEnvironmentProcessor.process(updateEvent).getEvent().getContent();
//
//
Assert.assertEquals("code" + RoleConfiguration.DEFAULT_CODE_ENVIRONMENT_SEPARATOR + "env2", content.getCode());
Assert.assertEquals("code", content.getBaseCode());
}
use of eu.bcvsolutions.idm.core.model.event.processor.role.RoleCodeEnvironmentProcessor in project CzechIdMng by bcvsolutions.
the class DefaultIdmRoleServiceUnitTest method testCreateSuccess.
@Test
public void testCreateSuccess() {
when(roleConfiguration.getCodeEnvironmentSeperator()).thenReturn(RoleConfiguration.DEFAULT_CODE_ENVIRONMENT_SEPARATOR);
//
IdmRoleDto role = new IdmRoleDto();
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());
}
Aggregations