Search in sources :

Example 21 with SchemaProvider

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

the class ProtobufSchemaTest method testParseSchemaSuppressException.

@Test
public void testParseSchemaSuppressException() {
    SchemaProvider protobufSchemaProvider = new ProtobufSchemaProvider();
    Optional<ParsedSchema> parsedSchema = protobufSchemaProvider.parseSchema(invalidSchemaString, new ArrayList<>(), false);
    assertFalse(parsedSchema.isPresent());
}
Also used : SchemaProvider(io.confluent.kafka.schemaregistry.SchemaProvider) ParsedSchema(io.confluent.kafka.schemaregistry.ParsedSchema) Test(org.junit.Test)

Example 22 with SchemaProvider

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

the class ProtobufSchemaTest method testParseSchemaThrowException.

@Test(expected = IllegalArgumentException.class)
public void testParseSchemaThrowException() {
    SchemaProvider protobufSchemaProvider = new ProtobufSchemaProvider();
    protobufSchemaProvider.parseSchemaOrElseThrow(invalidSchemaString, new ArrayList<>(), false);
}
Also used : SchemaProvider(io.confluent.kafka.schemaregistry.SchemaProvider) Test(org.junit.Test)

Aggregations

SchemaProvider (io.confluent.kafka.schemaregistry.SchemaProvider)22 ParsedSchema (io.confluent.kafka.schemaregistry.ParsedSchema)9 AvroSchemaProvider (io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider)7 JsonSchemaProvider (io.confluent.kafka.schemaregistry.json.JsonSchemaProvider)7 ProtobufSchemaProvider (io.confluent.kafka.schemaregistry.protobuf.ProtobufSchemaProvider)7 BadRequestException (io.confluent.kafkarest.exceptions.BadRequestException)5 IOException (java.io.IOException)5 Test (org.junit.Test)5 CachedSchemaRegistryClient (io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient)4 SchemaRegistryClient (io.confluent.kafka.schemaregistry.client.SchemaRegistryClient)4 RestClientException (io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException)3 EmbeddedFormat (io.confluent.kafkarest.entities.EmbeddedFormat)3 Test (org.junit.jupiter.api.Test)3 MockSchemaRegistryClient (io.confluent.kafka.schemaregistry.client.MockSchemaRegistryClient)2 SchemaString (io.confluent.kafka.schemaregistry.client.rest.entities.SchemaString)2 StoreException (io.confluent.kafka.schemaregistry.storage.exceptions.StoreException)2 TopicNameStrategy (io.confluent.kafka.serializers.subject.TopicNameStrategy)2 HashMap (java.util.HashMap)2 SchemaParseException (org.apache.avro.SchemaParseException)2 CompatibilityChecker (io.confluent.kafka.schemaregistry.CompatibilityChecker)1