@Test public void testCheckConditionWhenContentTypeIsFastinfosetShouldReturnTrue() throws SaxonApiException { parameterList.addParameter(new Parameter("xquery", QUERY)); given(request.getHeader(CONTENT_TYPE_HEADER)).willReturn(FASTINFOSET_CONTENT); given(request.getBody()).willReturn(BODY); given(queryExpressionEvaluator.evaluateXQuery(BODY, QUERY)).willReturn(XML_DECLARATION + "true"); boolean actual = underTest.checkCondition(request, parameterList); assertEquals(actual, true); }
@Override public boolean checkCondition(final WilmaHttpRequest request, final ParameterList parameterList) { List<Parameter> params = parameterList.getAllParameters(); boolean result = false; if (params.size() == 1) { String contentType = request.getHeader(CONTENT_TYPE_HEADER); if (contentType != null && (contentType.contains(XML_CONTENT) || FASTINFOSET_CONTENT.equals(contentType))) { try { Parameter paramater = params.iterator().next(); String value = paramater.getValue(); result = evaluateCondition(request.getBody(), value); } catch (SaxonApiException e) { throw new ConditionEvaluationFailedException("XQuery evaluation failed at request: " + request.getWilmaMessageLoggerId(), e); } } } else { throw new ConditionEvaluationFailedException("Please provide exactly one parameter in Stub Configuration!"); } return result; }
CustomXQueryBodyChecker implements ConditionChecker { @Override public boolean checkCondition(final WilmaHttpRequest request, final ParameterList parameterList) { List<Parameter> params = parameterList.getAllParameters(); boolean result = false; if (params.size() == 1) { String contentType = request.getHeader(CONTENT_TYPE_HEADER); if (contentType != null && (contentType.contains(XML_CONTENT) || FASTINFOSET_CONTENT.equals(contentType))) { try { Parameter paramater = params.iterator().next(); String value = paramater.getValue(); result = evaluateCondition(request.getBody(), value); } catch (SaxonApiException e) { throw new ConditionEvaluationFailedException("XQuery evaluation failed at request: " + request.getWilmaMessageLoggerId(), e); } } } else { throw new ConditionEvaluationFailedException("Please provide exactly one parameter in Stub Configuration!"); } return result; } }
CustomXQueryBodyChecker implements ConditionChecker { @Override public boolean checkCondition(final WilmaHttpRequest request, final ParameterList parameterList) { List<Parameter> params = parameterList.getAllParameters(); boolean result = false; if (params.size() == 1) { String contentType = request.getHeader(CONTENT_TYPE_HEADER); if (contentType != null && (contentType.contains(XML_CONTENT) || FASTINFOSET_CONTENT.equals(contentType))) { try { Parameter paramater = params.iterator().next(); String value = paramater.getValue(); result = evaluateCondition(request.getBody(), value); } catch (SaxonApiException e) { throw new ConditionEvaluationFailedException("XQuery evaluation failed at request: " + request.getWilmaMessageLoggerId(), e); } } } else { throw new ConditionEvaluationFailedException("Please provide exactly one parameter in Stub Configuration!"); } return result; }  }
CustomXQueryBodyChecker implements ConditionChecker { @Override public boolean checkCondition(final WilmaHttpRequest request, final ParameterList parameterList) { List<Parameter> params = parameterList.getAllParameters(); boolean result = false; if (params.size() == 1) { String contentType = request.getHeader(CONTENT_TYPE_HEADER); if (contentType != null && (contentType.contains(XML_CONTENT) || FASTINFOSET_CONTENT.equals(contentType))) { try { Parameter paramater = params.iterator().next(); String value = paramater.getValue(); result = evaluateCondition(request.getBody(), value); } catch (SaxonApiException e) { throw new ConditionEvaluationFailedException("XQuery evaluation failed at request: " + request.getWilmaMessageLoggerId(), e); } } } else { throw new ConditionEvaluationFailedException("Please provide exactly one parameter in Stub Configuration!"); } return result; }  @Override boolean checkCondition(final WilmaHttpRequest request, final ParameterList parameterList); }
CustomXQueryBodyChecker implements ConditionChecker { @Override public boolean checkCondition(final WilmaHttpRequest request, final ParameterList parameterList) { List<Parameter> params = parameterList.getAllParameters(); boolean result = false; if (params.size() == 1) { String contentType = request.getHeader(CONTENT_TYPE_HEADER); if (contentType != null && (contentType.contains(XML_CONTENT) || FASTINFOSET_CONTENT.equals(contentType))) { try { Parameter paramater = params.iterator().next(); String value = paramater.getValue(); result = evaluateCondition(request.getBody(), value); } catch (SaxonApiException e) { throw new ConditionEvaluationFailedException("XQuery evaluation failed at request: " + request.getWilmaMessageLoggerId(), e); } } } else { throw new ConditionEvaluationFailedException("Please provide exactly one parameter in Stub Configuration!"); } return result; }  @Override boolean checkCondition(final WilmaHttpRequest request, final ParameterList parameterList);  }