use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class SynchronizationMonitoringEvaluatorIntegrationTest method testSynchronizationNotOk.
@Test
public void testSynchronizationNotOk() {
UUID syncId = UUID.randomUUID();
SysSyncConfigDto config = new SysSyncConfigDto();
config.setName("mock");
config.setLastSyncLog(new SysSyncLogDto());
SysSyncActionLogDto action = new SysSyncActionLogDto();
action.setOperationResult(OperationResultType.ERROR);
action.setOperationCount(2);
config.getLastSyncLog().getSyncActionLogs().add(action);
SysSystemMappingDto mapping = new SysSystemMappingDto();
config.getEmbedded().put(SysSyncConfig_.systemMapping.getName(), mapping);
SysSchemaObjectClassDto schema = new SysSchemaObjectClassDto();
schema.setSystem(syncId);
mapping.getEmbedded().put(SysSystemMapping_.objectClass.getName(), schema);
SysSystemDto system = new SysSystemDto(UUID.randomUUID());
system.setName("mock");
//
SysSyncConfigFilter context = new SysSyncConfigFilter();
context.setIncludeLastLog(Boolean.TRUE);
Mockito.when(syncConfigService.get(ArgumentMatchers.any(), (SysSyncConfigFilter) ArgumentMatchers.any())).thenReturn(config);
Mockito.when(systemService.get(syncId)).thenReturn(system);
//
IdmMonitoringDto monitoring = new IdmMonitoringDto();
monitoring.getEvaluatorProperties().put(SynchronizationMonitoringEvaluator.PARAMETER_SYNCHRONIZATION, syncId);
IdmMonitoringResultDto result = evaluator.evaluate(monitoring);
//
Assert.assertEquals(AccResultCode.MONITORING_SYNCHRONIZATION_CONTAINS_ERROR.getCode(), result.getResult().getCode());
Assert.assertEquals(String.valueOf(2), result.getValue());
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class SynchronizationMonitoringEvaluatorIntegrationTest method testSynchronizationNotFound.
@Test(expected = EntityNotFoundException.class)
public void testSynchronizationNotFound() {
UUID syncId = UUID.randomUUID();
Mockito.when(syncConfigService.get(syncId, new SysSyncConfigFilter())).thenReturn(null);
//
IdmMonitoringDto monitoring = new IdmMonitoringDto();
monitoring.getEvaluatorProperties().put(SynchronizationMonitoringEvaluator.PARAMETER_SYNCHRONIZATION, syncId);
evaluator.evaluate(monitoring);
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class ProvisioningOperationMonitoringEvaluatorUnitTest method testError.
@Test
public void testError() {
Mockito.when(provisioningOperationService.count(ArgumentMatchers.any())).thenReturn(10L);
//
IdmMonitoringDto monitoring = new IdmMonitoringDto();
monitoring.setInstanceId("mock");
IdmMonitoringResultDto result = evaluator.evaluate(monitoring);
//
Assert.assertEquals(AccResultCode.MONITORING_PROVISIONING_OPERATION_ERROR.getCode(), result.getResult().getCode());
Assert.assertNull(result.getLevel());
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class ProvisioningOperationMonitoringEvaluatorUnitTest method testErrorWithNumberOfDays.
@Test
public void testErrorWithNumberOfDays() {
Mockito.when(provisioningOperationService.count(ArgumentMatchers.any())).thenReturn(10L);
//
IdmMonitoringDto monitoring = new IdmMonitoringDto();
monitoring.setInstanceId("mock");
monitoring.getEvaluatorProperties().put(AbstractDailyMonitoringEvaluator.PARAMETER_NUMBER_OF_DAYS, 2);
IdmMonitoringResultDto result = evaluator.evaluate(monitoring);
//
Assert.assertEquals(AccResultCode.MONITORING_PROVISIONING_OPERATION_ERROR.getCode(), result.getResult().getCode());
Assert.assertNull(result.getLevel());
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class ProvisioningOperationMonitoringEvaluatorUnitTest method testOk.
@Test
public void testOk() {
Mockito.when(provisioningOperationService.count(ArgumentMatchers.any())).thenReturn(0L);
//
IdmMonitoringDto monitoring = new IdmMonitoringDto();
monitoring.setInstanceId("mock");
monitoring.getEvaluatorProperties().put(AbstractDailyMonitoringEvaluator.PARAMETER_NUMBER_OF_DAYS, 2);
IdmMonitoringResultDto result = evaluator.evaluate(monitoring);
//
Assert.assertEquals(CoreResultCode.OK.getCode(), result.getResult().getCode());
}
Aggregations