1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.hadoop.hbase.util;
22
23 import junit.framework.TestCase;
24
25 import java.io.IOException;
26
27 import org.apache.commons.logging.Log;
28 import org.apache.commons.logging.LogFactory;
29
30 import org.apache.hadoop.fs.Path;
31 import org.apache.hadoop.hbase.SmallTests;
32 import org.junit.experimental.categories.Category;
33
34
35
36
37 @Category(SmallTests.class)
38 public class TestRootPath extends TestCase {
39 private static final Log LOG = LogFactory.getLog(TestRootPath.class);
40
41
42 public void testRootPath() {
43 try {
44
45 FSUtils.validateRootPath(new Path("file:///tmp/hbase/hbase"));
46 } catch (IOException e) {
47 LOG.fatal("Unexpected exception checking valid path:", e);
48 fail();
49 }
50 try {
51
52 FSUtils.validateRootPath(new Path("hdfs://a:9000/hbase"));
53 } catch (IOException e) {
54 LOG.fatal("Unexpected exception checking valid path:", e);
55 fail();
56 }
57 try {
58
59 FSUtils.validateRootPath(new Path("/hbase"));
60 fail();
61 } catch (IOException e) {
62
63 LOG.info("Got expected exception when checking invalid path:", e);
64 }
65 }
66
67 @org.junit.Rule
68 public org.apache.hadoop.hbase.ResourceCheckerJUnitRule cu =
69 new org.apache.hadoop.hbase.ResourceCheckerJUnitRule();
70 }
71