1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.hadoop.hbase.util;
21
22 import static org.junit.Assert.assertFalse;
23 import static org.junit.Assert.assertTrue;
24
25 import org.apache.hadoop.hbase.HBaseTestingUtility;
26 import org.apache.hadoop.hdfs.MiniDFSCluster;
27 import org.junit.Test;
28
29
30
31
32 public class TestFSUtils {
33 @Test public void testIsHDFS() throws Exception {
34 HBaseTestingUtility htu = new HBaseTestingUtility();
35 htu.getConfiguration().setBoolean("dfs.support.append", false);
36 assertFalse(FSUtils.isHDFS(htu.getConfiguration()));
37 assertFalse(FSUtils.isAppendSupported(htu.getConfiguration()));
38 htu.getConfiguration().setBoolean("dfs.support.append", true);
39 MiniDFSCluster cluster = null;
40 try {
41 cluster = htu.startMiniDFSCluster(1);
42 assertTrue(FSUtils.isHDFS(htu.getConfiguration()));
43 assertTrue(FSUtils.isAppendSupported(htu.getConfiguration()));
44 } finally {
45 if (cluster != null) cluster.shutdown();
46 }
47 }
48 }