|
@@ -21,9 +21,11 @@ import static org.junit.Assert.*;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.security.PrivilegedExceptionAction;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.UUID;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
+import com.google.common.collect.Ordering;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
import org.apache.hadoop.fs.permission.FsPermission;
|
|
@@ -1284,4 +1286,27 @@ public class TestGlobPaths {
|
|
|
public void testNonTerminalGlobsOnFC() throws Exception {
|
|
|
testOnFileContext(new TestNonTerminalGlobs(true));
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testLocalFilesystem() throws Exception {
|
|
|
+ Configuration conf = new Configuration();
|
|
|
+ FileSystem fs = FileSystem.getLocal(conf);
|
|
|
+ String localTmp = System.getProperty("java.io.tmpdir");
|
|
|
+ Path base = new Path(new Path(localTmp), UUID.randomUUID().toString());
|
|
|
+ Assert.assertTrue(fs.mkdirs(base));
|
|
|
+ Assert.assertTrue(fs.mkdirs(new Path(base, "e")));
|
|
|
+ Assert.assertTrue(fs.mkdirs(new Path(base, "c")));
|
|
|
+ Assert.assertTrue(fs.mkdirs(new Path(base, "a")));
|
|
|
+ Assert.assertTrue(fs.mkdirs(new Path(base, "d")));
|
|
|
+ Assert.assertTrue(fs.mkdirs(new Path(base, "b")));
|
|
|
+ fs.deleteOnExit(base);
|
|
|
+ FileStatus[] status = fs.globStatus(new Path(base, "*"));
|
|
|
+ ArrayList list = new ArrayList();
|
|
|
+ for (FileStatus f: status) {
|
|
|
+ list.add(f.getPath().toString());
|
|
|
+ }
|
|
|
+ boolean sorted = Ordering.natural().isOrdered(list);
|
|
|
+ Assert.assertTrue(sorted);
|
|
|
+ }
|
|
|
}
|
|
|
+
|