This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch TIKA-4252
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/TIKA-4252 by this push:
     new 07b9a7480 TIKA-4252 - add tests for metadata generated from the fetcher
07b9a7480 is described below

commit 07b9a74804ec8a8b580f276908ba52905d4a9f1e
Author: tallison <[email protected]>
AuthorDate: Thu May 9 12:32:26 2024 -0400

    TIKA-4252 - add tests for metadata generated from the fetcher
---
 .../test/java/org/apache/tika/pipes/PipesClientTest.java    | 13 ++++++++++++-
 .../src/test/resources/org/apache/tika/pipes/TIKA-4252.xml  |  1 +
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/tika-core/src/test/java/org/apache/tika/pipes/PipesClientTest.java 
b/tika-core/src/test/java/org/apache/tika/pipes/PipesClientTest.java
index a8c182ddc..168567a84 100644
--- a/tika-core/src/test/java/org/apache/tika/pipes/PipesClientTest.java
+++ b/tika-core/src/test/java/org/apache/tika/pipes/PipesClientTest.java
@@ -17,7 +17,9 @@
 package org.apache.tika.pipes;
 
 import static org.apache.tika.TikaTest.assertContains;
+import static org.apache.tika.TikaTest.debug;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
@@ -28,6 +30,7 @@ import java.util.List;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.io.TempDir;
 
+import org.apache.tika.metadata.FileSystem;
 import org.apache.tika.metadata.Metadata;
 import org.apache.tika.metadata.TikaCoreProperties;
 import org.apache.tika.pipes.emitter.EmitKey;
@@ -36,7 +39,10 @@ import org.apache.tika.pipes.fetcher.FetchKey;
 public class PipesClientTest {
 
     @Test
-    public void testUserMetadataAndNoEmitter(@TempDir Path tmp) throws 
Exception {
+    public void testMetadataWithNoEmitter(@TempDir Path tmp) throws Exception {
+        //this tests that metadata gathered by the fetcher and user metadata
+        //comes through into the final set of metadata.
+
         Path tikaConfigTemplate = 
Paths.get(PipesClientTest.class.getResource("TIKA-4252.xml").toURI());
         Path tikaConfig = tmp.resolve("tika-config.xml");
         String xml = Files.readString(tikaConfigTemplate, 
StandardCharsets.UTF_8);
@@ -62,5 +68,10 @@ public class PipesClientTest {
         assertEquals("v1", metadataList.get(0).get("k1"));
         assertEquals("v2a", metadataList.get(0).getValues("k2")[0]);
         assertEquals("v2b", metadataList.get(0).getValues("k2")[1]);
+
+        //confirm that metadata from the fetcher is making it into the final 
result
+        assertNotNull(metadataList.get(0).get(FileSystem.ACCESSED));
+        assertNotNull(metadataList.get(0).get(FileSystem.CREATED));
+        assertNotNull(metadataList.get(0).get(FileSystem.MODIFIED));
     }
 }
diff --git a/tika-core/src/test/resources/org/apache/tika/pipes/TIKA-4252.xml 
b/tika-core/src/test/resources/org/apache/tika/pipes/TIKA-4252.xml
index 036f0f2a5..16ac7e7ba 100644
--- a/tika-core/src/test/resources/org/apache/tika/pipes/TIKA-4252.xml
+++ b/tika-core/src/test/resources/org/apache/tika/pipes/TIKA-4252.xml
@@ -20,6 +20,7 @@
     <fetcher class="org.apache.tika.pipes.fetcher.fs.FileSystemFetcher">
       <name>fs</name>
       <basePath>BASE_PATH</basePath>
+      <extractFileSystemMetadata>true</extractFileSystemMetadata>
     </fetcher>
   </fetchers>
   <emitters>

Reply via email to