NIFI-333 - Adding failure test for DecompressContent

This commit is contained in:
danbress 2015-02-15 09:08:22 -05:00
parent 0f8d00d5ff
commit 361ac1f1e5
1 changed files with 18 additions and 0 deletions

View File

@ -109,4 +109,22 @@ public class TestCompressContent {
flowFile.assertAttributeEquals("filename", "SampleFile.txt.gz");
}
@Test
public void testDecompressFailure() throws IOException {
final TestRunner runner = TestRunners.newTestRunner(CompressContent.class);
runner.setProperty(CompressContent.MODE, "decompress");
runner.setProperty(CompressContent.COMPRESSION_FORMAT, "gzip");
byte[] data = new byte[]{1,2,3,4,5,6,7,8,9,10};
runner.enqueue(data);
assertTrue(runner.setProperty(CompressContent.UPDATE_FILENAME, "true").isValid());
runner.run();
runner.assertQueueEmpty();
runner.assertAllFlowFilesTransferred(CompressContent.REL_FAILURE, 1);
runner.getFlowFilesForRelationship(CompressContent.REL_FAILURE).get(0).assertContentEquals(data);
}
}