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

tballison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/main by this push:
     new 30679bdf8a TIKA-4984: drop test-only mock-digester-factory from 
configs shown in the docs (#3385)
30679bdf8a is described below

commit 30679bdf8a4921fbd93abce49c14520f95e740ad
Author: Tim Allison <[email protected]>
AuthorDate: Wed Oct 21 20:04:22 2026 -0400

    TIKA-4984: drop test-only mock-digester-factory from configs shown in the 
docs (#3385)
---
 CHANGES.txt                                        |  4 ++
 .../tika/pipes/core/DocsExampleConfigsTest.java    | 67 ++++++++++++++++++++++
 .../test/resources/configs/tika-config-basic.json  |  4 +-
 .../configs/tika-config-exception-reporting.json   |  4 +-
 .../configs/tika-config-inference-bindings.json    |  4 +-
 .../resources/configs/tika-config-passback.json    |  4 +-
 .../configs/tika-config-shared-server.json         |  4 +-
 .../configs/tika-config-text-recognizers.json      |  4 +-
 .../resources/configs/tika-config-uppercasing.json |  4 +-
 9 files changed, 92 insertions(+), 7 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 554ada5072..6175006c9c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -326,6 +326,10 @@ Release 4.2.0 - unreleased
 
   OTHER CHANGES
 
+   * The pipes getting-started and shared-server JSON examples no longer 
include the
+     test-only mock-digester-factory, which made the forked server fail at 
startup
+     (TIKA-4984).
+
    * tika-app -J writes the metadata list when the container throws (a 
zip-bomb trip, a
      corrupt or encrypted file), with the exception in 
tk:exception:container-exception on
      the first record, as /rmeta does; it used to print nothing. The exit 
status still
diff --git 
a/tika-pipes/tika-pipes-integration-tests/src/test/java/org/apache/tika/pipes/core/DocsExampleConfigsTest.java
 
b/tika-pipes/tika-pipes-integration-tests/src/test/java/org/apache/tika/pipes/core/DocsExampleConfigsTest.java
new file mode 100644
index 0000000000..fd9cf0804d
--- /dev/null
+++ 
b/tika-pipes/tika-pipes-integration-tests/src/test/java/org/apache/tika/pipes/core/DocsExampleConfigsTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.pipes.core;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Stream;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * Doc examples are symlinks to test configs; a test-only component in one 
fails at startup for
+ * users who copy it (TIKA-4984).
+ */
+public class DocsExampleConfigsTest {
+
+    private static final String EXAMPLES_RELATIVE_PATH = 
"docs/modules/ROOT/examples";
+
+    private static final Pattern MOCK_COMPONENT = 
Pattern.compile("\"(mock-[a-z0-9-]+)\"\\s*:");
+
+    @Test
+    public void testNoMockComponentsInDocExamples() throws Exception {
+        List<String> offenders = new ArrayList<>();
+        try (Stream<Path> files = Files.list(findExamplesDir())) {
+            for (Path p : (Iterable<Path>) files.filter(f -> 
f.toString().endsWith(".json"))::iterator) {
+                Matcher m = MOCK_COMPONENT.matcher(Files.readString(p, 
StandardCharsets.UTF_8));
+                while (m.find()) {
+                    offenders.add(p.getFileName() + ": " + m.group(1));
+                }
+            }
+        }
+        assertTrue(offenders.isEmpty(), "test-only components in doc examples: 
" + offenders);
+    }
+
+    private static Path findExamplesDir() {
+        Path dir = Path.of("").toAbsolutePath();
+        for (int i = 0; i < 6 && dir != null; i++, dir = dir.getParent()) {
+            Path candidate = dir.resolve(EXAMPLES_RELATIVE_PATH);
+            if (Files.isDirectory(candidate)) {
+                return candidate;
+            }
+        }
+        throw new IllegalStateException(
+                "could not locate " + EXAMPLES_RELATIVE_PATH + " above " + 
Path.of("").toAbsolutePath());
+    }
+}
diff --git 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-basic.json
 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-basic.json
index fde9878bfa..6cccb078f7 100644
--- 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-basic.json
+++ 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-basic.json
@@ -46,7 +46,9 @@
     "throwOnZeroBytes": false
   },
   "parse-context": {
-    "mock-digester-factory": {},
+    "commons-digester-factory": {
+      "digests": [{ "algorithm": "SHA256" }]
+    },
     "timeout-limits": {
       "progressTimeoutMillis": 5000
     }
diff --git 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-exception-reporting.json
 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-exception-reporting.json
index 23ff12b20f..c85a4dd303 100644
--- 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-exception-reporting.json
+++ 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-exception-reporting.json
@@ -46,7 +46,9 @@
     "throwOnZeroBytes": false
   },
   "parse-context": {
-    "mock-digester-factory": {},
+    "commons-digester-factory": {
+      "digests": [{ "algorithm": "SHA256" }]
+    },
     "exception-reporting": {
       "level": "MESSAGE_REDACTED",
       "maxLength": 10000
diff --git 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-inference-bindings.json
 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-inference-bindings.json
index 82891c676b..8951736618 100644
--- 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-inference-bindings.json
+++ 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-inference-bindings.json
@@ -51,7 +51,9 @@
     "throwOnZeroBytes": false
   },
   "parse-context": {
-    "mock-digester-factory": {},
+    "commons-digester-factory": {
+      "digests": [{ "algorithm": "SHA256" }]
+    },
     "timeout-limits": {
       "progressTimeoutMillis": 5000
     }
diff --git 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-passback.json
 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-passback.json
index 81c0d1f1dc..5403dffc35 100644
--- 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-passback.json
+++ 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-passback.json
@@ -45,7 +45,9 @@
     "throwOnZeroBytes": false
   },
   "parse-context": {
-    "mock-digester-factory": {},
+    "commons-digester-factory": {
+      "digests": [{ "algorithm": "SHA256" }]
+    },
     "timeout-limits": {
       "progressTimeoutMillis": 60000
     }
diff --git 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-shared-server.json
 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-shared-server.json
index 320133e6c9..211ee58f23 100644
--- 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-shared-server.json
+++ 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-shared-server.json
@@ -47,7 +47,9 @@
     "throwOnZeroBytes": false
   },
   "parse-context": {
-    "mock-digester-factory": {},
+    "commons-digester-factory": {
+      "digests": [{ "algorithm": "SHA256" }]
+    },
     "timeout-limits": {
       "progressTimeoutMillis": 5000
     }
diff --git 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-text-recognizers.json
 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-text-recognizers.json
index f321c97b51..1f0ffa581e 100644
--- 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-text-recognizers.json
+++ 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-text-recognizers.json
@@ -47,7 +47,9 @@
     "throwOnZeroBytes": false
   },
   "parse-context": {
-    "mock-digester-factory": {},
+    "commons-digester-factory": {
+      "digests": [{ "algorithm": "SHA256" }]
+    },
     "timeout-limits": {
       "progressTimeoutMillis": 5000
     }
diff --git 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-uppercasing.json
 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-uppercasing.json
index 26132ba517..825f7ffdf5 100644
--- 
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-uppercasing.json
+++ 
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-uppercasing.json
@@ -42,7 +42,9 @@
     "throwOnZeroBytes": false
   },
   "parse-context": {
-    "mock-digester-factory": {},
+    "commons-digester-factory": {
+      "digests": [{ "algorithm": "SHA256" }]
+    },
     "timeout-limits": {
       "progressTimeoutMillis": 60000
     }

Reply via email to