Path publicFileInPrivateSubdir = new Path(privateSubDir, "public_file_in_private_subdir");
Assert.assertTrue(remoteFs.createNewFile(publicFileInPrivateSubdir));
remoteFs.setPermission(publicFileInPrivateSubdir, publicFilePerms);
TezConfiguration tezConf = new TezConfiguration(conf);
String tmpTezLibUris = String.format("%s,%s,%s,%s", topLevelDir, publicSubDir, privateSubDir,
conf.get(TezConfiguration.TEZ_LIB_URIS, ""));
tezConf.set(TezConfiguration.TEZ_LIB_URIS, tmpTezLibUris);
Map<String, LocalResource> lrMap =
TezClientUtils.setupTezJarsLocalResources(tezConf, new Credentials());
Assert.assertEquals(publicFile.getName(), LocalResourceVisibility.PUBLIC,
lrMap.get(publicFile.getName()).getVisibility());
Assert.assertEquals(privateFile.getName(), LocalResourceVisibility.PRIVATE,
lrMap.get(privateFile.getName()).getVisibility());
Assert.assertEquals(publicFileInPrivateSubdir.getName(), LocalResourceVisibility.PRIVATE,
lrMap.get(publicFileInPrivateSubdir.getName()).getVisibility());
// test tar.gz
tezConf = new TezConfiguration(conf);
Path tarFile = new Path(topLevelDir, "foo.tar.gz");
Assert.assertTrue(remoteFs.createNewFile(tarFile));
//public
remoteFs.setPermission(tarFile, publicFilePerms);
tezConf.set(TezConfiguration.TEZ_LIB_URIS, tarFile.toString());
lrMap = TezClientUtils.setupTezJarsLocalResources(tezConf, new Credentials());
Assert.assertEquals(LocalResourceVisibility.PUBLIC,
lrMap.get(TezConstants.TEZ_TAR_LR_NAME).getVisibility());