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.zookeeper;
21
22 import static org.junit.Assert.assertEquals;
23 import static org.junit.Assert.assertTrue;
24
25 import org.apache.hadoop.conf.Configuration;
26 import org.apache.hadoop.hbase.*;
27 import org.junit.Test;
28 import org.junit.experimental.categories.Category;
29
30 @Category(SmallTests.class)
31 public class TestZooKeeperMainServerArg {
32 private final ZooKeeperMainServerArg parser = new ZooKeeperMainServerArg();
33
34 @Test public void test() {
35 Configuration c = HBaseConfiguration.create();
36 assertEquals("localhost:" + c.get(HConstants.ZOOKEEPER_CLIENT_PORT),
37 parser.parse(c));
38 final String port = "1234";
39 c.set(HConstants.ZOOKEEPER_CLIENT_PORT, port);
40 c.set("hbase.zookeeper.quorum", "example.com");
41 assertEquals("example.com:" + port, parser.parse(c));
42 c.set("hbase.zookeeper.quorum", "example1.com,example2.com,example3.com");
43 assertTrue(port,
44 parser.parse(c).matches("(example[1-3]\\.com,){2}example[1-3]\\.com:" + port));
45 }
46
47 @org.junit.Rule
48 public org.apache.hadoop.hbase.ResourceCheckerJUnitRule cu =
49 new org.apache.hadoop.hbase.ResourceCheckerJUnitRule();
50 }
51