Search in sources :

Example 1 with IncrementalIdGenerator

use of io.confluent.kafka.schemaregistry.id.IncrementalIdGenerator in project schema-registry by confluentinc.

the class KafkaStoreTest method testKafkaStoreMessageHandlerDeleteSubjectKeyNullValue.

// Test no NPE happens when handling DeleteSubjectKey with null value
@Test
public void testKafkaStoreMessageHandlerDeleteSubjectKeyNullValue() throws Exception {
    Properties props = new Properties();
    props.put(SchemaRegistryConfig.KAFKASTORE_BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
    props.put(SchemaRegistryConfig.KAFKASTORE_TOPIC_CONFIG, ClusterTestHarness.KAFKASTORE_TOPIC);
    SchemaRegistryConfig config = new SchemaRegistryConfig(props);
    KafkaSchemaRegistry schemaRegistry = new KafkaSchemaRegistry(config, new SchemaRegistrySerializer());
    InMemoryCache<SchemaRegistryKey, SchemaRegistryValue> store = new InMemoryCache<>(new SchemaRegistrySerializer());
    store.init();
    KafkaStoreMessageHandler storeMessageHandler = new KafkaStoreMessageHandler(schemaRegistry, store, new IncrementalIdGenerator(schemaRegistry));
    storeMessageHandler.handleUpdate(new DeleteSubjectKey("test"), null, null, null, 0L, 0L);
}
Also used : SchemaRegistryConfig(io.confluent.kafka.schemaregistry.rest.SchemaRegistryConfig) SchemaRegistrySerializer(io.confluent.kafka.schemaregistry.storage.serialization.SchemaRegistrySerializer) Properties(java.util.Properties) IncrementalIdGenerator(io.confluent.kafka.schemaregistry.id.IncrementalIdGenerator) Test(org.junit.Test)

Example 2 with IncrementalIdGenerator

use of io.confluent.kafka.schemaregistry.id.IncrementalIdGenerator in project schema-registry by confluentinc.

the class KafkaSchemaRegistry method identityGenerator.

protected IdGenerator identityGenerator(SchemaRegistryConfig config) {
    config.checkBootstrapServers();
    IdGenerator idGenerator = new IncrementalIdGenerator(this);
    idGenerator.configure(config);
    return idGenerator;
}
Also used : IdGenerator(io.confluent.kafka.schemaregistry.id.IdGenerator) IncrementalIdGenerator(io.confluent.kafka.schemaregistry.id.IncrementalIdGenerator) IncrementalIdGenerator(io.confluent.kafka.schemaregistry.id.IncrementalIdGenerator)

Example 3 with IncrementalIdGenerator

use of io.confluent.kafka.schemaregistry.id.IncrementalIdGenerator in project schema-registry by confluentinc.

the class KafkaStoreTest method testKafkaStoreMessageHandlerClearSubjectKeyNullValue.

// Test no NPE happens when handling ClearSubjectKey with null value
@Test
public void testKafkaStoreMessageHandlerClearSubjectKeyNullValue() throws Exception {
    Properties props = new Properties();
    props.put(SchemaRegistryConfig.KAFKASTORE_BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
    props.put(SchemaRegistryConfig.KAFKASTORE_TOPIC_CONFIG, ClusterTestHarness.KAFKASTORE_TOPIC);
    SchemaRegistryConfig config = new SchemaRegistryConfig(props);
    KafkaSchemaRegistry schemaRegistry = new KafkaSchemaRegistry(config, new SchemaRegistrySerializer());
    InMemoryCache<SchemaRegistryKey, SchemaRegistryValue> store = new InMemoryCache<>(new SchemaRegistrySerializer());
    store.init();
    KafkaStoreMessageHandler storeMessageHandler = new KafkaStoreMessageHandler(schemaRegistry, store, new IncrementalIdGenerator(schemaRegistry));
    storeMessageHandler.handleUpdate(new ClearSubjectKey("test"), null, null, null, 0L, 0L);
}
Also used : SchemaRegistryConfig(io.confluent.kafka.schemaregistry.rest.SchemaRegistryConfig) SchemaRegistrySerializer(io.confluent.kafka.schemaregistry.storage.serialization.SchemaRegistrySerializer) Properties(java.util.Properties) IncrementalIdGenerator(io.confluent.kafka.schemaregistry.id.IncrementalIdGenerator) Test(org.junit.Test)

Aggregations

IncrementalIdGenerator (io.confluent.kafka.schemaregistry.id.IncrementalIdGenerator)3 SchemaRegistryConfig (io.confluent.kafka.schemaregistry.rest.SchemaRegistryConfig)2 SchemaRegistrySerializer (io.confluent.kafka.schemaregistry.storage.serialization.SchemaRegistrySerializer)2 Properties (java.util.Properties)2 Test (org.junit.Test)2 IdGenerator (io.confluent.kafka.schemaregistry.id.IdGenerator)1