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
32
33
34
35 public class TestRootPath extends TestCase {
36 private static final Log LOG = LogFactory.getLog(TestRootPath.class);
37
38
39 public void testRootPath() {
40 try {
41
42 FSUtils.validateRootPath(new Path("file:///tmp/hbase/hbase"));
43 } catch (IOException e) {
44 LOG.fatal("Unexpected exception checking valid path:", e);
45 fail();
46 }
47 try {
48
49 FSUtils.validateRootPath(new Path("hdfs://a:9000/hbase"));
50 } catch (IOException e) {
51 LOG.fatal("Unexpected exception checking valid path:", e);
52 fail();
53 }
54 try {
55
56 FSUtils.validateRootPath(new Path("/hbase"));
57 fail();
58 } catch (IOException e) {
59
60 LOG.info("Got expected exception when checking invalid path:", e);
61 }
62 }
63 }