Skip to content

Commit

Permalink
Nessie: Use config constants from public Nessie API (apache#4387)
Browse files Browse the repository at this point in the history
  • Loading branch information
nastra authored Apr 1, 2022
1 parent 445bc61 commit 21000d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void initialize(String inputName, Map<String, String> options) {
// remove nessie prefix
final Function<String, String> 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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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);
Expand All @@ -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");
Expand Down

0 comments on commit 21000d2

Please sign in to comment.