use of eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter in project CzechIdMng by bcvsolutions.
the class SysProvisioningOperationFilterIntegrationTest method entityIdentifierFilterTest.
@Test
public void entityIdentifierFilterTest() {
IdmBasePermission permission = IdmBasePermission.ADMIN;
SystemEntityType entityType = SystemEntityType.IDENTITY;
SysSystemDto system = createSystem();
createProvisioningOperation(entityType, system);
SysProvisioningOperationDto provisioningOperation1 = createProvisioningOperation(entityType, system);
provisioningOperation1.setEntityIdentifier(UUID.randomUUID());
operationService.save(provisioningOperation1);
SysProvisioningOperationDto provisioningOperation2 = createProvisioningOperation(entityType, system);
SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
filter.setEntityIdentifier(provisioningOperation1.getEntityIdentifier());
filter.setSystemId(system.getId());
Page<SysProvisioningOperationDto> result = operationService.find(filter, null, permission);
assertEquals(1, result.getTotalElements());
assertTrue(result.getContent().contains(provisioningOperation1));
assertFalse(result.getContent().contains(provisioningOperation2));
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter in project CzechIdMng by bcvsolutions.
the class SysProvisioningOperationFilterIntegrationTest method resultStateFilterTest.
@Test
public void resultStateFilterTest() {
IdmBasePermission permission = IdmBasePermission.ADMIN;
SystemEntityType entityType = SystemEntityType.IDENTITY;
SysSystemDto system = createSystem();
OperationResult resultState = new OperationResult();
resultState.setState(OperationState.CREATED);
SysProvisioningOperationDto provisioningOperation1 = createProvisioningOperation(entityType, system);
SysProvisioningOperationDto provisioningOperation2 = createProvisioningOperation(entityType, system);
provisioningOperation2.setResult(resultState);
operationService.save(provisioningOperation2);
SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
filter.setResultState(OperationState.CREATED);
filter.setSystemId(system.getId());
Page<SysProvisioningOperationDto> result = operationService.find(filter, null, permission);
assertEquals(1, result.getTotalElements());
assertTrue(result.getContent().contains(provisioningOperation2));
assertFalse(result.getContent().contains(provisioningOperation1));
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter in project CzechIdMng by bcvsolutions.
the class SysProvisioningOperationFilterIntegrationTest method operationTypeFilterTest.
@Test
public void operationTypeFilterTest() {
IdmBasePermission permission = IdmBasePermission.ADMIN;
SystemEntityType entityType = SystemEntityType.IDENTITY;
SysSystemDto system = createSystem();
SysProvisioningOperationDto provisioningOperation1 = createProvisioningOperation(entityType, system);
SysProvisioningOperationDto provisioningOperation2 = createProvisioningOperation(entityType, system);
provisioningOperation2.setOperationType(ProvisioningEventType.CANCEL);
operationService.save(provisioningOperation2);
SysProvisioningOperationDto provisioningOperation3 = createProvisioningOperation(entityType, system);
provisioningOperation3.setOperationType(ProvisioningEventType.CANCEL);
operationService.save(provisioningOperation3);
SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
filter.setSystemId(system.getId());
filter.setOperationType(ProvisioningEventType.CANCEL);
Page<SysProvisioningOperationDto> result = operationService.find(filter, null, permission);
assertEquals(2, result.getTotalElements());
assertTrue(result.getContent().contains(provisioningOperation2));
assertFalse(result.getContent().contains(provisioningOperation1));
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter in project CzechIdMng by bcvsolutions.
the class ContractGuaranteeSaveAndDeleteProcessorTest method testDeleteContractGuaranteeWithoutProvisioning.
@Test
public void testDeleteContractGuaranteeWithoutProvisioning() {
IdmIdentityDto identity = testHelper.createIdentity();
//
IdmIdentityDto guarantee = testHelper.createIdentity();
IdmIdentityContractDto primeContract = testHelper.getPrimeContract(identity.getId());
IdmContractGuaranteeDto contractGuarantee = testHelper.createContractGuarantee(primeContract.getId(), guarantee.getId());
// delete
contractGuaranteeService.delete(contractGuarantee);
//
SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
filter.setEntityIdentifier(identity.getId());
List<SysProvisioningArchiveDto> content = provisioningArchiveService.find(filter, null).getContent();
assertEquals(0, content.size());
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter in project CzechIdMng by bcvsolutions.
the class ContractGuaranteeSaveAndDeleteProcessorTest method testProvisioningAfterDeleteContractGuarantee.
@Test
public void testProvisioningAfterDeleteContractGuarantee() {
SysSystemDto system = testHelper.createTestResourceSystem(true);
//
IdmIdentityDto identity = testHelper.createIdentity();
testHelper.createIdentityAccount(system, identity);
//
// save identity with account, invoke provisioning = create
identity = identityService.save(identity);
//
IdmIdentityDto guarantee = testHelper.createIdentity();
IdmIdentityContractDto primeContract = testHelper.getPrimeContract(identity.getId());
IdmContractGuaranteeDto contractGuarantee = testHelper.createContractGuarantee(primeContract.getId(), guarantee.getId());
// delete
contractGuaranteeService.delete(contractGuarantee);
//
SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
filter.setSystemId(system.getId());
List<SysProvisioningArchiveDto> content = provisioningArchiveService.find(filter, null).getContent();
// create, add contract guarantee and delete = 3 operation
assertEquals(3, content.size());
SysProvisioningArchiveDto last = Iterables.getLast(content);
assertEquals(ProvisioningEventType.UPDATE, last.getOperationType());
assertEquals(SystemEntityType.IDENTITY, last.getEntityType());
assertEquals(identity.getId(), last.getEntityIdentifier());
}
Aggregations