use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class RoleRequestDeleteBulkActionIntegrationTest method deleteRoleRequestExecuted.
/**
* When already executed in IdM and not in a system,
* request is set canceled on the target system
*/
@Test
public void deleteRoleRequestExecuted() {
IdmRoleDto role = this.createRoles(1).get(0);
IdmIdentityDto identity = createIdentities(1).get(0);
IdmIdentityContractDto contract = getHelper().getPrimeContract(identity);
IdmRoleRequestDto roleRequest = roleRequestService.createRequest(contract, role);
Assert.assertEquals(RoleRequestState.CONCEPT, roleRequest.getState());
getHelper().executeRequest(roleRequest, false);
roleRequest = roleRequestService.get(roleRequest);
Assert.assertEquals(RoleRequestState.EXECUTED, roleRequest.getState());
Assert.assertNotNull(roleRequest);
Assert.assertNotNull(roleRequest.getId());
IdmBulkActionDto bulkAction = this.findBulkAction(IdmRoleRequest.class, RoleRequestDeleteBulkAction.NAME);
Set<UUID> ids = new HashSet<UUID>();
ids.add(roleRequest.getId());
bulkAction.setIdentifiers(ids);
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, 1l, null, null);
roleRequest = roleRequestService.get(roleRequest.getId());
Assert.assertEquals(OperationState.CANCELED, roleRequest.getSystemState().getState());
// request cannot be deleted because it is already executed
processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, null, 1l, null);
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class ScriptDuplicateBulkActionIntegrationTest method processBulkActionWithoutPermission.
@Test
public void processBulkActionWithoutPermission() {
IdmScriptDto original = createIdmScript();
IdmScriptFilter filt = new IdmScriptFilter();
filt.setText(original.getCode());
List<IdmScriptDto> dtos = scriptService.find(filt, null).getContent();
Assert.assertEquals(1, dtos.size());
IdmIdentityDto readerIdentity = this.createUserWithAuthorities(IdmBasePermission.READ);
loginAsNoAdmin(readerIdentity.getUsername());
IdmBulkActionDto bulkAction = this.findBulkAction(IdmScript.class, ScriptDuplicateBulkAction.NAME);
bulkAction.getIdentifiers().add(original.getId());
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, null, null, 1l);
dtos = scriptService.find(filt, null).getContent();
Assert.assertEquals(1, dtos.size());
Assert.assertEquals(original.getId(), dtos.get(0).getId());
cleanScript(dtos);
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class ScriptDuplicateBulkActionIntegrationTest method processBulkActionByIds.
@Test
public void processBulkActionByIds() {
IdmScriptDto original = createIdmScript();
IdmScriptFilter filt = new IdmScriptFilter();
filt.setText(original.getCode());
List<IdmScriptDto> dtos = scriptService.find(filt, null).getContent();
Assert.assertEquals(1, dtos.size());
IdmBulkActionDto bulkAction = this.findBulkAction(IdmScript.class, ScriptDuplicateBulkAction.NAME);
bulkAction.getIdentifiers().add(original.getId());
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, 1l, null, null);
dtos = scriptService.find(filt, null).getContent();
Assert.assertEquals(2, dtos.size());
Assert.assertTrue(compareScripts(dtos.get(0), dtos.get(1)));
cleanScript(dtos);
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class MonitoringResultRunBulkActionIntegrationTest method testRun.
@Test
public void testRun() {
IdmMonitoringResultDto monitoringResult = createDto();
IdmBulkActionDto bulkAction = findBulkAction(IdmMonitoringResult.class, MonitoringResultRunBulkAction.NAME);
Set<UUID> ids = Sets.newHashSet(monitoringResult.getId());
bulkAction.setIdentifiers(ids);
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, 1l, null, null);
monitoringService.deleteById(monitoringResult.getMonitoring());
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class SystemMappingDeleteBulkAction method prevalidate.
@Override
public ResultModels prevalidate() {
IdmBulkActionDto action = getAction();
List<UUID> entities = getEntities(action, new StringBuilder());
ResultModels result = new ResultModels();
Map<ResultModel, Long> models = new HashMap<>();
entities.forEach(mappingId -> {
SysSystemMappingDto mapping = getService().get(mappingId);
SysSyncConfigFilter syncFilter = new SysSyncConfigFilter();
syncFilter.setSystemMappingId(mappingId);
long count = synchronizationService.count(syncFilter);
if (count > 0) {
models.put(new DefaultResultModel(AccResultCode.SYSTEM_MAPPING_DELETE_BULK_ACTION_MAPPING_IN_USE, ImmutableMap.of("mapping", mapping.getName(), "count", count)), count);
}
});
List<Entry<ResultModel, Long>> collect = //
models.entrySet().stream().sorted(//
Collections.reverseOrder(Map.Entry.comparingByValue())).collect(Collectors.toList());
collect.forEach(entry -> {
result.addInfo(entry.getKey());
});
return result;
}
Aggregations