use of org.asqatasun.entity.audit.ProcessRemark in project Asqatasun by Asqatasun.
the class Rgaa32016Rule060301 method testLink.
/**
*
* @param sspHandler
* @param el
* @return
*/
private TestSolution testLink(SSPHandler sspHandler, Element el) {
ElementHandler<Element> elHandler = new ElementHandlerImpl(el);
TestSolutionHandler tsHandler = new TestSolutionHandlerImpl();
// reset the service for each tested element. We use the collection
// handled by the service to feed the local collection of remarks
prs.resetService();
// check the pertinence of the link
getDecidableElementsChecker().check(sspHandler, elHandler, tsHandler);
// get the processRemark for eventually override it with the result
// returned by the title pertinence checker
ProcessRemark remark = prs.getRemarkList().iterator().next();
// to nmi but the inverse is impossible.
if (tsHandler.getTestSolution().equals(TestSolution.FAILED)) {
// check the pertinence of the title of the link
String linkText = getDecidableElementsChecker().getTextElementBuilder().buildTextFromElement(el);
if (testTitleAttributeLink(sspHandler, el, linkText).equals(TestSolution.NEED_MORE_INFO)) {
//override result (evidence element have already been collected
remark.setIssue(TestSolution.NEED_MORE_INFO);
remark.setMessageCode(CHECK_LINK_PERTINENCE_MSG);
remarks.add(remark);
return TestSolution.NEED_MORE_INFO;
}
}
remarks.add(remark);
return tsHandler.getTestSolution();
}
use of org.asqatasun.entity.audit.ProcessRemark 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.ProcessRemark in project Asqatasun by Asqatasun.
the class Aw22Rule06031 method testLink.
/**
*
* @param sspHandler
* @param el
* @return
*/
private TestSolution testLink(SSPHandler sspHandler, Element el) {
ElementHandler<Element> elHandler = new ElementHandlerImpl(el);
TestSolutionHandler tsHandler = new TestSolutionHandlerImpl();
// reset the service for each tested element. We use the collection
// handled by the service to feed the local collection of remarks
prs.resetService();
// check the pertinence of the link
getDecidableElementsChecker().check(sspHandler, elHandler, tsHandler);
// get the processRemark for eventually override it with the result
// returned by the title pertinence checker
ProcessRemark remark = prs.getRemarkList().iterator().next();
// to nmi but the inverse is impossible.
if (tsHandler.getTestSolution().equals(TestSolution.FAILED)) {
// check the pertinence of the title of the link
String linkText = getDecidableElementsChecker().getTextElementBuilder().buildTextFromElement(el);
if (testTitleAttributeLink(sspHandler, el, linkText).equals(TestSolution.NEED_MORE_INFO)) {
//override result (evidence element have already been collected
remark.setIssue(TestSolution.NEED_MORE_INFO);
remark.setMessageCode(CHECK_LINK_PERTINENCE_MSG);
remarks.add(remark);
return TestSolution.NEED_MORE_INFO;
}
}
remarks.add(remark);
return tsHandler.getTestSolution();
}
use of org.asqatasun.entity.audit.ProcessRemark in project Asqatasun by Asqatasun.
the class Aw22Rule11041Test method setProcess.
@Override
protected void setProcess() {
//----------------------------------------------------------------------
//------------------------------3NMI-01---------------------------------
//----------------------------------------------------------------------
ProcessResult processResult = processPageTest("AW22.Test.11.4.1-3NMI-01");
// check number of elements in the page
assertEquals(2, processResult.getElementCounter());
// check test result
assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
// check number of remarks and their value
assertEquals(2, processResult.getRemarkSet().size());
Iterator<ProcessRemark> iter = processResult.getRemarkSet().iterator();
SourceCodeRemark processRemark = (SourceCodeRemark) iter.next();
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.LABEL_ELEMENT, processRemark.getTarget());
// check number of evidence elements and their value
assertEquals(1, processRemark.getElementList().size());
assertEquals("Field1", processRemark.getElementList().iterator().next().getValue());
assertEquals(HtmlElementStore.TEXT_ELEMENT2, processRemark.getElementList().iterator().next().getEvidence().getCode());
processRemark = (SourceCodeRemark) iter.next();
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.LABEL_ELEMENT, processRemark.getTarget());
// check number of evidence elements and their value
assertEquals(1, processRemark.getElementList().size());
assertEquals("Field2", processRemark.getElementList().iterator().next().getValue());
assertEquals(HtmlElementStore.TEXT_ELEMENT2, processRemark.getElementList().iterator().next().getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------4NA-01----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.4.1-4NA-01");
// check test result
assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
// check test has no remark
assertNull(processResult.getRemarkSet());
//----------------------------------------------------------------------
//------------------------------4NA-02----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.4.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.ProcessRemark in project Asqatasun by Asqatasun.
the class Rgaa22Rule10021 method check.
@Override
protected void check(SSPHandler sspHandler, TestSolutionHandler testSolutionHandler) {
super.check(sspHandler, testSolutionHandler);
ProcessRemarkService prs = sspHandler.getProcessRemarkService();
if (CollectionUtils.isNotEmpty(prs.getRemarkList())) {
for (ProcessRemark pr : prs.getRemarkList()) {
addElementNameEvidenceElementToOverrideTarget(prs, pr);
}
}
}
Aggregations