Search in sources :

Example 61 with ElementHandlerImpl

use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.

the class ImageElementSelectorTest method testSelectElements7_5.

/**
     * Test of selectElements method, of class ImageElementSelector.
     */
public void testSelectElements7_5() {
    LOGGER.debug("selectElements7-5");
    Document doc = null;
    try {
        doc = Jsoup.parse(new File("src/test/resources/images/image-composite-4.html"), Charset.defaultCharset().displayName());
    } catch (IOException ex) {
    }
    initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
    ElementHandler<Element> elementHandler = new ElementHandlerImpl();
    ImageElementSelector instance = new ImageElementSelector(HtmlElementStore.IMG_ELEMENT, true, false);
    instance.selectElements(sspHandler, elementHandler);
    assertTrue(elementHandler.get().size() == 1);
    assertTrue(elementHandler.get().iterator().next().nodeName().equals(HtmlElementStore.IMG_ELEMENT));
    verifyMockContext();
}
Also used : Element(org.jsoup.nodes.Element) ElementHandlerImpl(org.asqatasun.ruleimplementation.ElementHandlerImpl) IOException(java.io.IOException) Document(org.jsoup.nodes.Document) File(java.io.File)

Example 62 with ElementHandlerImpl

use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.

the class ImageElementSelectorTest method testSelectElements4_4.

/**
     * Test of selectElements method, of class ImageElementSelector.
     */
public void testSelectElements4_4() {
    LOGGER.debug("selectElements4-4");
    Document doc = null;
    try {
        doc = Jsoup.parse(new File("src/test/resources/images/image-link-4.html"), Charset.defaultCharset().displayName());
    } catch (IOException ex) {
    }
    initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
    ElementHandler<Element> elementHandler = new ElementHandlerImpl();
    ImageElementSelector instance = new ImageElementSelector(HtmlElementStore.IMG_ELEMENT, false, false);
    instance.selectElements(sspHandler, elementHandler);
    assertTrue(elementHandler.get().size() == 1);
    assertTrue(elementHandler.get().iterator().next().nodeName().equals(HtmlElementStore.IMG_ELEMENT));
    verifyMockContext();
}
Also used : Element(org.jsoup.nodes.Element) ElementHandlerImpl(org.asqatasun.ruleimplementation.ElementHandlerImpl) IOException(java.io.IOException) Document(org.jsoup.nodes.Document) File(java.io.File)

Example 63 with ElementHandlerImpl

use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.

the class ImageElementSelectorTest method testSelectElements6_5.

/**
     * Test of selectElements method, of class ImageElementSelector.
     */
public void testSelectElements6_5() {
    LOGGER.debug("selectElements6-5");
    Document doc = null;
    try {
        doc = Jsoup.parse(new File("src/test/resources/images/image-composite-5.html"), Charset.defaultCharset().displayName());
    } catch (IOException ex) {
    }
    initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
    ElementHandler<Element> elementHandler = new ElementHandlerImpl();
    ImageElementSelector instance = new ImageElementSelector(HtmlElementStore.IMG_ELEMENT, false, true);
    instance.selectElements(sspHandler, elementHandler);
    assertTrue(elementHandler.isEmpty());
    verifyMockContext();
}
Also used : Element(org.jsoup.nodes.Element) ElementHandlerImpl(org.asqatasun.ruleimplementation.ElementHandlerImpl) IOException(java.io.IOException) Document(org.jsoup.nodes.Document) File(java.io.File)

Example 64 with ElementHandlerImpl

use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.

the class ImageElementSelectorTest method testSelectElements4_1.

/**
     * Test of selectElements method, of class ImageElementSelector.
     */
public void testSelectElements4_1() {
    LOGGER.debug("selectElements4-1");
    Document doc = null;
    try {
        doc = Jsoup.parse(new File("src/test/resources/images/image-link-1.html"), Charset.defaultCharset().displayName());
    } catch (IOException ex) {
    }
    initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
    ElementHandler<Element> elementHandler = new ElementHandlerImpl();
    ImageElementSelector instance = new ImageElementSelector(HtmlElementStore.IMG_ELEMENT, false, false);
    instance.selectElements(sspHandler, elementHandler);
    assertTrue(elementHandler.get().size() == 1);
    assertTrue(elementHandler.get().iterator().next().nodeName().equals(HtmlElementStore.IMG_ELEMENT));
    verifyMockContext();
}
Also used : Element(org.jsoup.nodes.Element) ElementHandlerImpl(org.asqatasun.ruleimplementation.ElementHandlerImpl) IOException(java.io.IOException) Document(org.jsoup.nodes.Document) File(java.io.File)

Example 65 with ElementHandlerImpl

use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.

the class ImageElementSelectorTest method testSelectElements3_3.

/**
     * Test of selectElements method, of class ImageElementSelector.
     */
public void testSelectElements3_3() {
    LOGGER.debug("selectElements3-3");
    Document doc = null;
    try {
        doc = Jsoup.parse(new File("src/test/resources/images/image-link-3.html"), Charset.defaultCharset().displayName());
    } catch (IOException ex) {
    }
    initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
    ElementHandler<Element> elementHandler = new ElementHandlerImpl();
    ImageElementSelector instance = new ImageElementSelector(HtmlElementStore.IMG_ELEMENT, true, false);
    instance.selectElements(sspHandler, elementHandler);
    assertTrue(elementHandler.isEmpty());
    verifyMockContext();
}
Also used : Element(org.jsoup.nodes.Element) ElementHandlerImpl(org.asqatasun.ruleimplementation.ElementHandlerImpl) IOException(java.io.IOException) Document(org.jsoup.nodes.Document) File(java.io.File)

Aggregations

ElementHandlerImpl (org.asqatasun.ruleimplementation.ElementHandlerImpl)88 Element (org.jsoup.nodes.Element)87 Document (org.jsoup.nodes.Document)51 File (java.io.File)49 IOException (java.io.IOException)44 TestSolutionHandler (org.asqatasun.ruleimplementation.TestSolutionHandler)14 TestSolutionHandlerImpl (org.asqatasun.ruleimplementation.TestSolutionHandlerImpl)14 SimpleElementSelector (org.asqatasun.rules.elementselector.SimpleElementSelector)9 ProcessRemark (org.asqatasun.entity.audit.ProcessRemark)6 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)5 ElementHandler (org.asqatasun.ruleimplementation.ElementHandler)5 Nomenclature (org.asqatasun.entity.reference.Nomenclature)4 ElementChecker (org.asqatasun.rules.elementchecker.ElementChecker)4 ElementPresenceChecker (org.asqatasun.rules.elementchecker.element.ElementPresenceChecker)4 ElementSelector (org.asqatasun.rules.elementselector.ElementSelector)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 TextEmptinessChecker (org.asqatasun.rules.elementchecker.text.TextEmptinessChecker)3 InputFormElementWithExplicitLabelSelector (org.asqatasun.rules.elementselector.InputFormElementWithExplicitLabelSelector)3 InputFormElementWithInplicitLabelSelector (org.asqatasun.rules.elementselector.InputFormElementWithInplicitLabelSelector)3