Search in sources :

Example 1 with AOnClickAction

use of org.codelibs.fess.crawler.client.http.action.AOnClickAction 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");
}
Also used : StandardCrawlerContainer(org.codelibs.fess.crawler.container.StandardCrawlerContainer) MimeTypeHelperImpl(org.codelibs.fess.crawler.helper.impl.MimeTypeHelperImpl) Iterator(java.util.Iterator) CrawlerPooledObjectFactory(org.codelibs.fess.crawler.pool.CrawlerPooledObjectFactory) ResourceUtil(org.codelibs.core.io.ResourceUtil) PlainTestCase(org.dbflute.utflute.core.PlainTestCase) CrawlerWebDriver(org.codelibs.fess.crawler.client.http.webdriver.CrawlerWebDriver) Resource(javax.annotation.Resource) GenericObjectPool(org.apache.commons.pool2.impl.GenericObjectPool) Set(java.util.Set) File(java.io.File) AOnClickAction(org.codelibs.fess.crawler.client.http.action.AOnClickAction) SystemUtil(org.codelibs.core.lang.SystemUtil) Constants(org.codelibs.fess.crawler.Constants) RequestData(org.codelibs.fess.crawler.entity.RequestData) FormAction(org.codelibs.fess.crawler.client.http.action.FormAction) WebDriverClient(org.codelibs.fess.crawler.client.http.WebDriverClient) CrawlerWebServer(org.codelibs.fess.crawler.util.CrawlerWebServer) RequestDataBuilder(org.codelibs.fess.crawler.builder.RequestDataBuilder) InputStreamUtil(org.codelibs.core.io.InputStreamUtil) ResponseData(org.codelibs.fess.crawler.entity.ResponseData) AOnClickAction(org.codelibs.fess.crawler.client.http.action.AOnClickAction) WebDriverClient(org.codelibs.fess.crawler.client.http.WebDriverClient) FormAction(org.codelibs.fess.crawler.client.http.action.FormAction) CrawlerWebDriver(org.codelibs.fess.crawler.client.http.webdriver.CrawlerWebDriver) StandardCrawlerContainer(org.codelibs.fess.crawler.container.StandardCrawlerContainer) CrawlerPooledObjectFactory(org.codelibs.fess.crawler.pool.CrawlerPooledObjectFactory) GenericObjectPool(org.apache.commons.pool2.impl.GenericObjectPool) MimeTypeHelperImpl(org.codelibs.fess.crawler.helper.impl.MimeTypeHelperImpl)

Aggregations

File (java.io.File)1 Iterator (java.util.Iterator)1 Set (java.util.Set)1 Resource (javax.annotation.Resource)1 GenericObjectPool (org.apache.commons.pool2.impl.GenericObjectPool)1 InputStreamUtil (org.codelibs.core.io.InputStreamUtil)1 ResourceUtil (org.codelibs.core.io.ResourceUtil)1 SystemUtil (org.codelibs.core.lang.SystemUtil)1 Constants (org.codelibs.fess.crawler.Constants)1 RequestDataBuilder (org.codelibs.fess.crawler.builder.RequestDataBuilder)1 WebDriverClient (org.codelibs.fess.crawler.client.http.WebDriverClient)1 AOnClickAction (org.codelibs.fess.crawler.client.http.action.AOnClickAction)1 FormAction (org.codelibs.fess.crawler.client.http.action.FormAction)1 CrawlerWebDriver (org.codelibs.fess.crawler.client.http.webdriver.CrawlerWebDriver)1 StandardCrawlerContainer (org.codelibs.fess.crawler.container.StandardCrawlerContainer)1 RequestData (org.codelibs.fess.crawler.entity.RequestData)1 ResponseData (org.codelibs.fess.crawler.entity.ResponseData)1 MimeTypeHelperImpl (org.codelibs.fess.crawler.helper.impl.MimeTypeHelperImpl)1 CrawlerPooledObjectFactory (org.codelibs.fess.crawler.pool.CrawlerPooledObjectFactory)1 CrawlerWebServer (org.codelibs.fess.crawler.util.CrawlerWebServer)1