use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class IdmMonitoringResultControllerRestTest method prepareDto.
@Override
protected IdmMonitoringResultDto prepareDto() {
IdmMonitoringDto monitoring = new IdmMonitoringDto();
monitoring.setEvaluatorType("mock");
monitoring.setInstanceId("mock");
monitoring = monitoringService.save(monitoring);
//
IdmMonitoringResultDto dto = new IdmMonitoringResultDto();
dto.setMonitoring(monitoring.getId());
dto.setEvaluatorType("mock");
dto.setInstanceId("mock");
dto.setResult(new OperationResultDto(OperationState.BLOCKED));
//
return dto;
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class DefaultMonitoringManagerIntegrationTest method testReferentiralIntegrity.
@Test
public void testReferentiralIntegrity() {
IdmMonitoringDto monitoring = new IdmMonitoringDto();
monitoring.setCheckPeriod(0L);
monitoring.setEvaluatorType(AutowireHelper.getTargetType(h2DatabaseMonitoringEvaluator));
monitoring.setInstanceId(configurationService.getInstanceId());
monitoring = monitoringService.save(monitoring);
//
manager.scheduleExecute();
//
IdmMonitoringResultFilter filter = new IdmMonitoringResultFilter();
filter.setMonitoring(monitoring.getId());
//
List<IdmMonitoringResultDto> results = monitoringResultService.find(filter, null).getContent();
// executed only once => 0 check period
Assert.assertEquals(1, results.size());
//
monitoringService.delete(monitoring);
//
results = monitoringResultService.find(filter, null).getContent();
Assert.assertTrue(results.isEmpty());
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class DefaultMonitoringManagerIntegrationTest method testNotExecuteBeforeExecuteDate.
@Test
public void testNotExecuteBeforeExecuteDate() {
IdmMonitoringDto monitoring = new IdmMonitoringDto();
monitoring.setCheckPeriod(0L);
monitoring.setEvaluatorType(AutowireHelper.getTargetType(h2DatabaseMonitoringEvaluator));
monitoring.setInstanceId(configurationService.getInstanceId());
monitoring.setExecuteDate(ZonedDateTime.now().plusHours(1));
monitoring = monitoringService.save(monitoring);
try {
//
manager.scheduleExecute();
//
IdmMonitoringResultFilter filter = new IdmMonitoringResultFilter();
filter.setMonitoring(monitoring.getId());
//
List<IdmMonitoringResultDto> results = monitoringResultService.find(filter, null).getContent();
// executed only once => 0 check period
Assert.assertTrue(results.isEmpty());
} finally {
monitoringService.delete(monitoring);
}
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class DefaultMonitoringManagerIntegrationTest method testNotExecuteDisabledMonitoring.
@Test
public void testNotExecuteDisabledMonitoring() {
IdmMonitoringDto monitoring = new IdmMonitoringDto();
monitoring.setCheckPeriod(0L);
monitoring.setEvaluatorType(AutowireHelper.getTargetType(h2DatabaseMonitoringEvaluator));
monitoring.setInstanceId(configurationService.getInstanceId());
monitoring.setDisabled(true);
monitoring = monitoringService.save(monitoring);
try {
//
manager.scheduleExecute();
//
IdmMonitoringResultFilter filter = new IdmMonitoringResultFilter();
filter.setMonitoring(monitoring.getId());
//
List<IdmMonitoringResultDto> results = monitoringResultService.find(filter, null).getContent();
// executed only once => 0 check period
Assert.assertTrue(results.isEmpty());
} finally {
monitoringService.delete(monitoring);
}
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class DefaultMonitoringManagerIntegrationTest method testExecuteMonitoringAfterSave.
@Test
@Transactional
public void testExecuteMonitoringAfterSave() {
IdmMonitoringDto monitoring = new IdmMonitoringDto();
monitoring.setCheckPeriod(0L);
monitoring.setEvaluatorType(AutowireHelper.getTargetType(h2DatabaseMonitoringEvaluator));
monitoring.setInstanceId(configurationService.getInstanceId());
monitoring.setDisabled(false);
//
MonitoringEvent event = new MonitoringEvent(MonitoringEventType.CREATE, monitoring);
event.setPriority(PriorityType.HIGH);
monitoring = monitoringService.publish(event).getContent();
try {
IdmMonitoringResultFilter filter = new IdmMonitoringResultFilter();
filter.setMonitoring(monitoring.getId());
List<IdmMonitoringResultDto> results = monitoringResultService.find(filter, null).getContent();
Assert.assertFalse(results.isEmpty());
} finally {
monitoringService.delete(monitoring);
}
}
Aggregations