You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you need to serialize and deserialize messages using Avro, a [Confluent Schema Registry](https://docs.confluent.io/current/schema-registry/docs/index.html) instance can be provided to test your code.
198
-
199
-
### How to use
200
-
201
-
* Provide an implicit `EmbeddedKafkaConfig` specifying a port for Schema Registry to use (a value of 0 means random available port will be selected).
202
-
203
-
```scala
204
-
classMySpecextendsWordSpecwithEmbeddedKafka {
205
-
206
-
"runs with embedded kafka and Schema Registry" should {
* A Schema Registry server will be started and automatically shutdown at the end of the test.
220
-
* Have a look at the [example test](kafka-streams/src/test/scala/net/manub/embeddedkafka/streams/ExampleKafkaStreamsSchemaRegistrySpec.scala).
221
-
222
-
### Utility methods
223
-
224
-
The `net.manub.embeddedkafka.avro.schemaregistry` package object provides useful implicit converters for testing with Avro and Schema Registry.
225
-
226
195
## scalatest-embedded-kafka-streams
227
196
228
197
A library that builds on top of `scalatest-embedded-kafka` to offer easy testing of [Kafka Streams](https://cwiki.apache.org/confluence/display/KAFKA/Kafka+Streams) with ScalaTest.
@@ -231,7 +200,7 @@ It takes care of instantiating and starting your streams as well as closing them
231
200
232
201
### How to use
233
202
234
-
* In your `build.sbt` file add the following dependency: `"net.manub" %% "scalatest-embedded-kafka-streams" % "1.1.0-kafka1.1" % "test"`
203
+
* In your `build.sbt` file add the following dependency: `"net.manub" %% "scalatest-embedded-kafka-streams" % "1.1.0-kafka1.1-nosr" % "test"`
235
204
* Have a look at the [example test](kafka-streams/src/test/scala/net/manub/embeddedkafka/streams/ExampleKafkaStreamsSpec.scala)
236
205
* For most of the cases have your `Spec` extend the `EmbeddedKafkaStreamsAllInOne` trait. This offers both streams management and easy creation of consumers for asserting resulting messages in output/sink topics.
237
206
* If you only want to use the streams management without the test consumers just have the `Spec` extend the `EmbeddedKafkaStreams` trait.
@@ -270,3 +239,44 @@ class MySpec extends WordSpec with Matchers with EmbeddedKafkaStreamsAllInOne {
270
239
}
271
240
}
272
241
```
242
+
243
+
## scalatest-embedded-schema-registry
244
+
245
+
If you need to serialize and deserialize messages using Avro, a [Confluent Schema Registry](https://docs.confluent.io/current/schema-registry/docs/index.html) instance can be provided to test your code.
246
+
247
+
### How to use
248
+
249
+
* In your `build.sbt` file add the following resolver: `resolvers += "confluent" at "https://packages.confluent.io/maven/"`
250
+
* In your `build.sbt` file add the following dependency: `"net.manub" %% "scalatest-embedded-schema-registry" % "1.1.0-kafka1.1-nosr" % "test"`
251
+
* Have your `Spec` extend the `EmbeddedKafkaWithSchemaRegistry` trait.
252
+
* Enclose the code that needs a running instance of Kafka within the `withRunningKafka` closure.
253
+
* Provide an implicit `EmbeddedKafkaConfigWithSchemaRegistryImpl`.
* A Schema Registry server will be started and automatically shutdown at the end of the test.
272
+
273
+
### Utility methods
274
+
275
+
The `net.manub.embeddedkafka.avro.schemaregistry` package object provides useful implicit converters for testing with Avro and Schema Registry.
276
+
277
+
## Using streams
278
+
279
+
* For most of the cases have your `Spec` extend the `EmbeddedKafkaStreamsWithSchemaRegistryAllInOne` trait. This offers both streams management and easy creation of consumers for asserting resulting messages in output/sink topics.
280
+
* If you only want to use the streams management without the test consumers just have the `Spec` extend the `EmbeddedKafkaStreamsWithSchemaRegistry` trait.
281
+
* Build your own `Topology` and use `runStreams` to test it.
282
+
* Have a look at the [example test](schema-registry/src/test/scala/net/manub/embeddedkafka/schemaregistry/streams/ExampleKafkaStreamsSchemaRegistrySpec.scala).
0 commit comments