Search in sources :

Example 1 with PdlLogMessage

use of se.inera.intyg.infra.logmessages.PdlLogMessage in project webcert by sklintyg.

the class LogResource method getLogMessage.

@GET
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public PdlLogMessage getLogMessage() {
    long originalTimeout = jmsTemplate.getReceiveTimeout();
    try {
        jmsTemplate.setReceiveTimeout(timeOut);
        Message message = jmsTemplate.receive(queue);
        String body = ((TextMessage) message).getText();
        return objectMapper.readValue(body, PdlLogMessage.class);
    } catch (JMSException e) {
        throw new RuntimeException("Could not retreive log message: " + e.getMessage(), e);
    } catch (IOException e) {
        throw new RuntimeException("Could not parse log message: " + e.getMessage(), e);
    } finally {
        jmsTemplate.setReceiveTimeout(originalTimeout);
    }
}
Also used : PdlLogMessage(se.inera.intyg.infra.logmessages.PdlLogMessage) IOException(java.io.IOException)

Example 2 with PdlLogMessage

use of se.inera.intyg.infra.logmessages.PdlLogMessage in project webcert by sklintyg.

the class IntygDeleteMessage method build.

public static PdlLogMessage build(String intygId) {
    PdlLogMessage pdlLogMessage = new PdlLogMessage(ActivityType.DELETE);
    pdlLogMessage.setActivityLevel(intygId);
    return pdlLogMessage;
}
Also used : PdlLogMessage(se.inera.intyg.infra.logmessages.PdlLogMessage)

Example 3 with PdlLogMessage

use of se.inera.intyg.infra.logmessages.PdlLogMessage in project webcert by sklintyg.

the class IntygPrintMessage method build.

public static PdlLogMessage build(String intygId, String printMethod) {
    PdlLogMessage pdlLogMessage = new PdlLogMessage(ActivityType.PRINT);
    pdlLogMessage.setActivityLevel(intygId);
    pdlLogMessage.setActivityArgs(printMethod);
    return pdlLogMessage;
}
Also used : PdlLogMessage(se.inera.intyg.infra.logmessages.PdlLogMessage)

Example 4 with PdlLogMessage

use of se.inera.intyg.infra.logmessages.PdlLogMessage in project webcert by sklintyg.

the class LogMessagePopulatorImplTest method buildPdlLogMessage.

private PdlLogMessage buildPdlLogMessage(String activityArgs) {
    PdlLogMessage pdlLogMessage = new PdlLogMessage();
    pdlLogMessage.setActivityArgs(activityArgs);
    return pdlLogMessage;
}
Also used : PdlLogMessage(se.inera.intyg.infra.logmessages.PdlLogMessage)

Example 5 with PdlLogMessage

use of se.inera.intyg.infra.logmessages.PdlLogMessage in project webcert by sklintyg.

the class LogMessagePopulatorImplTest method testActivityArgsAppendedFromAdditionalInfoWhenActivityArgsExists.

@Test
public void testActivityArgsAppendedFromAdditionalInfoWhenActivityArgsExists() {
    PdlLogMessage logMessage = testee.populateLogMessage(buildLogRequest(ADDITIONAL_INFO), buildPdlLogMessage(ACTIVITY_ARGS), buildLogUser());
    assertEquals(ACTIVITY_ARGS + ". " + ADDITIONAL_INFO, logMessage.getActivityArgs());
}
Also used : PdlLogMessage(se.inera.intyg.infra.logmessages.PdlLogMessage) Test(org.junit.Test)

Aggregations

PdlLogMessage (se.inera.intyg.infra.logmessages.PdlLogMessage)16 Test (org.junit.Test)5 IOException (java.io.IOException)1 Session (javax.jms.Session)1 MessageCreator (org.springframework.jms.core.MessageCreator)1 LogRequest (se.inera.intyg.webcert.web.service.log.dto.LogRequest)1