Permalink
Browse files

TIKA-2687 -- remove code used to generate test files

  • Loading branch information...
tballison committed Jul 13, 2018
1 parent c0fb57d commit 9b86c8578c9ab17e94ee080f498a86feaadfe6f1
Showing with 0 additions and 60 deletions.
  1. +0 −60 tika-app/src/test/java/org/apache/tika/cli/TikaCLITest.java
@@ -552,64 +552,4 @@ public void testConfigSerializationCustomStatic() throws Exception {
String content = outContent.toString(UTF_8.name());
assertFalse(content.contains("org.apache.tika.parser.executable.Executable"));
}
@Test
public void testFileNameNormalization() throws Exception {
File z = new File("C:/data/testZip_zeroByte.zip");
OutputStream os = new FileOutputStream(z);
ZipOutputStream outputStream = new ZipOutputStream(os);
ZipEntry zipEntry = new ZipEntry("dang\u0000erous.pl");
outputStream.putNextEntry(zipEntry);
byte[] bytes = "hello world1".getBytes(StandardCharsets.UTF_8);
outputStream.write(bytes, 0,bytes.length);
outputStream.closeEntry();
outputStream.flush();
outputStream.close();
z = new File("C:/data/testZip_absolutePath.zip");
os = new FileOutputStream(z);
outputStream = new ZipOutputStream(os);
zipEntry = new ZipEntry("C:/dangerous/dont/touch.pl");
outputStream.putNextEntry(zipEntry);
bytes = "hello world2".getBytes(StandardCharsets.UTF_8);
outputStream.write(bytes, 0,bytes.length);
outputStream.closeEntry();
zipEntry = new ZipEntry("/dangerous/dont/touch.pl");
outputStream.putNextEntry(zipEntry);
bytes = "hello world3".getBytes(StandardCharsets.UTF_8);
outputStream.write(bytes, 0,bytes.length);
outputStream.closeEntry();
outputStream.flush();
outputStream.close();
z = new File("C:/data/testZip_relative.zip");
os = new FileOutputStream(z);
outputStream = new ZipOutputStream(os);
zipEntry = new ZipEntry("../../../dangerous/dont/touch.pl");
outputStream.putNextEntry(zipEntry);
bytes = "hello world3".getBytes(StandardCharsets.UTF_8);
outputStream.write(bytes, 0,bytes.length);
outputStream.closeEntry();
outputStream.flush();
outputStream.close();
z = new File("C:/data/testZip_overlappingNames.zip");
os = new FileOutputStream(z);
outputStream = new ZipOutputStream(os);
zipEntry = new ZipEntry("f1.txt");
outputStream.putNextEntry(zipEntry);
bytes = "hello world4".getBytes(StandardCharsets.UTF_8);
outputStream.write(bytes, 0,bytes.length);
outputStream.closeEntry();
zipEntry = new ZipEntry("../../../f1.txt");
outputStream.putNextEntry(zipEntry);
bytes = "hello world5".getBytes(StandardCharsets.UTF_8);
outputStream.write(bytes, 0,bytes.length);
outputStream.closeEntry();
outputStream.flush();
outputStream.close();
}
}

0 comments on commit 9b86c85

Please sign in to comment.