bakdata / fluent-kafka-streams-tests

Fluent Kafka Streams Test with Java
https://medium.com/bakdata/fluent-kafka-streams-tests-e641785171ec
MIT License
88 stars 16 forks source link

Support JsonSchema and Protobuf providers on SchemaRegistryMock #50

Closed sergialonsaco closed 3 years ago

sergialonsaco commented 3 years ago

Since confluent version 5.5.0, schema registry supports JsonSchema and Protobuf as SchemaProviders to register schemas on it. To do so, when creating a SchemaRegistryClient or MockSchemaRegistryClient, a list of providers can be passed and it will use those ones for the registry.

The problem happens to be that in your TestTopology and SchemaRegistryMock classes, there is no support to send a list of providers to the MockSchemaRegistry you internally use.

Can anyone help me with that?

torbsto commented 3 years ago

Hi, I've opened a corresponding PR. However, I'm not sure whether I handle all cases correctly, especially regarding the schema references, since I haven't worked much with the new API yet. I'd appreciate any feedback. You can clone the repository, switch to the feature/schema-provider branch and run ./gradlew publishToMavenLocal. This will allow you to use version 2.3.1-SNAPSHOT with the applied changes. This test shows an example using schema provider.

sergialonsaco commented 3 years ago

Hi @torbsto, so many thanks for your help! Appreciate that. I just did a small PR to your branch, as for me it would be nice if when creating a TestTopology, the SchemaRegistryMock used could be created outside the class so I can control it. Does it make sense to you?

torbsto commented 3 years ago

Sorry for the delay!

Thanks for the PR. I see your point, but I'd like to integrate it with the existing wither API. Here is the updated test case. I hope that also works for you.

sergialonsaco commented 3 years ago

Awesome @torbsto, indeed it makes more sense to use the wither. Thanks for the update!