XmlExtractorFactory implements IExtractorFactory<StreamConnector> { @Override public Extractor createExtractor(StreamConnector connector, ExtractorModel model) { try { NamespaceContext namespaceContext = getNamespaceContext(model); XPathExpression expression = getXPathExpression(model, namespaceContext); return new XmlExtractor(connector, mapToXmlAttributes(model.getAttributes(), namespaceContext), expression); } catch (XPathExpressionException e) { throw new LmRuntimeException(e); } } XmlExtractorFactory(); @Override String getExtractorType(); @Override Class<StreamConnector> getConnectorType(); @Override Extractor createExtractor(StreamConnector connector, ExtractorModel model); static final String XPATH_EXPRESSION_PROPERTY; static final String XPATH_NS_BINDING_PROPERTY; }
@Test public void testCreateExtractor() { extractorFactory.createExtractor(connectorMock, model); }
@Test public void testCreateExtractorWithEmptyXPathExpression() { model.clearProperties(); assertThrows(IllegalArgumentException.class, () -> extractorFactory.createExtractor(connectorMock, model)); }