use of eu.bcvsolutions.idm.vs.dto.VsAccountDto in project CzechIdMng by bcvsolutions.
the class VsReqeustServiceTest method realizeRequestWithouRightTest.
@Test(expected = ForbiddenEntityException.class)
public void realizeRequestWithouRightTest() {
String reason = "cancel \"request\" reason!";
SysSystemDto system = this.createVirtualSystem(USER_IMPLEMENTER_NAME, null);
this.assignRoleSystem(system, helper.createIdentity(USER_ONE_NAME), ROLE_ONE_NAME);
// Find created requests
VsRequestFilter requestFilter = new VsRequestFilter();
requestFilter.setSystemId(system.getId());
requestFilter.setUid(USER_ONE_NAME);
List<VsRequestDto> requests = requestService.find(requestFilter, null).getContent();
Assert.assertEquals(1, requests.size());
VsRequestDto request = requests.get(0);
Assert.assertEquals(USER_ONE_NAME, request.getUid());
Assert.assertEquals(VsOperationType.CREATE, request.getOperationType());
Assert.assertEquals(VsRequestState.IN_PROGRESS, request.getState());
VsAccountDto account = accountService.findByUidSystem(USER_ONE_NAME, system.getId());
Assert.assertNull("Account must be null, because request was not realized yet!", account);
// We try cancel the request
super.logout();
loginService.login(new LoginDto(USER_ONE_NAME, new GuardedString("password")));
request = requestService.cancel(request, reason);
}
use of eu.bcvsolutions.idm.vs.dto.VsAccountDto in project CzechIdMng by bcvsolutions.
the class VsReqeustServiceTest method createAndCancelRequestTest.
@Test
public void createAndCancelRequestTest() {
String reason = "cancel \"request\" reason!";
SysSystemDto system = this.createVirtualSystem(USER_IMPLEMENTER_NAME, null);
this.assignRoleSystem(system, helper.createIdentity(USER_ONE_NAME), ROLE_ONE_NAME);
// Find created requests
VsRequestFilter requestFilter = new VsRequestFilter();
requestFilter.setSystemId(system.getId());
requestFilter.setUid(USER_ONE_NAME);
List<VsRequestDto> requests = requestService.find(requestFilter, null).getContent();
Assert.assertEquals(1, requests.size());
VsRequestDto request = requests.get(0);
Assert.assertEquals(USER_ONE_NAME, request.getUid());
Assert.assertEquals(VsOperationType.CREATE, request.getOperationType());
Assert.assertEquals(VsRequestState.IN_PROGRESS, request.getState());
VsAccountDto account = accountService.findByUidSystem(USER_ONE_NAME, system.getId());
Assert.assertNull("Account must be null, because request was not realized yet!", account);
// We try cancel the request
super.logout();
loginService.login(new LoginDto(USER_IMPLEMENTER_NAME, new GuardedString("password")));
request = requestService.cancel(request, reason);
Assert.assertEquals(VsRequestState.CANCELED, request.getState());
Assert.assertEquals(reason, request.getReason());
account = accountService.findByUidSystem(USER_ONE_NAME, system.getId());
Assert.assertNull("Account must be null, because request was canceled!", account);
}
Aggregations