assertEquals(targetQual, fc.getFileLinkStatus(linkAbs).getSymlink());
// Check that the target is qualified using the file system of the
// path used to access the link (if the link target was not specified
// fully qualified, in that case we use the link target verbatim).
if (!"file".equals(getScheme())) {
FileContext localFc = FileContext.getLocalFSFileContext();
Path linkQual = new Path(testURI().toString(), linkAbs);
assertEquals(targetQual,
localFc.getFileLinkStatus(linkQual).getSymlink());
}
// Check getLinkTarget
assertEquals(expectedTarget, fc.getLinkTarget(linkAbs));
// Now read using all path types..
fc.setWorkingDirectory(dir);
readFile(new Path("linkToFile"));
readFile(linkAbs);
// And fully qualified.. (NB: for local fs this is partially qualified)
readFile(new Path(testURI().toString(), linkAbs));
// And partially qualified..
boolean failureExpected = "file".equals(getScheme()) ? false : true;
try {
readFile(new Path(getScheme()+"://"+testBaseDir1()+"/linkToFile"));
assertFalse(failureExpected);
} catch (Exception e) {
assertTrue(failureExpected);
}
// Now read using a different file context (for HDFS at least)
if (!"file".equals(getScheme())) {
FileContext localFc = FileContext.getLocalFSFileContext();
readFile(localFc, new Path(testURI().toString(), linkAbs));
}
}