Search in sources :

Example 6 with Page

use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.

the class Rgaa32016Rule120301Test method setUpWebResourceMap.

@Override
protected void setUpWebResourceMap() {
    getWebResourceMap().put("Rgaa32016.Test.12.03.01-4NA-01", getWebResourceFactory().createPage(getTestcasesFilePath() + "rgaa32016/Rgaa32016Rule120301/Rgaa32016.Test.12.03.01-3NMI-01.html"));
    Site site = getWebResourceFactory().createSite("file:Site-NotTested");
    getWebResourceMap().put("Rgaa32016.Test.12.03.01-5NT-01", site);
    Page page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rgaa32016/Rgaa32016Rule120301/Rgaa32016.Test.12.03.01-3NMI-01.html");
    site.addChild(page);
    getWebResourceMap().put("Rgaa32016.Test.12.03.01-5NT-01-page1", page);
    page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rgaa32016/Rgaa32016Rule120301/Rgaa32016.Test.12.03.01-3NMI-01.html");
    site.addChild(page);
    getWebResourceMap().put("Rgaa32016.Test.12.03.01-5NT-01-page1", page);
}
Also used : Site(org.asqatasun.entity.subject.Site) Page(org.asqatasun.entity.subject.Page)

Example 7 with Page

use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.

the class AbstractRuleImplementationTestCase method getGrossResult.

protected ProcessResult getGrossResult(String pageKey, String siteKey) {
    Site site = (Site) webResourceMap.get(siteKey);
    Collection<ProcessResult> grossResultList = grossResultMap.get(site);
    Page page = (Page) webResourceMap.get(pageKey);
    for (ProcessResult grossResult : grossResultList) {
        if (grossResult.getSubject().equals(page)) {
            return grossResult;
        }
    }
    return null;
}
Also used : Site(org.asqatasun.entity.subject.Site) ProcessResult(org.asqatasun.entity.audit.ProcessResult) Page(org.asqatasun.entity.subject.Page)

Example 8 with Page

use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.

the class UploadAuditCommandImpl method createWebResources.

private void createWebResources() {
    WebResource webResource;
    if (fileMap.size() > 1) {
        webResource = getWebResourceDataService().createSite(FileNaming.addProtocolToUrl(fileMap.keySet().iterator().next()));
        getWebResourceDataService().saveOrUpdate(webResource);
        for (String pageUrl : fileMap.keySet()) {
            Page page = getWebResourceDataService().createPage(pageUrl);
            ((Site) webResource).addChild(page);
            getWebResourceDataService().saveOrUpdate(page);
        }
    } else {
        webResource = getWebResourceDataService().createPage(fileMap.keySet().iterator().next());
    }
    // the webresource needs to be persisted a second time because of the
    // relation with the audit
    webResource.setAudit(getAudit());
    getWebResourceDataService().saveOrUpdate(webResource);
    getAudit().setSubject(webResource);
}
Also used : Site(org.asqatasun.entity.subject.Site) WebResource(org.asqatasun.entity.subject.WebResource) Page(org.asqatasun.entity.subject.Page)

Example 9 with Page

use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.

the class AuditCommandImpl method analyse.

@Override
public void analyse() {
    audit = auditDataService.read(audit.getId());
    if (!audit.getStatus().equals(AuditStatus.ANALYSIS)) {
        LOGGER.warn(new StringBuilder(AUDIT_STATUS_IS_LOGGER_STR).append(audit.getStatus()).append(WHILE_LOGGER_STR).append(AuditStatus.ANALYSIS).append(WAS_REQUIRED_LOGGER_STR).toString());
        return;
    }
    if (LOGGER.isInfoEnabled()) {
        LOGGER.info("Analysing " + audit.getSubject().getURL());
    }
    // debug tools
    Date beginProcessDate = null;
    Date endProcessDate = null;
    Date endPersistDate;
    Long persistenceDuration = (long) 0;
    WebResource parentWebResource = audit.getSubject();
    if (parentWebResource instanceof Page) {
        analyserService.analyse(parentWebResource, audit);
        webResourceDataService.saveOrUpdate(parentWebResource);
    } else if (parentWebResource instanceof Site) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Analysing results of scope site");
            beginProcessDate = Calendar.getInstance().getTime();
        }
        analyserService.analyse(parentWebResource, audit);
        if (LOGGER.isDebugEnabled()) {
            endProcessDate = Calendar.getInstance().getTime();
            LOGGER.debug(new StringBuilder("Analysing results of scope site took ").append(endProcessDate.getTime() - beginProcessDate.getTime()).append(MS_LOGGER_STR).toString());
        }
        webResourceDataService.saveOrUpdate(parentWebResource);
        if (LOGGER.isDebugEnabled()) {
            endPersistDate = Calendar.getInstance().getTime();
            LOGGER.debug(new StringBuilder("Persisting Analysis results of scope site ").append(endPersistDate.getTime() - endProcessDate.getTime()).append(MS_LOGGER_STR).toString());
            persistenceDuration = persistenceDuration + (endPersistDate.getTime() - endProcessDate.getTime());
        }
        Long nbOfContent = webResourceDataService.getNumberOfChildWebResource(parentWebResource);
        Long i = (long) 0;
        List<WebResource> webResourceList;
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(new StringBuilder("Analysing ").append(nbOfContent).append(" elements ").toString());
        }
        while (i.compareTo(nbOfContent) < 0) {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug(new StringBuilder("Analysing results of scope page from ").append(i).append(TO_LOGGER_STR).append(i + analyseTreatmentWindow).toString());
                beginProcessDate = Calendar.getInstance().getTime();
            }
            webResourceList = webResourceDataService.getWebResourceFromItsParent(parentWebResource, i.intValue(), analyseTreatmentWindow);
            for (WebResource webResource : webResourceList) {
                if (LOGGER.isDebugEnabled()) {
                    endProcessDate = Calendar.getInstance().getTime();
                    LOGGER.debug(new StringBuilder("Analysing results for page ").append(webResource.getURL()).append(" took ").append(endProcessDate.getTime() - beginProcessDate.getTime()).append(MS_LOGGER_STR).toString());
                }
                analyserService.analyse(webResource, audit);
                if (LOGGER.isDebugEnabled()) {
                    endPersistDate = Calendar.getInstance().getTime();
                    LOGGER.debug(new StringBuilder("Persisting Analysis results for page ").append(webResource.getURL()).append(" took ").append(endPersistDate.getTime() - endProcessDate.getTime()).append(MS_LOGGER_STR).toString());
                    persistenceDuration = persistenceDuration + (endPersistDate.getTime() - endProcessDate.getTime());
                }
            }
            i = i + analyseTreatmentWindow;
        }
    }
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(new StringBuilder("Application spent ").append(persistenceDuration).append(" ms to write in Disk while analysing").toString());
    }
    if (LOGGER.isInfoEnabled()) {
        LOGGER.info(audit.getSubject().getURL() + " has been analysed");
    }
    setStatusToAudit(AuditStatus.COMPLETED);
    if (cleanUpRelatedContent) {
        cleanUpTestData(audit);
    }
}
Also used : Site(org.asqatasun.entity.subject.Site) WebResource(org.asqatasun.entity.subject.WebResource) Page(org.asqatasun.entity.subject.Page)

Example 10 with Page

use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.

the class AbstractGroupRuleWithPageResultImplementation method consolidateImpl.

/**
     * This is the implementation of the method declared in
     * {@link AbstractRuleImplementation}. It encapsulates the main algorithm of
     * the consolidation operation of concrete {@link RuleImplementation}
     * classes for tests with group scope. It calls the method
     * {@link #consolidateGroup(org.asqatasun.entity.subject.Site, java.util.Set)}
     * which should consolidate gross results by group. In common cases, this
     * method should not be overriden.
     *
     * @param grossResultMap
     *            the gross result map to consolidate.
     * @return the list of net results from the gross result list.
     */
@Override
protected List<ProcessResult> consolidateImpl(Map<WebResource, List<ProcessResult>> grossResultMap, ProcessRemarkService processRemarkService) {
    List<ProcessResult> netResultList = new ArrayList<>();
    for (Map.Entry<WebResource, List<ProcessResult>> entry : grossResultMap.entrySet()) {
        WebResource key = entry.getKey();
        List<ProcessResult> grossResultList = entry.getValue();
        if (entry.getKey() instanceof Page) {
            DefiniteResult netResult = processResultDataService.getDefiniteResult(test, key);
            netResult.setDefiniteValue(TestSolution.NOT_APPLICABLE);
            for (ProcessResult grossResult : grossResultList) {
                //                    netResult.addChildResult(grossResult);
                netResult.setNetResultAudit(grossResult.getGrossResultAudit());
            }
            netResultList.add(netResult);
            continue;
        } else {
            netResultList.addAll(consolidateGroup((Site) key, grossResultList, processRemarkService));
        }
    }
    return consolidateSite(netResultList, processRemarkService);
}
Also used : Site(org.asqatasun.entity.subject.Site) ArrayList(java.util.ArrayList) ProcessResult(org.asqatasun.entity.audit.ProcessResult) WebResource(org.asqatasun.entity.subject.WebResource) List(java.util.List) ArrayList(java.util.ArrayList) Page(org.asqatasun.entity.subject.Page) Map(java.util.Map) DefiniteResult(org.asqatasun.entity.audit.DefiniteResult)

Aggregations

Page (org.asqatasun.entity.subject.Page)77 Site (org.asqatasun.entity.subject.Site)68 WebResource (org.asqatasun.entity.subject.WebResource)7 ArrayList (java.util.ArrayList)6 Query (javax.persistence.Query)6 Audit (org.asqatasun.entity.audit.Audit)4 ProcessResult (org.asqatasun.entity.audit.ProcessResult)4 List (java.util.List)3 Map (java.util.Map)3 SSP (org.asqatasun.entity.audit.SSP)3 Content (org.asqatasun.entity.audit.Content)2 DefiniteResult (org.asqatasun.entity.audit.DefiniteResult)2 ForbiddenPageException (org.asqatasun.webapp.exception.ForbiddenPageException)2 ColumnBuilderException (ar.com.fdvs.dj.domain.builders.ColumnBuilderException)1 IOException (java.io.IOException)1 JRException (net.sf.jasperreports.engine.JRException)1 PreProcessResult (org.asqatasun.entity.audit.PreProcessResult)1 Scope (org.asqatasun.entity.reference.Scope)1 ContentDataService (org.asqatasun.entity.service.audit.ContentDataService)1 WebResourceDataService (org.asqatasun.entity.service.subject.WebResourceDataService)1