@Test public void simple() throws Exception { TaskExecutor executor = new BasicDeleteTaskExecutor(); temporary.newFile(); executor.execute(context, new BasicDeleteTaskInfo( "testing", PathKind.LOCAL_FILE_SYSTEM, temporary.getRoot().getAbsolutePath())); assertThat(temporary.getRoot().exists(), is(false)); }
@Override public void execute(TaskExecutionContext context, TaskInfo task) throws IOException, InterruptedException { DeleteTaskInfo delete = (DeleteTaskInfo) task; String resolved = TaskExecutors.resolvePath(context, delete.getPath()); LOG.info("delete file: {} ({})", resolved, delete.getPathKind()); switch (delete.getPathKind()) { case LOCAL_FILE_SYSTEM: deleteOnLocalFileSystem(context, resolved); break; case HADOOP_FILE_SYSTEM: deleteOnHadoopFileSystem(context, resolved); break; default: throw new AssertionError(delete.getPathKind()); } }
BasicDeleteTaskExecutor implements TaskExecutor { @Override public void execute(TaskExecutionContext context, TaskInfo task) throws IOException, InterruptedException { DeleteTaskInfo delete = (DeleteTaskInfo) task; String resolved = TaskExecutors.resolvePath(context, delete.getPath()); LOG.info("delete file: {} ({})", resolved, delete.getPathKind()); switch (delete.getPathKind()) { case LOCAL_FILE_SYSTEM: deleteOnLocalFileSystem(context, resolved); break; case HADOOP_FILE_SYSTEM: deleteOnHadoopFileSystem(context, resolved); break; default: throw new AssertionError(delete.getPathKind()); } } }
BasicDeleteTaskExecutor implements TaskExecutor { @Override public void execute(TaskExecutionContext context, TaskInfo task) throws IOException, InterruptedException { DeleteTaskInfo delete = (DeleteTaskInfo) task; String resolved = TaskExecutors.resolvePath(context, delete.getPath()); LOG.info("delete file: {} ({})", resolved, delete.getPathKind()); switch (delete.getPathKind()) { case LOCAL_FILE_SYSTEM: deleteOnLocalFileSystem(context, resolved); break; case HADOOP_FILE_SYSTEM: deleteOnHadoopFileSystem(context, resolved); break; default: throw new AssertionError(delete.getPathKind()); } }  }
BasicDeleteTaskExecutor implements TaskExecutor { @Override public void execute(TaskExecutionContext context, TaskInfo task) throws IOException, InterruptedException { DeleteTaskInfo delete = (DeleteTaskInfo) task; String resolved = TaskExecutors.resolvePath(context, delete.getPath()); LOG.info("delete file: {} ({})", resolved, delete.getPathKind()); switch (delete.getPathKind()) { case LOCAL_FILE_SYSTEM: deleteOnLocalFileSystem(context, resolved); break; case HADOOP_FILE_SYSTEM: deleteOnHadoopFileSystem(context, resolved); break; default: throw new AssertionError(delete.getPathKind()); } }  @Override boolean isSupported(TaskExecutionContext context, TaskInfo task); @Override void execute(TaskExecutionContext context, TaskInfo task); }
BasicDeleteTaskExecutor implements TaskExecutor { @Override public void execute(TaskExecutionContext context, TaskInfo task) throws IOException, InterruptedException { DeleteTaskInfo delete = (DeleteTaskInfo) task; String resolved = TaskExecutors.resolvePath(context, delete.getPath()); LOG.info("delete file: {} ({})", resolved, delete.getPathKind()); switch (delete.getPathKind()) { case LOCAL_FILE_SYSTEM: deleteOnLocalFileSystem(context, resolved); break; case HADOOP_FILE_SYSTEM: deleteOnHadoopFileSystem(context, resolved); break; default: throw new AssertionError(delete.getPathKind()); } }  @Override boolean isSupported(TaskExecutionContext context, TaskInfo task); @Override void execute(TaskExecutionContext context, TaskInfo task);  }