This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 689cbe2c1 [KYUUBI #3715] Remove unexpected mysql connector jar
689cbe2c1 is described below

commit 689cbe2c18613aca43d16aa2db4f5c76b711c706
Author: Cheng Pan <[email protected]>
AuthorDate: Sat Oct 29 10:22:58 2022 +0000

    [KYUUBI #3715] Remove unexpected mysql connector jar
    
    ### _Why are the changes needed?_
    
    Fix #3715.
    
    It was added in https://github.com/apache/incubator-kyuubi/pull/3240, and I 
didn't notice a binary Jar was shipped in the patch, and the worse thing is it 
was included in the source release tarball.
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run 
test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests)
 locally before make a pull request
    
    Closes #3716 from pan3793/mysql.
    
    Closes #3715
    
    0fdcac98 [Cheng Pan] fix
    833d4679 [Cheng Pan] nit
    5d098397 [Cheng Pan] [KYUUBI #3715] Remove unexpected mysql connector jar
    
    Authored-by: Cheng Pan <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
---
 integration-tests/kyuubi-jdbc-it/pom.xml           |  33 +++++++++++++++++++--
 .../mysql/mysql-connector-java-8.0.30.jar          | Bin 2513563 -> 0 bytes
 .../doris/WithKyuubiServerAndDorisContainer.scala  |  23 +++++++++++---
 3 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/integration-tests/kyuubi-jdbc-it/pom.xml 
b/integration-tests/kyuubi-jdbc-it/pom.xml
index 33aa678e6..2e33e191d 100644
--- a/integration-tests/kyuubi-jdbc-it/pom.xml
+++ b/integration-tests/kyuubi-jdbc-it/pom.xml
@@ -22,6 +22,7 @@
         <artifactId>integration-tests</artifactId>
         <groupId>org.apache.kyuubi</groupId>
         <version>1.7.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -30,7 +31,6 @@
     <url>https://kyuubi.apache.org/</url>
 
     <dependencies>
-
         <dependency>
             <groupId>org.apache.kyuubi</groupId>
             <artifactId>kyuubi-common_${scala.binary.version}</artifactId>
@@ -79,7 +79,34 @@
             
<artifactId>testcontainers-scala-scalatest_${scala.binary.version}</artifactId>
             <scope>test</scope>
         </dependency>
-
     </dependencies>
 
-</project>
\ No newline at end of file
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy</id>
+                        <phase>process-test-resources</phase>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>mysql</groupId>
+                                    
<artifactId>mysql-connector-java</artifactId>
+                                    <version>${mysql.jdbc.version}</version>
+                                    <overWrite>true</overWrite>
+                                    
<outputDirectory>${project.build.directory}</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git 
a/integration-tests/kyuubi-jdbc-it/src/test/resources/mysql/mysql-connector-java-8.0.30.jar
 
b/integration-tests/kyuubi-jdbc-it/src/test/resources/mysql/mysql-connector-java-8.0.30.jar
deleted file mode 100644
index 92ebe1b54..000000000
Binary files 
a/integration-tests/kyuubi-jdbc-it/src/test/resources/mysql/mysql-connector-java-8.0.30.jar
 and /dev/null differ
diff --git 
a/integration-tests/kyuubi-jdbc-it/src/test/scala/org/apache/kyuubi/it/jdbc/doris/WithKyuubiServerAndDorisContainer.scala
 
b/integration-tests/kyuubi-jdbc-it/src/test/scala/org/apache/kyuubi/it/jdbc/doris/WithKyuubiServerAndDorisContainer.scala
index 209681135..7b0516197 100644
--- 
a/integration-tests/kyuubi-jdbc-it/src/test/scala/org/apache/kyuubi/it/jdbc/doris/WithKyuubiServerAndDorisContainer.scala
+++ 
b/integration-tests/kyuubi-jdbc-it/src/test/scala/org/apache/kyuubi/it/jdbc/doris/WithKyuubiServerAndDorisContainer.scala
@@ -17,6 +17,8 @@
 
 package org.apache.kyuubi.it.jdbc.doris
 
+import java.nio.file.{Files, Path, Paths}
+
 import org.apache.kyuubi.{Utils, WithKyuubiServer}
 import org.apache.kyuubi.config.KyuubiConf
 import org.apache.kyuubi.config.KyuubiConf.{ENGINE_JDBC_EXTRA_CLASSPATH, 
KYUUBI_ENGINE_ENV_PREFIX, KYUUBI_HOME}
@@ -27,13 +29,26 @@ trait WithKyuubiServerAndDorisContainer extends 
WithKyuubiServer with WithDorisE
   private val kyuubiHome: String = Utils
     .getCodeSourceLocation(getClass).split("integration-tests").head
 
+  private val mysqlJdbcConnectorPath: String = {
+    val keyword = "mysql-connector"
+
+    val jarsDir = Paths.get(kyuubiHome)
+      .resolve("integration-tests")
+      .resolve("kyuubi-jdbc-it")
+      .resolve("target")
+
+    Files.list(jarsDir)
+      .filter { p: Path => p.getFileName.toString contains keyword }
+      .findFirst
+      .orElseThrow { () => new IllegalStateException(s"Can not find $keyword 
in $jarsDir.") }
+      .toAbsolutePath
+      .toString
+  }
+
   override protected val conf: KyuubiConf = {
     KyuubiConf()
       .set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME", kyuubiHome)
-      .set(
-        ENGINE_JDBC_EXTRA_CLASSPATH,
-        Utils.getContextOrKyuubiClassLoader.getResource(
-          "mysql/mysql-connector-java-8.0.30.jar").toURI.getPath)
+      .set(ENGINE_JDBC_EXTRA_CLASSPATH, mysqlJdbcConnectorPath)
   }
 
   override def beforeAll(): Unit = {

Reply via email to