31
31
import static org .junit .Assert .assertTrue ;
32
32
33
33
import java .io .IOException ;
34
+ import java .util .Iterator ;
34
35
36
+ import org .apache .hadoop .conf .Configuration ;
35
37
import org .apache .hadoop .fs .FSDataInputStream ;
36
38
import org .apache .hadoop .fs .FSDataOutputStream ;
37
39
import org .apache .hadoop .fs .FileStatus ;
38
40
import org .apache .hadoop .fs .FileSystem ;
41
+ import org .apache .hadoop .fs .LocatedFileStatus ;
39
42
import org .apache .hadoop .fs .Path ;
43
+ import org .apache .hadoop .fs .RemoteIterator ;
40
44
import org .apache .hadoop .fs .permission .FsAction ;
41
45
import org .apache .hadoop .fs .permission .FsPermission ;
42
46
import org .apache .hadoop .fs .test .connector .HcfsTestConnectorFactory ;
45
49
import org .junit .AfterClass ;
46
50
import org .junit .Assert ;
47
51
import org .junit .BeforeClass ;
48
- import org .junit .Ignore ;
49
52
import org .junit .Test ;
50
53
51
54
/**
@@ -56,6 +59,26 @@ public class HcfsFileSystemTest{
56
59
57
60
static FileSystem fs ;
58
61
62
+
63
+ /**
64
+ * See MAPREDUCE-5902 for context on why this test is critical
65
+ * for ecosystem interoperability.
66
+ */
67
+ @ org .junit .Test
68
+ public void testEncodedPaths () throws Exception {
69
+ //FileSystem fs2 = FileSystem.getLocal(new Configuration());
70
+ FileSystem fs2 = fs ;
71
+ Path encodedFiles =new Path ("/tmp/encodedTest" +System .currentTimeMillis ());
72
+ fs2 .mkdirs (encodedFiles );
73
+ fs2 .create (new Path (encodedFiles ,"a" ));
74
+ fs2 .create (new Path (encodedFiles ,"a%2" ));
75
+ fs2 .create (new Path (encodedFiles ,"a%2a" ));
76
+ fs2 .create (new Path (encodedFiles ,"a%3a" ));
77
+ fs2 .create (new Path (encodedFiles ,"a%4a" ));
78
+ Assert .assertEquals (5 , fs2 .listStatus (encodedFiles ).length );
79
+ fs2 .delete (encodedFiles );
80
+ }
81
+
59
82
@ BeforeClass
60
83
public static void setup () throws Exception {
61
84
HcfsTestConnectorInterface connector = HcfsTestConnectorFactory .getHcfsTestConnector ();
0 commit comments