@Test public void testInvalidXML() { XpathProduceDestination dest1 = new XpathProduceDestination(DEST_XPATH, DEFAULT_DEST); String s = dest1.getDestination(AdaptrisMessageFactory.getDefaultInstance().newMessage("ABCDEFG")); assertEquals(DEFAULT_DEST, s); }
@Override public String getDestination(AdaptrisMessage msg) { String result = defaultDestination; try { NamespaceContext ctx = SimpleNamespaceContext.create(getNamespaceContext(), msg); DocumentBuilderFactoryBuilder builder = documentFactoryBuilder(); if (ctx != null) { builder.setNamespaceAware(true); } XmlUtils xml = createXmlUtils(msg, ctx, builder); String s = xml.getSingleTextItem(xpath); if (isBlank(s)) { logR.warn("[{}] returned no results", xpath); } else { result = s; } } catch (Exception e) { logR.warn("Exception caught attempting to parse message, using default destination"); } logR.trace("Returning [{}]", result); return result; }
XpathProduceDestination implements MessageDrivenDestination { @Override public String getDestination(AdaptrisMessage msg) { String result = defaultDestination; try { NamespaceContext ctx = SimpleNamespaceContext.create(getNamespaceContext(), msg); DocumentBuilderFactoryBuilder builder = documentFactoryBuilder(); if (ctx != null) { builder.setNamespaceAware(true); } XmlUtils xml = createXmlUtils(msg, ctx, builder); String s = xml.getSingleTextItem(xpath); if (isBlank(s)) { logR.warn("[{}] returned no results", xpath); } else { result = s; } } catch (Exception e) { logR.warn("Exception caught attempting to parse message, using default destination"); } logR.trace("Returning [{}]", result); return result; } }
XpathProduceDestination implements MessageDrivenDestination { @Override public String getDestination(AdaptrisMessage msg) { String result = defaultDestination; try { NamespaceContext ctx = SimpleNamespaceContext.create(getNamespaceContext(), msg); DocumentBuilderFactoryBuilder builder = documentFactoryBuilder(); if (ctx != null) { builder.setNamespaceAware(true); } XmlUtils xml = createXmlUtils(msg, ctx, builder); String s = xml.getSingleTextItem(xpath); if (isBlank(s)) { logR.warn("[{}] returned no results", xpath); } else { result = s; } } catch (Exception e) { logR.warn("Exception caught attempting to parse message, using default destination"); } logR.trace("Returning [{}]", result); return result; } XpathProduceDestination();  XpathProduceDestination(String xpath);  XpathProduceDestination(String xpath, String defaultDest); }
XpathProduceDestination implements MessageDrivenDestination { @Override public String getDestination(AdaptrisMessage msg) { String result = defaultDestination; try { NamespaceContext ctx = SimpleNamespaceContext.create(getNamespaceContext(), msg); DocumentBuilderFactoryBuilder builder = documentFactoryBuilder(); if (ctx != null) { builder.setNamespaceAware(true); } XmlUtils xml = createXmlUtils(msg, ctx, builder); String s = xml.getSingleTextItem(xpath); if (isBlank(s)) { logR.warn("[{}] returned no results", xpath); } else { result = s; } } catch (Exception e) { logR.warn("Exception caught attempting to parse message, using default destination"); } logR.trace("Returning [{}]", result); return result; } XpathProduceDestination();  XpathProduceDestination(String xpath);  XpathProduceDestination(String xpath, String defaultDest); @Override boolean equals(Object obj); @Override int hashCode(); @Override String getDestination(AdaptrisMessage msg); String getXpath(); void setXpath(String s); String getDefaultDestination(); void setDefaultDestination(String s); KeyValuePairSet getNamespaceContext(); void setNamespaceContext(KeyValuePairSet kvps); DocumentBuilderFactoryBuilder getXmlDocumentFactoryConfig(); void setXmlDocumentFactoryConfig(DocumentBuilderFactoryBuilder xml); }
XpathProduceDestination implements MessageDrivenDestination { @Override public String getDestination(AdaptrisMessage msg) { String result = defaultDestination; try { NamespaceContext ctx = SimpleNamespaceContext.create(getNamespaceContext(), msg); DocumentBuilderFactoryBuilder builder = documentFactoryBuilder(); if (ctx != null) { builder.setNamespaceAware(true); } XmlUtils xml = createXmlUtils(msg, ctx, builder); String s = xml.getSingleTextItem(xpath); if (isBlank(s)) { logR.warn("[{}] returned no results", xpath); } else { result = s; } } catch (Exception e) { logR.warn("Exception caught attempting to parse message, using default destination"); } logR.trace("Returning [{}]", result); return result; } XpathProduceDestination();  XpathProduceDestination(String xpath);  XpathProduceDestination(String xpath, String defaultDest); @Override boolean equals(Object obj); @Override int hashCode(); @Override String getDestination(AdaptrisMessage msg); String getXpath(); void setXpath(String s); String getDefaultDestination(); void setDefaultDestination(String s); KeyValuePairSet getNamespaceContext(); void setNamespaceContext(KeyValuePairSet kvps); DocumentBuilderFactoryBuilder getXmlDocumentFactoryConfig(); void setXmlDocumentFactoryConfig(DocumentBuilderFactoryBuilder xml);  }