use of org.codelibs.fess.crawler.util.CrawlerWebServer in project fess-crawler by codelibs.
the class CrawlerTest method test_execute_xmlSitemaps.
public void test_execute_xmlSitemaps() throws Exception {
final CrawlerWebServer server = new CrawlerWebServer(7070);
server.start();
final String url = "http://localhost:7070/";
try {
final int maxCount = 50;
final int numOfThread = 10;
final File file = File.createTempFile("crawler-", "");
file.delete();
file.mkdirs();
file.deleteOnExit();
fileTransformer.setPath(file.getAbsolutePath());
crawler.addUrl(url + "sitemaps.xml");
crawler.crawlerContext.setMaxAccessCount(maxCount);
crawler.crawlerContext.setNumOfThread(numOfThread);
crawler.urlFilter.addInclude(url + ".*");
final String sessionId = crawler.execute();
assertEquals(maxCount, dataService.getCount(sessionId));
dataService.delete(sessionId);
} finally {
server.stop();
}
}
use of org.codelibs.fess.crawler.util.CrawlerWebServer in project fess-crawler by codelibs.
the class CrawlerTest method test_execute_web.
public void test_execute_web() throws Exception {
final CrawlerWebServer server = new CrawlerWebServer(7070);
server.start();
final String url = "http://localhost:7070/";
try {
final int maxCount = 50;
final int numOfThread = 10;
final File file = File.createTempFile("crawler-", "");
file.delete();
file.mkdirs();
file.deleteOnExit();
fileTransformer.setPath(file.getAbsolutePath());
crawler.addUrl(url);
crawler.crawlerContext.setMaxAccessCount(maxCount);
crawler.crawlerContext.setNumOfThread(numOfThread);
crawler.urlFilter.addInclude(url + ".*");
final String sessionId = crawler.execute();
assertEquals(maxCount, dataService.getCount(sessionId));
dataService.delete(sessionId);
} finally {
server.stop();
}
}
Aggregations