Search in sources :

Example 1 with HttpApiV1

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();
}
Also used : HttpApiV1(org.projectnessie.client.http.v1api.HttpApiV1) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with HttpApiV1

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()));
}
Also used : HttpApiV1(org.projectnessie.client.http.v1api.HttpApiV1)

Aggregations

HttpApiV1 (org.projectnessie.client.http.v1api.HttpApiV1)2 Test (org.junit.jupiter.api.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1