Search in sources :

Example 1 with RestService

use of io.confluent.kafka.schemaregistry.client.rest.RestService in project flink by apache.

the class CachedSchemaCoderProviderTest method getInternalStateFromRestService.

private <T> T getInternalStateFromRestService(String name, CachedSchemaCoderProvider provider) {
    CachedSchemaRegistryClient cachedSchemaRegistryClient = Whitebox.getInternalState(provider.get(), "schemaRegistryClient");
    RestService restService = Whitebox.getInternalState(cachedSchemaRegistryClient, "restService");
    return Whitebox.getInternalState(restService, name);
}
Also used : CachedSchemaRegistryClient(io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient) RestService(io.confluent.kafka.schemaregistry.client.rest.RestService)

Example 2 with RestService

use of io.confluent.kafka.schemaregistry.client.rest.RestService in project ksql by confluentinc.

the class KsqlSchemaRegistryClientFactory method get.

public SchemaRegistryClient get() {
    if (schemaRegistryUrl.equals("")) {
        return new DefaultSchemaRegistryClient();
    }
    final RestService restService = serviceSupplier.get();
    // This call sets a default sslSocketFactory.
    final SchemaRegistryClient client = schemaRegistryClientFactory.create(restService, 1000, ImmutableList.of(new AvroSchemaProvider(), new ProtobufSchemaProvider(), new JsonSchemaProvider()), schemaRegistryClientConfigs, httpHeaders);
    // above.
    if (sslContext != null) {
        restService.setSslSocketFactory(sslContext.getSocketFactory());
    }
    return client;
}
Also used : JsonSchemaProvider(io.confluent.kafka.schemaregistry.json.JsonSchemaProvider) RestService(io.confluent.kafka.schemaregistry.client.rest.RestService) ProtobufSchemaProvider(io.confluent.kafka.schemaregistry.protobuf.ProtobufSchemaProvider) AvroSchemaProvider(io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider) SchemaRegistryClient(io.confluent.kafka.schemaregistry.client.SchemaRegistryClient) CachedSchemaRegistryClient(io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient)

Example 3 with RestService

use of io.confluent.kafka.schemaregistry.client.rest.RestService in project flink-mirror by flink-ci.

the class CachedSchemaCoderProviderTest method getInternalStateFromRestService.

private <T> T getInternalStateFromRestService(String name, CachedSchemaCoderProvider provider) {
    CachedSchemaRegistryClient cachedSchemaRegistryClient = Whitebox.getInternalState(provider.get(), "schemaRegistryClient");
    RestService restService = Whitebox.getInternalState(cachedSchemaRegistryClient, "restService");
    return Whitebox.getInternalState(restService, name);
}
Also used : CachedSchemaRegistryClient(io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient) RestService(io.confluent.kafka.schemaregistry.client.rest.RestService)

Example 4 with RestService

use of io.confluent.kafka.schemaregistry.client.rest.RestService in project flink by splunk.

the class CachedSchemaCoderProviderTest method getInternalStateFromRestService.

private <T> T getInternalStateFromRestService(String name, CachedSchemaCoderProvider provider) {
    CachedSchemaRegistryClient cachedSchemaRegistryClient = Whitebox.getInternalState(provider.get(), "schemaRegistryClient");
    RestService restService = Whitebox.getInternalState(cachedSchemaRegistryClient, "restService");
    return Whitebox.getInternalState(restService, name);
}
Also used : CachedSchemaRegistryClient(io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient) RestService(io.confluent.kafka.schemaregistry.client.rest.RestService)

Example 5 with RestService

use of io.confluent.kafka.schemaregistry.client.rest.RestService in project schema-registry by confluentinc.

the class CachedSchemaRegistryClientTest method testMultipleCredentialProvider.

@Test(expected = ConfigException.class)
public void testMultipleCredentialProvider() throws Exception {
    Map<String, String> config = new HashMap<>();
    // Default credential provider
    config.put(SchemaRegistryClientConfig.BASIC_AUTH_CREDENTIALS_SOURCE, "URL");
    config.put(SchemaRegistryClientConfig.BEARER_AUTH_CREDENTIALS_SOURCE, "STATIC_TOKEN");
    config.put(SchemaRegistryClientConfig.BEARER_AUTH_TOKEN_CONFIG, "auth-token");
    // Throws ConfigException if both credential providers are fully configured.
    new CachedSchemaRegistryClient(// Sets initial credential set for URL provider
    new RestService("http://user:password@sr.com:8020"), CACHE_CAPACITY, config, null);
}
Also used : HashMap(java.util.HashMap) SchemaString(io.confluent.kafka.schemaregistry.client.rest.entities.SchemaString) EasyMock.anyString(org.easymock.EasyMock.anyString) RestService(io.confluent.kafka.schemaregistry.client.rest.RestService) Test(org.junit.Test)

Aggregations

RestService (io.confluent.kafka.schemaregistry.client.rest.RestService)14 CachedSchemaRegistryClient (io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient)7 Test (org.junit.Test)4 HashMap (java.util.HashMap)3 AvroSchemaProvider (io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider)2 SchemaRegistryClient (io.confluent.kafka.schemaregistry.client.SchemaRegistryClient)2 SchemaString (io.confluent.kafka.schemaregistry.client.rest.entities.SchemaString)2 RestClientException (io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException)2 BasicAuthCredentialProvider (io.confluent.kafka.schemaregistry.client.security.basicauth.BasicAuthCredentialProvider)2 JsonSchemaProvider (io.confluent.kafka.schemaregistry.json.JsonSchemaProvider)2 ProtobufSchemaProvider (io.confluent.kafka.schemaregistry.protobuf.ProtobufSchemaProvider)2 Collectors (java.util.stream.Collectors)2 KafkaProducer (org.apache.kafka.clients.producer.KafkaProducer)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 FakeTicker (com.google.common.testing.FakeTicker)1 ParsedSchema (io.confluent.kafka.schemaregistry.ParsedSchema)1 SchemaProvider (io.confluent.kafka.schemaregistry.SchemaProvider)1 AvroSchema (io.confluent.kafka.schemaregistry.avro.AvroSchema)1 Mode (io.confluent.kafka.schemaregistry.client.rest.entities.Mode)1 Schema (io.confluent.kafka.schemaregistry.client.rest.entities.Schema)1