@Test public void testRemoteFileList() throws Exception { final String srcPath = "/testList"; final String file1 = "file1"; final String file2 = "file2"; final String dir = "/childDir"; final String dirFile1 = "childDirFile1"; dfs.mkdirs(new Path(srcPath)); dfs.mkdirs(new Path(srcPath + dir)); FSDataOutputStream out1 = dfs.create(new Path(dfs.getUri() + srcPath + "/" + file1)); out1.writeChars("test"); out1.close(); out1 = dfs.create(new Path(dfs.getUri() + srcPath + "/" + file2)); out1.writeChars("test"); out1.close(); out1 = dfs.create(new Path(dfs.getUri() + srcPath + dir + "/" + dirFile1)); out1.writeChars("test"); out1.close(); Assert.assertTrue(dfsClient.exists(srcPath + "/" + file1)); Assert.assertTrue(dfsClient.exists(srcPath + "/" + file2)); Assert.assertTrue(dfsClient.exists(srcPath + dir + "/" + dirFile1)); ListFileAction listFileAction = new ListFileAction(); listFileAction.setDfsClient(dfsClient); listFileAction.setContext(smartContext); Map<String , String> args = new HashMap<>(); args.put(ListFileAction.FILE_PATH , dfs.getUri() + srcPath); listFileAction.init(args); listFileAction.run(); Assert.assertTrue(listFileAction.getExpectedAfterRun()); listFileAction = new ListFileAction(); listFileAction.setDfsClient(dfsClient); listFileAction.setContext(smartContext); args = new HashMap<>(); args.put(ListFileAction.FILE_PATH , dfs.getUri() + srcPath + "/" + file1); listFileAction.init(args); listFileAction.run(); Assert.assertTrue(listFileAction.getExpectedAfterRun()); }
@Override public void init(Map<String, String> args) { super.init(args); if (args.containsKey(RECURSIVELY)) { this.recursively = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(RECURSIVELY); } if (args.containsKey(DUMP)) { this.dump = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(DUMP); } if (args.containsKey(HUMAN)) { this.human = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(HUMAN); } if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(FILE_PATH); }
ListFileAction extends HdfsAction { @Override public void init(Map<String, String> args) { super.init(args); if (args.containsKey(RECURSIVELY)) { this.recursively = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(RECURSIVELY); } if (args.containsKey(DUMP)) { this.dump = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(DUMP); } if (args.containsKey(HUMAN)) { this.human = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(HUMAN); } if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(FILE_PATH); } }
ListFileAction extends HdfsAction { @Override public void init(Map<String, String> args) { super.init(args); if (args.containsKey(RECURSIVELY)) { this.recursively = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(RECURSIVELY); } if (args.containsKey(DUMP)) { this.dump = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(DUMP); } if (args.containsKey(HUMAN)) { this.human = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(HUMAN); } if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(FILE_PATH); }  }
ListFileAction extends HdfsAction { @Override public void init(Map<String, String> args) { super.init(args); if (args.containsKey(RECURSIVELY)) { this.recursively = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(RECURSIVELY); } if (args.containsKey(DUMP)) { this.dump = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(DUMP); } if (args.containsKey(HUMAN)) { this.human = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(HUMAN); } if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(FILE_PATH); }  @Override void init(Map<String, String> args); }
ListFileAction extends HdfsAction { @Override public void init(Map<String, String> args) { super.init(args); if (args.containsKey(RECURSIVELY)) { this.recursively = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(RECURSIVELY); } if (args.containsKey(DUMP)) { this.dump = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(DUMP); } if (args.containsKey(HUMAN)) { this.human = true; if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(HUMAN); } if (this.srcPath == null || this.srcPath == "") this.srcPath = args.get(FILE_PATH); }  @Override void init(Map<String, String> args); static final String RECURSIVELY; static final String DUMP; static final String HUMAN; }