use of org.apache.nifi.processors.hadoop.exception.FailureException in project nifi by apache.
the class PutParquetTest method testFailureExceptionRenamingShouldRouteToFailure.
@Test
public void testFailureExceptionRenamingShouldRouteToFailure() throws InitializationException, IOException {
final PutParquet proc = new PutParquet() {
@Override
protected void rename(FileSystem fileSystem, Path srcFile, Path destFile) throws IOException, InterruptedException, FailureException {
throw new FailureException("FailureException renaming");
}
};
configure(proc, 10);
final String filename = "testFailureExceptionRenamingShouldRouteToFailure-" + System.currentTimeMillis();
final Map<String, String> flowFileAttributes = new HashMap<>();
flowFileAttributes.put(CoreAttributes.FILENAME.key(), filename);
testRunner.enqueue("trigger", flowFileAttributes);
testRunner.run();
testRunner.assertAllFlowFilesTransferred(PutParquet.REL_FAILURE, 1);
// verify we don't have the temp dot file after success
final File tempAvroParquetFile = new File(DIRECTORY + "/." + filename);
Assert.assertFalse(tempAvroParquetFile.exists());
}
Aggregations