TikaAutoDetectExtractor extends AbstractFilemgrMetExtractor { public Metadata doExtract(Product product, Metadata met) throws MetExtractionException { Metadata outMetadata = new Metadata(); merge(met, outMetadata); Metadata tikaMetadata = getMetadataFromTika(product); merge(tikaMetadata, outMetadata); return outMetadata; }  void doConfigure(); Metadata doExtract(Product product, Metadata met);  }
@Test public void test() throws MetExtractionException { TikaAutoDetectExtractor tikaExtractor = new TikaAutoDetectExtractor(); Metadata emptyMetadata = new Metadata(); Reference ref = new Reference(); URL file = this.getClass().getResource("/test.txt"); ref.setOrigReference(file.toString()); ref.setDataStoreReference(file.toString()); Product product = new Product(); product.getProductReferences().add(ref); product.setProductStructure(Product.STRUCTURE_FLAT); Metadata outputMetadata = tikaExtractor.doExtract(product, emptyMetadata); assertNotNull(outputMetadata); assertTrue(outputMetadata.getAllKeys().size() > 0); assertTrue(outputMetadata.containsKey("X-Parsed-By")); assertFalse(outputMetadata.getMetadata("X-Parsed-By").equals("org.apache.tika.parser.EmptyParser")); }