bharathv commented on a change in pull request #781: HBASE-18095: Zookeeper-less client connection implementation URL: https://github.com/apache/hbase/pull/781#discussion_r341910294
########## File path: hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHMasterAsyncRegistry.java ########## @@ -0,0 +1,120 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.client; + +import org.apache.commons.io.IOUtils; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.master.HMaster; +import org.apache.hadoop.hbase.testclassification.ClientTests; +import org.apache.hadoop.hbase.testclassification.MediumTests; +import org.apache.hadoop.hbase.util.Bytes; +import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.hbase.thirdparty.com.google.common.net.HostAndPort; + +import static junit.framework.TestCase.assertTrue; +import static org.apache.hadoop.hbase.HConstants.META_REPLICAS_NUM; +import static org.junit.Assert.assertEquals; + +@Category({ MediumTests.class, ClientTests.class }) +public class TestHMasterAsyncRegistry { + private static final Logger LOG = LoggerFactory.getLogger(TestHMasterAsyncRegistry.class); + private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); + private static final TableName TEST_TABLE = TableName.valueOf("foo"); + private static final byte[] COL_FAM = Bytes.toBytes("cf"); + private static final byte[] QUALIFIER = Bytes.toBytes("col"); + + + // Automatically cleaned up on cluster shutdown. + private static AsyncClusterConnection customConnection; + private static HMasterAsyncRegistry REGISTRY; + + @BeforeClass + public static void setUp() throws Exception { + TEST_UTIL.getConfiguration().setInt(META_REPLICAS_NUM, 3); + TEST_UTIL.startMiniCluster(3); + Configuration conf = new Configuration(TEST_UTIL.getConfiguration()); + // Set the master host:port in the client config used to create a custom connection. + String masterHostName = TEST_UTIL.getMiniHBaseCluster().getMaster().getServerName().getHostname(); + int masterPort = TEST_UTIL.getMiniHBaseCluster().getMaster().getServerName().getPort(); + conf.set(HMasterAsyncRegistry.CONF_KEY, HostAndPort.fromParts(masterHostName, masterPort).toString()); + conf.set(AsyncRegistryFactory.REGISTRY_IMPL_CONF_KEY, HMasterAsyncRegistry.class.getName()); Review comment: Same comment as above, the reason I didn't do that is because that enables this registry on Region servers too. This is purely a client side config. Let me know if you know of a cleaner way to do this. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services