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));
}
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);
}
}
Aggregations