Search in sources :

Example 6 with ProcessRemarkService

use of org.asqatasun.service.ProcessRemarkService in project Asqatasun by Asqatasun.

the class DoctypeHtml5CheckerTest method testChecker.

/**
     * 
     * @param doctype
     * @param result
     * @param remark 
     */
private void testChecker(String doctype, TestSolution result, String remark) {
    ProcessRemarkService processRemarkService = createMock(ProcessRemarkService.class);
    SSP ssp = createMock(SSP.class);
    SSPHandler sspHandler = createMock(SSPHandler.class);
    expect(sspHandler.getSSP()).andReturn(ssp);
    expect(ssp.getDoctype()).andReturn(doctype);
    if (StringUtils.isNotBlank(remark)) {
        processRemarkService.addProcessRemark(result, remark);
        expectLastCall();
    }
    // Elements not used in this implementation
    Elements elements = null;
    TestSolutionHandler testSolutionHandler = createMock(TestSolutionHandler.class);
    testSolutionHandler.addTestSolution(result);
    expectLastCall();
    replay(ssp, sspHandler, processRemarkService, testSolutionHandler);
    DoctypeHtml5Checker instance = new DoctypeHtml5Checker();
    instance.setProcessRemarkService(processRemarkService);
    instance.doCheck(sspHandler, elements, testSolutionHandler);
    verify(ssp, sspHandler, processRemarkService, testSolutionHandler);
}
Also used : SSP(org.asqatasun.entity.audit.SSP) SSPHandler(org.asqatasun.processor.SSPHandler) TestSolutionHandler(org.asqatasun.ruleimplementation.TestSolutionHandler) Elements(org.jsoup.select.Elements) ProcessRemarkService(org.asqatasun.service.ProcessRemarkService)

Example 7 with ProcessRemarkService

use of org.asqatasun.service.ProcessRemarkService in project Asqatasun by Asqatasun.

the class SeoRule01081 method processImpl.

@Override
protected ProcessResult processImpl(SSPHandler sspHandler) {
    ProcessRemarkService processRemarkService = sspHandler.getProcessRemarkService();
    processRemarkService.resetService();
    TestSolution testSolution = TestSolution.PASSED;
    try {
        URL url = new URL(sspHandler.getSSP().getURI());
        if (StringUtils.isNotBlank(url.getPath()) && url.getPath().contains("_")) {
            testSolution = TestSolution.FAILED;
            processRemarkService.addProcessRemark(TestSolution.FAILED, RemarkMessageStore.URL_PATH_UNDERSCORE_DETECTED);
        }
    } catch (MalformedURLException ex) {
        testSolution = TestSolution.NOT_APPLICABLE;
    }
    return processResultDataService.getDefiniteResult(test, sspHandler.getPage(), testSolution, processRemarkService.getRemarkList());
}
Also used : MalformedURLException(java.net.MalformedURLException) TestSolution(org.asqatasun.entity.audit.TestSolution) URL(java.net.URL) ProcessRemarkService(org.asqatasun.service.ProcessRemarkService)

Example 8 with ProcessRemarkService

use of org.asqatasun.service.ProcessRemarkService in project Asqatasun by Asqatasun.

the class SeoRule07013 method check.

@Override
protected void check(final 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);
        }
    }
}
Also used : ProcessRemark(org.asqatasun.entity.audit.ProcessRemark) ProcessRemarkService(org.asqatasun.service.ProcessRemarkService)

Aggregations

ProcessRemarkService (org.asqatasun.service.ProcessRemarkService)8 ProcessRemark (org.asqatasun.entity.audit.ProcessRemark)5 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 TestSolution (org.asqatasun.entity.audit.TestSolution)2 SSP (org.asqatasun.entity.audit.SSP)1 SSPHandler (org.asqatasun.processor.SSPHandler)1 TestSolutionHandler (org.asqatasun.ruleimplementation.TestSolutionHandler)1 Elements (org.jsoup.select.Elements)1