Search in sources :

Example 1 with IdmMonitoringDto

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();
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult)

Example 2 with IdmMonitoringDto

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);
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) UUID(java.util.UUID)

Example 3 with IdmMonitoringDto

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);
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) IdmMonitoringResultDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto)

Example 4 with IdmMonitoringDto

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());
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) Test(org.junit.Test) AbstractReadWriteDtoControllerRestTest(eu.bcvsolutions.idm.core.api.rest.AbstractReadWriteDtoControllerRestTest)

Example 5 with IdmMonitoringDto

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;
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto)

Aggregations

IdmMonitoringDto (eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto)73 Test (org.junit.Test)46 IdmMonitoringResultDto (eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto)45 AbstractUnitTest (eu.bcvsolutions.idm.test.api.AbstractUnitTest)24 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)16 UUID (java.util.UUID)13 IdmMonitoringResultFilter (eu.bcvsolutions.idm.core.monitoring.api.dto.filter.IdmMonitoringResultFilter)10 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)6 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)6 SysSyncConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter)6 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)6 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)5 SysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncConfigDto)5 ConfigurationMap (eu.bcvsolutions.idm.core.api.domain.ConfigurationMap)5 OperationResultDto (eu.bcvsolutions.idm.core.api.dto.OperationResultDto)5 AbstractReadWriteDtoControllerRestTest (eu.bcvsolutions.idm.core.api.rest.AbstractReadWriteDtoControllerRestTest)5 IdmMonitoringFilter (eu.bcvsolutions.idm.core.monitoring.api.dto.filter.IdmMonitoringFilter)5 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)4 AutowireHelper (eu.bcvsolutions.idm.core.api.utils.AutowireHelper)4 IdmMonitoringService (eu.bcvsolutions.idm.core.monitoring.api.service.IdmMonitoringService)4