use of org.asqatasun.entity.subject.Page 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);
}
}
use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.
the class ScenarioLoaderImpl method getWebResource.
/**
*
* @param url
* @return the page instance for a given URL
*/
private Page getWebResource(String url) {
Page page = null;
if (webResource instanceof Page) {
if (!StringUtils.equals(url, webResource.getURL())) {
webResource.setURL(url);
}
page = (Page) webResource;
page.setRank(1);
} else if (webResource instanceof Site) {
page = webResourceDataService.createPage(url);
page.setRank(pageRank);
pageRank++;
((Site) webResource).addChild(page);
}
page = (Page) webResourceDataService.saveOrUpdate(page);
return page;
}
use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.
the class Aw22Rule12022Test method setUpWebResourceMap.
@Override
protected void setUpWebResourceMap() {
getWebResourceMap().put("AW22.Test.12.2.2-4NA-01", getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12022/AW22.Test.12.2.2-3NMI-01.html"));
Site site = getWebResourceFactory().createSite("file:Site-NotTested");
getWebResourceMap().put("AW22.Test.12.2.2-5NT-01", site);
Page page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12022/AW22.Test.12.2.2-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("AW22.Test.12.2.2-5NT-01-page1", page);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12022/AW22.Test.12.2.2-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("AW22.Test.12.2.2-5NT-01-page1", page);
}
use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.
the class Aw22Rule12032Test method setUpWebResourceMap.
@Override
protected void setUpWebResourceMap() {
getWebResourceMap().put("AW22.Test.12.3.2-4NA-01", getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12032/AW22.Test.12.3.2-3NMI-01.html"));
Site site = getWebResourceFactory().createSite("file:Site-NotTested");
getWebResourceMap().put("AW22.Test.12.3.2-5NT-01", site);
Page page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12032/AW22.Test.12.3.2-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("AW22.Test.12.3.2-5NT-01-page1", page);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12032/AW22.Test.12.3.2-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("AW22.Test.12.3.2-5NT-01-page1", page);
}
use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.
the class Aw22Rule12063Test method setUpWebResourceMap.
@Override
protected void setUpWebResourceMap() {
getWebResourceMap().put("AW22.Test.12.6.3-4NA-01", getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12063/AW22.Test.12.6.3-3NMI-01.html"));
Site site = getWebResourceFactory().createSite("file:Site-NotTested");
getWebResourceMap().put("AW22.Test.12.6.3-5NT-01", site);
Page page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12063/AW22.Test.12.6.3-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("AW22.Test.12.6.3-5NT-01-page1", page);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12063/AW22.Test.12.6.3-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("AW22.Test.12.6.3-5NT-01-page1", page);
}
Aggregations