HADOOP-10175. Har files system authority should preserve userinfo. Contributed by Chuan Liu.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1553169 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e8de319789
commit
150440c607
|
@ -565,6 +565,9 @@ Release 2.3.0 - UNRELEASED
|
||||||
HADOOP-10087. UserGroupInformation.getGroupNames() fails to return primary
|
HADOOP-10087. UserGroupInformation.getGroupNames() fails to return primary
|
||||||
group first when JniBasedUnixGroupsMappingWithFallback is used (cmccabe)
|
group first when JniBasedUnixGroupsMappingWithFallback is used (cmccabe)
|
||||||
|
|
||||||
|
HADOOP-10175. Har files system authority should preserve userinfo.
|
||||||
|
(Chuan Liu via cnauroth)
|
||||||
|
|
||||||
Release 2.2.0 - 2013-10-13
|
Release 2.2.0 - 2013-10-13
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -294,6 +294,10 @@ public class HarFileSystem extends FileSystem {
|
||||||
private String getHarAuth(URI underLyingUri) {
|
private String getHarAuth(URI underLyingUri) {
|
||||||
String auth = underLyingUri.getScheme() + "-";
|
String auth = underLyingUri.getScheme() + "-";
|
||||||
if (underLyingUri.getHost() != null) {
|
if (underLyingUri.getHost() != null) {
|
||||||
|
if (underLyingUri.getUserInfo() != null) {
|
||||||
|
auth += underLyingUri.getUserInfo();
|
||||||
|
auth += "@";
|
||||||
|
}
|
||||||
auth += underLyingUri.getHost();
|
auth += underLyingUri.getHost();
|
||||||
if (underLyingUri.getPort() != -1) {
|
if (underLyingUri.getPort() != -1) {
|
||||||
auth += ":";
|
auth += ":";
|
||||||
|
|
|
@ -258,6 +258,22 @@ public class TestHarFileSystemBasics {
|
||||||
0, expectedFileNames.size());
|
0, expectedFileNames.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMakeQualifiedPath() throws Exception {
|
||||||
|
// Construct a valid har file system path with authority that
|
||||||
|
// contains userinfo and port. The userinfo and port are useless
|
||||||
|
// in local fs uri. They are only used to verify har file system
|
||||||
|
// can correctly preserve the information for the underlying file system.
|
||||||
|
String harPathWithUserinfo = "har://file-user:passwd@localhost:80"
|
||||||
|
+ harPath.toUri().getPath().toString();
|
||||||
|
Path path = new Path(harPathWithUserinfo);
|
||||||
|
Path qualifiedPath = path.getFileSystem(conf).makeQualified(path);
|
||||||
|
assertTrue(String.format(
|
||||||
|
"The qualified path (%s) did not match the expected path (%s).",
|
||||||
|
qualifiedPath.toString(), harPathWithUserinfo),
|
||||||
|
qualifiedPath.toString().equals(harPathWithUserinfo));
|
||||||
|
}
|
||||||
|
|
||||||
// ========== Negative:
|
// ========== Negative:
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue