use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class ProvisioningOperationDeleteBulkActionIntegrationTest method testDelete.
@Test
public void testDelete() {
SysSystemDto system = getHelper().createTestResourceSystem(false);
SysProvisioningOperationDto operationOne = createOperation(system);
SysProvisioningOperationDto operationTwo = createOperation(system);
IdmBulkActionDto bulkAction = this.findBulkAction(SysProvisioningOperation.class, ProvisioningOperationDeleteBulkAction.NAME);
bulkAction.setIdentifiers(ImmutableSet.of(operationOne.getId()));
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, 1l, null, null);
Assert.assertNull(provisioningOperationService.get(operationOne.getId()));
Assert.assertNotNull(provisioningOperationService.get(operationTwo.getId()));
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class ProvisioningOperationRetryBulkActionTest method testRetryFullBatchWithFilter.
@Test
public void testRetryFullBatchWithFilter() {
IdmRoleDto role = getHelper().createRole();
IdmIdentityDto identity = getHelper().createIdentity();
SysSystemDto system = helper.createTestResourceSystem(true);
system.setReadonly(true);
system = systemService.save(system);
helper.createRoleSystem(role, system);
getHelper().createIdentityRole(identity, role);
identityService.save(identity);
identityService.save(identity);
identityService.save(identity);
SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
filter.setEntityIdentifier(identity.getId());
filter.setEntityType(SystemEntityType.IDENTITY);
List<SysProvisioningOperationDto> operations = provisioningOperationService.find(filter, null).getContent();
assertFalse(operations.isEmpty());
assertTrue(operations.size() > 1);
system.setReadonly(false);
system = systemService.save(system);
IdmBulkActionDto bulkAction = this.findBulkAction(SysProvisioningOperation.class, ProvisioningOperationRetryBulkAction.NAME);
bulkAction.setFilter(toMap(filter));
bulkAction.setTransformedFilter(filter);
Map<String, Object> properties = new HashMap<>();
properties.put(ProvisioningOperationRetryBulkAction.RETRY_WHOLE_BATCH_CODE, Boolean.TRUE.toString());
bulkAction.setProperties(properties);
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, 4l, null, null);
checkProcessItemsCount(processAction, operations.size());
List<SysProvisioningOperationDto> newOperations = provisioningOperationService.find(filter, null).getContent();
assertEquals(0, newOperations.size());
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class ProvisioningOperationRetryBulkActionTest method testRetryOneItemWithReturnToQueue.
@Test
public void testRetryOneItemWithReturnToQueue() {
IdmRoleDto role = getHelper().createRole();
IdmIdentityDto identity = getHelper().createIdentity();
SysSystemDto system = helper.createTestResourceSystem(true);
system.setReadonly(true);
system = systemService.save(system);
helper.createRoleSystem(role, system);
getHelper().createIdentityRole(identity, role);
identityService.save(identity);
identityService.save(identity);
identityService.save(identity);
SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
filter.setEntityIdentifier(identity.getId());
filter.setEntityType(SystemEntityType.IDENTITY);
List<SysProvisioningOperationDto> operations = provisioningOperationService.find(filter, null).getContent();
assertFalse(operations.isEmpty());
assertTrue(operations.size() > 1);
IdmBulkActionDto bulkAction = this.findBulkAction(SysProvisioningOperation.class, ProvisioningOperationRetryBulkAction.NAME);
// We found just one
SysProvisioningOperationDto provisioningOperationDto = operations.stream().findAny().get();
bulkAction.setIdentifiers(Sets.newHashSet(provisioningOperationDto.getId()));
Map<String, Object> properties = new HashMap<>();
properties.put(ProvisioningOperationRetryBulkAction.RETRY_WHOLE_BATCH_CODE, Boolean.FALSE.toString());
bulkAction.setProperties(properties);
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, 1l, null, null);
List<SysProvisioningOperationDto> newOperations = provisioningOperationService.find(filter, null).getContent();
assertEquals(operations.size(), newOperations.size());
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class ProvisioningOperationRetryBulkActionTest method testRetryWithFilterAndReturnToQueue.
@Test
public void testRetryWithFilterAndReturnToQueue() {
IdmRoleDto role = getHelper().createRole();
IdmIdentityDto identity = getHelper().createIdentity();
SysSystemDto system = helper.createTestResourceSystem(true);
system.setReadonly(true);
system = systemService.save(system);
helper.createRoleSystem(role, system);
getHelper().createIdentityRole(identity, role);
identityService.save(identity);
identityService.save(identity);
identityService.save(identity);
SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
filter.setEntityIdentifier(identity.getId());
filter.setEntityType(SystemEntityType.IDENTITY);
List<SysProvisioningOperationDto> operations = provisioningOperationService.find(filter, null).getContent();
assertFalse(operations.isEmpty());
assertTrue(operations.size() > 1);
IdmBulkActionDto bulkAction = this.findBulkAction(SysProvisioningOperation.class, ProvisioningOperationRetryBulkAction.NAME);
bulkAction.setFilter(toMap(filter));
bulkAction.setTransformedFilter(filter);
Map<String, Object> properties = new HashMap<>();
properties.put(ProvisioningOperationRetryBulkAction.RETRY_WHOLE_BATCH_CODE, Boolean.FALSE.toString());
bulkAction.setProperties(properties);
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
// Multipled by 2
checkResultLrt(processAction, (long) operations.size(), null, null);
checkProcessItemsCount(processAction, operations.size());
List<SysProvisioningOperationDto> newOperations = provisioningOperationService.find(filter, null).getContent();
assertEquals(operations.size(), newOperations.size());
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class ProvisioningOperationRetryBulkActionTest method testEmptyFilterWithController.
@Test
public void testEmptyFilterWithController() {
// Delete operation from before
provisioningOperationService.deleteAllOperations();
SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
List<SysProvisioningOperationDto> operations = provisioningOperationService.find(filter, null).getContent();
assertTrue(operations.isEmpty());
IdmRoleDto role = getHelper().createRole();
IdmIdentityDto identity = getHelper().createIdentity();
SysSystemDto system = helper.createTestResourceSystem(true);
system.setDisabled(true);
system = systemService.save(system);
helper.createRoleSystem(role, system);
getHelper().createIdentityRole(identity, role);
system.setDisabled(false);
system = systemService.save(system);
operations = provisioningOperationService.find(filter, null).getContent();
assertFalse(operations.isEmpty());
IdmBulkActionDto bulkAction = this.findBulkAction(SysProvisioningOperation.class, ProvisioningOperationRetryBulkAction.NAME);
bulkAction.setTransformedFilter(filter);
// FIXME: can be multivalued (attributes) ...
bulkAction.setFilter(filter.getData().toSingleValueMap());
int allOperations = operations.size();
Map<String, Object> properties = new HashMap<>();
properties.put(ProvisioningOperationCancelBulkAction.RETRY_WHOLE_BATCH_CODE, Boolean.TRUE.toString());
bulkAction.setProperties(properties);
IdmBulkActionDto processAction = provisioningOperationController.bulkAction(bulkAction).getBody();
checkResultLrt(processAction, Long.valueOf(allOperations), null, null);
operations = provisioningOperationService.find(filter, null).getContent();
assertTrue(operations.isEmpty());
}
Aggregations