use of org.asqatasun.entity.audit.ProcessRemark in project Asqatasun by Asqatasun.
the class Rgaa30Rule060301 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 Rgaa30Rule060304 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 Rgaa22Rule11011Test method setProcess.
@Override
protected void setProcess() {
//----------------------------------------------------------------------
//----------------------------2Failed-01--------------------------------
//----------------------------------------------------------------------
ProcessResult processResult = processPageTest("RGAA22.Test.11.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(TestSolution.FAILED, processRemark.getIssue());
assertEquals(RemarkMessageStore.DATA_TABLE_WITHOUT_HEADER_MSG, processRemark.getMessageCode());
assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------3NMI-01--------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.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());
processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_TABLE_IS_PRESENTATION_TABLE_MSG, processRemark.getMessageCode());
assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------3NMI-02--------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.1-3NMI-02");
// 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());
processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.HEADER_DETECTED_CHECK_ALL_HEADERS_ARE_WELL_FORMED_MSG, processRemark.getMessageCode());
assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------3NMI-03--------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.1-3NMI-03");
// 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());
Iterator<ProcessRemark> iter = processResult.getRemarkSet().iterator();
processRemark = (SourceCodeRemark) iter.next();
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_TABLE_IS_DATA_TABLE_MSG, processRemark.getMessageCode());
assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------4NA-01------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.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-01------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.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());
}
use of org.asqatasun.entity.audit.ProcessRemark in project Asqatasun by Asqatasun.
the class Rgaa22Rule11021Test method setProcess.
@Override
protected void setProcess() {
//----------------------------------------------------------------------
//------------------------------3NMI-01--------------------------------
//----------------------------------------------------------------------
ProcessResult processResult = processPageTest("RGAA22.Test.11.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(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_HEADERS_DEFINITION_MSG, processRemark.getMessageCode());
assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------3NMI-02--------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.2-3NMI-02");
// 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());
processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_HEADERS_DEFINITION_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.TABLE_ELEMENT, processRemark.getTarget());
assertNotNull(processRemark.getSnippet());
//check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------3NMI-03--------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.2-3NMI-03");
// 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());
processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_HEADERS_DEFINITION_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.TABLE_ELEMENT, processRemark.getTarget());
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------3NMI-04--------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.2-3NMI-04");
// 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());
processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_HEADERS_DEFINITION_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.TABLE_ELEMENT, processRemark.getTarget());
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------3NMI-05--------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.2-3NMI-05");
// 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());
processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_DEFINITION_OF_HEADERS_FOR_DATA_TABLE_MSG, processRemark.getMessageCode());
assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------3NMI-06--------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.2-3NMI-06");
// 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();
processRemark = (SourceCodeRemark) iter.next();
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_DEFINITION_OF_HEADERS_FOR_DATA_TABLE_MSG, processRemark.getMessageCode());
assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
processRemark = (SourceCodeRemark) iter.next();
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_HEADERS_DEFINITION_MSG, processRemark.getMessageCode());
assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------4NA-01------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.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("RGAA22.Test.11.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("RGAA22.Test.11.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());
}
use of org.asqatasun.entity.audit.ProcessRemark in project Asqatasun by Asqatasun.
the class Rgaa22Rule11031Test method setProcess.
@Override
protected void setProcess() {
//----------------------------------------------------------------------
//------------------------------3NMI-01--------------------------------
//----------------------------------------------------------------------
ProcessResult processResult = processPageTest("RGAA22.Test.11.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(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_HEADERS_DEFINITION_MSG, processRemark.getMessageCode());
assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------3NMI-02--------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.3-3NMI-02");
// 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());
processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_HEADERS_DEFINITION_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.TABLE_ELEMENT, processRemark.getTarget());
assertNotNull(processRemark.getSnippet());
//check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------3NMI-03--------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.3-3NMI-03");
// 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());
processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_HEADERS_DEFINITION_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.TABLE_ELEMENT, processRemark.getTarget());
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------3NMI-04--------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.3-3NMI-04");
// 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());
processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_HEADERS_DEFINITION_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.TABLE_ELEMENT, processRemark.getTarget());
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------3NMI-05--------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.3-3NMI-05");
// 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());
processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_DEFINITION_OF_HEADERS_FOR_DATA_TABLE_MSG, processRemark.getMessageCode());
assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------3NMI-06--------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.3-3NMI-06");
// 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();
processRemark = (SourceCodeRemark) iter.next();
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_DEFINITION_OF_HEADERS_FOR_DATA_TABLE_MSG, processRemark.getMessageCode());
assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
processRemark = (SourceCodeRemark) iter.next();
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_HEADERS_DEFINITION_MSG, processRemark.getMessageCode());
assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertNull(processRemark.getElementList());
//----------------------------------------------------------------------
//------------------------------4NA-01------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("RGAA22.Test.11.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("RGAA22.Test.11.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("RGAA22.Test.11.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());
}
Aggregations