Search in sources :

Example 56 with IdmMonitoringDto

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;
}
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 57 with IdmMonitoringDto

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());
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) IdmMonitoringResultFilter(eu.bcvsolutions.idm.core.monitoring.api.dto.filter.IdmMonitoringResultFilter) IdmMonitoringResultDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 58 with IdmMonitoringDto

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);
    }
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) IdmMonitoringResultFilter(eu.bcvsolutions.idm.core.monitoring.api.dto.filter.IdmMonitoringResultFilter) IdmMonitoringResultDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 59 with IdmMonitoringDto

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);
    }
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) IdmMonitoringResultFilter(eu.bcvsolutions.idm.core.monitoring.api.dto.filter.IdmMonitoringResultFilter) IdmMonitoringResultDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 60 with IdmMonitoringDto

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);
    }
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) MonitoringEvent(eu.bcvsolutions.idm.core.monitoring.api.event.MonitoringEvent) IdmMonitoringResultFilter(eu.bcvsolutions.idm.core.monitoring.api.dto.filter.IdmMonitoringResultFilter) IdmMonitoringResultDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Transactional(org.springframework.transaction.annotation.Transactional)

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