This is an automated email from the ASF dual-hosted git repository. tallison pushed a commit to branch TIKA-3226 in repository https://gitbox.apache.org/repos/asf/tika.git
commit aedbbc2a282c6da317d261b518f7d5c2e6e98188 Author: tballison <[email protected]> AuthorDate: Tue Jan 26 15:23:58 2021 -0500 TIKA-3226 -- unit tests pass --- .../tika/config/TikaTranslatorConfigTest.java | 5 ++-- .../org/apache/tika/server/client/TestBasic.java | 28 +++++++++++++++++++++- ...itter.xml => tika-config-simple-fs-emitter.xml} | 2 +- .../tika/server/core/resource/TikaResource.java | 4 ++-- .../apache/tika/server/core/StackTraceOffTest.java | 2 +- 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/tika-parsers/tika-parsers-classic/tika-parsers-classic-package/src/test/java/org/apache/tika/config/TikaTranslatorConfigTest.java b/tika-parsers/tika-parsers-classic/tika-parsers-classic-package/src/test/java/org/apache/tika/config/TikaTranslatorConfigTest.java index 71af206..3c7e227 100644 --- a/tika-parsers/tika-parsers-classic/tika-parsers-classic-package/src/test/java/org/apache/tika/config/TikaTranslatorConfigTest.java +++ b/tika-parsers/tika-parsers-classic/tika-parsers-classic-package/src/test/java/org/apache/tika/config/TikaTranslatorConfigTest.java @@ -19,6 +19,7 @@ package org.apache.tika.config; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import org.apache.tika.exception.TikaConfigException; import org.apache.tika.language.translate.DefaultTranslator; import org.apache.tika.language.translate.EmptyTranslator; import org.junit.Test; @@ -58,9 +59,9 @@ public class TikaTranslatorConfigTest extends AbstractTikaConfigTest { /** * Currently, Translators don't support Composites, so - * if multiple translators are given, only the first wins + * if multiple translators are given, throw a TikaConfigException */ - @Test + @Test(expected = TikaConfigException.class) public void testRequestsMultiple() throws Exception { TikaConfig config = getConfig("TIKA-1702-translator-empty-default.xml"); assertNotNull(config.getParser()); diff --git a/tika-server/tika-server-client/src/test/java/org/apache/tika/server/client/TestBasic.java b/tika-server/tika-server-client/src/test/java/org/apache/tika/server/client/TestBasic.java index 9df8e44..1cee50f 100644 --- a/tika-server/tika-server-client/src/test/java/org/apache/tika/server/client/TestBasic.java +++ b/tika-server/tika-server-client/src/test/java/org/apache/tika/server/client/TestBasic.java @@ -1,13 +1,39 @@ +/* + * 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.server.client; +import org.junit.Ignore; import org.junit.Test; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import static org.junit.Assert.assertTrue; + +@Ignore("turn into actual unit test") public class TestBasic { @Test public void testBasic() throws Exception { + Path p = Paths.get(TestBasic.class.getResource("/tika-config-simple-fs-emitter.xml").toURI()); + assertTrue(Files.isRegularFile(p)); String[] args = new String[]{ - "/Users/allison/Intellij/tika-main/tika-server/tika-server-client/src/test/resources/tika-config-simple-solr-emitter.xml", + p.toAbsolutePath().toString(), "http://localhost:9998/", "fs" }; diff --git a/tika-server/tika-server-client/src/test/resources/tika-config-simple-solr-emitter.xml b/tika-server/tika-server-client/src/test/resources/tika-config-simple-fs-emitter.xml similarity index 97% rename from tika-server/tika-server-client/src/test/resources/tika-config-simple-solr-emitter.xml rename to tika-server/tika-server-client/src/test/resources/tika-config-simple-fs-emitter.xml index 56be391..bfa3716 100644 --- a/tika-server/tika-server-client/src/test/resources/tika-config-simple-solr-emitter.xml +++ b/tika-server/tika-server-client/src/test/resources/tika-config-simple-fs-emitter.xml @@ -22,7 +22,7 @@ <fetchIterators> <fetchIterator class="org.apache.tika.pipes.fetchiterator.FileSystemFetchIterator"> <params> - <param name="fetchPrefix" type="string">fs</param> + <param name="fetcherName" type="string">fs</param> <param name="basePath" type="string">fix</param> </params> </fetchIterator> diff --git a/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/TikaResource.java b/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/TikaResource.java index 9285309..46cf093 100644 --- a/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/TikaResource.java +++ b/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/TikaResource.java @@ -292,8 +292,8 @@ public class TikaResource { } if (mediaType != null) { - //metadata.add(Metadata.CONTENT_TYPE, mediaType.toString()); - //metadata.add(TikaCoreProperties.CONTENT_TYPE_OVERRIDE, mediaType.toString()); + metadata.add(Metadata.CONTENT_TYPE, mediaType.toString()); + metadata.add(TikaCoreProperties.CONTENT_TYPE_OVERRIDE, mediaType.toString()); } for (Map.Entry<String, List<String>> e : httpHeaders.entrySet()) { 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 70a6b78..9dadd63 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 @@ -145,7 +145,7 @@ public class StackTraceOffTest extends CXFTestBase { } //For now, make sure that non-complete document - //still returtestXDP.xdpns BAD_REQUEST. We may want to + //still returns BAD_REQUEST. We may want to //make MetadataResource return the same types of parse //exceptions as the others... @Test
