From 03d38905eca1608c0c20cdc62b5a80edff2636a0 Mon Sep 17 00:00:00 2001 From: Dmitri Bourlatchkov Date: Tue, 7 Jan 2025 17:10:56 -0500 Subject: [PATCH] review: use JacksonJsonProvider --- integration-tests/build.gradle.kts | 3 +++ .../polaris/service/it/env/PolarisApiClient.java | 14 ++------------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/integration-tests/build.gradle.kts b/integration-tests/build.gradle.kts index 17c0f60cb..ccafcbeac 100644 --- a/integration-tests/build.gradle.kts +++ b/integration-tests/build.gradle.kts @@ -26,6 +26,9 @@ dependencies { implementation(libs.jakarta.ws.rs.api) implementation(libs.guava) + implementation(platform(libs.jackson.bom)) + implementation("com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-json-provider") + implementation(platform(libs.iceberg.bom)) implementation("org.apache.iceberg:iceberg-api") implementation("org.apache.iceberg:iceberg-core") diff --git a/integration-tests/src/main/java/org/apache/polaris/service/it/env/PolarisApiClient.java b/integration-tests/src/main/java/org/apache/polaris/service/it/env/PolarisApiClient.java index 05848d7e5..5f87200b6 100644 --- a/integration-tests/src/main/java/org/apache/polaris/service/it/env/PolarisApiClient.java +++ b/integration-tests/src/main/java/org/apache/polaris/service/it/env/PolarisApiClient.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider; import jakarta.ws.rs.client.Client; import jakarta.ws.rs.client.ClientBuilder; -import jakarta.ws.rs.ext.ContextResolver; import java.io.Serializable; import java.net.URI; import org.apache.iceberg.rest.RESTSerializers; @@ -83,21 +83,11 @@ public Client client() { mapper.setPropertyNamingStrategy(new PropertyNamingStrategies.KebabCaseStrategy()); RESTSerializers.registerAll(mapper); - // Note: converting to lambda apparently breaks discovery/injections in the client below - //noinspection Convert2Lambda - ContextResolver mapperProvider = - new ContextResolver<>() { - @Override - public ObjectMapper getContext(Class type) { - return mapper; - } - }; - return client = ClientBuilder.newBuilder() .readTimeout(5, MINUTES) .connectTimeout(1, MINUTES) - .register(mapperProvider) + .register(new JacksonJsonProvider(mapper)) .build(); }