Search in sources :

Example 1 with AuditImpl

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

the class CrawlerServiceImplTest method initialiseAndLaunchCrawl.

/**
     *
     * @param siteUrl
     * @param depth
     * @param regexp
     * @param maxDuration
     * @param maxDocuments
     * @param proxyHost
     * @param proxyPort
     * @return
     */
private List<Content> initialiseAndLaunchCrawl(String siteUrl, String depth, String exlusionRegexp, String inlusionRegexp, String maxDuration, String maxDocuments) {
    Audit audit = new AuditImpl();
    audit.setParameterSet(setCrawlParameters(depth, exlusionRegexp, inlusionRegexp, maxDuration, maxDocuments));
    WebResource site = crawlerService.crawlSite(audit, siteUrl);
    Collection<Long> contentListId = mockContentDataService.getSSPIdsFromWebResource(site.getId(), HttpStatus.SC_OK, 0, 10);
    List<Content> contentList = new ArrayList();
    for (Long id : contentListId) {
        Content content = mockContentDataService.readWithRelatedContent(id, false);
        if (content != null) {
            System.out.println(content.getURI() + "  " + content.getClass());
            contentList.add(content);
        }
    }
    return contentList;
}
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 2 with AuditImpl

use of org.asqatasun.entity.audit.AuditImpl 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 3 with AuditImpl

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

the class TestDAOImplTest method testRetrieveTestFromAuditAndLabel.

public void testRetrieveTestFromAuditAndLabel() {
    Audit audit = new AuditImpl();
    audit.setId(1L);
    audit.setStatus(AuditStatus.COMPLETED);
    Test test = testDAO.retrieveTestFromAuditAndLabel(audit, "1.1.2");
    assertEquals(test.getLabel(), "1.1.2");
    audit.setId(2L);
    test = testDAO.retrieveTestFromAuditAndLabel(audit, "1.1.15");
    assertEquals(test.getLabel(), "1.1.15");
    test = testDAO.retrieveTestFromAuditAndLabel(audit, "2.1.5");
    assertNull(test);
}
Also used : AuditImpl(org.asqatasun.entity.audit.AuditImpl) Audit(org.asqatasun.entity.audit.Audit) Test(org.asqatasun.entity.reference.Test)

Aggregations

Audit (org.asqatasun.entity.audit.Audit)3 AuditImpl (org.asqatasun.entity.audit.AuditImpl)3 Content (org.asqatasun.entity.audit.Content)2 WebResource (org.asqatasun.entity.subject.WebResource)2 Test (org.asqatasun.entity.reference.Test)1