Search in sources :

Example 21 with HealthStatus

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

the class HealthCheckServiceImplTest method testCheckJMSException.

@Test
public void testCheckJMSException() throws JMSException {
    when(connectionFactory.createConnection()).thenThrow(new JMSException(""));
    HealthStatus res = service.checkJMS();
    assertNotNull(res);
    assertFalse(res.isOk());
    assertNotNull(res.getMeasurement());
}
Also used : HealthStatus(se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus) JMSException(javax.jms.JMSException) Test(org.junit.Test)

Example 22 with HealthStatus

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

the class HealthCheckServiceImplTest method testCheckDB.

@Test
public void testCheckDB() {
    Query query = mock(Query.class);
    when(query.getSingleResult()).thenReturn(mock(Time.class));
    when(entityManager.createNativeQuery(anyString())).thenReturn(query);
    HealthStatus res = service.checkDB();
    assertNotNull(res);
    assertTrue(res.isOk());
    assertNotNull(res.getMeasurement());
}
Also used : Query(javax.persistence.Query) HealthStatus(se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus) Time(java.sql.Time) Test(org.junit.Test)

Example 23 with HealthStatus

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

the class HealthCheckServiceImplTest method testCheckSignatureQueue.

@SuppressWarnings("unchecked")
@Test
public void testCheckSignatureQueue() {
    final int queueDepth = 5;
    when(jmsCertificateSenderTemplate.browse(any(BrowserCallback.class))).thenReturn(queueDepth);
    HealthStatus res = service.checkSignatureQueue();
    assertNotNull(res);
    assertTrue(res.isOk());
    assertEquals(queueDepth, res.getMeasurement());
}
Also used : BrowserCallback(org.springframework.jms.core.BrowserCallback) HealthStatus(se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus) Test(org.junit.Test)

Example 24 with HealthStatus

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

the class HealthCheckServiceImplTest method testCheckDBTimestampNull.

@Test
public void testCheckDBTimestampNull() {
    Query query = mock(Query.class);
    when(entityManager.createNativeQuery(anyString())).thenReturn(query);
    HealthStatus res = service.checkDB();
    assertNotNull(res);
    assertFalse(res.isOk());
    assertNotNull(res.getMeasurement());
}
Also used : Query(javax.persistence.Query) HealthStatus(se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus) Test(org.junit.Test)

Example 25 with HealthStatus

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

the class HealthCheckServiceImplTest method testCheckUptime.

@Test
public void testCheckUptime() {
    HealthStatus res = service.checkUptime();
    assertNotNull(res);
    assertTrue(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