Skip to content

Commit cc3b203

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.x branch
1 parent 0eea9c8 commit cc3b203

File tree

210 files changed

+9
-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

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
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;
@@ -37,11 +38,17 @@
3738
public class TikaDocTests extends ESTestCase {
3839

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

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

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

0 commit comments

Comments
 (0)