Skip to content

Commit

Permalink
Merge pull request #23 from jpzk/release/1.6
Browse files Browse the repository at this point in the history
release 1.6
  • Loading branch information
jpzk authored Mar 15, 2018
2 parents fc13590 + efcbc1e commit d699340
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Mocked Streams 1.6.0

* Build against Apache Kafka 1.0.1
* Updated Scala 2.12 version to 2.12.4

## Mocked Streams 1.5.0

* Build against Apache Kafka 1.0
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
[![codecov](https://codecov.io/gh/jpzk/mockedstreams/branch/master/graph/badge.svg)](https://codecov.io/gh/jpzk/mockedstreams) [![License](http://img.shields.io/:license-Apache%202-grey.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt) [![GitHub stars](https://img.shields.io/github/stars/jpzk/mockedstreams.svg?style=flat)](https://github.com/jpzk/mockedstreams/stargazers)


Mocked Streams 1.5.0 [(git)](https://github.com/jpzk/mockedstreams) is a library for Scala 2.11 and 2.12 which allows you to **unit-test processing topologies** of [Kafka Streams](https://kafka.apache.org/documentation#streams) applications (since Apache Kafka >=0.10.1) **without Zookeeper and Kafka Brokers**. Further, you can use your favourite Scala testing framework e.g. [ScalaTest](http://www.scalatest.org/) and [Specs2](https://etorreborre.github.io/specs2/). Mocked Streams is located at the Maven Central Repository, therefore you just have to add the following to your [SBT dependencies](http://www.scala-sbt.org/0.13/docs/Library-Dependencies.html):
Mocked Streams 1.6.0 [(git)](https://github.com/jpzk/mockedstreams) is a library for Scala 2.11 and 2.12 which allows you to **unit-test processing topologies** of [Kafka Streams](https://kafka.apache.org/documentation#streams) applications (since Apache Kafka >=0.10.1) **without Zookeeper and Kafka Brokers**. Further, you can use your favourite Scala testing framework e.g. [ScalaTest](http://www.scalatest.org/) and [Specs2](https://etorreborre.github.io/specs2/). Mocked Streams is located at the Maven Central Repository, therefore you just have to add the following to your [SBT dependencies](http://www.scala-sbt.org/0.13/docs/Library-Dependencies.html):

libraryDependencies += "com.madewithtea" %% "mockedstreams" % "1.5.0" % "test"
libraryDependencies += "com.madewithtea" %% "mockedstreams" % "1.6.0" % "test"

## Apache Kafka Compatibility

| Mocked Streams Version | Apache Kafka Version |
| ------------- |-------------|
| 1.5.0 | 1.0.0.0 |
| Mocked Streams Version | Apache Kafka Version |
|------------- |-------------|
| 1.6.0 | 1.0.1.0 |
| 1.5.0 | 1.0.0.0 |
| 1.4.0 | 0.11.0.1 |
| 1.3.0 | 0.11.0.0 |
| 1.2.1 | 0.10.2.1 |
Expand Down
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@

lazy val commonSettings = Seq(
organization := "com.madewithtea",
version := "1.5.0",
scalaVersion := "2.12.2",
crossScalaVersions := Seq("2.12.2","2.11.11"),
version := "1.6.0",
scalaVersion := "2.12.4",
crossScalaVersions := Seq("2.12.4","2.11.11"),
description := "Topology Unit-Testing Library for Apache Kafka / Kafka Streams",
organizationHomepage := Some(url("https://www.madewithtea.com")),
scalacOptions := Seq("-Xexperimental"))

val scalaTestVersion = "3.0.4"
val rocksDBVersion = "5.7.3"
val kafkaVersion = "1.0.0"
val kafkaVersion = "1.0.1"

lazy val kafka = Seq(
"org.apache.kafka" % "kafka-clients" % kafkaVersion,
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/MockedStreams.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ object MockedStreams {
val updatedRecords = newRecords.foldLeft(inputs) {
case (events, (k, v)) =>
val newRecord = Record(topic, keySer.serialize(topic, k), valSer.serialize(topic, v))
events :+ newRecord
events :+ newRecord
}

this.copy(inputs = updatedRecords)
Expand All @@ -58,7 +58,7 @@ object MockedStreams {
def output[K, V](topic: String, key: Serde[K], value: Serde[V], size: Int) = {
if (size <= 0) throw new ExpectedOutputIsEmpty
withProcessedDriver { driver =>
(0 until size).flatMap { i =>
(0 until size).flatMap { _ =>
Option(driver.readOutput(topic, key.deserializer, value.deserializer)) match {
case Some(record) => Some((record.key, record.value))
case None => None
Expand Down Expand Up @@ -104,7 +104,7 @@ object MockedStreams {
}

private def produce(driver: Driver): Unit = {
inputs.foreach{
inputs.foreach {
case Record(topic, key, value) =>
driver.process(topic, key, value)
}
Expand Down

0 comments on commit d699340

Please sign in to comment.