use of org.projectnessie.client.http.v1api.HttpApiV1 in project nessie by projectnessie.
the class TestTranslatingVersionNessieApi method requiresProxyOrReserialization.
@Test
void requiresProxyOrReserialization() {
assertThat(TranslatingVersionNessieApi.requiresProxy(null)).isFalse();
assertThat(TranslatingVersionNessieApi.requiresProxy(new ArrayList<>())).isFalse();
assertThat(TranslatingVersionNessieApi.requiresProxy(42)).isFalse();
assertThat(TranslatingVersionNessieApi.requiresProxy(new HttpApiV1(null))).isTrue();
assertThat(TranslatingVersionNessieApi.requiresProxy(Branch.of("foo", null))).isFalse();
assertThat(TranslatingVersionNessieApi.requiresReserialization(null)).isFalse();
assertThat(TranslatingVersionNessieApi.requiresReserialization(new ArrayList<>())).isFalse();
assertThat(TranslatingVersionNessieApi.requiresReserialization(42)).isFalse();
assertThat(TranslatingVersionNessieApi.requiresReserialization(new HttpApiV1(null))).isFalse();
assertThat(TranslatingVersionNessieApi.requiresReserialization(Branch.of("foo", null))).isTrue();
}
use of org.projectnessie.client.http.v1api.HttpApiV1 in project nessie by projectnessie.
the class HttpClientBuilder method build.
@SuppressWarnings({ "unchecked" })
@Override
public <API extends NessieApi> API build(Class<API> apiVersion) {
Objects.requireNonNull(apiVersion, "API version class must be non-null");
NessieHttpClient client = new NessieHttpClient(authentication, tracing, builder);
if (apiVersion.isAssignableFrom(HttpApiV1.class)) {
return (API) new HttpApiV1(client);
}
throw new IllegalArgumentException(String.format("API version %s is not supported.", apiVersion.getName()));
}
Aggregations