use of eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute in project CzechIdMng by bcvsolutions.
the class DefaultProvisioningExecutorIntegrationTest method testDeleteOperations.
@Test
public void testDeleteOperations() {
SysSystemDto systemOne = getHelper().createTestResourceSystem(true);
SysSystemDto systemTwo = getHelper().createTestResourceSystem(true);
//
SysProvisioningOperationDto createProvisioningOperationOne = createProvisioningOperation(systemOne, getHelper().createName());
createProvisioningOperationOne.setResult(new OperationResult(OperationState.BLOCKED));
createProvisioningOperationOne = provisioningOperationService.save(createProvisioningOperationOne);
SysProvisioningAttribute attributeOne = provisioningAttributeRepository.save(new SysProvisioningAttribute(createProvisioningOperationOne.getId(), getHelper().createName()));
SysProvisioningOperationDto createProvisioningOperationTwo = createProvisioningOperation(systemTwo, getHelper().createName());
createProvisioningOperationTwo.setResult(new OperationResult(OperationState.BLOCKED));
createProvisioningOperationTwo = provisioningOperationService.save(createProvisioningOperationTwo);
SysProvisioningAttribute attributeTwo = provisioningAttributeRepository.save(new SysProvisioningAttribute(createProvisioningOperationTwo.getId(), getHelper().createName()));
SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
filter.setSystemId(systemOne.getId());
Assert.assertEquals(1, provisioningOperationService.find(filter, null).getTotalElements());
filter.setSystemId(systemTwo.getId());
Assert.assertEquals(1, provisioningOperationService.find(filter, null).getTotalElements());
//
provisioningOperationService.deleteOperations(systemOne.getId());
Assert.assertNull(provisioningAttributeRepository.findById(attributeOne.getId()).orElse(null));
Assert.assertNotNull(provisioningAttributeRepository.findById(attributeTwo.getId()).get());
//
filter.setSystemId(systemOne.getId());
Assert.assertEquals(0, provisioningOperationService.find(filter, null).getTotalElements());
filter.setSystemId(systemTwo.getId());
Assert.assertEquals(1, provisioningOperationService.find(filter, null).getTotalElements());
}
Aggregations