Search in sources :

Example 46 with ImmutablePair

use of org.apache.commons.lang3.tuple.ImmutablePair in project Asqatasun by Asqatasun.

the class Rgaa32016Rule060501 method check.

@Override
protected void check(SSPHandler sspHandler, TestSolutionHandler testSolutionHandler) {
    if (linksHandler.isEmpty()) {
        testSolutionHandler.addTestSolution(TestSolution.NOT_APPLICABLE);
        return;
    }
    if (emptyLinksHandler.isEmpty()) {
        testSolutionHandler.addTestSolution(TestSolution.PASSED);
        return;
    }
    ElementChecker ec = new ElementPresenceChecker(new ImmutablePair(TestSolution.FAILED, EMPTY_LINK_MSG), new ImmutablePair(TestSolution.PASSED, ""), HREF_ATTR);
    ec.check(sspHandler, emptyLinksHandler, testSolutionHandler);
}
Also used : ElementPresenceChecker(org.asqatasun.rules.elementchecker.element.ElementPresenceChecker) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) ElementChecker(org.asqatasun.rules.elementchecker.ElementChecker)

Example 47 with ImmutablePair

use of org.apache.commons.lang3.tuple.ImmutablePair in project Asqatasun by Asqatasun.

the class Rgaa32016Rule080901 method check.

@Override
protected void check(SSPHandler sspHandler, TestSolutionHandler testSolutionHandler) {
    if (linkWithoutTarget.isEmpty() && fieldsetNotWithinForm.isEmpty()) {
        sspHandler.getProcessRemarkService().addProcessRemark(TestSolution.NEED_MORE_INFO, RuleCheckHelper.specifyMessageToRule(NO_PATTERN_DETECTED_MSG, this.getTest().getCode()));
        testSolutionHandler.addTestSolution(TestSolution.NEED_MORE_INFO);
        return;
    }
    ElementChecker linkWithoutTargetChecker = new ElementPresenceChecker(new ImmutablePair(TestSolution.FAILED, LINK_WITHOUT_TARGET_MSG), new ImmutablePair(TestSolution.PASSED, ""));
    linkWithoutTargetChecker.check(sspHandler, linkWithoutTarget, testSolutionHandler);
    ElementChecker fieldsetNotWithinFormChecker = new ElementPresenceChecker(new ImmutablePair(TestSolution.NEED_MORE_INFO, FIELDSET_NOT_WITHIN_FORM_MSG), new ImmutablePair(TestSolution.PASSED, ""));
    fieldsetNotWithinFormChecker.check(sspHandler, fieldsetNotWithinForm, testSolutionHandler);
}
Also used : ElementPresenceChecker(org.asqatasun.rules.elementchecker.element.ElementPresenceChecker) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) ElementChecker(org.asqatasun.rules.elementchecker.ElementChecker)

Example 48 with ImmutablePair

use of org.apache.commons.lang3.tuple.ImmutablePair in project Asqatasun by Asqatasun.

the class Rgaa32016Rule100102 method check.

@Override
protected void check(SSPHandler sspHandler, TestSolutionHandler testSolutionHandler) {
    // Attributes checks
    for (Map.Entry<String, ElementHandler> attrElementHandlerMapEntry : attrElementHandlerMap.entrySet()) {
        ElementChecker attrEc = new ElementWithAttributePresenceChecker(new ImmutablePair(TestSolution.FAILED, PRESENTATION_ATTR_DETECTED_MSG), new ImmutablePair(TestSolution.PASSED, ""), attrElementHandlerMapEntry.getKey());
        attrEc.check(sspHandler, attrElementHandlerMapEntry.getValue(), testSolutionHandler);
    }
}
Also used : ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) ElementWithAttributePresenceChecker(org.asqatasun.rules.elementchecker.element.ElementWithAttributePresenceChecker) ElementHandler(org.asqatasun.ruleimplementation.ElementHandler) ElementChecker(org.asqatasun.rules.elementchecker.ElementChecker) HashMap(java.util.HashMap) Map(java.util.Map)

Example 49 with ImmutablePair

use of org.apache.commons.lang3.tuple.ImmutablePair in project Asqatasun by Asqatasun.

the class Rgaa32016Rule010101Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------1Passed-01------------------------------
    //----------------------------------------------------------------------
    checkResultIsPassed(processPageTest("Rgaa32016.Test.1.1.1-1Passed-01"), 1);
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("Rgaa32016.Test.1.1.1-2Failed-01");
    checkResultIsFailed(processResult, 1, 1);
    checkRemarkIsPresent(processResult, TestSolution.FAILED, RemarkMessageStore.ALT_MISSING_MSG, HtmlElementStore.IMG_ELEMENT, 1, new ImmutablePair(SRC_ATTR, "mock-image-failed.jpg"));
    //----------------------------------------------------------------------
    //------------------------------2Failed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa32016.Test.1.1.1-2Failed-02");
    checkResultIsFailed(processResult, 2, 1);
    checkRemarkIsPresent(processResult, TestSolution.FAILED, RemarkMessageStore.ALT_MISSING_MSG, HtmlElementStore.IMG_ELEMENT, 1, new ImmutablePair(SRC_ATTR, "mock-image-failed.jpg"));
    //----------------------------------------------------------------------
    //------------------------------2Failed-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa32016.Test.1.1.1-2Failed-03");
    checkResultIsFailed(processResult, 2, 1);
    checkRemarkIsPresent(processResult, TestSolution.FAILED, RemarkMessageStore.ALT_MISSING_MSG, HtmlElementStore.IMG_ELEMENT, 1, new ImmutablePair(SRC_ATTR, "mock-image-failed.jpg"));
    //----------------------------------------------------------------------
    //------------------------------4NA-01------------------------------
    //----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa32016.Test.1.1.1-4NA-01"));
}
Also used : ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) ProcessResult(org.asqatasun.entity.audit.ProcessResult)

Example 50 with ImmutablePair

use of org.apache.commons.lang3.tuple.ImmutablePair in project Asqatasun by Asqatasun.

the class Rgaa32016Rule010102Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------1Passed-01------------------------------
    //----------------------------------------------------------------------
    checkResultIsPassed(processPageTest("Rgaa32016.Test.1.1.2-1Passed-01"), 2);
    //----------------------------------------------------------------------
    //------------------------------1Passed-02------------------------------
    //----------------------------------------------------------------------
    checkResultIsPassed(processPageTest("Rgaa32016.Test.1.1.2-1Passed-02"), 2);
    //----------------------------------------------------------------------
    //------------------------------1Passed-03------------------------------
    //----------------------------------------------------------------------
    checkResultIsPassed(processPageTest("Rgaa32016.Test.1.1.2-1Passed-03"), 2);
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("Rgaa32016.Test.1.1.2-2Failed-01");
    checkResultIsFailed(processResult, 2, 2);
    checkRemarkIsPresent(processResult, TestSolution.FAILED, RemarkMessageStore.ALT_MISSING_MSG, HtmlElementStore.AREA_ELEMENT, 1, new ImmutablePair(HREF_ATTR, ABSENT_ATTRIBUTE_VALUE));
    checkRemarkIsPresent(processResult, TestSolution.FAILED, RemarkMessageStore.ALT_MISSING_MSG, HtmlElementStore.AREA_ELEMENT, 2, new ImmutablePair(HREF_ATTR, ABSENT_ATTRIBUTE_VALUE));
    //----------------------------------------------------------------------
    //------------------------------2Failed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa32016.Test.1.1.2-2Failed-02");
    checkResultIsFailed(processResult, 2, 2);
    checkRemarkIsPresent(processResult, TestSolution.FAILED, RemarkMessageStore.ALT_MISSING_MSG, HtmlElementStore.AREA_ELEMENT, 1, new ImmutablePair(HREF_ATTR, ABSENT_ATTRIBUTE_VALUE));
    checkRemarkIsPresent(processResult, TestSolution.FAILED, RemarkMessageStore.ALT_MISSING_MSG, HtmlElementStore.AREA_ELEMENT, 2, new ImmutablePair(HREF_ATTR, ABSENT_ATTRIBUTE_VALUE));
    //----------------------------------------------------------------------
    //------------------------------2Failed-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa32016.Test.1.1.2-2Failed-03");
    checkResultIsFailed(processResult, 2, 1);
    checkRemarkIsPresent(processResult, TestSolution.FAILED, RemarkMessageStore.ALT_MISSING_MSG, HtmlElementStore.AREA_ELEMENT, 1, new ImmutablePair(HREF_ATTR, "mock-area-link.html"));
    //----------------------------------------------------------------------
    //------------------------------4NA-01------------------------------
    //----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa32016.Test.1.1.2-4NA-01"));
    //----------------------------------------------------------------------
    //------------------------------4NA-02------------------------------
    //----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa32016.Test.1.1.2-4NA-02"));
}
Also used : ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) ProcessResult(org.asqatasun.entity.audit.ProcessResult)

Aggregations

ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)234 ProcessResult (org.asqatasun.entity.audit.ProcessResult)109 Pair (org.apache.commons.lang3.tuple.Pair)28 ElementChecker (org.asqatasun.rules.elementchecker.ElementChecker)19 Collectors (java.util.stream.Collectors)18 IntStream (java.util.stream.IntStream)18 File (java.io.File)17 IOException (java.io.IOException)16 java.util (java.util)16 ArrayList (java.util.ArrayList)15 UserException (org.broadinstitute.hellbender.exceptions.UserException)15 ParamUtils (org.broadinstitute.hellbender.utils.param.ParamUtils)14 INDArray (org.nd4j.linalg.api.ndarray.INDArray)14 Nonnull (javax.annotation.Nonnull)12 Logger (org.apache.logging.log4j.Logger)12 VisibleForTesting (com.google.common.annotations.VisibleForTesting)10 HashMap (java.util.HashMap)10 Nullable (javax.annotation.Nullable)10 ImmutableTriple (org.apache.commons.lang3.tuple.ImmutableTriple)10 TextAttributeOfElementBuilder (org.asqatasun.rules.textbuilder.TextAttributeOfElementBuilder)10