use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class MonitoringResultRunBulkAction method processDto.
@Override
protected OperationResult processDto(IdmMonitoringResultDto dto) {
IdmMonitoringDto monitoring = getLookupService().lookupEmbeddedDto(dto, IdmMonitoringResult_.monitoring);
//
// preset parameters by result - monitoring configuration cen be changed in the meantime
monitoring.setEvaluatorProperties(dto.getEvaluatorProperties());
//
manager.execute(monitoring, IdmBasePermission.EXECUTE);
//
return new OperationResult.Builder(OperationState.EXECUTED).build();
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class MonitoringDeleteProcessor method process.
@Override
public EventResult<IdmMonitoringDto> process(EntityEvent<IdmMonitoringDto> event) {
IdmMonitoringDto monitoring = event.getContent();
UUID monitoringId = monitoring.getId();
Assert.notNull(monitoringId, "Monitoring identifier is required.");
//
monitoringResultRepository.deleteByMonitoring(monitoringId);
//
service.deleteInternal(monitoring);
//
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class MonitoringResultRunBulkActionIntegrationTest method createDto.
protected IdmMonitoringResultDto createDto() {
IdmMonitoringDto monitoring = new IdmMonitoringDto();
monitoring.setCheckPeriod(0L);
monitoring.setEvaluatorType(AutowireHelper.getTargetType(h2DatabaseMonitoringEvaluator));
monitoring.setInstanceId(configurationService.getInstanceId());
monitoring = monitoringService.save(monitoring);
//
IdmMonitoringResultDto dto = new IdmMonitoringResultDto();
dto.setMonitoring(monitoring.getId());
dto.setEvaluatorType(AutowireHelper.getTargetType(h2DatabaseMonitoringEvaluator));
dto.setInstanceId(configurationService.getInstanceId());
dto.setResult(new OperationResultDto(OperationState.BLOCKED));
//
return monitoringResultService.save(dto);
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class IdmMonitoringControllerRestTest method testExecute.
@Test
public void testExecute() throws Exception {
IdmMonitoringDto monitoring = new IdmMonitoringDto();
monitoring.setCheckPeriod(0L);
monitoring.setEvaluatorType(AutowireHelper.getTargetType(h2DatabaseMonitoringEvaluator));
monitoring.setInstanceId(configurationService.getInstanceId());
//
monitoring = service.save(monitoring);
//
String response = getMockMvc().perform(put(String.format("%s/execute", getDetailUrl(monitoring.getId()))).with(authentication(getAdminAuthentication())).contentType(TestHelper.HAL_CONTENT_TYPE)).andExpect(status().isCreated()).andReturn().getResponse().getContentAsString();
Assert.assertNotNull(response);
//
getMockMvc().perform(put(String.format("%s/execute", getDetailUrl(UUID.randomUUID()))).with(authentication(getAdminAuthentication())).contentType(TestHelper.HAL_CONTENT_TYPE)).andExpect(status().isNotFound());
}
use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.
the class IdmMonitoringControllerRestTest method prepareDto.
@Override
protected IdmMonitoringDto prepareDto() {
IdmMonitoringDto dto = new IdmMonitoringDto();
dto.setCode(getHelper().createName());
dto.setEvaluatorType("mock");
dto.setInstanceId("mock");
//
return dto;
}
Aggregations