use of org.codelibs.fess.crawler.container.StandardCrawlerContainer in project fess-crawler by codelibs.
the class WebDriverClientTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
CrawlerPooledObjectFactory<CrawlerWebDriver> pooledObjectFactory = new CrawlerPooledObjectFactory<>();
pooledObjectFactory.setComponentName("webDriver");
pooledObjectFactory.setOnDestroyListener(p -> {
final CrawlerWebDriver driver = p.getObject();
driver.quit();
});
final StandardCrawlerContainer container = new StandardCrawlerContainer();
container.prototype("webDriver", CrawlerWebDriver.class).singleton("mimeTypeHelper", MimeTypeHelperImpl.class).singleton("pooledObjectFactory", pooledObjectFactory).singleton("webDriverPool", new GenericObjectPool<>(pooledObjectFactory), null, pool -> {
pool.close();
}).<AOnClickAction>singleton("aOnClickAction", AOnClickAction.class).<FormAction>singleton("formAction", FormAction.class).<WebDriverClient>singleton("webDriverClient", WebDriverClient.class, client -> {
AOnClickAction aOnClick = container.getComponent("aOnClickAction");
aOnClick.setName("aOnClick");
aOnClick.setCssQuery("a");
client.addUrlAction(aOnClick);
FormAction formAction = container.getComponent("formAction");
formAction.setName("form");
formAction.setCssQuery("form");
client.addUrlAction(formAction);
});
webDriverClient = container.getComponent("webDriverClient");
}
use of org.codelibs.fess.crawler.container.StandardCrawlerContainer in project fess-crawler by codelibs.
the class RuleManagerImplTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
StandardCrawlerContainer container = new StandardCrawlerContainer().singleton("sitemapsHelper", //
SitemapsHelper.class).singleton("sitemapsRule", //
SitemapsRule.class).singleton("fileRule", //
RegexRule.class).singleton("ruleManager", RuleManagerImpl.class);
ruleManager = container.getComponent("ruleManager");
SitemapsRule sitemapsRule = container.getComponent("sitemapsRule");
sitemapsRule.setRuleId("sitemapsRule");
sitemapsRule.addRule("url", ".*sitemap.*");
ruleManager.addRule(sitemapsRule);
RegexRule fileRule = container.getComponent("fileRule");
fileRule.setRuleId("fileRule");
fileRule.setDefaultRule(true);
ruleManager.addRule(fileRule);
}
use of org.codelibs.fess.crawler.container.StandardCrawlerContainer in project fess-crawler by codelibs.
the class TextTransformerTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
StandardCrawlerContainer container = new StandardCrawlerContainer().singleton("extractorFactory", ExtractorFactory.class).singleton("textTransformer", TextTransformer.class).singleton("tikaExtractor", TikaExtractor.class);
textTransformer = container.getComponent("textTransformer");
textTransformer.setName("textTransformer");
ExtractorFactory extractorFactory = container.getComponent("extractorFactory");
TikaExtractor tikaExtractor = container.getComponent("tikaExtractor");
extractorFactory.addExtractor("text/plain", tikaExtractor);
extractorFactory.addExtractor("text/html", tikaExtractor);
}
use of org.codelibs.fess.crawler.container.StandardCrawlerContainer in project fess-crawler by codelibs.
the class EmlExtractorTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
StandardCrawlerContainer container = new StandardCrawlerContainer().singleton("emlExtractor", EmlExtractor.class);
container.singleton("mimeTypeHelper", MimeTypeHelperImpl.class).singleton("tikaExtractor", TikaExtractor.class).singleton("zipExtractor", ZipExtractor.class).<ExtractorFactory>singleton("extractorFactory", ExtractorFactory.class, factory -> {
TikaExtractor tikaExtractor = container.getComponent("tikaExtractor");
factory.addExtractor("application/pdf", tikaExtractor);
});
emlExtractor = container.getComponent("emlExtractor");
}
use of org.codelibs.fess.crawler.container.StandardCrawlerContainer in project fess-crawler by codelibs.
the class HtmlExtractorTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
StandardCrawlerContainer container = new StandardCrawlerContainer().singleton("htmlExtractor", HtmlExtractor.class);
htmlExtractor = container.getComponent("htmlExtractor");
}
Aggregations