From 21000d27b0c5798a3dadd355ab7fb312eac798e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduard=20Tudenh=C3=B6fner?= Date: Fri, 1 Apr 2022 15:36:15 +0200 Subject: [PATCH] Nessie: Use config constants from public Nessie API (#4387) --- .../main/java/org/apache/iceberg/nessie/NessieCatalog.java | 2 +- .../main/java/org/apache/iceberg/nessie/NessieUtil.java | 2 -- .../org/apache/iceberg/nessie/TestCustomNessieClient.java | 7 ++++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java b/nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java index b558c276daaa..8316be5f45dc 100644 --- a/nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java +++ b/nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java @@ -100,7 +100,7 @@ public void initialize(String inputName, Map options) { // remove nessie prefix final Function removePrefix = x -> x.replace(NessieUtil.NESSIE_CONFIG_PREFIX, ""); - this.api = createNessieClientBuilder(options.get(NessieUtil.CONFIG_CLIENT_BUILDER_IMPL)) + this.api = createNessieClientBuilder(options.get(NessieConfigConstants.CONF_NESSIE_CLIENT_BUILDER_IMPL)) .fromConfig(x -> options.get(removePrefix.apply(x))) .build(NessieApiV1.class); diff --git a/nessie/src/main/java/org/apache/iceberg/nessie/NessieUtil.java b/nessie/src/main/java/org/apache/iceberg/nessie/NessieUtil.java index e92fa016e77c..9dc964175895 100644 --- a/nessie/src/main/java/org/apache/iceberg/nessie/NessieUtil.java +++ b/nessie/src/main/java/org/apache/iceberg/nessie/NessieUtil.java @@ -38,8 +38,6 @@ public final class NessieUtil { public static final String NESSIE_CONFIG_PREFIX = "nessie."; - public static final String CONFIG_CLIENT_BUILDER_IMPL = NESSIE_CONFIG_PREFIX + "client-builder-impl"; - static final String APPLICATION_TYPE = "application-type"; private NessieUtil() { diff --git a/nessie/src/test/java/org/apache/iceberg/nessie/TestCustomNessieClient.java b/nessie/src/test/java/org/apache/iceberg/nessie/TestCustomNessieClient.java index 742e6071c51d..5dafaa9b85ec 100644 --- a/nessie/src/test/java/org/apache/iceberg/nessie/TestCustomNessieClient.java +++ b/nessie/src/test/java/org/apache/iceberg/nessie/TestCustomNessieClient.java @@ -25,6 +25,7 @@ import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; import org.junit.jupiter.api.Test; import org.projectnessie.client.NessieClientBuilder; +import org.projectnessie.client.NessieConfigConstants; import org.projectnessie.client.api.NessieApi; import org.projectnessie.client.auth.NessieAuthentication; import org.projectnessie.client.http.HttpClientBuilder; @@ -51,7 +52,7 @@ public void testUnnecessaryDefaultCustomClient() { catalog.initialize("nessie", ImmutableMap.of(CatalogProperties.WAREHOUSE_LOCATION, temp.toUri().toString(), CatalogProperties.URI, uri, - NessieUtil.CONFIG_CLIENT_BUILDER_IMPL, HttpClientBuilder.class.getName())); + NessieConfigConstants.CONF_NESSIE_CLIENT_BUILDER_IMPL, HttpClientBuilder.class.getName())); } @Test @@ -62,7 +63,7 @@ public void testNonExistentCustomClient() { catalog.initialize("nessie", ImmutableMap.of(CatalogProperties.WAREHOUSE_LOCATION, temp.toUri().toString(), CatalogProperties.URI, uri, - NessieUtil.CONFIG_CLIENT_BUILDER_IMPL, nonExistingClass)); + NessieConfigConstants.CONF_NESSIE_CLIENT_BUILDER_IMPL, nonExistingClass)); }) .isInstanceOf(RuntimeException.class) .hasMessageContaining(nonExistingClass); @@ -75,7 +76,7 @@ public void testCustomClient() { catalog.initialize("nessie", ImmutableMap.of(CatalogProperties.WAREHOUSE_LOCATION, temp.toUri().toString(), CatalogProperties.URI, uri, - NessieUtil.CONFIG_CLIENT_BUILDER_IMPL, DummyClientBuilderImpl.class.getName())); + NessieConfigConstants.CONF_NESSIE_CLIENT_BUILDER_IMPL, DummyClientBuilderImpl.class.getName())); }) .isInstanceOf(RuntimeException.class) .hasMessage("BUILD CALLED");