You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by bo...@apache.org on 2023/01/23 08:16:34 UTC
[kyuubi] branch master updated: [KYUUBI #4201] [Improvement] Remove Gson as direct dependency by using Jackson instead in Authz tests
This is an automated email from the ASF dual-hosted git repository.
bowenliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new 5357a0211 [KYUUBI #4201] [Improvement] Remove Gson as direct dependency by using Jackson instead in Authz tests
5357a0211 is described below
commit 5357a0211bd50e3789a5cffb43e104587586a287
Author: liangbowen <li...@gf.com.cn>
AuthorDate: Mon Jan 23 16:16:23 2023 +0800
[KYUUBI #4201] [Improvement] Remove Gson as direct dependency by using Jackson instead in Authz tests
### _Why are the changes needed?_
- use `Jackson` instead of `Gson` in Authz tests, where it is the only place `Gson` is used in project
- remove `Gson` as the dependency
- Notice: Gson project is in maintenance mode, (see https://github.com/google/gson/pull/2085)
- Gson is still on `dependencyList`, as depended in kyuubi-ha
<img width="640" alt="image" src="https://user-images.githubusercontent.com/1935105/213956635-ce079638-15c3-4de2-9f46-a93dfe3db199.png">
### _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.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #4201 from bowenliang123/remove-gson.
Closes #4201
96df2513 [liangbowen] update dependencyList
81303d6e [liangbowen] imports
a73a1f98 [liangbowen] use jackson instead of gson in authz testing and remove gson as dependency
Authored-by: liangbowen <li...@gf.com.cn>
Signed-off-by: liangbowen <li...@gf.com.cn>
---
dev/dependencyList | 2 +-
extensions/spark/kyuubi-spark-authz/pom.xml | 6 ------
.../kyuubi/plugin/spark/authz/ranger/RangerLocalClient.scala | 11 ++++++-----
pom.xml | 7 -------
4 files changed, 7 insertions(+), 19 deletions(-)
diff --git a/dev/dependencyList b/dev/dependencyList
index cce193b6f..b061ac68e 100644
--- a/dev/dependencyList
+++ b/dev/dependencyList
@@ -44,7 +44,7 @@ grpc-netty/1.48.0//grpc-netty-1.48.0.jar
grpc-protobuf-lite/1.48.0//grpc-protobuf-lite-1.48.0.jar
grpc-protobuf/1.48.0//grpc-protobuf-1.48.0.jar
grpc-stub/1.48.0//grpc-stub-1.48.0.jar
-gson/2.8.9//gson-2.8.9.jar
+gson/2.9.0//gson-2.9.0.jar
guava/31.1-jre//guava-31.1-jre.jar
hadoop-client-api/3.3.4//hadoop-client-api-3.3.4.jar
hadoop-client-runtime/3.3.4//hadoop-client-runtime-3.3.4.jar
diff --git a/extensions/spark/kyuubi-spark-authz/pom.xml b/extensions/spark/kyuubi-spark-authz/pom.xml
index 532564183..d537e5a1c 100644
--- a/extensions/spark/kyuubi-spark-authz/pom.xml
+++ b/extensions/spark/kyuubi-spark-authz/pom.xml
@@ -283,12 +283,6 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <scope>test</scope>
- </dependency>
-
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
diff --git a/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/ranger/RangerLocalClient.scala b/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/ranger/RangerLocalClient.scala
index 323bd524a..d25ea716a 100644
--- a/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/ranger/RangerLocalClient.scala
+++ b/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/ranger/RangerLocalClient.scala
@@ -17,22 +17,23 @@
package org.apache.kyuubi.plugin.spark.authz.ranger
-import java.io.InputStreamReader
+import java.text.SimpleDateFormat
-import com.google.gson.GsonBuilder
+import com.fasterxml.jackson.databind.json.JsonMapper
import org.apache.ranger.admin.client.RangerAdminRESTClient
import org.apache.ranger.plugin.util.ServicePolicies
class RangerLocalClient extends RangerAdminRESTClient with RangerClientHelper {
- private val g =
- new GsonBuilder().setDateFormat("yyyyMMdd-HH:mm:ss.SSS-Z").setPrettyPrinting().create
+ private val mapper = new JsonMapper()
+ .setDateFormat(new SimpleDateFormat("yyyyMMdd-HH:mm:ss.SSS-Z"))
+
private val policies: ServicePolicies = {
val loader = Thread.currentThread().getContextClassLoader
val inputStream = {
loader.getResourceAsStream("sparkSql_hive_jenkins.json")
}
- g.fromJson(new InputStreamReader(inputStream), classOf[ServicePolicies])
+ mapper.readValue(inputStream, classOf[ServicePolicies])
}
override def getServicePoliciesIfUpdated(
diff --git a/pom.xml b/pom.xml
index cac5f4f1d..37d124568 100644
--- a/pom.xml
+++ b/pom.xml
@@ -139,7 +139,6 @@
<flink.archive.download.skip>false</flink.archive.download.skip>
<google.jsr305.version>3.0.2</google.jsr305.version>
<grpc.version>1.48.0</grpc.version>
- <gson.version>2.8.9</gson.version>
<guava.version>31.1-jre</guava.version>
<guava.failureaccess.version>1.0.1</guava.failureaccess.version>
<hadoop.version>3.3.4</hadoop.version>
@@ -1600,12 +1599,6 @@
</exclusions>
</dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>${gson.version}</version>
- </dependency>
-
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>