Search in sources :

Example 46 with Audit

use of org.asqatasun.entity.audit.Audit in project Asqatasun by Asqatasun.

the class ProcessResultDAOImplTest method testRetrieveNumberOfNetResultFromAudit.

public void testRetrieveNumberOfNetResultFromAudit() {
    Audit audit = auditDAO.read(Long.valueOf(1));
    assertEquals(Long.valueOf(10), processResultDAO.retrieveNumberOfNetResultFromAudit(audit));
    audit = auditDAO.read(Long.valueOf(2));
    assertEquals(Long.valueOf(2), processResultDAO.retrieveNumberOfNetResultFromAudit(audit));
}
Also used : Audit(org.asqatasun.entity.audit.Audit)

Example 47 with Audit

use of org.asqatasun.entity.audit.Audit in project Asqatasun by Asqatasun.

the class ScenarioLoaderImpl method fireNewSSP.

/**
     * 
     * @param url
     * @param sourceCode 
     */
private void fireNewSSP(String url, String sourceCode, byte[] snapshotContent, Map<String, String> jsScriptMap) {
    LOGGER.debug("fire New SSP " + url);
    if (StringUtils.isEmpty(sourceCode)) {
        LOGGER.debug("Emtpy SSP " + url + " not saved");
        return;
    }
    String charset = UFT8;
    try {
        charset = CrawlUtils.extractCharset(IOUtils.toInputStream(sourceCode));
    } catch (IOException ex) {
        Logger.getLogger(this.getClass()).warn(ex);
    }
    Page page = getWebResource(url);
    SSP ssp = contentDataService.getSSP(dateFactory.createDate(), url, sourceCode, page, HttpStatus.SC_OK);
    ssp.setCharset(charset);
    contentDataService.saveOrUpdate(ssp);
    result.add(ssp);
    //        if (snapshotContent != null) {
    //            Snapshot snapshot = snapshotFactory.create(
    //                    page, 
    //                    snapshotContent);
    //            snapshotDataService.saveOrUpdate(snapshot);
    //        }
    Audit audit = null;
    if (page.getAudit() != null) {
        audit = page.getAudit();
    } else if (page.getParent().getAudit() != null) {
        audit = page.getParent().getAudit();
    }
    for (Map.Entry<String, String> entry : jsScriptMap.entrySet()) {
        PreProcessResult ppr = preProcessResultDataService.getPreProcessResult(entry.getKey(), entry.getValue(), audit, page);
        preProcessResultDataService.saveOrUpdate(ppr);
    }
}
Also used : SSP(org.asqatasun.entity.audit.SSP) Audit(org.asqatasun.entity.audit.Audit) PreProcessResult(org.asqatasun.entity.audit.PreProcessResult) Page(org.asqatasun.entity.subject.Page) IOException(java.io.IOException) Map(java.util.Map)

Aggregations

Audit (org.asqatasun.entity.audit.Audit)47 WebResource (org.asqatasun.entity.subject.WebResource)11 ForbiddenPageException (org.asqatasun.webapp.exception.ForbiddenPageException)10 Parameter (org.asqatasun.entity.parameterization.Parameter)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)8 Site (org.asqatasun.entity.subject.Site)7 AuditCommand (org.asqatasun.service.command.AuditCommand)7 ForbiddenUserException (org.asqatasun.webapp.exception.ForbiddenUserException)6 Secured (org.springframework.security.access.annotation.Secured)6 AuditCommandFactory (org.asqatasun.service.command.factory.AuditCommandFactory)5 Contract (org.asqatasun.webapp.entity.contract.Contract)5 Content (org.asqatasun.entity.audit.Content)4 ProcessResult (org.asqatasun.entity.audit.ProcessResult)4 Page (org.asqatasun.entity.subject.Page)4 AuditImpl (org.asqatasun.entity.audit.AuditImpl)3 SSP (org.asqatasun.entity.audit.SSP)2 Test (org.asqatasun.entity.reference.Test)2 ScenarioLoader (org.asqatasun.scenarioloader.ScenarioLoader)2 Act (org.asqatasun.webapp.entity.contract.Act)2 IOException (java.io.IOException)1