Skip to content

Commit

Permalink
update internal dependencies (#42)
Browse files Browse the repository at this point in the history
* update dependencies

* add support for kafka versions 2.1.x, 2.2.x, 2.3.x, 2.4.x

* Fix bug causing zkServer to restart unnecessarily

* Update version and changelog

* Update version and changelog

* fix changelog
  • Loading branch information
Crim authored Feb 3, 2020
1 parent 9ab7114 commit 043b8e7
Show file tree
Hide file tree
Showing 11 changed files with 289 additions and 41 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 4 additions & 4 deletions kafka-junit-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<artifactId>kafka-junit</artifactId>
<groupId>com.salesforce.kafka.test</groupId>
<version>3.2.0</version>
<version>3.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>kafka-junit-core</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>

<!-- defined properties -->
<properties>
Expand All @@ -37,15 +37,15 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.18.3</version>
<version>2.28.2</version>
<scope>test</scope>
</dependency>

<!-- Zookeeper for validation in tests -->
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.12</version>
<version>3.4.14</version>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -72,6 +83,9 @@ public void start() {
} catch (final Exception exception) {
throw new RuntimeException(exception.getMessage(), exception);
}

// Set internal state flag
isStarted = true;
}

/**
Expand All @@ -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);
}
Expand All @@ -109,6 +126,8 @@ public void stop() {
throw new RuntimeException(exception.getMessage(), exception);
}
}
// Set internal state flag.
isStarted = false;
}

/**
Expand Down
112 changes: 106 additions & 6 deletions kafka-junit4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand All @@ -20,7 +20,107 @@ Include this library in your project's POM with test scope. **You'll also need
<dependency>
<groupId>com.salesforce.kafka.test</groupId>
<artifactId>kafka-junit4</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
<scope>test</scope>
</dependency>
```

#### POM for Kafka 2.4.x
```xml
<!-- Declare kafka-junit4 dependency -->
<dependency>
<groupId>com.salesforce.kafka.test</groupId>
<artifactId>kafka-junit4</artifactId>
<version>3.2.1</version>
<scope>test</scope>
</dependency>

<!-- Include Kafka 2.4.x -->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.11</artifactId>
<version>2.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.4.0</version>
<scope>test</scope>
</dependency>
```

#### POM for Kafka 2.3.x
```xml
<!-- Declare kafka-junit4 dependency -->
<dependency>
<groupId>com.salesforce.kafka.test</groupId>
<artifactId>kafka-junit4</artifactId>
<version>3.2.1</version>
<scope>test</scope>
</dependency>

<!-- Include Kafka 2.3.x -->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.11</artifactId>
<version>2.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.3.1</version>
<scope>test</scope>
</dependency>
```

#### POM for Kafka 2.2.x
```xml
<!-- Declare kafka-junit4 dependency -->
<dependency>
<groupId>com.salesforce.kafka.test</groupId>
<artifactId>kafka-junit4</artifactId>
<version>3.2.1</version>
<scope>test</scope>
</dependency>

<!-- Include Kafka 2.2.x -->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.11</artifactId>
<version>2.2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.2.2</version>
<scope>test</scope>
</dependency>
```

#### POM for Kafka 2.1.x
```xml
<!-- Declare kafka-junit4 dependency -->
<dependency>
<groupId>com.salesforce.kafka.test</groupId>
<artifactId>kafka-junit4</artifactId>
<version>3.2.1</version>
<scope>test</scope>
</dependency>

<!-- Include Kafka 2.1.x -->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.11</artifactId>
<version>2.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.1.1</version>
<scope>test</scope>
</dependency>
```
Expand All @@ -32,7 +132,7 @@ Include this library in your project's POM with test scope. **You'll also need
<dependency>
<groupId>com.salesforce.kafka.test</groupId>
<artifactId>kafka-junit4</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
<scope>test</scope>
</dependency>

Expand All @@ -58,7 +158,7 @@ Include this library in your project's POM with test scope. **You'll also need
<dependency>
<groupId>com.salesforce.kafka.test</groupId>
<artifactId>kafka-junit4</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
<scope>test</scope>
</dependency>

Expand All @@ -84,7 +184,7 @@ Include this library in your project's POM with test scope. **You'll also need
<dependency>
<groupId>com.salesforce.kafka.test</groupId>
<artifactId>kafka-junit4</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
<scope>test</scope>
</dependency>

Expand All @@ -110,7 +210,7 @@ Include this library in your project's POM with test scope. **You'll also need
<dependency>
<groupId>com.salesforce.kafka.test</groupId>
<artifactId>kafka-junit4</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
<scope>test</scope>
</dependency>

Expand Down
6 changes: 3 additions & 3 deletions kafka-junit4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
<parent>
<artifactId>kafka-junit</artifactId>
<groupId>com.salesforce.kafka.test</groupId>
<version>3.2.0</version>
<version>3.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<!-- Module Definition & Version -->
<artifactId>kafka-junit4</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>

<!-- defined properties -->
<properties>
Expand All @@ -50,7 +50,7 @@
<dependency>
<groupId>com.salesforce.kafka.test</groupId>
<artifactId>kafka-junit-core</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
</dependency>

<!-- JUnit is Required -->
Expand Down
Loading

0 comments on commit 043b8e7

Please sign in to comment.