Configuration conf = new Configuration();
cluster = new MiniDFSCluster(conf, 2, true, null);
namenode = conf.get("fs.default.name", "local");
if (!"local".equals(namenode)) {
MyFile[] files = createFiles(namenode, "/srcdat");
ToolRunner.run(new CopyFiles(conf), new String[] {
"-p",
"-log",
"hdfs://"+namenode+"/logs",
"hdfs://"+namenode+"/srcdat",
"hdfs://"+namenode+"/destdat"});
assertTrue("Source and destination directories do not match.",
checkFiles(namenode, "/destdat", files));
FileSystem fs = FileSystem.get(URI.create("hdfs://"+namenode+"/logs"), conf);
assertTrue("Log directory does not exist.",
fs.exists(new Path("hdfs://"+namenode+"/logs")));
FileStatus[] dchkpoint = getFileStatus(namenode, "/destdat", files);
final int nupdate = NFILES>>2;
updateFiles(namenode, "/srcdat", files, nupdate);
deldir(namenode, "/logs");
ToolRunner.run(new CopyFiles(conf), new String[] {
"-p",
"-update",
"-log",
"hdfs://"+namenode+"/logs",
"hdfs://"+namenode+"/srcdat",
"hdfs://"+namenode+"/destdat"});
assertTrue("Source and destination directories do not match.",
checkFiles(namenode, "/destdat", files));
assertTrue("Update failed to replicate all changes in src",
checkUpdate(dchkpoint, namenode, "/destdat", files, nupdate));
deldir(namenode, "/logs");
ToolRunner.run(new CopyFiles(conf), new String[] {
"-p",
"-overwrite",
"-log",
"hdfs://"+namenode+"/logs",
"hdfs://"+namenode+"/srcdat",