use of eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto in project CzechIdMng by bcvsolutions.
the class IdentitySyncTest method testUpdateIdentityNoAutomappingDontRemoveWishSync.
// linked, system entity has "wish", action Update entity, automapping is not allowed => no change + warning
@Test
public void testUpdateIdentityNoAutomappingDontRemoveWishSync() {
SysSystemDto system = initData();
Assert.assertNotNull(system);
// Disallow automapping
configurationService.setBooleanValue(ProvisioningConfiguration.PROPERTY_ALLOW_AUTO_MAPPING_ON_EXISTING_ACCOUNT, Boolean.FALSE);
SysSyncIdentityConfigDto config = doCreateSyncConfig(system);
config.setLinkedAction(SynchronizationLinkedActionType.UPDATE_ENTITY);
config = (SysSyncIdentityConfigDto) syncConfigService.save(config);
// Create system entity with "wish"
createSystemEntityWish(system);
// Create identity with account
IdmIdentityDto identity = helper.createIdentity(IDENTITY_ONE);
helper.createIdentityAccount(system, identity);
helper.startSynchronization(config);
// has to be warning - automapping is not allowed
SysSyncLogDto log = checkSyncLog(config, SynchronizationActionType.UPDATE_ENTITY, 1, OperationResultType.WARNING);
Assert.assertFalse(log.isRunning());
Assert.assertFalse(log.isContainsError());
// System entity has "wish"
SysSystemEntityDto systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, SystemEntityType.IDENTITY, IDENTITY_ONE);
Assert.assertTrue(systemEntity.isWish());
// Delete log
syncLogService.delete(log);
syncConfigService.delete(config);
// Return default
configurationService.setBooleanValue(ProvisioningConfiguration.PROPERTY_ALLOW_AUTO_MAPPING_ON_EXISTING_ACCOUNT, ProvisioningConfiguration.DEFAULT_ALLOW_AUTO_MAPPING_ON_EXISTING_ACCOUNT);
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto in project CzechIdMng by bcvsolutions.
the class IdentitySyncTest method testLinkedIdentityIgnoredDontRemoveWishSync.
// linked, system entity has "wish", action Ignore => no change
@Test
public void testLinkedIdentityIgnoredDontRemoveWishSync() {
SysSystemDto system = initData();
Assert.assertNotNull(system);
SysSyncIdentityConfigDto config = doCreateSyncConfig(system);
config.setLinkedAction(SynchronizationLinkedActionType.IGNORE);
config = (SysSyncIdentityConfigDto) syncConfigService.save(config);
// Create system entity with "wish"
createSystemEntityWish(system);
// Create identity with account
IdmIdentityDto identity = helper.createIdentity(IDENTITY_ONE);
helper.createIdentityAccount(system, identity);
helper.startSynchronization(config);
// has to be ignored
SysSyncLogDto log = checkSyncLog(config, SynchronizationActionType.LINKED, 1, OperationResultType.IGNORE);
Assert.assertFalse(log.isRunning());
Assert.assertFalse(log.isContainsError());
// System entity has "wish"
SysSystemEntityDto systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, SystemEntityType.IDENTITY, IDENTITY_ONE);
Assert.assertTrue(systemEntity.isWish());
// Delete log
syncLogService.delete(log);
syncConfigService.delete(config);
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto in project CzechIdMng by bcvsolutions.
the class AccountDeleteProcessor method initContext.
/**
* Create context for systemEntity in account DTO and set ID of role-request to
* it.
*
* @param account
* @param requestId
*/
private void initContext(AccAccountDto account, UUID requestId) {
SysSystemEntityDto systemEntityDto = DtoUtils.getEmbedded(account, AccAccount_.systemEntity.getName(), SysSystemEntityDto.class, null);
if (systemEntityDto == null) {
return;
}
Map<String, Object> context = systemEntityDto.getContext();
if (context == null) {
context = new HashMap<String, Object>();
}
context.put(IdmRoleRequestService.ROLE_REQUEST_ID_KEY, requestId);
systemEntityDto.setContext(context);
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto in project CzechIdMng by bcvsolutions.
the class DefaultProvisioningExecutorIntegrationTest method testChangePasswordWithoutAccountExist.
@Test
public void testChangePasswordWithoutAccountExist() {
SysSystemDto system = getHelper().createTestResourceSystem(true);
ProvisioningContext context = new ProvisioningContext();
SysSystemEntityDto systemEntity = getHelper().createSystemEntity(system);
ProvisioningAttributeDto passwordAttribute = getProvisioningAttribute(TestHelper.ATTRIBUTE_MAPPING_PASSWORD);
//
Map<ProvisioningAttributeDto, Object> accoutObject = new HashMap<>();
accoutObject.put(passwordAttribute, new GuardedString("password"));
context.setAccountObject(accoutObject);
//
// prepare provisioning operation
SysSystemMappingDto systemMapping = getHelper().getDefaultMapping(system);
IcObjectClass objectClass = new IcObjectClassImpl(schemaObjectClassService.get(systemMapping.getObjectClass()).getObjectClassName());
IcConnectorObject connectorObject = new IcConnectorObjectImpl(null, objectClass, null);
SysProvisioningOperationDto.Builder operationBuilder = new SysProvisioningOperationDto.Builder().setSystem(system.getId()).setOperationType(ProvisioningOperationType.CREATE).setSystemEntity(systemEntity).setProvisioningContext(new ProvisioningContext(accoutObject, connectorObject));
SysProvisioningOperationDto provisioningOperation = operationBuilder.build();
// set default result state
provisioningOperation.setResult(new OperationResult(OperationState.CREATED));
//
// publish event
provisioningExecutor.execute(provisioningOperation);
//
SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
filter.setSystemEntity(provisioningOperation.getSystemEntity());
filter.setSystemId(system.getId());
//
List<SysProvisioningOperationDto> operations = provisioningOperationService.find(filter, null).getContent();
Assert.assertEquals(1, operations.size());
//
Assert.assertEquals(AccResultCode.PROVISIONING_PASSWORD_CREATE_ACCOUNT_UID_NOT_FOUND.getCode(), operations.get(0).getResult().getModel().getStatusEnum());
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto in project CzechIdMng by bcvsolutions.
the class DefaultProvisioningExecutorIntegrationTest method testAsynchronousSystem.
@Test
public void testAsynchronousSystem() {
SysSystemDto system = getHelper().createTestResourceSystem(true);
system.setQueue(true);
system = systemService.save(system);
//
// create test provisioning context
SysProvisioningOperationDto provisioningOperation = createProvisioningOperation(system, "firstname");
Map<ProvisioningAttributeDto, Object> accoutObject = provisioningOperation.getProvisioningContext().getAccountObject();
String uid = (String) accoutObject.get(getProvisioningAttribute(TestHelper.ATTRIBUTE_MAPPING_NAME));
//
// publish event
provisioningExecutor.execute(provisioningOperation);
// is necessary to get again operation from service
SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
filter.setSystemEntity(provisioningOperation.getSystemEntity());
filter.setSystemId(system.getId());
SysProvisioningOperationDto operation = provisioningOperationService.find(filter, null).getContent().get(0);
assertEquals(OperationState.CREATED, operation.getResultState());
SysSystemEntityDto systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, SystemEntityType.IDENTITY, uid);
assertTrue(systemEntity.isWish());
assertNull(getHelper().findResource(uid));
//
// execute LRT with incorrect setting - virtual at fist - expected no process
ProvisioningQueueTaskExecutor provisioningQueueExecutor = new ProvisioningQueueTaskExecutor();
provisioningQueueExecutor.setVirtual(true);
Boolean result = longRunningTaskManager.executeSync(provisioningQueueExecutor);
assertTrue(result);
IdmLongRunningTaskDto lrt = longRunningTaskManager.getLongRunningTask(provisioningQueueExecutor.getLongRunningTaskId());
assertEquals(0L, lrt.getCount().longValue());
systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, SystemEntityType.IDENTITY, uid);
assertTrue(systemEntity.isWish());
assertNull(getHelper().findResource(uid));
//
// execute LRT with correct setting
provisioningQueueExecutor = new ProvisioningQueueTaskExecutor();
result = longRunningTaskManager.executeSync(provisioningQueueExecutor);
assertTrue(result);
lrt = longRunningTaskManager.getLongRunningTask(provisioningQueueExecutor);
assertEquals(1L, lrt.getCount().longValue());
systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, SystemEntityType.IDENTITY, uid);
assertFalse(systemEntity.isWish());
assertNotNull(getHelper().findResource(uid));
}
Aggregations