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 junit.framework.TestCase;
23
24 import java.io.IOException;
25
26 import org.apache.commons.logging.Log;
27 import org.apache.commons.logging.LogFactory;
28
29 import org.apache.hadoop.fs.Path;
30 import org.apache.hadoop.hbase.SmallTests;
31 import org.junit.experimental.categories.Category;
32
33
34
35
36 @Category(SmallTests.class)
37 public class TestRootPath extends TestCase {
38 private static final Log LOG = LogFactory.getLog(TestRootPath.class);
39
40
41 public void testRootPath() {
42 try {
43
44 FSUtils.validateRootPath(new Path("file:///tmp/hbase/hbase"));
45 } catch (IOException e) {
46 LOG.fatal("Unexpected exception checking valid path:", e);
47 fail();
48 }
49 try {
50
51 FSUtils.validateRootPath(new Path("hdfs://a:9000/hbase"));
52 } catch (IOException e) {
53 LOG.fatal("Unexpected exception checking valid path:", e);
54 fail();
55 }
56 try {
57
58 FSUtils.validateRootPath(new Path("/hbase"));
59 fail();
60 } catch (IOException e) {
61
62 LOG.info("Got expected exception when checking invalid path:", e);
63 }
64 }
65
66 }
67