|
@@ -18,7 +18,9 @@
|
|
|
|
|
|
package org.apache.hadoop.fs.azurebfs;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.OutputStream;
|
|
|
|
|
|
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
|
|
import org.junit.Test;
|
|
@@ -83,9 +85,11 @@ public class ITestAzureBlobFileSystemFileStatus extends
|
|
|
if (isDir) {
|
|
|
assertEquals(errorInStatus + ": permission",
|
|
|
new FsPermission(DEFAULT_DIR_PERMISSION_VALUE), fileStatus.getPermission());
|
|
|
+ assertTrue(errorInStatus + "not a directory", fileStatus.isDirectory());
|
|
|
} else {
|
|
|
assertEquals(errorInStatus + ": permission",
|
|
|
new FsPermission(DEFAULT_FILE_PERMISSION_VALUE), fileStatus.getPermission());
|
|
|
+ assertTrue(errorInStatus + "not a file", fileStatus.isFile());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -144,4 +148,22 @@ public class ITestAzureBlobFileSystemFileStatus extends
|
|
|
assertTrue("lastModifiedTime should be before createEndTime",
|
|
|
createEndTime > lastModifiedTime);
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testFileStatusOnRoot() throws IOException {
|
|
|
+ AzureBlobFileSystem fs = getFileSystem();
|
|
|
+
|
|
|
+ // Assert that passing relative root path works
|
|
|
+ Path testPath = new Path("/");
|
|
|
+ validateStatus(fs, testPath, true);
|
|
|
+
|
|
|
+ // Assert that passing absolute root path works
|
|
|
+ String testPathStr = makeQualified(testPath).toString();
|
|
|
+ validateStatus(fs, new Path(testPathStr), true);
|
|
|
+
|
|
|
+ // Assert that passing absolute root path without "/" works
|
|
|
+ testPathStr = testPathStr.substring(0, testPathStr.length() - 1);
|
|
|
+ validateStatus(fs, new Path(testPathStr), true);
|
|
|
+
|
|
|
+ }
|
|
|
}
|