LeonBein commented on a change in pull request #15109:
URL: https://github.com/apache/flink/pull/15109#discussion_r592529086



##########
File path: 
flink-connectors/flink-connector-hbase/src/test/java/org/apache/flink/connector/hbase/testutil/HBaseTestClusterUtil.java
##########
@@ -0,0 +1,322 @@
+/*
+ * 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.flink.connector.hbase.testutil;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.StartMiniClusterOption;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Delete;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
+import org.apache.hadoop.hbase.replication.ReplicationPeerDescription;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hdfs.protocol.HdfsConstants;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+/** Provides static access to a {@link MiniHBaseCluster} for testing. */
+public class HBaseTestClusterUtil {
+
+    public static final String COLUMN_FAMILY_BASE = "info";
+    public static final String DEFAULT_COLUMN_FAMILY = COLUMN_FAMILY_BASE + 0;
+    public static final String QUALIFIER_BASE = "qualifier";
+    public static final String DEFAULT_QUALIFIER = QUALIFIER_BASE + 0;
+
+    public final String configPath = "config" + UUID.randomUUID() + ".xml";
+    private MiniHBaseCluster cluster;
+    private Configuration hbaseConf;
+    private String testFolder;
+
+    public HBaseTestClusterUtil() {}
+
+    public static void main(String[] args)
+            throws ParserConfigurationException, SAXException, IOException {
+        
Arrays.asList(HdfsConstants.class.getDeclaredFields()).forEach(System.out::println);
+        HBaseTestClusterUtil hbaseTestClusterUtil = new HBaseTestClusterUtil();
+        hbaseTestClusterUtil.startCluster();
+        hbaseTestClusterUtil.makeTable("tableName");
+    }
+
+    public void startCluster() throws IOException {
+        System.out.println("Starting HBase test cluster ...");
+        testFolder = Files.createTempDirectory(null).toString();

Review comment:
       The folder is actually a temporary folder. However, on windows, temp is 
found at `C:\Users\{USERNAME}\AppData\Local\Temp` which causes problems with 
HBase if the user name contains spaces. To be able to run the tests on windows, 
replacing the folder is necessary. This replacement can be removed but actually 
is nice to have.




----------------------------------------------------------------
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:
[email protected]


Reply via email to