diff --git a/.travis.yml b/.travis.yml index 6920329..97dd248 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,19 @@ env: - KAFKA_VERSION=2.0.1 EXCLUDE_KAFKA_TESTS=0_11_0_x +- + KAFKA_VERSION=2.1.1 + EXCLUDE_KAFKA_TESTS=0_11_0_x +- + KAFKA_VERSION=2.2.2 + EXCLUDE_KAFKA_TESTS=0_11_0_x +- + KAFKA_VERSION=2.3.1 + EXCLUDE_KAFKA_TESTS=0_11_0_x +- + KAFKA_VERSION=2.4.0 + EXCLUDE_KAFKA_TESTS=0_11_0_x + script: ## Generate dummy SSL Certificates used in tests - script/generateCertificatesForTests.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 88db84d..c6192c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 3.2.1 (02/03/2020) +[PR-42](https://github.com/salesforce/kafka-junit/pull/42) + +### Features +- Officially added support for Kafka versions 2.1.x, 2.2.x, 2.3.x, 2.4.x. + +### Bugfix +- Fixes bug in `ZookeeperTestServer.start()` where calling start on an already running instance caused the instance to be restarted instead of being a no-operation. + This caused issues with Kafka version 2.1.x on startup and shutdown causing tests to hang. + +### Internal dependency updates +- JUnit4 from 2.12 to 2.13 +- JUnit5 from 5.3.2 to 5.6.0 + ## 3.2.0 (11/13/2019) - [ISSUE-38](https://github.com/salesforce/kafka-junit/issues/38) Optionally allow for explicitly defining which ports kakfa brokers listen on. diff --git a/README.md b/README.md index eddc8e2..0336ad8 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ one or more "real" kafka brokers. No longer do you need to setup and coordinate ## 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 all Kafka versions from 0.11.0.x through 2.4.x - Support for running either single broker cluster, or multi-broker clusters. - Support for PLAINTEXT, SASL_PLAINTEXT, SASL_SSL, and SSL listeners. diff --git a/kafka-junit-core/pom.xml b/kafka-junit-core/pom.xml index ffe7ed8..a77dc65 100644 --- a/kafka-junit-core/pom.xml +++ b/kafka-junit-core/pom.xml @@ -5,12 +5,12 @@ kafka-junit com.salesforce.kafka.test - 3.2.0 + 3.2.1 4.0.0 kafka-junit-core - 3.2.0 + 3.2.1 @@ -37,7 +37,7 @@ org.mockito mockito-core - 2.18.3 + 2.28.2 test @@ -45,7 +45,7 @@ org.apache.zookeeper zookeeper - 3.4.12 + 3.4.14 test diff --git a/kafka-junit-core/src/main/java/com/salesforce/kafka/test/ZookeeperTestServer.java b/kafka-junit-core/src/main/java/com/salesforce/kafka/test/ZookeeperTestServer.java index ae5a8dd..2db95eb 100644 --- a/kafka-junit-core/src/main/java/com/salesforce/kafka/test/ZookeeperTestServer.java +++ b/kafka-junit-core/src/main/java/com/salesforce/kafka/test/ZookeeperTestServer.java @@ -43,10 +43,21 @@ public class ZookeeperTestServer implements AutoCloseable { */ private TestingServer zkServer = null; + /** + * Internal state flag. + */ + private boolean isStarted = false; + /** * Starts the internal Test zookeeper server instance. */ public void start() { + // If we're already started + if (isStarted) { + // Do nothing. + return; + } + try { if (zkServer == null) { // Define configuration @@ -72,6 +83,9 @@ public void start() { } catch (final Exception exception) { throw new RuntimeException(exception.getMessage(), exception); } + + // Set internal state flag + isStarted = true; } /** @@ -88,6 +102,9 @@ public void restart() { // Otherwise call restart. try { zkServer.restart(); + + // Ensure flag is set correctly. + isStarted = true; } catch (final Exception exception) { throw new RuntimeException(exception.getMessage(), exception); } @@ -109,6 +126,8 @@ public void stop() { throw new RuntimeException(exception.getMessage(), exception); } } + // Set internal state flag. + isStarted = false; } /** diff --git a/kafka-junit4/README.md b/kafka-junit4/README.md index fe18105..57b33b5 100644 --- a/kafka-junit4/README.md +++ b/kafka-junit4/README.md @@ -5,7 +5,7 @@ one or more "real" kafka brokers running within your tests. No longer do you nee Kafka-JUnit4 is built on-top of **JUnit 4** as a SharedResource using the **@ClassRule** annotation. -Kafka-JUnit4 works with Kafka versions **0.11.0.x**, **1.0.x**, **1.1.x**, and **2.0.x**. The library requires your project to explicitly declare/include Kafka in your project's POM dependency list. +Kafka-JUnit4 works with all Kafka versions from **0.11.0.x** through **2.4.x**. The library requires your project to explicitly declare/include Kafka in your project's POM dependency list. For usage with JUnit5 or more general project information please review top level [README](../README.md). @@ -20,7 +20,107 @@ Include this library in your project's POM with test scope. **You'll also need com.salesforce.kafka.test kafka-junit4 - 3.2.0 + 3.2.1 + test + +``` + +#### POM for Kafka 2.4.x +```xml + + + com.salesforce.kafka.test + kafka-junit4 + 3.2.1 + test + + + + + org.apache.kafka + kafka_2.11 + 2.4.0 + test + + + org.apache.kafka + kafka-clients + 2.4.0 + test + +``` + +#### POM for Kafka 2.3.x +```xml + + + com.salesforce.kafka.test + kafka-junit4 + 3.2.1 + test + + + + + org.apache.kafka + kafka_2.11 + 2.3.1 + test + + + org.apache.kafka + kafka-clients + 2.3.1 + test + +``` + +#### POM for Kafka 2.2.x +```xml + + + com.salesforce.kafka.test + kafka-junit4 + 3.2.1 + test + + + + + org.apache.kafka + kafka_2.11 + 2.2.2 + test + + + org.apache.kafka + kafka-clients + 2.2.2 + test + +``` + +#### POM for Kafka 2.1.x +```xml + + + com.salesforce.kafka.test + kafka-junit4 + 3.2.1 + test + + + + + org.apache.kafka + kafka_2.11 + 2.1.1 + test + + + org.apache.kafka + kafka-clients + 2.1.1 test ``` @@ -32,7 +132,7 @@ Include this library in your project's POM with test scope. **You'll also need com.salesforce.kafka.test kafka-junit4 - 3.2.0 + 3.2.1 test @@ -58,7 +158,7 @@ Include this library in your project's POM with test scope. **You'll also need com.salesforce.kafka.test kafka-junit4 - 3.2.0 + 3.2.1 test @@ -84,7 +184,7 @@ Include this library in your project's POM with test scope. **You'll also need com.salesforce.kafka.test kafka-junit4 - 3.2.0 + 3.2.1 test @@ -110,7 +210,7 @@ Include this library in your project's POM with test scope. **You'll also need com.salesforce.kafka.test kafka-junit4 - 3.2.0 + 3.2.1 test diff --git a/kafka-junit4/pom.xml b/kafka-junit4/pom.xml index 27fc391..1e2b236 100644 --- a/kafka-junit4/pom.xml +++ b/kafka-junit4/pom.xml @@ -32,13 +32,13 @@ kafka-junit com.salesforce.kafka.test - 3.2.0 + 3.2.1 4.0.0 kafka-junit4 - 3.2.0 + 3.2.1 @@ -50,7 +50,7 @@ com.salesforce.kafka.test kafka-junit-core - 3.2.0 + 3.2.1 diff --git a/kafka-junit5/README.md b/kafka-junit5/README.md index 0f9716f..bfc0cd4 100644 --- a/kafka-junit5/README.md +++ b/kafka-junit5/README.md @@ -5,7 +5,7 @@ one or more "real" kafka brokers running within your tests. No longer do you nee Kafka-JUnit5 is built on-top of **JUnit 5** as an Extension using the **@RegisterExtension** annotation. -Kafka-JUnit5 works with Kafka versions **0.11.0.x**, **1.0.x**, **1.1.x**, and **2.0.x**. The library requires your project to explicitly declare/include Kafka in your project's POM dependency list. +Kafka-JUnit5 works with all Kafka versions from **0.11.0.x** through **2.4.x**. The library requires your project to explicitly declare/include Kafka in your project's POM dependency list. For usage with JUnit4 or more general project information please review top level [README](../README.md). @@ -20,7 +20,107 @@ Include this library in your project's POM with test scope. **You'll also need com.salesforce.kafka.test kafka-junit5 - 3.2.0 + 3.2.1 + test + +``` + +#### POM for Kafka 2.4.x +```xml + + + com.salesforce.kafka.test + kafka-junit5 + 3.2.1 + test + + + + + org.apache.kafka + kafka_2.11 + 2.4.0 + test + + + org.apache.kafka + kafka-clients + 2.4.0 + test + +``` + +#### POM for Kafka 2.3.x +```xml + + + com.salesforce.kafka.test + kafka-junit5 + 3.2.1 + test + + + + + org.apache.kafka + kafka_2.11 + 2.3.1 + test + + + org.apache.kafka + kafka-clients + 2.3.1 + test + +``` + +#### POM for Kafka 2.2.x +```xml + + + com.salesforce.kafka.test + kafka-junit5 + 3.2.1 + test + + + + + org.apache.kafka + kafka_2.11 + 2.2.2 + test + + + org.apache.kafka + kafka-clients + 2.2.2 + test + +``` + +#### POM for Kafka 2.1.x +```xml + + + com.salesforce.kafka.test + kafka-junit5 + 3.2.1 + test + + + + + org.apache.kafka + kafka_2.11 + 2.1.1 + test + + + org.apache.kafka + kafka-clients + 2.1.1 test ``` @@ -31,7 +131,7 @@ Include this library in your project's POM with test scope. **You'll also need com.salesforce.kafka.test kafka-junit5 - 3.2.0 + 3.2.1 test @@ -57,7 +157,7 @@ Include this library in your project's POM with test scope. **You'll also need com.salesforce.kafka.test kafka-junit5 - 3.2.0 + 3.2.1 test @@ -83,7 +183,7 @@ Include this library in your project's POM with test scope. **You'll also need com.salesforce.kafka.test kafka-junit5 - 3.2.0 + 3.2.1 test @@ -109,7 +209,7 @@ Include this library in your project's POM with test scope. **You'll also need com.salesforce.kafka.test kafka-junit5 - 3.2.0 + 3.2.1 test diff --git a/kafka-junit5/pom.xml b/kafka-junit5/pom.xml index 16c5335..16e25ea 100644 --- a/kafka-junit5/pom.xml +++ b/kafka-junit5/pom.xml @@ -31,12 +31,12 @@ kafka-junit com.salesforce.kafka.test - 3.2.0 + 3.2.1 4.0.0 kafka-junit5 - 3.2.0 + 3.2.1 @@ -48,7 +48,7 @@ com.salesforce.kafka.test kafka-junit-core - 3.2.0 + 3.2.1 diff --git a/pom.xml b/pom.xml index d3a0daa..b610250 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ com.salesforce.kafka.test kafka-junit - 3.2.0 + 3.2.1 @@ -91,12 +91,12 @@ 2.12.0 - 1.7.25 + 1.7.30 - 4.12 - 5.3.2 - 1.2.0 + 4.13 + 5.6.0 + 1.3.2 false @@ -104,9 +104,9 @@ script/checkstyle-ruleset.xml - 3.0.0 - 3.0.1 - 2.22.0 + 3.1.0 + 3.1.1 + 2.22.2 @@ -275,7 +275,7 @@ com.puppycrawl.tools checkstyle - 8.18 + 8.29 diff --git a/script/checkstyle-ruleset.xml b/script/checkstyle-ruleset.xml index aa1740d..4ced0c7 100755 --- a/script/checkstyle-ruleset.xml +++ b/script/checkstyle-ruleset.xml @@ -32,6 +32,11 @@ + + + + + @@ -45,10 +50,6 @@ - - - - @@ -177,12 +178,13 @@ - - - - + + - + + + +