use of se.riv.itintegration.monitoring.v1.PingForConfigurationResponseType in project webcert by sklintyg.
the class PingForConfigurationResponderImplTest method testPingForConfigurationErrors.
@Test
public void testPingForConfigurationErrors() {
long signatureQueueMeasure = -1;
long nbrUsersMeasure = -1;
when(healthCheck.checkDB()).thenReturn(new HealthStatus(-1, false));
when(healthCheck.checkJMS()).thenReturn(new HealthStatus(-1, false));
when(healthCheck.checkSignatureQueue()).thenReturn(new HealthStatus(signatureQueueMeasure, false));
when(healthCheck.checkIntygstjanst()).thenReturn(new HealthStatus(-1, false));
when(healthCheck.checkPrivatlakarportal()).thenReturn(new HealthStatus(-1, false));
when(healthCheck.checkUptime()).thenReturn(new HealthStatus(-1, false));
when(healthCheck.checkNbrOfUsers()).thenReturn(new HealthStatus(nbrUsersMeasure, false));
PingForConfigurationResponseType res = responder.pingForConfiguration("logicalAddress", new PingForConfigurationType());
assertNotNull(res);
assertNotNull(res.getPingDateTime());
assertEquals(PROJECT_VERSION, res.getVersion());
assertEquals(BUILD_NUMBER, res.getConfiguration().stream().filter(c -> "buildNumber".equals(c.getName())).findAny().get().getValue());
assertEquals(BUILD_TIME, res.getConfiguration().stream().filter(c -> "buildTime".equals(c.getName())).findAny().get().getValue());
assertNotNull(res.getConfiguration().stream().filter(c -> "systemUptime".equals(c.getName())).findAny().get().getValue());
assertEquals("error", res.getConfiguration().stream().filter(c -> "dbStatus".equals(c.getName())).findAny().get().getValue());
assertEquals("error", res.getConfiguration().stream().filter(c -> "jmsStatus".equals(c.getName())).findAny().get().getValue());
assertEquals("no connection", res.getConfiguration().stream().filter(c -> "intygstjanst".equals(c.getName())).findAny().get().getValue());
assertEquals("no connection", res.getConfiguration().stream().filter(c -> "privatlakarportal".equals(c.getName())).findAny().get().getValue());
assertEquals("" + signatureQueueMeasure, res.getConfiguration().stream().filter(c -> "signatureQueueSize".equals(c.getName())).findAny().get().getValue());
assertEquals("" + nbrUsersMeasure, res.getConfiguration().stream().filter(c -> "nbrOfUsers".equals(c.getName())).findAny().get().getValue());
verify(healthCheck).checkDB();
verify(healthCheck).checkJMS();
verify(healthCheck).checkSignatureQueue();
verify(healthCheck).checkIntygstjanst();
verify(healthCheck).checkPrivatlakarportal();
verify(healthCheck).checkUptime();
verify(healthCheck).checkNbrOfUsers();
}
use of se.riv.itintegration.monitoring.v1.PingForConfigurationResponseType in project webcert by sklintyg.
the class PingForConfigurationResponderImplTest method testPingForConfiguration.
@Test
public void testPingForConfiguration() {
long signatureQueueMeasure = 3;
long nbrUsersMeasure = 7;
when(healthCheck.checkDB()).thenReturn(new HealthStatus(1, true));
when(healthCheck.checkJMS()).thenReturn(new HealthStatus(2, true));
when(healthCheck.checkSignatureQueue()).thenReturn(new HealthStatus(signatureQueueMeasure, true));
when(healthCheck.checkIntygstjanst()).thenReturn(new HealthStatus(4, true));
when(healthCheck.checkPrivatlakarportal()).thenReturn(new HealthStatus(5, true));
when(healthCheck.checkUptime()).thenReturn(new HealthStatus(6, true));
when(healthCheck.checkNbrOfUsers()).thenReturn(new HealthStatus(nbrUsersMeasure, true));
PingForConfigurationResponseType res = responder.pingForConfiguration("logicalAddress", new PingForConfigurationType());
assertNotNull(res);
assertNotNull(res.getPingDateTime());
assertEquals(PROJECT_VERSION, res.getVersion());
assertEquals(BUILD_NUMBER, res.getConfiguration().stream().filter(c -> "buildNumber".equals(c.getName())).findAny().get().getValue());
assertEquals(BUILD_TIME, res.getConfiguration().stream().filter(c -> "buildTime".equals(c.getName())).findAny().get().getValue());
assertNotNull(res.getConfiguration().stream().filter(c -> "systemUptime".equals(c.getName())).findAny().get().getValue());
assertEquals("ok", res.getConfiguration().stream().filter(c -> "dbStatus".equals(c.getName())).findAny().get().getValue());
assertEquals("ok", res.getConfiguration().stream().filter(c -> "jmsStatus".equals(c.getName())).findAny().get().getValue());
assertEquals("ok", res.getConfiguration().stream().filter(c -> "intygstjanst".equals(c.getName())).findAny().get().getValue());
assertEquals("ok", res.getConfiguration().stream().filter(c -> "privatlakarportal".equals(c.getName())).findAny().get().getValue());
assertEquals("" + signatureQueueMeasure, res.getConfiguration().stream().filter(c -> "signatureQueueSize".equals(c.getName())).findAny().get().getValue());
assertEquals("" + nbrUsersMeasure, res.getConfiguration().stream().filter(c -> "nbrOfUsers".equals(c.getName())).findAny().get().getValue());
verify(healthCheck).checkDB();
verify(healthCheck).checkJMS();
verify(healthCheck).checkSignatureQueue();
verify(healthCheck).checkIntygstjanst();
verify(healthCheck).checkPrivatlakarportal();
verify(healthCheck).checkUptime();
verify(healthCheck).checkNbrOfUsers();
}
use of se.riv.itintegration.monitoring.v1.PingForConfigurationResponseType in project webcert by sklintyg.
the class HealthCheckServiceImplTest method testCheckIntygstjanst.
@Test
public void testCheckIntygstjanst() {
when(intygstjanstPingForConfiguration.pingForConfiguration(eq(IT_LOGICAL_ADDRESS), any(PingForConfigurationType.class))).thenReturn(new PingForConfigurationResponseType());
HealthStatus res = service.checkIntygstjanst();
assertNotNull(res);
assertTrue(res.isOk());
assertNotNull(res.getMeasurement());
}
use of se.riv.itintegration.monitoring.v1.PingForConfigurationResponseType in project webcert by sklintyg.
the class HealthCheckServiceImpl method pingPrivatlakarportal.
private boolean pingPrivatlakarportal() {
try {
PingForConfigurationType parameters = new PingForConfigurationType();
PingForConfigurationResponseType pingResponse = privatlakarportalPingForConfiguration.pingForConfiguration(ppLogicalAddress, parameters);
return pingResponse != null;
} catch (Exception e) {
LOG.error("pingPrivatlakarportal failed with exception: " + e.getMessage());
return false;
}
}
use of se.riv.itintegration.monitoring.v1.PingForConfigurationResponseType in project webcert by sklintyg.
the class PingForConfigurationResponderImpl method addConfiguration.
private void addConfiguration(PingForConfigurationResponseType response, String name, String value) {
ConfigurationType conf = new ConfigurationType();
conf.setName(name);
conf.setValue(value);
response.getConfiguration().add(conf);
}
Aggregations