Search in sources :

Example 1 with ParsingTask

use of org.apache.jackrabbit.core.query.lucene.LazyTextExtractorField.ParsingTask in project jackrabbit by apache.

the class LazyTextExtractorFieldTest method testEmptyParser.

/**
     * @see <a
     *      href="https://issues.apache.org/jira/browse/JCR-3296">JCR-3296</a>
     *      Indexing ignored file types creates some garbage
     */
public void testEmptyParser() throws Exception {
    InternalValue val = InternalValue.create(new RandomInputStream(1, 1024));
    Metadata metadata = new Metadata();
    metadata.set(Metadata.CONTENT_TYPE, "application/java-archive");
    metadata.set(Metadata.CONTENT_ENCODING, "UTF-8");
    Parser p = getSearchIndex().getParser();
    ParsingTask task = new ParsingTask(p, val, metadata, Integer.MAX_VALUE) {

        public void setExtractedText(String value) {
            assertEquals("", value);
        }
    };
    task.run();
}
Also used : ParsingTask(org.apache.jackrabbit.core.query.lucene.LazyTextExtractorField.ParsingTask) Metadata(org.apache.tika.metadata.Metadata) InternalValue(org.apache.jackrabbit.core.value.InternalValue) RandomInputStream(org.apache.jackrabbit.core.data.RandomInputStream) Parser(org.apache.tika.parser.Parser)

Aggregations

RandomInputStream (org.apache.jackrabbit.core.data.RandomInputStream)1 ParsingTask (org.apache.jackrabbit.core.query.lucene.LazyTextExtractorField.ParsingTask)1 InternalValue (org.apache.jackrabbit.core.value.InternalValue)1 Metadata (org.apache.tika.metadata.Metadata)1 Parser (org.apache.tika.parser.Parser)1