Path archivePath = new Path(fs.getHomeDirectory(), "srcdat.har");
{
// copy from Local to hdfs
String[] args = { "-copyFromLocal", localDir, archivePath.toString() };
int ret = ToolRunner.run(new HadoopArchives(conf), args);
assertTrue("failed test", ret == 0);
URI uri = archivePath.toUri();
// create appropriate har path
Path harPath = new Path("har://" + uri.getScheme() + "-" + uri.getAuthority() + uri.getPath());
FileSystem harfs = harPath.getFileSystem(conf);
CopyFilesBase.checkFiles(harfs, archivePath.toString(), myFiles);
}
{
// copy from hdfs to local
localfs.mkdirs(new Path(localDir2));
String[] args = { "-copyToLocal", archivePath.toString(), localDir2 };
int ret = ToolRunner.run(new HadoopArchives(conf), args);
assertTrue("failed test", ret == 0);
CopyFilesBase.checkFiles(localfs, localDir2, myFiles);
}