Source:
public void testHDFSDeleteDirectoryAction() throws Exception { Path outputDir = dfsCluster.getFileSystem().getHomeDirectory(); fileSystem.mkdirs(new Path("dir/source")); fileSystem.createNewFile(new Path("dir/source/test.txt")); fileSystem.createNewFile(new Path("dir/source/test2.txt")); fileSystem.createNewFile(new Path("dir/source/dir2/test2.txt")); ETLStage action = new ETLStage( "HDFSFileDeleteAction", new ETLPlugin("HDFSFileDeleteAction", Action.PLUGIN_TYPE, ImmutableMap.of("path", outputDir.toUri().toString() + "/dir/source", "continueOnError", "false"), null)); ETLStage source = new ETLStage("source", new ETLPlugin("KVTable", BatchSource.PLUGIN_TYPE, ImmutableMap.of("name", "hdfsTestSource"), null)); ETLStage sink = new ETLStage("sink", new ETLPlugin("KVTable", BatchSink.PLUGIN_TYPE, ImmutableMap.of("name", "hdfsTestSink"), null)); ETLBatchConfig etlConfig = ETLBatchConfig.builder("* * * * *") .addStage(source) .addStage(sink) .addStage(action) .addConnection(action.getName(), source.getName()) .addConnection(source.getName(), sink.getName()) .build(); AppRequest<ETLBatchConfig> appRequest = new AppRequest<>(DATAPIPELINE_ARTIFACT, etlConfig); Id.Application appId = Id.Application.from(Id.Namespace.DEFAULT, "hdfsDeleteDirectoryActionTest"); ApplicationManager appManager = deployApplication(appId, appRequest); WorkflowManager manager = appManager.getWorkflowManager(SmartWorkflow.NAME); manager.start(); manager.waitForFinish(3, TimeUnit.MINUTES); Assert.assertFalse(fileSystem.exists(new Path(outputDir.toUri().toString() + "/dir/source/test.txt"))); Assert.assertFalse(fileSystem.exists(new Path(outputDir.toUri().toString() + "/dir/source/dir2/test2.txt"))); }

Target:
public void testHDFSDeleteDirectoryAction() throws Exception { Path outputDir = dfsCluster.getFileSystem().getHomeDirectory(); fileSystem.mkdirs(new Path("dir1/source/dir2")); fileSystem.createNewFile(new Path("dir1/source/test.txt")); fileSystem.createNewFile(new Path("dir1/source/test2.txt")); fileSystem.createNewFile(new Path("dir1/source/dir2/test2.txt")); Assert.assertTrue(fileSystem.exists(new Path(outputDir.toUri().toString() + "/dir1/source/test.txt"))); Assert.assertTrue(fileSystem.exists(new Path(outputDir.toUri().toString() + "/dir1/source/test2.txt"))); Assert.assertTrue(fileSystem.exists(new Path(outputDir.toUri().toString() + "/dir1/source/dir2/test2.txt"))); ETLStage action = new ETLStage( "HDFSFileDeleteAction", new ETLPlugin("HDFSFileDeleteAction", Action.PLUGIN_TYPE, ImmutableMap.of("path", outputDir.toUri().toString() + "/dir1/source", "continueOnError", "false"), null)); ETLStage source = new ETLStage("source", new ETLPlugin("KVTable", BatchSource.PLUGIN_TYPE, ImmutableMap.of("name", "hdfsTestSource"), null)); ETLStage sink = new ETLStage("sink", new ETLPlugin("KVTable", BatchSink.PLUGIN_TYPE, ImmutableMap.of("name", "hdfsTestSink"), null)); ETLBatchConfig etlConfig = ETLBatchConfig.builder("* * * * *") .addStage(source) .addStage(sink) .addStage(action) .addConnection(action.getName(), source.getName()) .addConnection(source.getName(), sink.getName()) .build(); AppRequest<ETLBatchConfig> appRequest = new AppRequest<>(DATAPIPELINE_ARTIFACT, etlConfig); Id.Application appId = Id.Application.from(Id.Namespace.DEFAULT, "hdfsDeleteDirectoryActionTest"); ApplicationManager appManager = deployApplication(appId, appRequest); WorkflowManager manager = appManager.getWorkflowManager(SmartWorkflow.NAME); manager.start(); manager.waitForFinish(3, TimeUnit.MINUTES); Assert.assertFalse(fileSystem.isDirectory(new Path(outputDir.toUri().toString() + "/dir1/source"))); }