use of org.asqatasun.entity.audit.EvidenceElement in project Asqatasun by Asqatasun.
the class Asqatasun method displayWebResourceResult.
private void displayWebResourceResult(WebResource wr, List<ProcessResult> processResultList) {
System.out.println("");
System.out.println("Subject : " + wr.getURL());
List<ProcessResult> prList = new ArrayList<>();
for (ProcessResult netResult : processResultList) {
if (netResult.getSubject().getURL().equalsIgnoreCase(wr.getURL())) {
prList.add(netResult);
}
}
System.out.println("RawMark : " + webResourceStatisticsDataService.getWebResourceStatisticsByWebResource(wr).getRawMark() + "%");
System.out.println("WeightedMark : " + webResourceStatisticsDataService.getWebResourceStatisticsByWebResource(wr).getMark() + "%");
System.out.println("Nb Passed : " + webResourceStatisticsDataService.getWebResourceStatisticsByWebResource(wr).getNbOfPassed());
System.out.println("Nb Failed test : " + webResourceStatisticsDataService.getWebResourceStatisticsByWebResource(wr).getNbOfInvalidTest());
System.out.println("Nb Failed occurences : " + webResourceStatisticsDataService.getWebResourceStatisticsByWebResource(wr).getNbOfFailedOccurences());
System.out.println("Nb Pre-qualified : " + webResourceStatisticsDataService.getWebResourceStatisticsByWebResource(wr).getNbOfNmi());
System.out.println("Nb Not Applicable : " + webResourceStatisticsDataService.getWebResourceStatisticsByWebResource(wr).getNbOfNa());
System.out.println("Nb Not Tested : " + webResourceStatisticsDataService.getWebResourceStatisticsByWebResource(wr).getNbOfNotTested());
Collections.sort(prList, new Comparator<ProcessResult>() {
@Override
public int compare(ProcessResult t, ProcessResult t1) {
return t.getTest().getId().compareTo(t1.getTest().getId());
}
});
for (ProcessResult result : prList) {
System.out.println(result.getTest().getCode() + ": " + result.getValue());
Set<ProcessRemark> processRemarkList = (Set<ProcessRemark>) processRemarkDataService.findProcessRemarksFromProcessResult(result, -1);
for (ProcessRemark processRemark : processRemarkList) {
System.out.println(" -> " + processRemark.getIssue() + " " + processRemark.getMessageCode());
for (EvidenceElement el : processRemark.getElementList()) {
System.out.println(" -> " + el.getEvidence().getCode() + ":" + el.getValue());
}
}
}
}
use of org.asqatasun.entity.audit.EvidenceElement in project Asqatasun by Asqatasun.
the class SeoRule02011Test method setProcess.
@Override
protected void setProcess() {
//----------------------------------------------------------------------
//------------------------------1Passed-01------------------------------
//----------------------------------------------------------------------
ProcessResult processResult = processPageTest("Seo.Test.2.1.1-1Passed-01");
// check number of elements in the page
assertEquals(1, processResult.getElementCounter());
// check test result
assertEquals(TestSolution.PASSED, processResult.getValue());
// check number of remarks and their value
assertNull(processResult.getRemarkSet());
//----------------------------------------------------------------------
//------------------------------1Passed-02------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("Seo.Test.2.1.1-1Passed-02");
// check number of elements in the page
assertEquals(1, processResult.getElementCounter());
// check test result
assertEquals(TestSolution.PASSED, processResult.getValue());
// check number of remarks and their value
assertNull(processResult.getRemarkSet());
//----------------------------------------------------------------------
//------------------------------2Failed-01------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("Seo.Test.2.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) processResult.getRemarkSet().iterator().next();
assertEquals(TestSolution.FAILED, processRemark.getIssue());
assertEquals(RemarkMessageStore.ALT_MISSING_MSG, processRemark.getMessageCode());
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();
assertTrue(ee.getValue().contains("my-image.jpg"));
assertEquals(AttributeStore.SRC_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------2Failed-02------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("Seo.Test.2.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) processResult.getRemarkSet().iterator().next();
assertEquals(TestSolution.FAILED, processRemark.getIssue());
assertEquals(RemarkMessageStore.ALT_MISSING_MSG, processRemark.getMessageCode());
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(ee.getValue().contains("my-image2.jpg"));
assertEquals(AttributeStore.SRC_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------4NA-01---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("Seo.Test.2.1.1-4NA-01");
// check test result
assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
// check test has no remark
assertNull(processResult.getRemarkSet());
//----------------------------------------------------------------------
//------------------------------4NA-02---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("Seo.Test.2.1.1-4NA-02");
// check test result
assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
// check test has no remark
assertNull(processResult.getRemarkSet());
}
use of org.asqatasun.entity.audit.EvidenceElement in project Asqatasun by Asqatasun.
the class Aw22Rule01043Test method setProcess.
@Override
protected void setProcess() {
//----------------------------------------------------------------------
//------------------------------3NMI-01---------------------------------
//----------------------------------------------------------------------
ProcessResult processResult = processPageTest("AW22.Test.1.4.3-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.APPLET_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();
assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
assertEquals(CODE_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------4NA-01----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.1.4.3-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.3-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.3-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.3-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());
}
use of org.asqatasun.entity.audit.EvidenceElement in project Asqatasun by Asqatasun.
the class Aw22Rule01044Test method setProcess.
@Override
protected void setProcess() {
//----------------------------------------------------------------------
//------------------------------3NMI-01---------------------------------
//----------------------------------------------------------------------
ProcessResult processResult = processPageTest("AW22.Test.1.4.4-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.INPUT_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(SRC_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------4NA-01----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.1.4.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());
//----------------------------------------------------------------------
//------------------------------4NA-02----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.1.4.4-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.4-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.4-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.4-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());
}
use of org.asqatasun.entity.audit.EvidenceElement 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());
}
Aggregations