@Test public void testRemoteFileRename() throws IOException { final String srcPath = "/testRename"; final String file1 = "file1"; final String destPath = "/destDir"; final String destFilename = "file2"; dfs.mkdirs(new Path(dfs.getUri() + srcPath)); dfs.mkdirs(new Path(dfs.getUri() + destPath)); final FSDataOutputStream out1 = dfs.create(new Path( dfs.getUri() + srcPath + "/" + file1)); out1.writeChars("testCopy1"); out1.close(); RenameFileAction renameFileAction = new RenameFileAction(); renameFileAction.setDfsClient(dfsClient); renameFileAction.setContext(smartContext); Map<String , String> args = new HashMap<>(); args.put(RenameFileAction.FILE_PATH , dfs.getUri() + srcPath + "/" +file1); args.put(RenameFileAction.DEST_PATH , dfs.getUri() + destPath + "/" +destFilename); renameFileAction.init(args); renameFileAction.run(); Assert.assertTrue(renameFileAction.getExpectedAfterRun()); Assert.assertFalse(dfsClient.exists(srcPath + "/" + file1)); Assert.assertTrue(dfsClient.exists(destPath + "/" + destFilename)); }
@Override public void init(Map<String, String> args) { super.init(args); this.srcPath = args.get(FILE_PATH); if (args.containsKey(DEST_PATH)) { this.destPath = args.get(DEST_PATH); } }
RenameFileAction extends HdfsAction { @Override public void init(Map<String, String> args) { super.init(args); this.srcPath = args.get(FILE_PATH); if (args.containsKey(DEST_PATH)) { this.destPath = args.get(DEST_PATH); } } }
RenameFileAction extends HdfsAction { @Override public void init(Map<String, String> args) { super.init(args); this.srcPath = args.get(FILE_PATH); if (args.containsKey(DEST_PATH)) { this.destPath = args.get(DEST_PATH); } }  }
RenameFileAction extends HdfsAction { @Override public void init(Map<String, String> args) { super.init(args); this.srcPath = args.get(FILE_PATH); if (args.containsKey(DEST_PATH)) { this.destPath = args.get(DEST_PATH); } }  @Override void init(Map<String, String> args); }
RenameFileAction extends HdfsAction { @Override public void init(Map<String, String> args) { super.init(args); this.srcPath = args.get(FILE_PATH); if (args.containsKey(DEST_PATH)) { this.destPath = args.get(DEST_PATH); } }  @Override void init(Map<String, String> args); static final String DEST_PATH; }