Search in sources :

Example 31 with SourceCodeRemark

use of org.asqatasun.entity.audit.SourceCodeRemark in project Asqatasun by Asqatasun.

the class Aw22Rule01045Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------3NMI-01---------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.4.5-3NMI-01");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.CHECK_CAPTCHA_ALTERNATIVE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    Iterator<EvidenceElement> iter = processRemark.getElementList().iterator();
    EvidenceElement ee = iter.next();
    assertEquals("Some text can be added here.", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    //------------------------------4NA-01----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.4.5-4NA-01");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------4NA-02----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.4.5-4NA-02");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------4NA-03----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.4.5-4NA-03");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------4NA-04----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.4.5-4NA-04");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------4NA-05----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.4.5-4NA-05");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
}
Also used : EvidenceElement(org.asqatasun.entity.audit.EvidenceElement) ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark)

Example 32 with SourceCodeRemark

use of org.asqatasun.entity.audit.SourceCodeRemark in project Asqatasun by Asqatasun.

the class Aw22Rule01014Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------1Passed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.1.4-1Passed-01");
    // check test result
    assertEquals(TestSolution.PASSED, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.1.4-2Failed-01");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    EvidenceElement ee = processRemark.getElementList().iterator().next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    //------------------------------4NA-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.1.4-4NA-01");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
}
Also used : EvidenceElement(org.asqatasun.entity.audit.EvidenceElement) ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark)

Example 33 with SourceCodeRemark

use of org.asqatasun.entity.audit.SourceCodeRemark in project Asqatasun by Asqatasun.

the class Aw22Rule01041Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------3NMI-01---------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.4.1-3NMI-01");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.CHECK_CAPTCHA_ALTERNATIVE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    Iterator<EvidenceElement> iter = processRemark.getElementList().iterator();
    EvidenceElement ee = iter.next();
    assertEquals(ee.getValue(), "captcha");
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    //------------------------------4NA-01----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.4.1-4NA-01");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------4NA-02----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.4.1-4NA-02");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------4NA-03----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.4.1-4NA-03");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------4NA-04----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.4.1-4NA-04");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
}
Also used : EvidenceElement(org.asqatasun.entity.audit.EvidenceElement) ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark)

Example 34 with SourceCodeRemark

use of org.asqatasun.entity.audit.SourceCodeRemark in project Asqatasun by Asqatasun.

the class Aw22Rule01042Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------3NMI-01---------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.4.2-3NMI-01");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.CHECK_CAPTCHA_ALTERNATIVE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    Iterator<EvidenceElement> iter = processRemark.getElementList().iterator();
    EvidenceElement ee = iter.next();
    assertEquals(ee.getValue(), "");
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertEquals(ABSENT_ATTRIBUTE_VALUE, ee.getValue());
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    //------------------------------4NA-01----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.4.2-4NA-01");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------4NA-02----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.4.2-4NA-02");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------4NA-03----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.4.2-4NA-03");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------4NA-04----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.4.2-4NA-04");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
}
Also used : EvidenceElement(org.asqatasun.entity.audit.EvidenceElement) ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark)

Example 35 with SourceCodeRemark

use of org.asqatasun.entity.audit.SourceCodeRemark in project Asqatasun by Asqatasun.

the class Aw22Rule01011Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------1Passed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.1.1-1Passed-01");
    // check test result
    assertEquals(TestSolution.PASSED, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.1.1-2Failed-01");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.ALT_MISSING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    EvidenceElement ee = processRemark.getElementList().iterator().next();
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image-failed.jpg"));
    //----------------------------------------------------------------------
    //------------------------------2Failed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.1.1-2Failed-02");
    // check number of elements in the page
    assertEquals(2, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.ALT_MISSING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image-failed.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    //------------------------------2Failed-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.1.1-2Failed-03");
    // check number of elements in the page
    assertEquals(2, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.ALT_MISSING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image-failed.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    //------------------------------4NA-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.1.1-4NA-01");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
}
Also used : LinkedHashSet(java.util.LinkedHashSet) EvidenceElement(org.asqatasun.entity.audit.EvidenceElement) ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark)

Aggregations

SourceCodeRemark (org.asqatasun.entity.audit.SourceCodeRemark)146 ProcessResult (org.asqatasun.entity.audit.ProcessResult)143 LinkedHashSet (java.util.LinkedHashSet)73 EvidenceElement (org.asqatasun.entity.audit.EvidenceElement)53 ProcessRemark (org.asqatasun.entity.audit.ProcessRemark)31