Skip to content

Commit 3fda86a

Browse files
committed
Replace tika-files.zip by a tika-files dir
Let's make our life easier when debugging/testing. Also having a flat dir helps us to compare or "synchronize" more easily with Tika project files. Closes #22958. Backport of #22959 in 5.2 branch
1 parent 19853cb commit 3fda86a

File tree

210 files changed

+10
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+10
-2
lines changed

plugins/ingest-attachment/src/test/java/org/elasticsearch/ingest/attachment/TikaDocTests.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
import org.apache.lucene.util.LuceneTestCase.SuppressFileSystems;
2323
import org.apache.lucene.util.TestUtil;
2424
import org.apache.tika.metadata.Metadata;
25+
import org.elasticsearch.common.io.PathUtils;
2526
import org.elasticsearch.test.ESTestCase;
2627

2728
import java.nio.file.DirectoryStream;
2829
import java.nio.file.Files;
2930
import java.nio.file.Path;
31+
import java.nio.file.Paths;
3032

3133
/**
3234
* Evil test-coverage cheat, we parse a bunch of docs from tika
@@ -37,11 +39,17 @@
3739
public class TikaDocTests extends ESTestCase {
3840

3941
/** some test files from tika test suite, zipped up */
40-
static final String TIKA_FILES = "/org/elasticsearch/ingest/attachment/test/tika-files.zip";
42+
static final String TIKA_FILES = "/org/elasticsearch/ingest/attachment/test/tika-files/";
4143

4244
public void testFiles() throws Exception {
4345
Path tmp = createTempDir();
44-
TestUtil.unzip(getClass().getResourceAsStream(TIKA_FILES), tmp);
46+
logger.debug("unzipping all tika sample files");
47+
try (DirectoryStream<Path> stream = Files.newDirectoryStream(PathUtils.get(getClass().getResource(TIKA_FILES).toURI()))) {
48+
for (Path doc : stream) {
49+
String filename = doc.getFileName().toString();
50+
TestUtil.unzip(getClass().getResourceAsStream(TIKA_FILES + filename), tmp);
51+
}
52+
}
4553

4654
try (DirectoryStream<Path> stream = Files.newDirectoryStream(tmp)) {
4755
for (Path doc : stream) {

0 commit comments

Comments
 (0)