Search in sources :

Example 51 with IdmMonitoringDto

use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.

the class DemoAdminMonitoringEvaluatorUnitTest method testDevelopmentWithDemoAdmin.

@Test
public void testDevelopmentWithDemoAdmin() {
    Mockito.when(applicationConfiguration.isDevelopment()).thenReturn(true);
    Mockito.when(lookupService.lookupDto(IdmIdentityDto.class, InitAdminIdentityProcessor.ADMIN_USERNAME)).thenReturn(new IdmIdentityDto(InitAdminIdentityProcessor.ADMIN_USERNAME));
    Mockito.when(authenticationManager.validate(ArgumentMatchers.any())).thenReturn(true);
    // 
    IdmMonitoringDto monitoring = new IdmMonitoringDto();
    monitoring.setInstanceId("mock");
    IdmMonitoringResultDto result = evaluator.evaluate(monitoring);
    // 
    Assert.assertEquals(CoreResultCode.MONITORING_DEMO_ADMIN_WARNING.getCode(), result.getResult().getCode());
    Assert.assertNull(result.getLevel());
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmMonitoringResultDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

Example 52 with IdmMonitoringDto

use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.

the class H2DatabaseMonitoringEvaluatorUnitTest method testSuccess.

@Test
public void testSuccess() {
    Mockito.when(flywayMigrationStrategy.resolveDbName(dataSource)).thenReturn(IdmFlywayMigrationStrategy.POSTGRESQL_DBNAME);
    // 
    IdmMonitoringDto monitoring = new IdmMonitoringDto();
    monitoring.setInstanceId("mock");
    IdmMonitoringResultDto result = evaluator.evaluate(monitoring);
    // 
    Assert.assertEquals(CoreResultCode.MONITORING_H2_DATABASE_SUCCESS.getCode(), result.getResult().getCode());
    Assert.assertEquals(IdmFlywayMigrationStrategy.POSTGRESQL_DBNAME, result.getValue());
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) IdmMonitoringResultDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest) Test(org.junit.Test)

Example 53 with IdmMonitoringDto

use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.

the class H2DatabaseMonitoringEvaluatorUnitTest method testProductionWithH2.

@Test
public void testProductionWithH2() {
    Mockito.when(applicationConfiguration.isProduction()).thenReturn(true);
    Mockito.when(flywayMigrationStrategy.resolveDbName(dataSource)).thenReturn(IdmFlywayMigrationStrategy.H2_DBNAME);
    // 
    IdmMonitoringDto monitoring = new IdmMonitoringDto();
    monitoring.setInstanceId("mock");
    IdmMonitoringResultDto result = evaluator.evaluate(monitoring);
    // 
    Assert.assertEquals(CoreResultCode.MONITORING_H2_DATABASE_ERROR.getCode(), result.getResult().getCode());
    Assert.assertEquals(IdmFlywayMigrationStrategy.H2_DBNAME, result.getValue());
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) IdmMonitoringResultDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest) Test(org.junit.Test)

Example 54 with IdmMonitoringDto

use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.

the class H2DatabaseMonitoringEvaluatorUnitTest method testDevelopmentWithH2.

@Test
public void testDevelopmentWithH2() {
    Mockito.when(applicationConfiguration.isProduction()).thenReturn(false);
    Mockito.when(applicationConfiguration.getStage()).thenReturn(ApplicationConfiguration.STAGE_DEVELOPMENT);
    Mockito.when(flywayMigrationStrategy.resolveDbName(dataSource)).thenReturn(IdmFlywayMigrationStrategy.H2_DBNAME);
    // 
    IdmMonitoringDto monitoring = new IdmMonitoringDto();
    monitoring.setInstanceId("mock");
    IdmMonitoringResultDto result = evaluator.evaluate(monitoring);
    // 
    Assert.assertEquals(CoreResultCode.MONITORING_H2_DATABASE_WARNING.getCode(), result.getResult().getCode());
    Assert.assertEquals(IdmFlywayMigrationStrategy.H2_DBNAME, result.getValue());
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) IdmMonitoringResultDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest) Test(org.junit.Test)

Example 55 with IdmMonitoringDto

use of eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto in project CzechIdMng by bcvsolutions.

the class LoggingEventMonitoringEvaluatorUnitTest method testError.

@Test
public void testError() {
    Mockito.when(loggingEventService.count(ArgumentMatchers.any())).thenReturn(10L);
    // 
    IdmMonitoringDto monitoring = new IdmMonitoringDto();
    monitoring.setInstanceId("mock");
    IdmMonitoringResultDto result = evaluator.evaluate(monitoring);
    // 
    Assert.assertEquals(CoreResultCode.MONITORING_LOGGING_EVENT_ERROR.getCode(), result.getResult().getCode());
    Assert.assertNull(result.getLevel());
}
Also used : IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) IdmMonitoringResultDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringResultDto) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest) Test(org.junit.Test)

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