Search in sources :

Example 16 with Content

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

the class CrawlerServiceImplTest method testCrawl_Page.

/**
     * Test the crawl of a page
     */
public void testCrawl_Page() {
    System.out.println("crawl_page");
    crawlerFactory.setCrawlConfigFilePath(PAGE_CRAWL_CONF_FILE_PATH);
    String siteUrl = bundle.getString(FULL_SITE_CRAWL_URL_KEY);
    Audit audit = new AuditImpl();
    audit.setParameterSet(setCrawlParameters("3", "", "", "", ""));
    WebResource page = crawlerService.crawlPage(audit, siteUrl);
    Collection<Long> contentListId = mockContentDataService.getSSPIdsFromWebResource(page.getId(), HttpStatus.SC_OK, 0, 10);
    List<Content> contentList = new ArrayList<>();
    for (Long id : contentListId) {
        contentList.add(mockContentDataService.readWithRelatedContent(id, false));
    }
    assertEquals(1, contentList.size());
    Set<String> urlSet = getUrlSet(contentList);
    assertTrue(urlSet.contains(siteUrl));
    assertFalse(urlSet.contains(siteUrl + PAGE_NAME_LEVEL1));
    assertFalse(urlSet.contains(siteUrl + PAGE_NAME_LEVEL2));
    assertFalse(urlSet.contains(siteUrl + FORBIDDEN_PAGE_NAME));
}
Also used : AuditImpl(org.asqatasun.entity.audit.AuditImpl) Audit(org.asqatasun.entity.audit.Audit) Content(org.asqatasun.entity.audit.Content) WebResource(org.asqatasun.entity.subject.WebResource)

Example 17 with Content

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

the class AbstractRuleImplementationTestCase method process.

protected Collection<ProcessResult> process(String webResourceKey) {
    LOGGER.debug(this + "::process(\"" + webResourceKey + "\")");
    WebResource webResource = webResourceMap.get(webResourceKey);
    Collection<ProcessResult> grossResultList = PROCESSOR_SERVICE.process(contentMap.get(webResource), testList);
    for (Content content : contentMap.get(webResource)) {
        LOGGER.debug(content.getURI());
    }
    grossResultMap.put(webResource, grossResultList);
    return grossResultList;
}
Also used : Content(org.asqatasun.entity.audit.Content) ProcessResult(org.asqatasun.entity.audit.ProcessResult) WebResource(org.asqatasun.entity.subject.WebResource)

Aggregations

Content (org.asqatasun.entity.audit.Content)17 WebResource (org.asqatasun.entity.subject.WebResource)11 ArrayList (java.util.ArrayList)7 SSP (org.asqatasun.entity.audit.SSP)5 Audit (org.asqatasun.entity.audit.Audit)4 ContentDataService (org.asqatasun.entity.service.audit.ContentDataService)3 ContentLoader (org.asqatasun.contentloader.ContentLoader)2 ContentLoaderFactory (org.asqatasun.contentloader.ContentLoaderFactory)2 AuditImpl (org.asqatasun.entity.audit.AuditImpl)2 ProcessResult (org.asqatasun.entity.audit.ProcessResult)2 RelatedContent (org.asqatasun.entity.audit.RelatedContent)2 Test (org.asqatasun.entity.reference.Test)2 Page (org.asqatasun.entity.subject.Page)2 Site (org.asqatasun.entity.subject.Site)2 ScenarioLoader (org.asqatasun.scenarioloader.ScenarioLoader)2 DateFactory (org.asqatasun.util.factory.DateFactory)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1