schemaregistry-junit

A library that provides an in-memory instance of Confluent Schema Registry to run your tests against.

License

License

Categories

Categories

JUnit Unit Testing Data
GroupId

GroupId

io.github.data-rocks-team
ArtifactId

ArtifactId

schemaregistry-junit4
Last Version

Last Version

0.1.1
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

schemaregistry-junit
A library that provides an in-memory instance of Confluent Schema Registry to run your tests against.
Project URL

Project URL

https://github.com/data-rocks-team/schemaregistry-junit
Source Code Management

Source Code Management

https://github.com/data-rocks-team/schemaregistry-junit

Download schemaregistry-junit4

Dependencies

compile (1)

Group / Artifact Type Version
io.github.data-rocks-team : schemaregistry-junit-core jar 0.1.1

runtime (3)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.30
org.slf4j : slf4j-simple jar 1.7.30
junit : junit jar 4.13.1

Project Modules

There are no modules declared in this project.

schemaregistry-junit

GitHub Actions Status FOSSA Status Quality Gate Status Coverage

Library Version Documentation Vulnerability
schemaregistry-junit5 Maven Central Javadocs Known Vulnerabilities
schemaregistry-junit4 Maven Central Javadocs Known Vulnerabilities
schemaregistry-junit-core Maven Central Javadocs Known Vulnerabilities

Are you tired of waiting for Docker containers to fire up while testing your Kafka solution? Or are you tired of waiting for an ephemeral environment to start? Are you looking for a solution to reduce the time you are loosing waiting for Apache Kafka Cluster and Confluent Schema Registry to start while testing? schemaregistry-junit is the answer! By pairing schemaregistry-junit together with kafka-junit, you can speed up your tests and shorten the feedback loop by reducing the time wasted waiting for Docker containers or ephemeral environments to start. schemaregistry-junit lets you run a fully working Confluent Schema Registry in-memory. The server lifecycle is fully automated via JUnit extensions. A fluent DSL is provided to configure the Confluent Schema Registry.

This project was inspired by kafka-junit.

Features

Installation

The easiest way to include schemaregistry-junit in your project(s) is via Maven dependency. Binary, Sources and Javadocs are all available in Maven Central.

For JUnit 5

Maven

Example POM

<!-- Declare schemaregistry-junit5 dependency -->
<dependency>
  <groupId>io.github.data-rocks-team</groupId>
  <artifactId>schemaregistry-junit5</artifactId>
  <version>0.1.1</version>
</dependency>

<!-- Include Confluent Schema-Registry -->
<dependency>
  <groupId>io.confluent</groupId>
  <artifactId>kafka-schema-registry</artifactId>
  <version>X.X.X</version>
</dependency>
Gradle

Example build.gradle

testImplementation 'io.github.data-rocks-team:schemaregistry-junit5:0.1.1'
testImplementation 'io.confluent:kafka-schema-registry:X.X.X'

For JUnit 4

Maven

Example POM

<!-- Declare schemaregistry-junit5 dependency -->
<dependency>
  <groupId>io.github.data-rocks-team</groupId>
  <artifactId>schemaregistry-junit4</artifactId>
  <version>0.1.1</version>
</dependency>

<!-- Include Confluent Schema-Registry -->
<dependency>
  <groupId>io.confluent</groupId>
  <artifactId>kafka-schema-registry</artifactId>
  <version>X.X.X</version>
</dependency>
Gradle

Example build.gradle

testImplementation 'io.github.data-rocks-team:schemaregistry-junit4:0.1.1'
testImplementation 'io.confluent:kafka-schema-registry:X.X.X'

How it works

Given a class using SharedSchemaRegistryTestResource, before all tests start, JUnit calls the start function. This function replicates the behaviour of SchemaRegistryMain.java, which first validates the settings and then starts the server. When all tests have been executed, independently of the test results, JUnit calls the shutdown function, which will shut the server down. Logs generated by the server are redirected to the terminal.

Regression testing

Every build is automatically tested against the latest patch version of every minor version since 4.0.0. For more details, check schemaregistry-junit-regression-test.

Examples

Before compiling any example, run ./gradlew setDependenciesForExample in the main project. This gradle task will ensure that the example project will use the same dependency versions used in the main project. To ensure that setDependenciesForExample works as expected, dependencies version should be defined in the ext {} section in the main build.gradle and the example project should define versions as nameOfTheDependencyVersion = PLACEHOLDER (an example can be found here).

Contributing

Found a bug? Think you've got an awesome feature you want to add? We welcome contributions!

Feedback

Any questions or suggestions? Get in touch!

Tweet

Blog post

License

MIT view license

FOSSA Status

io.github.data-rocks-team
Where data can rock

Versions

Version
0.1.1
0.1.0