Search in sources :

Example 41 with Page

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

the class Rgaa32016Rule120701Test method setUpWebResourceMap.

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

Example 42 with Page

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

the class Rgaa32016Rule120503Test method setUpWebResourceMap.

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

Example 43 with Page

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

the class AuditLauncherController method preparePageAudit.

/**
     * This methods controls the validity of the form and launch an audit with
     * values populated by the user. In case of audit failure, an appropriate
     * message is displayed
     *
     * @param pageAuditSetUpCommand
     * @param contract
     * @param locale
     * @param auditScope
     * @param model
     * @return
     */
private String preparePageAudit(final AuditSetUpCommand auditSetUpCommand, final Contract contract, final Locale locale, final ScopeEnum auditScope, Model model) {
    Audit audit;
    boolean isPageAudit = true;
    // if the form is correct, we launch the audit
    try {
        if (auditScope.equals(ScopeEnum.FILE)) {
            audit = launchUploadAudit(contract, auditSetUpCommand, locale);
            isPageAudit = false;
        } else {
            audit = launchPageAudit(contract, auditSetUpCommand, locale);
        }
    } catch (KrashAuditException kae) {
        return TgolKeyStore.OUPS_VIEW_NAME;
    }
    // page and send an email when it's ready
    if (audit == null) {
        model.addAttribute(TgolKeyStore.TESTED_URL_KEY, auditSetUpCommand.getUrlList().get(0));
        model.addAttribute(TgolKeyStore.CONTRACT_ID_KEY, contract.getId());
        model.addAttribute(TgolKeyStore.CONTRACT_NAME_KEY, contract.getLabel());
        model.addAttribute(TgolKeyStore.IS_PAGE_AUDIT_KEY, isPageAudit);
        if (!getEmailSentToUserExclusionList().contains(contract.getUser().getEmail1())) {
            model.addAttribute(TgolKeyStore.IS_USER_NOTIFIED_KEY, true);
        }
        return TgolKeyStore.GREEDY_AUDIT_VIEW_NAME;
    }
    if (audit.getStatus() != AuditStatus.COMPLETED) {
        return prepareFailedAuditData(audit, model);
    }
    if (audit.getSubject() instanceof Site) {
        // in case of group of page, we display the list of audited pages
        model.addAttribute(TgolKeyStore.AUDIT_ID_KEY, audit.getId());
        model.addAttribute(TgolKeyStore.STATUS_KEY, HttpStatusCodeFamily.f2xx);
        return TgolKeyStore.PAGE_LIST_XXX_VIEW_REDIRECT_NAME;
    } else if (audit.getSubject() instanceof Page) {
        model.addAttribute(TgolKeyStore.WEBRESOURCE_ID_KEY, audit.getSubject().getId());
        return TgolKeyStore.RESULT_PAGE_VIEW_REDIRECT_NAME;
    }
    throw new LostInSpaceException(getCurrentUser());
}
Also used : Site(org.asqatasun.entity.subject.Site) Audit(org.asqatasun.entity.audit.Audit) KrashAuditException(org.asqatasun.webapp.exception.KrashAuditException) LostInSpaceException(org.asqatasun.webapp.exception.LostInSpaceException) Page(org.asqatasun.entity.subject.Page)

Example 44 with Page

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

the class AuditResultController method displaySourceCodeFromContract.

/**
     *
     * @param webresourceId
     * @param request
     * @param response
     * @param model
     * @return
     */
@RequestMapping(value = TgolKeyStore.SOURCE_CODE_CONTRACT_URL, method = RequestMethod.GET)
@Secured({ TgolKeyStore.ROLE_USER_KEY, TgolKeyStore.ROLE_ADMIN_KEY })
public String displaySourceCodeFromContract(@RequestParam(TgolKeyStore.WEBRESOURCE_ID_KEY) String webresourceId, HttpServletRequest request, HttpServletResponse response, Model model) {
    WebResource webResource;
    try {
        webResource = getWebResourceDataService().ligthRead(Long.valueOf(webresourceId));
    } catch (NumberFormatException nfe) {
        throw new ForbiddenPageException();
    }
    if (webResource instanceof Site) {
        throw new ForbiddenPageException();
    }
    Audit audit = getAuditFromWebResource(webResource);
    if (isUserAllowedToDisplayResult(audit)) {
        Page page = (Page) webResource;
        SSP ssp = getContentDataService().findSSP(page, page.getURL());
        model.addAttribute(TgolKeyStore.SOURCE_CODE_KEY, highlightSourceCode(ssp));
        ScopeEnum scope = getActDataService().getActFromAudit(audit).getScope().getCode();
        if (scope.equals(ScopeEnum.GROUPOFPAGES) || scope.equals(ScopeEnum.PAGE)) {
            model.addAttribute(TgolKeyStore.IS_GENERATED_HTML_KEY, true);
        }
        return TgolKeyStore.SOURCE_CODE_PAGE_VIEW_NAME;
    } else {
        throw new ForbiddenUserException(getCurrentUser());
    }
}
Also used : Site(org.asqatasun.entity.subject.Site) Audit(org.asqatasun.entity.audit.Audit) SSP(org.asqatasun.entity.audit.SSP) ScopeEnum(org.asqatasun.webapp.entity.contract.ScopeEnum) WebResource(org.asqatasun.entity.subject.WebResource) Page(org.asqatasun.entity.subject.Page) ForbiddenUserException(org.asqatasun.webapp.exception.ForbiddenUserException) ForbiddenPageException(org.asqatasun.webapp.exception.ForbiddenPageException) Secured(org.springframework.security.access.annotation.Secured) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 45 with Page

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

the class AbstractGroupRuleImplementation 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.add(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