Search in sources :

Example 6 with HealthStatus

use of se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus in project webcert by sklintyg.

the class HealthCheckServiceImplTest method testCheckPrivatlakarportalNullResponse.

@Test
public void testCheckPrivatlakarportalNullResponse() {
    when(privatlakarportalPingForConfiguration.pingForConfiguration(eq(PP_LOGICAL_ADDRESS), any(PingForConfigurationType.class))).thenReturn(null);
    HealthStatus res = service.checkPrivatlakarportal();
    assertNotNull(res);
    assertFalse(res.isOk());
    assertNotNull(res.getMeasurement());
}
Also used : PingForConfigurationType(se.riv.itintegration.monitoring.v1.PingForConfigurationType) HealthStatus(se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus) Test(org.junit.Test)

Example 7 with HealthStatus

use of se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus in project webcert by sklintyg.

the class HealthCheckServiceImplTest method testCheckNbrOfUsersException.

@Test
public void testCheckNbrOfUsersException() {
    when(sessionRegistry.getAllPrincipals()).thenThrow(new RuntimeException());
    HealthStatus res = service.checkNbrOfUsers();
    assertNotNull(res);
    assertFalse(res.isOk());
    assertEquals(-1, res.getMeasurement());
}
Also used : HealthStatus(se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus) Test(org.junit.Test)

Example 8 with HealthStatus

use of se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus in project webcert by sklintyg.

the class HealthCheckServiceImplTest method testCheckPrivatlakarportalException.

@Test
public void testCheckPrivatlakarportalException() {
    when(privatlakarportalPingForConfiguration.pingForConfiguration(eq(PP_LOGICAL_ADDRESS), any(PingForConfigurationType.class))).thenThrow(new WebServiceException());
    HealthStatus res = service.checkPrivatlakarportal();
    assertNotNull(res);
    assertFalse(res.isOk());
    assertNotNull(res.getMeasurement());
}
Also used : PingForConfigurationType(se.riv.itintegration.monitoring.v1.PingForConfigurationType) WebServiceException(javax.xml.ws.WebServiceException) HealthStatus(se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus) Test(org.junit.Test)

Example 9 with HealthStatus

use of se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus 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());
}
Also used : PingForConfigurationType(se.riv.itintegration.monitoring.v1.PingForConfigurationType) PingForConfigurationResponseType(se.riv.itintegration.monitoring.v1.PingForConfigurationResponseType) HealthStatus(se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus) Test(org.junit.Test)

Example 10 with HealthStatus

use of se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus in project webcert by sklintyg.

the class HealthCheckServiceImplTest method testCheckDBQueryException.

@Test
public void testCheckDBQueryException() {
    HealthStatus res = service.checkDB();
    assertNotNull(res);
    assertFalse(res.isOk());
    assertNotNull(res.getMeasurement());
}
Also used : HealthStatus(se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus) Test(org.junit.Test)

Aggregations

HealthStatus (se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus)30 Test (org.junit.Test)18 PingForConfigurationType (se.riv.itintegration.monitoring.v1.PingForConfigurationType)8 GET (javax.ws.rs.GET)6 Path (javax.ws.rs.Path)6 Produces (javax.ws.rs.Produces)6 PingForConfigurationResponseType (se.riv.itintegration.monitoring.v1.PingForConfigurationResponseType)5 Stopwatch (com.google.common.base.Stopwatch)4 JMSException (javax.jms.JMSException)2 Query (javax.persistence.Query)2 WebServiceException (javax.xml.ws.WebServiceException)2 BrowserCallback (org.springframework.jms.core.BrowserCallback)2 Time (java.sql.Time)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Connection (javax.jms.Connection)1 Transactional (org.springframework.transaction.annotation.Transactional)1