use of se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus 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.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus 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.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus in project webcert by sklintyg.
the class HealthCheckApiController method checkIntygstjanst.
@GET
@Path("/intygstjanst")
@Produces(MediaType.APPLICATION_XML)
public Response checkIntygstjanst() {
HealthStatus status = healthCheck.checkIntygstjanst();
String xmlResponse = buildXMLResponse(status);
return Response.ok(xmlResponse).build();
}
use of se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus in project webcert by sklintyg.
the class HealthCheckApiController method checkJMS.
@GET
@Path("/jms")
@Produces(MediaType.APPLICATION_XML)
public Response checkJMS() {
HealthStatus status = healthCheck.checkJMS();
String xmlResponse = buildXMLResponse(status);
return Response.ok(xmlResponse).build();
}
use of se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus in project webcert by sklintyg.
the class HealthCheckApiController method checkPrivatlakarportal.
@GET
@Path("/privatlakarportal")
@Produces(MediaType.APPLICATION_XML)
public Response checkPrivatlakarportal() {
HealthStatus status = healthCheck.checkPrivatlakarportal();
String xmlResponse = buildXMLResponse(status);
return Response.ok(xmlResponse).build();
}
Aggregations