This is an automated email from the ASF dual-hosted git repository.
tallison 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 2dbadc6b9 Non-controversial updates that will make applying spotless
easier -- fix the path for a test file and fix a number of license headers.
(#2406)
2dbadc6b9 is described below
commit 2dbadc6b99ba02dae2031b1842648f5ddf7e5123
Author: Tim Allison <[email protected]>
AuthorDate: Tue Nov 25 15:14:53 2025 -0500
Non-controversial updates that will make applying spotless easier -- fix
the path for a test file and fix a number of license headers. (#2406)
---
.../main/java/org/apache/tika/metadata/Font.java | 4 +-
.../main/java/org/apache/tika/metadata/HTML.java | 4 +-
.../java/org/apache/tika/metadata/RTFMetadata.java | 4 +-
.../org/apache/tika/config/MockConfigTest.java | 2 +-
.../java/org/apache/tika/config/ParamTest.java | 2 +-
.../parser/microsoft/msg/TikaNameIdChunks.java | 32 ++---
.../tika/parser/indesign/IDMLParserTest.java | 2 +-
.../tika/pipes/core/TikaPipesConfigTest.java | 2 +-
.../pipesiterator/csv/TestCSVPipesIterator.java | 131 +++++++++++++++++++++
.../apache/tika/server/core/StackTraceOffTest.java | 2 +-
.../apache/tika/server/core/StackTraceTest.java | 2 +-
.../org/apache/tika/server/core/TikaPipesTest.java | 2 +-
.../server/standard/JsonMaxFieldLengthTest.java | 6 +-
.../apache/tika/server/standard/TikaPipesTest.java | 2 +-
.../language/translate/impl/RTGTranslator.java | 2 +-
.../language/translate/impl/RTGTranslatorTest.java | 2 +-
16 files changed, 170 insertions(+), 31 deletions(-)
diff --git a/tika-core/src/main/java/org/apache/tika/metadata/Font.java
b/tika-core/src/main/java/org/apache/tika/metadata/Font.java
index 706e199db..510b584e9 100644
--- a/tika-core/src/main/java/org/apache/tika/metadata/Font.java
+++ b/tika-core/src/main/java/org/apache/tika/metadata/Font.java
@@ -1,4 +1,4 @@
-package org.apache.tika.metadata; /*
+/*
* 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.
@@ -15,6 +15,8 @@ package org.apache.tika.metadata; /*
* limitations under the License.
*/
+package org.apache.tika.metadata;
+
public interface Font {
String PREFIX_FONT_META = "font";
diff --git a/tika-core/src/main/java/org/apache/tika/metadata/HTML.java
b/tika-core/src/main/java/org/apache/tika/metadata/HTML.java
index 2d6eb485f..0f3ed8d9c 100644
--- a/tika-core/src/main/java/org/apache/tika/metadata/HTML.java
+++ b/tika-core/src/main/java/org/apache/tika/metadata/HTML.java
@@ -1,4 +1,4 @@
-package org.apache.tika.metadata; /*
+/*
* 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.
@@ -15,6 +15,8 @@ package org.apache.tika.metadata; /*
* limitations under the License.
*/
+package org.apache.tika.metadata;
+
public interface HTML {
String PREFIX_HTML_META = "html" +
TikaCoreProperties.NAMESPACE_PREFIX_DELIMITER;
diff --git a/tika-core/src/main/java/org/apache/tika/metadata/RTFMetadata.java
b/tika-core/src/main/java/org/apache/tika/metadata/RTFMetadata.java
index 22842391f..74b9ec73c 100644
--- a/tika-core/src/main/java/org/apache/tika/metadata/RTFMetadata.java
+++ b/tika-core/src/main/java/org/apache/tika/metadata/RTFMetadata.java
@@ -1,4 +1,4 @@
-package org.apache.tika.metadata; /*
+/*
* 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.
@@ -15,6 +15,8 @@ package org.apache.tika.metadata; /*
* limitations under the License.
*/
+package org.apache.tika.metadata;
+
public interface RTFMetadata {
String PREFIX_RTF_META = "rtf_meta";
diff --git a/tika-core/src/test/java/org/apache/tika/config/MockConfigTest.java
b/tika-core/src/test/java/org/apache/tika/config/MockConfigTest.java
index 9bbe8ede9..63ffccec2 100644
--- a/tika-core/src/test/java/org/apache/tika/config/MockConfigTest.java
+++ b/tika-core/src/test/java/org/apache/tika/config/MockConfigTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
diff --git a/tika-core/src/test/java/org/apache/tika/config/ParamTest.java
b/tika-core/src/test/java/org/apache/tika/config/ParamTest.java
index d4d53b667..fd25b3cca 100644
--- a/tika-core/src/test/java/org/apache/tika/config/ParamTest.java
+++ b/tika-core/src/test/java/org/apache/tika/config/ParamTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
diff --git
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/msg/TikaNameIdChunks.java
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/msg/TikaNameIdChunks.java
index ba54f6e4e..ac47e01e7 100644
---
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/msg/TikaNameIdChunks.java
+++
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/msg/TikaNameIdChunks.java
@@ -1,19 +1,19 @@
-/* ====================================================================
- 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.
-==================================================================== */
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.parser.microsoft.msg;
diff --git
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/test/java/org/apache/tika/parser/indesign/IDMLParserTest.java
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/test/java/org/apache/tika/parser/indesign/IDMLParserTest.java
index 856c5990c..d29ba19d2 100644
---
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/test/java/org/apache/tika/parser/indesign/IDMLParserTest.java
+++
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/test/java/org/apache/tika/parser/indesign/IDMLParserTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
diff --git
a/tika-pipes/tika-pipes-core/src/test/java/org/apache/tika/pipes/core/TikaPipesConfigTest.java
b/tika-pipes/tika-pipes-core/src/test/java/org/apache/tika/pipes/core/TikaPipesConfigTest.java
index 1b3cfaa4c..ca6eaf1cf 100644
---
a/tika-pipes/tika-pipes-core/src/test/java/org/apache/tika/pipes/core/TikaPipesConfigTest.java
+++
b/tika-pipes/tika-pipes-core/src/test/java/org/apache/tika/pipes/core/TikaPipesConfigTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
diff --git
a/tika-pipes/tika-pipes-iterators/tika-pipes-iterator-csv/src/test/java/org/apache/tika/pipes/pipesiterator/csv/TestCSVPipesIterator.java
b/tika-pipes/tika-pipes-iterators/tika-pipes-iterator-csv/src/test/java/org/apache/tika/pipes/pipesiterator/csv/TestCSVPipesIterator.java
new file mode 100644
index 000000000..ce54556a1
--- /dev/null
+++
b/tika-pipes/tika-pipes-iterators/tika-pipes-iterator-csv/src/test/java/org/apache/tika/pipes/pipesiterator/csv/TestCSVPipesIterator.java
@@ -0,0 +1,131 @@
+/*
+ * 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.pipesiterator.csv;
+
+import static
org.apache.tika.pipes.core.pipesiterator.PipesIterator.COMPLETED_SEMAPHORE;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorCompletionService;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.jupiter.api.Test;
+
+import org.apache.tika.pipes.core.FetchEmitTuple;
+
+public class TestCSVPipesIterator {
+
+
+ @Test
+ public void testSimple() throws Exception {
+ Path p = get("test-simple.csv");
+ CSVPipesIterator it = new CSVPipesIterator();
+ it.setFetcherName("fsf");
+ it.setEmitterName("fse");
+ it.setCsvPath(p);
+ it.setFetchKeyColumn("fetchKey");
+ int numConsumers = 2;
+ ExecutorService es = Executors.newFixedThreadPool(numConsumers);
+ ExecutorCompletionService c = new ExecutorCompletionService(es);
+ ArrayBlockingQueue<FetchEmitTuple> queue = new
ArrayBlockingQueue<>(100);
+ List<MockFetcher> fetchers = new ArrayList<>();
+ for (int i = 0; i < numConsumers; i++) {
+ MockFetcher f = new MockFetcher(queue);
+ fetchers.add(f);
+ c.submit(f);
+ }
+ for (FetchEmitTuple t : it) {
+ queue.offer(t);
+ }
+ for (int i = 0; i < numConsumers; i++) {
+ queue.offer(COMPLETED_SEMAPHORE);
+ }
+ int finished = 0;
+ int completed = 0;
+ try {
+ while (finished++ < numConsumers) {
+ Future<Integer> f = c.take();
+ completed += f.get();
+ }
+ } finally {
+ es.shutdownNow();
+ }
+ assertEquals(5, completed);
+ for (MockFetcher f : fetchers) {
+ for (FetchEmitTuple t : f.pairs) {
+ String id = t
+ .getMetadata()
+ .get("id");
+ assertEquals("path/to/my/file" + id, t
+ .getFetchKey()
+ .getFetchKey());
+ assertEquals("project" + (Integer.parseInt(id) % 2 == 1 ? "a"
: "b"), t
+ .getMetadata()
+ .get("project"));
+ }
+ }
+ }
+
+ @Test
+ public void testBadFetchKeyCol() throws Exception {
+ Path p = get("test-simple.csv");
+ CSVPipesIterator it = new CSVPipesIterator();
+ it.setFetcherName("fs");
+ it.setCsvPath(p);
+ assertThrows(RuntimeException.class, () -> {
+ it.setFetchKeyColumn("fetchKeyDoesntExist");
+ for (FetchEmitTuple t : it) {
+
+ }
+ });
+ }
+
+ private Path get(String testFileName) throws Exception {
+ return Paths.get(TestCSVPipesIterator.class
+ .getResource("/" + testFileName)
+ .toURI());
+ }
+
+ private static class MockFetcher implements Callable<Integer> {
+ private final ArrayBlockingQueue<FetchEmitTuple> queue;
+ private final List<FetchEmitTuple> pairs = new ArrayList<>();
+
+ private MockFetcher(ArrayBlockingQueue<FetchEmitTuple> queue) {
+ this.queue = queue;
+ }
+
+ @Override
+ public Integer call() throws Exception {
+ while (true) {
+ FetchEmitTuple t = queue.poll(1, TimeUnit.HOURS);
+ if (t == COMPLETED_SEMAPHORE) {
+ return pairs.size();
+ }
+ pairs.add(t);
+ }
+ }
+ }
+}
diff --git
a/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/StackTraceOffTest.java
b/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/StackTraceOffTest.java
index 6d212581a..2a5a5d281 100644
---
a/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/StackTraceOffTest.java
+++
b/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/StackTraceOffTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
diff --git
a/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/StackTraceTest.java
b/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/StackTraceTest.java
index b7d22c3b4..c1161069a 100644
---
a/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/StackTraceTest.java
+++
b/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/StackTraceTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
diff --git
a/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/TikaPipesTest.java
b/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/TikaPipesTest.java
index 7901e14d1..1e84deeda 100644
---
a/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/TikaPipesTest.java
+++
b/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/TikaPipesTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
diff --git
a/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/JsonMaxFieldLengthTest.java
b/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/JsonMaxFieldLengthTest.java
index ddb45ec37..03982eceb 100644
---
a/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/JsonMaxFieldLengthTest.java
+++
b/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/JsonMaxFieldLengthTest.java
@@ -1,4 +1,4 @@
-package org.apache.tika.server.standard;/*
+/*
* 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.
@@ -6,7 +6,7 @@ package org.apache.tika.server.standard;/*
* (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
+ * 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,
@@ -15,6 +15,8 @@ package org.apache.tika.server.standard;/*
* limitations under the License.
*/
+package org.apache.tika.server.standard;
+
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.jupiter.api.Assertions.assertEquals;
diff --git
a/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/TikaPipesTest.java
b/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/TikaPipesTest.java
index e49827fa6..80c241b6b 100644
---
a/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/TikaPipesTest.java
+++
b/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/TikaPipesTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
diff --git
a/tika-translate/src/main/java/org/apache/tika/language/translate/impl/RTGTranslator.java
b/tika-translate/src/main/java/org/apache/tika/language/translate/impl/RTGTranslator.java
index 7a36499ef..618c5e88f 100644
---
a/tika-translate/src/main/java/org/apache/tika/language/translate/impl/RTGTranslator.java
+++
b/tika-translate/src/main/java/org/apache/tika/language/translate/impl/RTGTranslator.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
diff --git
a/tika-translate/src/test/java/org/apache/tika/language/translate/impl/RTGTranslatorTest.java
b/tika-translate/src/test/java/org/apache/tika/language/translate/impl/RTGTranslatorTest.java
index 45121a91e..37f1eadb9 100644
---
a/tika-translate/src/test/java/org/apache/tika/language/translate/impl/RTGTranslatorTest.java
+++
b/tika-translate/src/test/java/org/apache/tika/language/translate/impl/RTGTranslatorTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.