use of eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto in project CzechIdMng by bcvsolutions.
the class AbstractProvisioningExecutor method doDeleteProvisioning.
@Override
public void doDeleteProvisioning(AccAccountDto account, UUID entityId) {
Assert.notNull(account, "Account is required.");
SysSystemEntityDto systemEntity = getSystemEntity(account);
//
if (systemEntity != null) {
doProvisioning(systemEntity, null, entityId, ProvisioningOperationType.DELETE, null);
}
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemEntityServiceIntegrationTest method testReferentialIntegrity.
@Test
public void testReferentialIntegrity() {
// system
SysSystemDto system = new SysSystemDto();
String systemName = "t_s_" + System.currentTimeMillis();
system.setName(systemName);
system = systemService.save(system);
// system entity
SysSystemEntityDto systemEntity = new SysSystemEntityDto();
systemEntity.setSystem(system.getId());
systemEntity.setEntityType(SystemEntityType.IDENTITY);
String uid = "se_uid_" + System.currentTimeMillis();
systemEntity.setUid(uid);
systemEntity = systemEntityService.save(systemEntity);
// account
AccAccountDto account = new AccAccountDto();
account.setSystem(system.getId());
account.setUid("test_uid_" + System.currentTimeMillis());
account.setAccountType(AccountType.PERSONAL);
account.setSystemEntity(systemEntity.getId());
account = accountService.save(account);
SysSystemEntityDto systemEntityDto = DtoUtils.getEmbedded(account, AccAccount_.systemEntity);
assertEquals(uid, systemEntityDto.getUid());
systemEntityService.delete(systemEntity);
assertNull(accountService.get(account.getId()).getSystemEntity());
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto in project CzechIdMng by bcvsolutions.
the class DefaultSysProvisioningBatchServiceTest method testMergeBatches.
@Test
public void testMergeBatches() {
// create two batch for the same system entity
SysSystemDto system = getHelper().createSystem(TestResource.TABLE_NAME);
SysSystemEntityDto systemEntity = getHelper().createSystemEntity(system);
//
SysProvisioningBatchDto batchOne = new SysProvisioningBatchDto();
batchOne.setId(UUID.randomUUID());
batchOne.setSystemEntity(systemEntity.getId());
batchOne = batchService.save(batchOne);
SysProvisioningOperationDto operationOne = createOperation(systemEntity, batchOne);
//
SysProvisioningBatchDto batchTwo = new SysProvisioningBatchDto();
batchTwo.setId(UUID.randomUUID());
batchTwo.setSystemEntity(systemEntity.getId());
batchTwo = batchService.save(batchTwo);
SysProvisioningOperationDto operationTwo = createOperation(systemEntity, batchTwo);
//
Assert.assertNotEquals(batchOne.getId(), batchTwo.getId());
//
SysProvisioningBatchDto mergedBatch = batchService.findBatch(systemEntity.getId());
//
Assert.assertEquals(batchOne.getId(), mergedBatch.getId());
//
Assert.assertNull(batchService.get(batchTwo));
operationOne = operationService.get(operationOne.getId());
operationTwo = operationService.get(operationTwo.getId());
Assert.assertEquals(batchOne.getId(), operationOne.getBatch());
Assert.assertEquals(batchOne.getId(), operationTwo.getBatch());
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemServiceIntegrationTest method testReferentialIntegritySystemEntityExists.
@Test
public void testReferentialIntegritySystemEntityExists() {
SysSystemDto system = new SysSystemDto();
String systemName = "t_s_" + System.currentTimeMillis();
system.setName(systemName);
system = systemService.save(system);
// system entity
SysSystemEntityDto systemEntity = new SysSystemEntityDto();
systemEntity.setSystem(system.getId());
systemEntity.setEntityType(SystemEntityType.IDENTITY);
systemEntity.setUid("se_uid_" + System.currentTimeMillis());
systemEntity = systemEntityService.save(systemEntity);
systemService.delete(system);
assertNull(systemService.getByCode(system.getCode()));
assertNull(systemEntityService.get(systemEntity.getId()));
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemEntityServiceFilterTest method testFindByText.
@Test
public void testFindByText() {
SysSystemDto system = helper.createTestResourceSystem(false);
SysSystemEntityDto entityOne = createEntitySystem(getHelper().createName(), SystemEntityType.CONTRACT, system.getId(), UUID.randomUUID());
createEntitySystem(getHelper().createName(), SystemEntityType.CONTRACT, system.getId(), UUID.randomUUID());
createEntitySystem(getHelper().createName(), SystemEntityType.CONTRACT, system.getId(), UUID.randomUUID());
//
SysSystemEntityFilter testFilter = new SysSystemEntityFilter();
testFilter.setText(entityOne.getUid());
List<SysSystemEntityDto> results = entityService.find(testFilter, null).getContent();
Assert.assertEquals(1, results.size());
Assert.assertEquals(entityOne.getId(), results.get(0).getId());
}
Aggregations