Search in sources :

Example 1 with LocalProperties

use of io.confluent.ksql.properties.LocalProperties in project ksql by confluentinc.

the class InternalKsqlClientFactory method createInternalClient.

public static KsqlClient createInternalClient(final Map<String, String> clientProps, final BiFunction<Integer, String, SocketAddress> socketAddressFactory, final Vertx vertx) {
    final String internalClientAuth = clientProps.get(KsqlRestConfig.KSQL_INTERNAL_SSL_CLIENT_AUTHENTICATION_CONFIG);
    final boolean verifyHost = !Strings.isNullOrEmpty(internalClientAuth) && !KsqlRestConfig.SSL_CLIENT_AUTHENTICATION_NONE.equals(internalClientAuth);
    return new KsqlClient(Optional.empty(), new LocalProperties(ImmutableMap.of()), httpOptionsFactory(clientProps, verifyHost, InternalKsqlClientFactory::createClientOptions), httpOptionsFactory(clientProps, verifyHost, InternalKsqlClientFactory::createClientOptionsHttp2), socketAddressFactory, vertx);
}
Also used : KsqlClient(io.confluent.ksql.rest.client.KsqlClient) LocalProperties(io.confluent.ksql.properties.LocalProperties)

Example 2 with LocalProperties

use of io.confluent.ksql.properties.LocalProperties in project ksql by confluentinc.

the class KsqlClientTest method shouldFailWithNonHttp2Options.

@Test
public void shouldFailWithNonHttp2Options() {
    // When:
    final IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> new KsqlClient(new HashMap<>(), Optional.empty(), new LocalProperties(properties), new HttpClientOptions().setVerifyHost(false), Optional.of(new HttpClientOptions())));
    // Then:
    assertThat(e.getMessage(), containsString("Expecting http2 protocol version"));
}
Also used : HashMap(java.util.HashMap) LocalProperties(io.confluent.ksql.properties.LocalProperties) HttpClientOptions(io.vertx.core.http.HttpClientOptions) Test(org.junit.Test)

Example 3 with LocalProperties

use of io.confluent.ksql.properties.LocalProperties in project ksql by confluentinc.

the class KsqlRestClient method create.

@VisibleForTesting
static KsqlRestClient create(final String serverAddress, final Map<String, ?> localProps, final Map<String, String> clientProps, final Optional<BasicCredentials> creds, final Optional<BasicCredentials> ccloudApiKey, final KsqlClientSupplier clientSupplier, final ConsistencyLevel consistencyLevel) {
    final LocalProperties localProperties = new LocalProperties(localProps);
    final KsqlClient client = clientSupplier.get(clientProps, creds, localProperties);
    return new KsqlRestClient(client, serverAddress, localProperties, ccloudApiKey, consistencyLevel);
}
Also used : LocalProperties(io.confluent.ksql.properties.LocalProperties) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

LocalProperties (io.confluent.ksql.properties.LocalProperties)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 KsqlClient (io.confluent.ksql.rest.client.KsqlClient)1 HttpClientOptions (io.vertx.core.http.HttpClientOptions)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1