use of org.asqatasun.entity.audit.EvidenceElement in project Asqatasun by Asqatasun.
the class Aw22Rule06051Test method setProcess.
@Override
protected void setProcess() {
//----------------------------------------------------------------------
//------------------------------3NMI-01---------------------------------
//----------------------------------------------------------------------
ProcessResult processResult = processPageTest("AW22.Test.6.5.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(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_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(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
assertEquals(SRC_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------3NMI-02---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.6.5.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.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.INPUT_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.jpg"));
assertEquals(SRC_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------4NA-01---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.6.5.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("AW22.Test.6.5.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.EvidenceElement in project Asqatasun by Asqatasun.
the class Aw22Rule06052Test method setProcess.
@Override
protected void setProcess() {
//----------------------------------------------------------------------
//------------------------------3NMI-01---------------------------------
//----------------------------------------------------------------------
ProcessResult processResult = processPageTest("AW22.Test.6.5.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.MANUAL_CHECK_ON_ELEMENTS_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(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
assertEquals(SRC_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------3NMI-02---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.6.5.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.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.INPUT_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.jpg"));
assertEquals(SRC_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------4NA-01---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.6.5.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-01----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.6.5.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());
}
use of org.asqatasun.entity.audit.EvidenceElement in project Asqatasun by Asqatasun.
the class ElementCheckerImpl method getEvidenceElement.
/**
* @param element
* @param attr
* @return an evidenceElement
*/
protected EvidenceElement getEvidenceElement(Element element, String attr) {
EvidenceElement extraEe;
String attrEE;
// specific control with xml:lang attribute due to the ':' character
if (StringUtils.equalsIgnoreCase(attr, AttributeStore.XML_LANG_ATTR)) {
attrEE = StringUtils.replace(attr, ":", "-");
} else {
attrEE = attr;
}
if (isElementTextRequested(attr)) {
extraEe = processRemarkService.getEvidenceElement(attrEE, StringUtils.substring(getTextElementBuilder().buildTextFromElement(element), 0, MAX_TEXT_EE_SIZE));
} else if (isAttributeExternalResource(attr)) {
extraEe = processRemarkService.getEvidenceElement(attrEE, buildAttributeContent(element, attr, true));
} else {
extraEe = processRemarkService.getEvidenceElement(attrEE, buildAttributeContent(element, attr, false));
}
return extraEe;
}
use of org.asqatasun.entity.audit.EvidenceElement in project Asqatasun by Asqatasun.
the class ElementCheckerImpl method addSourceCodeRemarkOnAttribute.
/**
* Add a sourceCodeRemark on the given element with a preset evidence element
* collection
*
* @param testSolution
* @param element
* @param messageCode
* @param attributeName
*/
protected void addSourceCodeRemarkOnAttribute(TestSolution testSolution, Element element, String messageCode, String attributeName) {
if (attributeName != null) {
Collection<EvidenceElement> evidenceElementList = new ArrayList<>();
EvidenceElement ee = getEvidenceElement(EvidenceStore.TARGETTED_ELEMENT_FROM_SCOPE_EE, attributeName);
evidenceElementList.add(ee);
processRemarkService.addSourceCodeRemarkOnElement(testSolution, element, messageCode, evidenceElementList);
}
}
use of org.asqatasun.entity.audit.EvidenceElement in project Asqatasun by Asqatasun.
the class Aw22Rule13164Test method setProcess.
@Override
protected void setProcess() {
//----------------------------------------------------------------------
//------------------------------3NMI-01------------------------------
//----------------------------------------------------------------------
ProcessResult processResult = processPageTest("AW22.Test.13.16.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(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.APPLET_ELEMENT, processRemark.getTarget());
// 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(AttributeStore.CODE_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------4NA-01------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.13.16.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());
}
Aggregations