Exemplo n.º 1
0
  @Test
  public void testIndexingMetadata() {
    bridgeUnderTest.setMetadataProcessorClass(CustomTikaMetadataProcessor.class);
    bridgeUnderTest.set(testFieldName, PATH_TO_TEST_DOCUMENT_PDF, testDocument, options);

    assertEquals(
        "The content type should have been indexed", "application/pdf", testDocument.get("type"));
  }
Exemplo n.º 2
0
 @Test
 public void testPrepareMetadata() {
   bridgeUnderTest.setMetadataProcessorClass(CustomTikaMetadataProcessor.class);
   bridgeUnderTest.set(testFieldName, PATH_TO_TEST_DOCUMENT_PDF, testDocument, options);
   assertEquals(
       "The set method of the custom metadata processor should have been called",
       1,
       CustomTikaMetadataProcessor.invocationCount);
 }
Exemplo n.º 3
0
 @Test
 public void testUnknownTikaMetadataProcessor() throws Exception {
   try {
     bridgeUnderTest.setMetadataProcessorClass(this.getClass());
     fail();
   } catch (SearchException e) {
     assertEquals(
         "Wrong error message",
         "Wrong configuration of Tika parse context provider: class org.hibernate.search.test.bridge.builtin.TikaBridgeTest does not implement interface org.hibernate.search.bridge.TikaMetadataProcessor",
         e.getMessage());
   }
 }