Skip to content
This library wraps Kafka's embedded test cluster, allowing you to more easily create and run integration tests using JUnit against a "real" kafka server running within the context of your tests. No need to stand up an external kafka cluster!
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
kafka-junit-core Add support for SSL, SASL_PLAIN, and SASL_SSL listeners in kafka brok… Dec 13, 2018
kafka-junit4 Update README with versions Dec 13, 2018
kafka-junit5
script
.gitignore
.travis.yml Add support for SSL, SASL_PLAIN, and SASL_SSL listeners in kafka brok… Dec 13, 2018
CHANGELOG.md
LICENSE.txt
README.md
pom.xml Add support for SSL, SASL_PLAIN, and SASL_SSL listeners in kafka brok… Dec 13, 2018

README.md

kafka-junit

Build Status

This library wraps Apache Kafka's KafkaServerStartable class and allows you to easily create and run tests against one or more "real" kafka brokers. No longer do you need to setup and coordinate with an external kafka cluster for your tests! The library transparently supports running a single or multi-broker cluster. Running a multi-broker cluster allows you to validate how your software reacts under various error scenarios, such as when one or more brokers become unavailable.

Features

  • Support for JUnit 4 and JUnit 5.
  • Support for Kafka versions 2.0.x, 1.1.x, 1.0.x, and 0.11.0.x.
  • Support for running either single broker cluster, or multi-broker clusters.
  • Support for PLAINTEXT, SASL_PLAINTEXT, SASL_SSL, and SSL listeners.

Using Kafka-JUnit with JUnit 4.

Please review Kafka-JUnit4 Readme for usage instructions with JUnit4.

Using Kafka-JUnit with JUnit 5.

Please review Kafka-JUnit5 Readme for usage instructions with JUnit5.

Using Kafka-JUnit-Core.

For use cases where you want to embed Kafka broker/cluster within your existing software, you can make use of the core package directly. Please review Kafka-JUnit-Core Readme for usage instructions.

Contributing

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

Submitting a Contribution

  1. Search for an existing issue. If none exists, create a new issue so that other contributors can keep track of what you are trying to add/fix and offer suggestions (or let you know if there is already an effort in progress). Be sure to clearly state the problem you are trying to solve and an explanation of why you want to use the strategy you're proposing to solve it.
  2. Fork this repository on GitHub and create a branch for your feature.
  3. Clone your fork and branch to your local machine.
  4. Commit changes to your branch.
  5. Push your work up to GitHub.
  6. Submit a pull request so that we can review your changes.

Make sure that you rebase your branch off of master before opening a new pull request. We might also ask you to rebase it if master changes after you open your pull request.

Acceptance Criteria

We love contributions, but it's important that your pull request adhere to some of the standards we maintain in this repository.

  • All tests must be passing!
  • All code changes require tests!
  • All code changes must be consistent with our checkstyle rules.
  • Great inline comments.

Other Notes

Checkstyle

We use checkstyle aggressively on source and tests, our config is located under the 'script' folder and can be imported into your IDE of choice.

Releasing

Steps for proper release:

  • Update release version: mvn versions:set -DnewVersion=X.Y.Z
  • Validate and then commit version: mvn versions:commit
  • Update CHANGELOG and README files.
  • Merge to master.
  • Deploy to Maven Central: mvn clean deploy -P release-kafka-junit
  • Create release on Github project.

Changelog

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

View Changelog

License

BSD 3-Clause View License.

You can’t perform that action at this time.