@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()); }
@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; }
SendMessageToCareResponderImpl implements SendMessageToCareResponderInterface { @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; } }
SendMessageToCareResponderImpl implements SendMessageToCareResponderInterface { @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; }  }
SendMessageToCareResponderImpl implements SendMessageToCareResponderInterface { @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; }  @Override SendMessageToCareResponseType sendMessageToCare(String logicalAddress, SendMessageToCareType request); }
SendMessageToCareResponderImpl implements SendMessageToCareResponderInterface { @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; }  @Override SendMessageToCareResponseType sendMessageToCare(String logicalAddress, SendMessageToCareType request);  }