use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientBuilderTest method testKubeconfigAddsSchemeHttp.
@Test
public void testKubeconfigAddsSchemeHttp() throws Exception {
String path = withEnvironmentVariable("KUBECONFIG", KUBECONFIG_HTTP_FILE_PATH).execute(() -> {
final ApiClient client = ClientBuilder.standard().build();
return client.getBasePath();
});
assertThat(path, is("http://localhost"));
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientBuilderTest method testCredentialProviderInvoked.
@Test
public void testCredentialProviderInvoked() throws IOException {
final Authentication provider = mock(Authentication.class);
final ApiClient client = ClientBuilder.standard().setAuthentication(provider).build();
verify(provider).provide(client);
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientBuilderTest method testBasePathTrailingSlash.
@Test
public void testBasePathTrailingSlash() throws Exception {
final ApiClient client = ClientBuilder.standard().setBasePath("http://localhost/").build();
assertThat(client.getBasePath(), is("http://localhost"));
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientBuilderTest method testInvalidKubeconfig.
@Test
public void testInvalidKubeconfig() throws Exception {
String path = withEnvironmentVariable("KUBECONFIG", "/non-existent").and("HOME", "/none-existent").and("HOMEDRIVE", null).and("USERPROFILE", null).execute(() -> {
final ApiClient client = ClientBuilder.standard().build();
return client.getBasePath();
});
assertThat(path, is(Config.DEFAULT_FALLBACK_HOST));
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientCertificateAuthenticationTest method testValidCertificates.
@Test
public void testValidCertificates() throws Exception {
final ApiClient client = new ApiClient();
final byte[] certificate = Files.readAllBytes(Paths.get(CLIENT_CERT_PATH));
final byte[] key = Files.readAllBytes(Paths.get(CLIENT_KEY_PATH));
new ClientCertificateAuthentication(certificate, key).provide(client);
}
Aggregations