@Test public void simple() throws Exception { File file = temporary.newFile(); int status = HadoopDelete.exec(file.toURI().toString()); assertThat(status, is(0)); assertThat(file.exists(), is(false)); }
static int exec(String... args) { if (args.length == 0) { LOG.warn("there are no files to delete"); return -1; } boolean sawError = false; Configuration conf = new Configuration(); for (String arg : args) { try { delete(conf, new Path(arg)); } catch (IOException e) { LOG.error(MessageFormat.format( "failed to delete file: {0}", arg), e); sawError = true; } } return sawError ? 1 : 0; }
HadoopDelete { static int exec(String... args) { if (args.length == 0) { LOG.warn("there are no files to delete"); return -1; } boolean sawError = false; Configuration conf = new Configuration(); for (String arg : args) { try { delete(conf, new Path(arg)); } catch (IOException e) { LOG.error(MessageFormat.format( "failed to delete file: {0}", arg), e); sawError = true; } } return sawError ? 1 : 0; } }
HadoopDelete { static int exec(String... args) { if (args.length == 0) { LOG.warn("there are no files to delete"); return -1; } boolean sawError = false; Configuration conf = new Configuration(); for (String arg : args) { try { delete(conf, new Path(arg)); } catch (IOException e) { LOG.error(MessageFormat.format( "failed to delete file: {0}", arg), e); sawError = true; } } return sawError ? 1 : 0; } private  HadoopDelete(); }
HadoopDelete { static int exec(String... args) { if (args.length == 0) { LOG.warn("there are no files to delete"); return -1; } boolean sawError = false; Configuration conf = new Configuration(); for (String arg : args) { try { delete(conf, new Path(arg)); } catch (IOException e) { LOG.error(MessageFormat.format( "failed to delete file: {0}", arg), e); sawError = true; } } return sawError ? 1 : 0; } private  HadoopDelete(); static void main(String... args); }
HadoopDelete { static int exec(String... args) { if (args.length == 0) { LOG.warn("there are no files to delete"); return -1; } boolean sawError = false; Configuration conf = new Configuration(); for (String arg : args) { try { delete(conf, new Path(arg)); } catch (IOException e) { LOG.error(MessageFormat.format( "failed to delete file: {0}", arg), e); sawError = true; } } return sawError ? 1 : 0; } private  HadoopDelete(); static void main(String... args);  }