use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToCare.v2.SendMessageToCareResponseType in project webcert by sklintyg.
the class SendMessageToCareResponderImplTest method testSendRequestToService.
@Test
public void testSendRequestToService() throws WebCertServiceException {
when(arendeService.processIncomingMessage(any())).thenReturn(new Arende());
SendMessageToCareResponseType response = responder.sendMessageToCare(DEFAULT_LOGICAL_ADDRESS, createNewRequest());
assertNotNull(response.getResult());
assertEquals(response.getResult().getResultCode(), ResultCodeType.OK);
}
use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToCare.v2.SendMessageToCareResponseType in project webcert by sklintyg.
the class SendMessageToCareResponderImplTest method testSendRequestToServiceFailedNotFound.
@Test
public void testSendRequestToServiceFailedNotFound() throws WebCertServiceException {
when(arendeService.processIncomingMessage(any())).thenThrow(new WebCertServiceException(WebCertServiceErrorCodeEnum.DATA_NOT_FOUND, ""));
SendMessageToCareResponseType response = responder.sendMessageToCare(DEFAULT_LOGICAL_ADDRESS, createNewRequest());
assertNotNull(response.getResult());
assertEquals(ResultCodeType.ERROR, response.getResult().getResultCode());
assertEquals(ErrorIdType.VALIDATION_ERROR, response.getResult().getErrorId());
}
use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToCare.v2.SendMessageToCareResponseType in project webcert by sklintyg.
the class SendMessageToCareResponderImplTest method testSendRequestToServiceFailedNotSigned.
@Test
public void testSendRequestToServiceFailedNotSigned() throws WebCertServiceException {
when(arendeService.processIncomingMessage(any())).thenThrow(new WebCertServiceException(WebCertServiceErrorCodeEnum.INVALID_STATE, ""));
SendMessageToCareResponseType response = responder.sendMessageToCare(DEFAULT_LOGICAL_ADDRESS, createNewRequest());
assertNotNull(response.getResult());
assertEquals(ResultCodeType.ERROR, response.getResult().getResultCode());
assertEquals(ErrorIdType.VALIDATION_ERROR, response.getResult().getErrorId());
}
use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToCare.v2.SendMessageToCareResponseType in project webcert by sklintyg.
the class SendMessageToCareResponderImpl method sendMessageToCare.
@Override
public SendMessageToCareResponseType sendMessageToCare(String logicalAddress, SendMessageToCareType request) {
LOG.debug("Received new message to care");
SendMessageToCareResponseType response = new SendMessageToCareResponseType();
ResultType result = new ResultType();
try {
arendeService.processIncomingMessage(ArendeConverter.convert(request));
result.setResultCode(ResultCodeType.OK);
} catch (WebCertServiceException e) {
result.setResultCode(ResultCodeType.ERROR);
switch(e.getErrorCode()) {
case INVALID_STATE:
case DATA_NOT_FOUND:
case EXTERNAL_SYSTEM_PROBLEM:
result.setErrorId(ErrorIdType.VALIDATION_ERROR);
result.setResultText(e.getMessage());
LOG.warn("{}: {}", e.getErrorCode().name(), e.getMessage());
break;
default:
result.setErrorId(ErrorIdType.APPLICATION_ERROR);
result.setResultText(e.getMessage());
LOG.error("Could not process incoming message to care. Cause is: {}", e.getMessage());
break;
}
}
response.setResult(result);
return response;
}
use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToCare.v2.SendMessageToCareResponseType in project webcert by sklintyg.
the class SendMessageToCareResponderImplTest method testSendRequestToServiceFailed.
@Test
public void testSendRequestToServiceFailed() throws WebCertServiceException {
when(arendeService.processIncomingMessage(any())).thenThrow(new WebCertServiceException(WebCertServiceErrorCodeEnum.INTERNAL_PROBLEM, ""));
SendMessageToCareResponseType response = responder.sendMessageToCare(DEFAULT_LOGICAL_ADDRESS, createNewRequest());
assertNotNull(response.getResult());
assertEquals(ResultCodeType.ERROR, response.getResult().getResultCode());
assertEquals(ErrorIdType.APPLICATION_ERROR, response.getResult().getErrorId());
}
Aggregations