Search in sources :

Example 11 with AccessResultDataImpl

use of org.codelibs.fess.crawler.entity.AccessResultDataImpl in project fess-crawler by codelibs.

the class BinaryTransformerTest method test_getData_wrongName.

public void test_getData_wrongName() throws Exception {
    final AccessResultDataImpl accessResultData = new AccessResultDataImpl();
    accessResultData.setTransformerName("transformer");
    accessResultData.setData("xyz".getBytes());
    try {
        binaryTransformer.getData(accessResultData);
        fail();
    } catch (final CrawlerSystemException e) {
    }
}
Also used : CrawlerSystemException(org.codelibs.fess.crawler.exception.CrawlerSystemException) AccessResultDataImpl(org.codelibs.fess.crawler.entity.AccessResultDataImpl)

Example 12 with AccessResultDataImpl

use of org.codelibs.fess.crawler.entity.AccessResultDataImpl in project fess-crawler by codelibs.

the class BinaryTransformerTest method test_getData.

public void test_getData() throws Exception {
    final AccessResultDataImpl accessResultData = new AccessResultDataImpl();
    accessResultData.setTransformerName("binaryTransformer");
    accessResultData.setData("xyz".getBytes());
    final Object obj = binaryTransformer.getData(accessResultData);
    assertNotNull(obj);
    assertTrue(obj instanceof InputStream);
    assertEquals("xyz", new String(IOUtils.toByteArray((InputStream) obj)));
}
Also used : InputStream(java.io.InputStream) AccessResultDataImpl(org.codelibs.fess.crawler.entity.AccessResultDataImpl)

Example 13 with AccessResultDataImpl

use of org.codelibs.fess.crawler.entity.AccessResultDataImpl in project fess-crawler by codelibs.

the class FileTransformerTest method test_getData.

public void test_getData() throws Exception {
    final AccessResultDataImpl accessResultDataImpl = new AccessResultDataImpl();
    accessResultDataImpl.setData("hoge.txt".getBytes());
    accessResultDataImpl.setEncoding(Constants.UTF_8);
    accessResultDataImpl.setTransformerName("fileTransformer");
    setBaseDir();
    final Object obj = fileTransformer.getData(accessResultDataImpl);
    assertTrue(obj instanceof File);
    assertEquals(new File(fileTransformer.baseDir, "hoge.txt"), obj);
}
Also used : AccessResultDataImpl(org.codelibs.fess.crawler.entity.AccessResultDataImpl) File(java.io.File)

Example 14 with AccessResultDataImpl

use of org.codelibs.fess.crawler.entity.AccessResultDataImpl in project fess-crawler by codelibs.

the class FileTransformerTest method test_getData_wrongName.

public void test_getData_wrongName() throws Exception {
    final AccessResultDataImpl accessResultDataImpl = new AccessResultDataImpl();
    accessResultDataImpl.setData("hoge.txt".getBytes());
    accessResultDataImpl.setEncoding(Constants.UTF_8);
    accessResultDataImpl.setTransformerName("transformer");
    setBaseDir();
    try {
        final Object obj = fileTransformer.getData(accessResultDataImpl);
        fail();
    } catch (final CrawlerSystemException e) {
    }
}
Also used : CrawlerSystemException(org.codelibs.fess.crawler.exception.CrawlerSystemException) AccessResultDataImpl(org.codelibs.fess.crawler.entity.AccessResultDataImpl)

Example 15 with AccessResultDataImpl

use of org.codelibs.fess.crawler.entity.AccessResultDataImpl in project fess-crawler by codelibs.

the class HtmlTransformerTest method test_getData.

public void test_getData() throws Exception {
    final String value = "<html><body>hoge</body></html>";
    final AccessResultDataImpl accessResultDataImpl = new AccessResultDataImpl();
    accessResultDataImpl.setData(value.getBytes());
    accessResultDataImpl.setEncoding(Constants.UTF_8);
    accessResultDataImpl.setTransformerName("htmlTransformer");
    final Object obj = htmlTransformer.getData(accessResultDataImpl);
    assertEquals(value, obj);
}
Also used : AccessResultDataImpl(org.codelibs.fess.crawler.entity.AccessResultDataImpl)

Aggregations

AccessResultDataImpl (org.codelibs.fess.crawler.entity.AccessResultDataImpl)24 ArrayList (java.util.ArrayList)6 CrawlerSystemException (org.codelibs.fess.crawler.exception.CrawlerSystemException)6 TestEntity (org.codelibs.fess.crawler.entity.TestEntity)4 Map (java.util.Map)2 File (java.io.File)1 InputStream (java.io.InputStream)1