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.HBaseConfiguration;
27 import org.junit.Test;
28
29
30 public class TestZooKeeperMainServerArg {
31 private final ZooKeeperMainServerArg parser = new ZooKeeperMainServerArg();
32
33 @Test public void test() {
34 Configuration c = HBaseConfiguration.create();
35 assertEquals("localhost:" + c.get("hbase.zookeeper.property.clientPort"),
36 parser.parse(c));
37 final String port = "1234";
38 c.set("hbase.zookeeper.property.clientPort", port);
39 c.set("hbase.zookeeper.quorum", "example.com");
40 assertEquals("example.com:" + port, parser.parse(c));
41 c.set("hbase.zookeeper.quorum", "example1.com,example2.com,example3.com");
42 assertTrue(port, parser.parse(c).matches("example[1-3]\\.com:" + port));
43 }
44 }