Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface NessieAPI {
String builderClassName() default "org.projectnessie.client.http.HttpClientBuilder";
String DEFAULT_BUILDER_CLASS_NAME = "_DEFAULT_BUILDER_CLASS_NAME_";

String builderClassName() default DEFAULT_BUILDER_CLASS_NAME;

/**
* Defines the target Nessie version instance in case multiple Nessie versions are running, for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,22 @@ protected static AutoCloseable createNessieClient(ClassLoader classLoader, Clien
Class<?> nessieClientBuilderClass =
classLoader.loadClass("org.projectnessie.client.NessieClientBuilder");
String builderClass = clientKey.getBuilderClass();
if (NessieAPI.DEFAULT_BUILDER_CLASS_NAME.equals(builderClass)) {
builderClass = null;
}

try {
// New functionality using NessieClientBuilder and the service loader mechanism.
Method createClientBuilderMethod =
nessieClientBuilderClass.getDeclaredMethod(
"createClientBuilder", String.class, String.class);
builderInstance = createClientBuilderMethod.invoke(null, null, builderClass);
} catch (NoSuchMethodException ignore) {
if (builderClass == null) {
// Fall back to legacy (and now removed) HttpClientBuilder. See
// https://github.com/projectnessie/nessie/pull/7803
builderClass = "org.projectnessie.client.http.HttpClientBuilder";
}
Class<?> builderClazz = classLoader.loadClass(builderClass);
builderInstance = builderClazz.getMethod("builder").invoke(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void currentVersionServer() {
new CurrentNessieApiHolder(
new ClientKey(
Version.CURRENT,
"org.projectnessie.client.http.HttpClientBuilder",
"org.projectnessie.client.http.NessieHttpClientBuilderImpl",
NessieApiV1.class,
ImmutableMap.of(
"nessie.uri", "http://127.42.42.42:19120",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ void upgrade() {
soft.assertThat(UpgradeSample.never).isEmpty();
}

@SuppressWarnings({"JUnitMalformedDeclaration", "NewClassNamingConvention"})
@ExtendWith({OlderNessieClientsExtension.class, SoftAssertionsExtension.class})
static class OldClientsSample {
@InjectSoftAssertions protected SoftAssertions soft;
Expand Down Expand Up @@ -254,6 +255,7 @@ void never() {
}
}

@SuppressWarnings({"JUnitMalformedDeclaration", "NewClassNamingConvention"})
@ExtendWith({OlderNessieServersExtension.class, SoftAssertionsExtension.class})
static class OldServersSample {
@InjectSoftAssertions protected SoftAssertions soft;
Expand Down Expand Up @@ -304,6 +306,7 @@ void never() {
}
}

@SuppressWarnings({"JUnitMalformedDeclaration", "NewClassNamingConvention"})
@ExtendWith({OlderNessieServersExtension.class, SoftAssertionsExtension.class})
static class ApiEndpointServerSample {
@InjectSoftAssertions protected SoftAssertions soft;
Expand All @@ -318,7 +321,7 @@ static class ApiEndpointServerSample {
static final List<Version> allVersions = new ArrayList<>();

@Test
void testSome() throws Exception {
void testSome() {
soft.assertThat(api).isNotNull().isSameAs(apiStatic);
soft.assertThat(uri).isNotNull().isEqualTo(uriStatic);
soft.assertThat(version).isNotNull().isEqualTo(versionStatic);
Expand All @@ -330,6 +333,7 @@ void testSome() throws Exception {
}
}

@SuppressWarnings({"JUnitMalformedDeclaration", "NewClassNamingConvention"})
@ExtendWith(OlderNessieServersExtension.class)
static class OuterSample {
static final List<Version> outerVersions = new ArrayList<>();
Expand All @@ -353,6 +357,7 @@ void inner() {
}
}

@SuppressWarnings({"JUnitMalformedDeclaration", "NewClassNamingConvention"})
@ExtendWith({NessieUpgradesExtension.class, SoftAssertionsExtension.class})
static class UpgradeSample {
@InjectSoftAssertions protected SoftAssertions soft;
Expand Down Expand Up @@ -398,27 +403,31 @@ void never() {
}
}

@SuppressWarnings({"JUnitMalformedDeclaration", "NewClassNamingConvention"})
@ExtendWith(OlderNessieClientsExtension.class)
@ExtendWith(OlderNessieServersExtension.class)
static class TooManyExtensions1 {
@Test
void testSome() {}
}

@SuppressWarnings({"JUnitMalformedDeclaration", "NewClassNamingConvention"})
@ExtendWith(OlderNessieClientsExtension.class)
@ExtendWith(NessieUpgradesExtension.class)
static class TooManyExtensions2 {
@Test
void testSome() {}
}

@SuppressWarnings({"JUnitMalformedDeclaration", "NewClassNamingConvention"})
@ExtendWith(NessieUpgradesExtension.class)
@ExtendWith(OlderNessieServersExtension.class)
static class TooManyExtensions3 {
@Test
void testSome() {}
}

@SuppressWarnings({"JUnitMalformedDeclaration", "NewClassNamingConvention"})
@ExtendWith(OlderNessieClientsExtension.class)
@ExtendWith(OlderNessieServersExtension.class)
@ExtendWith(NessieUpgradesExtension.class)
Expand Down