cluster.getJTClient().getClient().getJob(org.apache.hadoop.mapred.JobID.downgrade(slpJob.getJobID()));
JobStatus[] jobStatus = client.getAllJobs();
String userName = jobStatus[0].getUsername();
TTClient tClient = null;
JobInfo jInfo = wovenClient.getJobInfo(rJob.getID());
LOG.info("jInfo is :" + jInfo);
//Assert if jobInfo is null
Assert.assertNotNull("jobInfo is null", jInfo);
//Wait for the job to start running.
count = 0;
while (jInfo.getStatus().getRunState() != JobStatus.RUNNING) {
UtilsForTests.waitFor(10000);
count++;
jInfo = wovenClient.getJobInfo(rJob.getID());
//If the count goes beyond a point, then Assert; This is to avoid
//infinite loop under unforeseen circumstances.
if (count > 10) {
Assert.fail("job has not reached running state for more than" +
"100 seconds. Failing at this point");
}
}
LOG.info("job id is :" + rJob.getID().toString());
TaskInfo[] taskInfos = cluster.getJTClient().getProxy()
.getTaskInfo(rJob.getID());
boolean distCacheFileIsFound;
for (TaskInfo taskInfo : taskInfos) {
distCacheFileIsFound = false;
String[] taskTrackers = taskInfo.getTaskTrackers();
for(String taskTracker : taskTrackers) {
//Getting the exact FQDN of the tasktracker from
//the tasktracker string.
taskTracker = UtilsForTests.getFQDNofTT(taskTracker);
tClient = cluster.getTTClient(taskTracker);
String[] localDirs = tClient.getMapredLocalDirs();
int distributedFileCount = 0;
String localDirOnly = null;
boolean FileNotPresentForThisDirectoryPath = false;
//Go to every single path
for (String localDir : localDirs) {
FileNotPresentForThisDirectoryPath = false;
localDirOnly = localDir;
//Public Distributed cache will always be stored under
//mapred.local.dir/tasktracker/archive
localDirOnly = localDir + Path.SEPARATOR + TaskTracker.SUBDIR +
Path.SEPARATOR + userName;
//Private Distributed cache will always be stored under
//mapre.local.dir/taskTracker/<username>/distcache
//Checking for username directory to check if it has the
//proper permissions
localDir = localDir + Path.SEPARATOR +
TaskTracker.getPrivateDistributedCacheDir(userName);
FileStatus fileStatusMapredLocalDirUserName = null;
try {
fileStatusMapredLocalDirUserName = tClient.
getFileStatus(localDirOnly, true);
} catch (Exception e) {
LOG.info("LocalDirOnly :" + localDirOnly + " not found");
FileNotPresentForThisDirectoryPath = true;
}
//File will only be stored under one of the mapred.lcoal.dir
//If other paths were hit, just continue
if (FileNotPresentForThisDirectoryPath)
continue;
Path pathMapredLocalDirUserName =
fileStatusMapredLocalDirUserName.getPath();
FsPermission fsPermMapredLocalDirUserName =
fileStatusMapredLocalDirUserName.getPermission();
Assert.assertTrue("Directory Permission is not 700",
fsPermMapredLocalDirUserName.equals(new FsPermission("700")));
//Get file status of all the directories
//and files under that path.
FileStatus[] fileStatuses = tClient.listStatus(localDir,
true, true);
for (FileStatus fileStatus : fileStatuses) {
Path path = fileStatus.getPath();
LOG.info("path is :" + path.toString());
//Checking if the received path ends with