leonardBang commented on a change in pull request #12701: URL: https://github.com/apache/flink/pull/12701#discussion_r442055147
########## File path: flink-end-to-end-tests/flink-end-to-end-tests-hbase/src/test/java/org/apache/flink/tests/util/hbase/SQLClientHBaseITCase.java ########## @@ -0,0 +1,193 @@ +/* + * 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.tests.util.hbase; + +import org.apache.flink.api.common.time.Deadline; +import org.apache.flink.tests.util.TestUtils; +import org.apache.flink.tests.util.cache.DownloadCache; +import org.apache.flink.tests.util.categories.PreCommit; +import org.apache.flink.tests.util.categories.TravisGroup1; +import org.apache.flink.tests.util.flink.ClusterController; +import org.apache.flink.tests.util.flink.FlinkResource; +import org.apache.flink.tests.util.flink.FlinkResourceSetup; +import org.apache.flink.tests.util.flink.LocalStandaloneFlinkResourceFactory; +import org.apache.flink.tests.util.flink.SQLJobSubmission; +import org.apache.flink.util.FileUtils; +import org.apache.flink.util.TestLogger; + +import org.hamcrest.CoreMatchers; +import org.junit.Assert; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.rules.TemporaryFolder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.time.Duration; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static org.apache.flink.tests.util.flink.LocalStandaloneFlinkResourceFactory.loadProjectRootDirectory; +import static org.hamcrest.Matchers.arrayContainingInAnyOrder; +import static org.hamcrest.Matchers.containsString; +import static org.junit.Assert.assertThat; + +/** + * End-to-end test for the HBase connectors. + */ +@Category(value = {TravisGroup1.class, PreCommit.class}) +public class SQLClientHBaseITCase extends TestLogger { + + private static final Logger LOG = LoggerFactory.getLogger(SQLClientHBaseITCase.class); + + private static final String HBASE_E2E_SQL = "hbase_e2e.sql"; + private static final String YARN_CLASSPATH = "/flink-yarn-tests/target/yarn.classpath"; + + @Rule + public final HBaseResource hbase; + + @Rule + public final FlinkResource flink = new LocalStandaloneFlinkResourceFactory() + .create(FlinkResourceSetup.builder().build()); + + @Rule + public final TemporaryFolder tmp = new TemporaryFolder(); + + @ClassRule + public static final DownloadCache DOWNLOAD_CACHE = DownloadCache.get(); + + private static final Path sqlToolBoxJar = TestUtils.getResourceJar(".*SqlToolbox.jar"); + private static final Path sqlConnectorHBaseJar = TestUtils.getResourceJar(".*hbase.jar"); + private List<Path> hadoopClasspathJars; + + public SQLClientHBaseITCase() { + this.hbase = HBaseResource.get(); + } + + @Before + public void before() throws Exception { + DOWNLOAD_CACHE.before(); + Path tmpPath = tmp.getRoot().toPath(); + LOG.info("The current temporary path: {}", tmpPath); + + // Prepare all hadoop jars under HADOOP_CLASSPATH, use yarn.classpath which contains all hadoop jars + Path currentModulePath = Paths.get("").toAbsolutePath(); + Path flinkHomePath = loadProjectRootDirectory(currentModulePath); + String hadoopClasspath = Paths.get(flinkHomePath.toString(), YARN_CLASSPATH).toString(); Review comment: I'm inspired by https://github.com/apache/flink/pull/12369#discussion_r439999545. If we use the dependency-plugin, we need add many hadoop dependencies to the project for make a HADOOP_CLASSPATH, It's a little heavy from my side. How about use flink shaded Hadoop jar for test ? @zentol ---------------------------------------------------------------- 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]
