use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto in project CzechIdMng by bcvsolutions.
the class RoleForRequestEvaluatorIntegrationTest method createContract.
private IdmIdentityContractDto createContract(IdmIdentityDto result) {
IdmIdentityContractDto dto = new IdmIdentityContractDto();
dto.setIdentity(result.getId());
dto.setPosition("MY_DEFAULT");
return contractService.save(dto);
}
use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto in project CzechIdMng by bcvsolutions.
the class RoleForRequestEvaluatorIntegrationTest method createUser.
private IdmIdentityDto createUser(String name, String password, IdmRoleDto... roles) {
IdmIdentityDto identity = new IdmIdentityDto();
identity.setEmail(RandomStringUtils.randomAlphabetic(10) + "@email.com");
identity.setLastName(name);
identity.setFirstName(name);
identity.setUsername(name);
identity.setPassword(new GuardedString(password));
final IdmIdentityDto result = identityService.save(identity);
//
IdmIdentityContractDto contract = createContract(result);
assignRoles(contract, roles);
//
return result;
}
use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto in project CzechIdMng by bcvsolutions.
the class DtoUtilsIntegrationTest method testEmbedded.
@Test
public void testEmbedded() {
IdmIdentityRoleDto dto = new IdmIdentityRoleDto();
IdmIdentityContractDto contract = new IdmIdentityContractDto(UUID.randomUUID());
dto.getEmbedded().put(IdmIdentityRole_.identityContract.getName(), contract);
//
IdmIdentityContractDto embedded = DtoUtils.getEmbedded(dto, IdmIdentityRole_.identityContract, IdmIdentityContractDto.class);
assertEquals(contract, embedded);
}
use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto in project CzechIdMng by bcvsolutions.
the class DtoUtilsUnitTest method testEmbedded.
@Test
public void testEmbedded() {
IdmIdentityRoleDto dto = new IdmIdentityRoleDto();
IdmIdentityContractDto contract = new IdmIdentityContractDto(UUID.randomUUID());
dto.getEmbedded().put(PROPERTY, contract);
//
IdmIdentityContractDto embedded = DtoUtils.getEmbedded(dto, PROPERTY, IdmIdentityContractDto.class);
assertEquals(contract, embedded);
}
use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto in project CzechIdMng by bcvsolutions.
the class SendNotificationToApplicantAndImplementerTest method requestReturnedByHelpdeskImplementerNotSameTest.
@Test
public void requestReturnedByHelpdeskImplementerNotSameTest() {
loginAsAdmin(InitTestData.TEST_ADMIN_USERNAME);
configurationService.setValue(SENT_TO_APPLICANT, "false");
configurationService.setValue(SENT_TO_IMPLEMENTER, "true");
//
IdmIdentityDto testUser3 = createTestUser();
loginAsAdmin(testUser3.getUsername());
IdmIdentityDto test1 = createTestUser();
IdmRoleDto test_role = createRole("test_role" + System.currentTimeMillis());
//
IdmIdentityContractDto contract = identityContractService.getPrimeContract(test1.getId());
IdmRoleRequestDto request = createRoleRequest(test1);
request = roleRequestService.save(request);
IdmConceptRoleRequestDto concept = createRoleConcept(test_role, contract, request);
concept = conceptRoleRequestService.save(concept);
roleRequestService.startRequestInternal(request.getId(), true);
request = roleRequestService.get(request.getId());
assertEquals(RoleRequestState.IN_PROGRESS, request.getState());
WorkflowFilterDto taskFilter = new WorkflowFilterDto();
List<WorkflowTaskInstanceDto> tasks = (List<WorkflowTaskInstanceDto>) workflowTaskInstanceService.search(taskFilter).getResources();
assertEquals(0, tasks.size());
loginAsAdmin(InitTestData.TEST_ADMIN_USERNAME);
// HELPDESK
checkAndCompleteOneTask(taskFilter, test1.getUsername(), "backToApplicant");
// test notification to applicant
IdmNotificationFilter filter = new IdmNotificationFilter();
filter.setRecipient(test1.getUsername());
filter.setNotificationType(IdmNotificationLog.class);
List<IdmNotificationLogDto> notifications = notificationLogService.find(filter, null).getContent();
assertEquals(0, notifications.size());
// test notification to implementer
filter = new IdmNotificationFilter();
filter.setRecipient(testUser3.getUsername());
filter.setNotificationType(IdmNotificationLog.class);
notifications = notificationLogService.find(filter, null).getContent();
assertEquals(1, notifications.size());
assertEquals(CoreModuleDescriptor.TOPIC_RETURN_REQUEST_IDENTITY_ROLES_IMPLEMENTER, notifications.get(0).getTopic());
}
Aggregations