NIFI-8359 removing test that cannot be reliable. Random data doesn't guarantee it will be detected as octet-stream and there is no obvious 'will never match' set of bytes so this test is not reliable or valuable

This commit is contained in:
Joe Witt 2021-03-23 14:17:41 -07:00 committed by markap14
parent 22fcb594d9
commit 788abe9eb3
1 changed files with 0 additions and 29 deletions

View File

@ -173,35 +173,6 @@ public class TestExtractMediaMetadata {
assertEquals(flowFile0.getSize(), textFile.length());
}
@Test
public void testJunkBytes() throws IOException {
final TestRunner runner = TestRunners.newTestRunner(new ExtractMediaMetadata());
runner.setProperty(ExtractMediaMetadata.METADATA_KEY_FILTER, "");
runner.setProperty(ExtractMediaMetadata.METADATA_KEY_PREFIX, "junk.");
runner.assertValid();
final Map<String, String> attrs = new HashMap<>();
attrs.put("filename", "junk");
Random random = new Random();
byte[] bytes = new byte[2048];
random.nextBytes(bytes);
runner.enqueue(bytes, attrs);
runner.run();
runner.assertAllFlowFilesTransferred(ExtractMediaMetadata.SUCCESS, 1);
runner.assertTransferCount(ExtractMediaMetadata.FAILURE, 0);
final List<MockFlowFile> successFiles = runner.getFlowFilesForRelationship(ExtractMediaMetadata.SUCCESS);
MockFlowFile flowFile0 = successFiles.get(0);
flowFile0.assertAttributeExists("filename");
flowFile0.assertAttributeEquals("filename", "junk");
flowFile0.assertAttributeExists("junk.Content-Type");
assertTrue(flowFile0.getAttribute("junk.Content-Type").startsWith("application/octet-stream"));
flowFile0.assertAttributeExists("junk.X-Parsed-By");
assertTrue(flowFile0.getAttribute("junk.X-Parsed-By").contains("org.apache.tika.parser.EmptyParser"));
flowFile0.assertContentEquals(bytes);
}
@Test
public void testMetadataKeyFilter() throws IOException {
final TestRunner runner = TestRunners.newTestRunner(new ExtractMediaMetadata());