Search in sources :

Example 6 with PingForConfigurationResponseType

use of se.riv.itintegration.monitoring.v1.PingForConfigurationResponseType in project webcert by sklintyg.

the class PingForConfigurationResponderImpl method pingForConfiguration.

// CHECKSTYLE:OFF LineLength
@Override
public PingForConfigurationResponseType pingForConfiguration(@WebParam(partName = "LogicalAddress", name = "LogicalAddress", targetNamespace = "urn:riv:itintegration:registry:1", header = true) String logicalAddress, @WebParam(partName = "parameters", name = "PingForConfiguration", targetNamespace = "urn:riv:itintegration:monitoring:PingForConfigurationResponder:1") PingForConfigurationType parameters) {
    // CHECKSTYLE:ON LineLength
    PingForConfigurationResponseType response = new PingForConfigurationResponseType();
    response.setPingDateTime(new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()));
    LOG.info("Version String: " + projectVersion);
    response.setVersion(projectVersion);
    HealthStatus db = healthCheck.checkDB();
    HealthStatus jms = healthCheck.checkJMS();
    HealthStatus queueSize = healthCheck.checkSignatureQueue();
    HealthStatus pingIntygstjanst = healthCheck.checkIntygstjanst();
    HealthStatus pingPrivatlakarportal = healthCheck.checkPrivatlakarportal();
    HealthStatus uptime = healthCheck.checkUptime();
    HealthStatus nbrOfUsers = healthCheck.checkNbrOfUsers();
    addConfiguration(response, "buildNumber", buildNumberString);
    addConfiguration(response, "buildTime", buildTimeString);
    addConfiguration(response, "systemUptime", DurationFormatUtils.formatDurationWords(uptime.getMeasurement(), true, true));
    addConfiguration(response, "dbStatus", db.isOk() ? "ok" : "error");
    addConfiguration(response, "jmsStatus", jms.isOk() ? "ok" : "error");
    addConfiguration(response, "intygstjanst", pingIntygstjanst.isOk() ? "ok" : "no connection");
    addConfiguration(response, "privatlakarportal", pingPrivatlakarportal.isOk() ? "ok" : "no connection");
    addConfiguration(response, "signatureQueueSize", Long.toString(queueSize.getMeasurement()));
    addConfiguration(response, "nbrOfUsers", Long.toString(nbrOfUsers.getMeasurement()));
    return response;
}
Also used : PingForConfigurationResponseType(se.riv.itintegration.monitoring.v1.PingForConfigurationResponseType) HealthStatus(se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 7 with PingForConfigurationResponseType

use of se.riv.itintegration.monitoring.v1.PingForConfigurationResponseType in project webcert by sklintyg.

the class HealthCheckServiceImplTest method testCheckPrivatlakarportal.

@Test
public void testCheckPrivatlakarportal() {
    when(privatlakarportalPingForConfiguration.pingForConfiguration(eq(PP_LOGICAL_ADDRESS), any(PingForConfigurationType.class))).thenReturn(new PingForConfigurationResponseType());
    HealthStatus res = service.checkPrivatlakarportal();
    assertNotNull(res);
    assertTrue(res.isOk());
    assertNotNull(res.getMeasurement());
    verify(privatlakarportalPingForConfiguration).pingForConfiguration(eq(PP_LOGICAL_ADDRESS), any(PingForConfigurationType.class));
}
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 8 with PingForConfigurationResponseType

use of se.riv.itintegration.monitoring.v1.PingForConfigurationResponseType in project webcert by sklintyg.

the class HealthCheckServiceImpl method pingIntygstjanst.

private boolean pingIntygstjanst() {
    try {
        PingForConfigurationType parameters = new PingForConfigurationType();
        PingForConfigurationResponseType pingResponse = intygstjanstPingForConfiguration.pingForConfiguration(itLogicalAddress, parameters);
        return pingResponse != null;
    } catch (Exception e) {
        LOG.error("pingIntygstjanst failed with exception: " + e.getMessage());
        return false;
    }
}
Also used : PingForConfigurationType(se.riv.itintegration.monitoring.v1.PingForConfigurationType) PingForConfigurationResponseType(se.riv.itintegration.monitoring.v1.PingForConfigurationResponseType) JMSException(javax.jms.JMSException)

Aggregations

PingForConfigurationResponseType (se.riv.itintegration.monitoring.v1.PingForConfigurationResponseType)7 PingForConfigurationType (se.riv.itintegration.monitoring.v1.PingForConfigurationType)7 HealthStatus (se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus)5 Test (org.junit.Test)4 JMSException (javax.jms.JMSException)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 ConfigurationType (se.riv.itintegration.monitoring.v1.ConfigurationType)1