use of org.apache.jackrabbit.oak.plugins.index.fulltext.PreExtractedTextProvider in project jackrabbit-oak by apache.
the class ExtractedTextCacheTest method preExtractionReindex.
@Test
public void preExtractionReindex() throws Exception {
ExtractedTextCache cache = new ExtractedTextCache(10 * FileUtils.ONE_MB, 100);
PreExtractedTextProvider provider = mock(PreExtractedTextProvider.class);
cache.setExtractedTextProvider(provider);
when(provider.getText(anyString(), any(Blob.class))).thenReturn(new ExtractedText(ExtractionResult.SUCCESS, "bar"));
Blob b = new IdBlob("hello", "a");
String text = cache.get("/a", "foo", b, true);
assertEquals("bar", text);
}
use of org.apache.jackrabbit.oak.plugins.index.fulltext.PreExtractedTextProvider in project jackrabbit-oak by apache.
the class ExtractedTextCacheTest method preExtractionNoReindex.
@Test
public void preExtractionNoReindex() throws Exception {
ExtractedTextCache cache = new ExtractedTextCache(10 * FileUtils.ONE_MB, 100);
PreExtractedTextProvider provider = mock(PreExtractedTextProvider.class);
cache.setExtractedTextProvider(provider);
Blob b = new IdBlob("hello", "a");
String text = cache.get("/a", "foo", b, false);
assertNull(text);
verifyZeroInteractions(provider);
}
use of org.apache.jackrabbit.oak.plugins.index.fulltext.PreExtractedTextProvider in project jackrabbit-oak by apache.
the class DataStoreTextWriterTest method inMemoryRecord.
@Test
public void inMemoryRecord() throws Exception {
File fdsDir = temporaryFolder.newFolder();
FileDataStore fds = DataStoreUtils.createFDS(fdsDir, 10000);
DataStoreBlobStore dbs = new DataStoreBlobStore(fds);
ByteArrayInputStream is = new ByteArrayInputStream("".getBytes());
String blobId = dbs.writeBlob(is);
File writerDir = temporaryFolder.newFolder();
PreExtractedTextProvider textProvider = new DataStoreTextWriter(writerDir, true);
assertNull(textProvider.getText("/content", new BlobStoreBlob(dbs, blobId)));
}
use of org.apache.jackrabbit.oak.plugins.index.fulltext.PreExtractedTextProvider in project jackrabbit-oak by apache.
the class ExtractedTextCacheTest method preExtractionAlwaysUse.
@Test
public void preExtractionAlwaysUse() throws Exception {
ExtractedTextCache cache = new ExtractedTextCache(10 * FileUtils.ONE_MB, 100, true, null);
PreExtractedTextProvider provider = mock(PreExtractedTextProvider.class);
cache.setExtractedTextProvider(provider);
when(provider.getText(anyString(), any(Blob.class))).thenReturn(new ExtractedText(ExtractionResult.SUCCESS, "bar"));
Blob b = new IdBlob("hello", "a");
String text = cache.get("/a", "foo", b, false);
assertEquals("bar", text);
}
Aggregations