From a7c5eabec48e0e920102fc9e9043c581d4a53835 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 10 Mar 2022 11:29:17 +0100 Subject: [PATCH 01/14] bump gradle 7.4.1 --- build.gradle.kts | 2 +- gradle/wrapper/gradle-wrapper.jar | Bin 59536 -> 59821 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 10 +++++----- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2708afd..7f7ea96 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,6 +27,6 @@ dependencies { } tasks.wrapper { - gradleVersion = "7.4" + gradleVersion = "7.4.1" distributionType = Wrapper.DistributionType.ALL } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f2ae8848c63b8b4dea2cb829da983f2fa..41d9927a4d4fb3f96a785543079b8df6723c946b 100644 GIT binary patch delta 8958 zcmY+KWl$VIlZIh&f(Hri?gR<$?iyT!TL`X;1^2~W7YVSq1qtqM!JWlDxLm%}UESUM zndj}Uny%^UnjhVhFb!8V3s(a#fIy>`VW15{5nuy;_V&a5O#0S&!a4dSkUMz_VHu3S zGA@p9Q$T|Sj}tYGWdjH;Mpp8m&yu&YURcrt{K;R|kM~(*{v%QwrBJIUF+K1kX5ZmF zty3i{d`y0;DgE+de>vN@yYqFPe1Ud{!&G*Q?iUc^V=|H%4~2|N zW+DM)W!`b&V2mQ0Y4u_)uB=P@-2`v|Wm{>CxER1P^ z>c}ZPZ)xxdOCDu59{X^~2id7+6l6x)U}C4Em?H~F`uOxS1?}xMxTV|5@}PlN%Cg$( zwY6c}r60=z5ZA1L zTMe;84rLtYvcm?M(H~ZqU;6F7Evo{P7!LGcdwO|qf1w+)MsnvK5^c@Uzj<{ zUoej1>95tuSvDJ|5K6k%&UF*uE6kBn47QJw^yE&#G;u^Z9oYWrK(+oL97hBsUMc_^ z;-lmxebwlB`Er_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npAh2%rB@vD|Lau$2O)#1n*aa+ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b1159fc..d7e66b5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index c53aefa..1b6c787 100644 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # From d8e6c1be653e24fde2e4348dcff814a4d5bafb87 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 10 Mar 2022 11:30:26 +0100 Subject: [PATCH 02/14] bump mockk, kotest, git-versioning. add kover plugin. remove uneeded junit deps. --- build.gradle.kts | 2 ++ buildSrc/build.gradle.kts | 5 ++++- .../kotka/convention/kotlin-jvm.gradle.kts | 16 ++++++++-------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7f7ea96..188013f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,6 +6,8 @@ plugins { `project-report` `build-dashboard` + + id("org.jetbrains.kotlinx.kover") } group = "dev.adamko.kotka" diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index c30da89..ac8bbfc 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -16,8 +16,11 @@ dependencies { val kotlinXSerializationVersion = "1.3.2" implementation(enforcedPlatform("org.jetbrains.kotlinx:kotlinx-serialization-bom:$kotlinXSerializationVersion")) - val gitVersioningPluginVersion = "5.1.3" + val gitVersioningPluginVersion = "5.1.5" implementation("me.qoomon:gradle-git-versioning-plugin:$gitVersioningPluginVersion") + + val kotlinxKoverVersion = "0.5.0" + implementation("org.jetbrains.kotlinx:kover:${kotlinxKoverVersion}") } val projectJvmTarget = "11" diff --git a/buildSrc/src/main/kotlin/kotka/convention/kotlin-jvm.gradle.kts b/buildSrc/src/main/kotlin/kotka/convention/kotlin-jvm.gradle.kts index 7fc26d3..6cf9495 100644 --- a/buildSrc/src/main/kotlin/kotka/convention/kotlin-jvm.gradle.kts +++ b/buildSrc/src/main/kotlin/kotka/convention/kotlin-jvm.gradle.kts @@ -11,21 +11,21 @@ dependencies { implementation(platform("org.jetbrains.kotlin:kotlin-bom")) - val junitVersion = "5.8.2" - testImplementation(platform("org.junit:junit-bom:$junitVersion")) - testImplementation("org.junit.jupiter:junit-jupiter") - testRuntimeOnly("org.junit.platform:junit-platform-launcher") { - because("Only needed to run tests in a version of IntelliJ IDEA that bundles older versions") - } +// val junitVersion = "5.8.2" +// testImplementation(platform("org.junit:junit-bom:$junitVersion")) +// testImplementation("org.junit.jupiter:junit-jupiter") +// testRuntimeOnly("org.junit.platform:junit-platform-launcher") { +// because("Only needed to run tests in a version of IntelliJ IDEA that bundles older versions") +// } - val kotestVersion = "5.0.3" + val kotestVersion = "5.1.0" testImplementation(platform("io.kotest:kotest-bom:$kotestVersion")) testImplementation("io.kotest:kotest-runner-junit5") testImplementation("io.kotest:kotest-assertions-core") testImplementation("io.kotest:kotest-property") testImplementation("io.kotest:kotest-assertions-json") - testImplementation("io.mockk:mockk:1.12.1") + testImplementation("io.mockk:mockk:1.12.3") } From 528678d39bc54151c4ec060bcbf386089e98fa55 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 10 Mar 2022 11:30:43 +0100 Subject: [PATCH 03/14] specify return types, for clarity --- .../main/kotlin/dev/adamko/kotka/kxs/binaryFormatSerde.kt | 5 +++-- .../main/kotlin/dev/adamko/kotka/kxs/stringFormatSerde.kt | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/kotka-streams-kotlinx-serialization/src/main/kotlin/dev/adamko/kotka/kxs/binaryFormatSerde.kt b/modules/kotka-streams-kotlinx-serialization/src/main/kotlin/dev/adamko/kotka/kxs/binaryFormatSerde.kt index 876d1b0..e88e02b 100644 --- a/modules/kotka-streams-kotlinx-serialization/src/main/kotlin/dev/adamko/kotka/kxs/binaryFormatSerde.kt +++ b/modules/kotka-streams-kotlinx-serialization/src/main/kotlin/dev/adamko/kotka/kxs/binaryFormatSerde.kt @@ -9,7 +9,7 @@ import org.apache.kafka.common.serialization.Serde import org.apache.kafka.common.serialization.Serializer -inline fun BinaryFormat.kafkaSerializer() = +inline fun BinaryFormat.kafkaSerializer(): Serializer = Serializer { topic: String, data: T? -> runCatching { encodeToByteArray(data) @@ -27,7 +27,7 @@ inline fun BinaryFormat.kafkaSerializer() = } } -inline fun BinaryFormat.kafkaDeserializer() = +inline fun BinaryFormat.kafkaDeserializer(): Deserializer = Deserializer { topic: String, data: ByteArray -> runCatching { decodeFromByteArray(data) @@ -51,5 +51,6 @@ inline fun BinaryFormat.serde() = object : Serde { override fun deserializer(): Deserializer = kafkaDeserializer() } + inline fun BinaryFormat.keyValueSerdes(): KeyValueSerdes = KeyValueSerdes(serde(), serde()) diff --git a/modules/kotka-streams-kotlinx-serialization/src/main/kotlin/dev/adamko/kotka/kxs/stringFormatSerde.kt b/modules/kotka-streams-kotlinx-serialization/src/main/kotlin/dev/adamko/kotka/kxs/stringFormatSerde.kt index 9fa34bd..020962d 100644 --- a/modules/kotka-streams-kotlinx-serialization/src/main/kotlin/dev/adamko/kotka/kxs/stringFormatSerde.kt +++ b/modules/kotka-streams-kotlinx-serialization/src/main/kotlin/dev/adamko/kotka/kxs/stringFormatSerde.kt @@ -9,11 +9,10 @@ import org.apache.kafka.common.serialization.Serde import org.apache.kafka.common.serialization.Serializer -inline fun StringFormat.kafkaSerializer() = +inline fun StringFormat.kafkaSerializer(): Serializer = Serializer { topic: String, data: T? -> runCatching { encodeToString(data).encodeToByteArray() -// jsonMapper.encodeToString(data as T).encodeToByteArray() }.getOrElse { e -> println( """ @@ -28,10 +27,10 @@ inline fun StringFormat.kafkaSerializer() = } } -inline fun StringFormat.kafkaDeserializer() = +inline fun StringFormat.kafkaDeserializer(): Deserializer = Deserializer { topic: String, data: ByteArray -> runCatching { - decodeFromString(data.decodeToString()) + decodeFromString(data.decodeToString()) }.getOrElse { e -> println( """ @@ -46,6 +45,7 @@ inline fun StringFormat.kafkaDeserializer() = } } + inline fun StringFormat.serde() = object : Serde { override fun serializer(): Serializer = kafkaSerializer() override fun deserializer(): Deserializer = kafkaDeserializer() From 74d1615cbed67a6f17963f4307491168c87a2fff Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 10 Mar 2022 11:30:56 +0100 Subject: [PATCH 04/14] add processor Record tests --- .../kotka/extensions/processor/RecordTests.kt | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordTests.kt diff --git a/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordTests.kt b/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordTests.kt new file mode 100644 index 0000000..12a633f --- /dev/null +++ b/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordTests.kt @@ -0,0 +1,72 @@ +package dev.adamko.kotka.extensions.processor + +import io.kotest.core.spec.IsolationMode +import io.kotest.core.spec.style.BehaviorSpec +import io.kotest.matchers.shouldBe +import io.mockk.confirmVerified +import io.mockk.every +import io.mockk.mockk +import io.mockk.verify +import org.apache.kafka.streams.processor.api.Record + +class RecordTests : BehaviorSpec({ + isolationMode = IsolationMode.InstancePerLeaf + + Given("a Kafka Streams Processor API Record") { + val mockRecord: Record = mockk { + every { key() } returns "record-key" + every { value() } returns "record-value" + every { timestamp() } returns 12345L + } + + When("when the Record extension functions are used") { + + Then("component1 should return the Record's key") { + mockRecord.component1() + + verify(exactly = 1) { mockRecord.key() } + confirmVerified(mockRecord) + } + + Then("component2 should return the Record's value") { + mockRecord.component2() + + verify(exactly = 1) { mockRecord.value() } + confirmVerified(mockRecord) + } + + Then("component3 should return the Record's timestamp") { + mockRecord.component3() + + verify(exactly = 1) { mockRecord.timestamp() } + confirmVerified(mockRecord) + } + + } + + When("when the Record is deconstructed") { + val (key, value, timestamp) = mockRecord + + Then("the Record's key should be assigned") { + key shouldBe "record-key" + } + + Then("the Record's value should be assigned") { + value shouldBe "record-value" + } + + Then("the Record's timestamp should be assigned") { + timestamp shouldBe 12345L + } + + Then("all extension functions should be used") { + verify(exactly = 1) { mockRecord.key() } + verify(exactly = 1) { mockRecord.value() } + verify(exactly = 1) { mockRecord.timestamp() } + confirmVerified(mockRecord) + } + } + + } + +}) From d47140d53818a3fabb26e53194e6cd9656ba59d6 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 10 Mar 2022 11:34:39 +0100 Subject: [PATCH 05/14] fix test steps naming --- .../kotka/extensions/processor/RecordTests.kt | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordTests.kt b/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordTests.kt index 12a633f..20c554f 100644 --- a/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordTests.kt +++ b/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordTests.kt @@ -10,7 +10,7 @@ import io.mockk.verify import org.apache.kafka.streams.processor.api.Record class RecordTests : BehaviorSpec({ - isolationMode = IsolationMode.InstancePerLeaf + isolationMode = IsolationMode.InstancePerLeaf // so the mockk is fresh for each test Given("a Kafka Streams Processor API Record") { val mockRecord: Record = mockk { @@ -19,23 +19,23 @@ class RecordTests : BehaviorSpec({ every { timestamp() } returns 12345L } - When("when the Record extension functions are used") { + When("the Record extension functions are used") { - Then("component1 should return the Record's key") { + Then("expect component1 returns the Record's key") { mockRecord.component1() verify(exactly = 1) { mockRecord.key() } confirmVerified(mockRecord) } - Then("component2 should return the Record's value") { + Then("expect component2 should return the Record's value") { mockRecord.component2() verify(exactly = 1) { mockRecord.value() } confirmVerified(mockRecord) } - Then("component3 should return the Record's timestamp") { + Then("expect component3 should return the Record's timestamp") { mockRecord.component3() verify(exactly = 1) { mockRecord.timestamp() } @@ -44,22 +44,22 @@ class RecordTests : BehaviorSpec({ } - When("when the Record is deconstructed") { + When("the Record is deconstructed") { val (key, value, timestamp) = mockRecord - Then("the Record's key should be assigned") { + Then("expect the Record's key is extracted") { key shouldBe "record-key" } - Then("the Record's value should be assigned") { + Then("expect the Record's value is extracted") { value shouldBe "record-value" } - Then("the Record's timestamp should be assigned") { + Then("expect the Record's timestamp is extracted") { timestamp shouldBe 12345L } - Then("all extension functions should be used") { + Then("expect the extension functions are used") { verify(exactly = 1) { mockRecord.key() } verify(exactly = 1) { mockRecord.value() } verify(exactly = 1) { mockRecord.timestamp() } From 34b263304361ed841113f1a667fccbacae545e8b Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Fri, 11 Mar 2022 23:46:30 +0100 Subject: [PATCH 06/14] KTable, mapValues test --- .../extensions/tables/KTableMapValuesTest.kt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/tables/KTableMapValuesTest.kt diff --git a/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/tables/KTableMapValuesTest.kt b/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/tables/KTableMapValuesTest.kt new file mode 100644 index 0000000..8873d37 --- /dev/null +++ b/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/tables/KTableMapValuesTest.kt @@ -0,0 +1,24 @@ +package dev.adamko.kotka.extensions.tables + +import io.kotest.core.spec.style.BehaviorSpec +import io.mockk.confirmVerified +import io.mockk.mockk +import io.mockk.verify +import org.apache.kafka.streams.kstream.KTable +import org.apache.kafka.streams.kstream.ValueMapperWithKey + +class KTableMapValuesTest : BehaviorSpec({ + + Given("a KTable") { + val mockKTable: KTable = mockk(relaxed = true) {} + + When("mapValues, mapper only") { + mockKTable.mapValues(mapper = { key, value -> "dummy mapper $key $value" }) + Then("expect MapValues method is called") { + verify(exactly = 1) { mockKTable.mapValues(any>()) } + confirmVerified(mockKTable) + } + } + } + +}) From 218b6812787889e4fb92bb4c9eed000657d77f66 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Fri, 11 Mar 2022 23:47:08 +0100 Subject: [PATCH 07/14] add kafka-streams-test-utils dependency (preparing, not in use yet) --- gradle/libs.versions.toml | 3 ++- modules/kotka-streams-extensions/build.gradle.kts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8116a70..a1a25c5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -15,7 +15,8 @@ kotlinx-serialization = "1.3.2" kotlin-bom = { group = "org.jetbrains.kotlin", name = "kotlin-bom", version.ref = "kotlin" } -kafka-streams = { group = "org.apache.kafka", name = "kafka-streams", version.ref = "kafka" } +kafka-streams = { group = "org.apache.kafka", name = "kafka-streams", version.ref = "kafka" } +kafka-streamsTestUtils = { group = "org.apache.kafka", name = "kafka-streams-test-utils", version.ref = "kafka" } kotlinx-serialization-bom = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-bom", version.ref = "kotlinx-serialization" } kotlinx-serialization-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-core" } diff --git a/modules/kotka-streams-extensions/build.gradle.kts b/modules/kotka-streams-extensions/build.gradle.kts index 0fa6ac2..7cbe784 100644 --- a/modules/kotka-streams-extensions/build.gradle.kts +++ b/modules/kotka-streams-extensions/build.gradle.kts @@ -5,4 +5,5 @@ plugins { dependencies { api(libs.kafka.streams) + testImplementation(libs.kafka.streamsTestUtils) } From d23c12af166b3dbb2d3ecaf3fe52d16d6e4fca95 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Fri, 11 Mar 2022 23:47:42 +0100 Subject: [PATCH 08/14] setup knit (not in use yet, just preparing) --- buildSrc/build.gradle.kts | 5 ++++- docs/code/build.gradle.kts | 42 ++++++++++++++++++++++++++++++++++++++ docs/knit.properties | 9 ++++++++ settings.gradle.kts | 2 ++ 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 docs/code/build.gradle.kts create mode 100644 docs/knit.properties diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index ac8bbfc..b3848bf 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -10,7 +10,7 @@ dependencies { val kotlinVersion = "1.6.10" implementation(enforcedPlatform("org.jetbrains.kotlin:kotlin-bom:$kotlinVersion")) implementation("org.jetbrains.kotlin:kotlin-serialization") - implementation("org.jetbrains.kotlin:kotlin-reflect") +// implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") val kotlinXSerializationVersion = "1.3.2" @@ -21,6 +21,9 @@ dependencies { val kotlinxKoverVersion = "0.5.0" implementation("org.jetbrains.kotlinx:kover:${kotlinxKoverVersion}") + + val kotlinxKnitVersion = "0.3.0" + implementation("org.jetbrains.kotlinx:kotlinx-knit:${kotlinxKnitVersion}") } val projectJvmTarget = "11" diff --git a/docs/code/build.gradle.kts b/docs/code/build.gradle.kts new file mode 100644 index 0000000..811d432 --- /dev/null +++ b/docs/code/build.gradle.kts @@ -0,0 +1,42 @@ +plugins { + kotka.convention.`kotlin-jvm` + id("org.jetbrains.kotlinx.knit") +} + + +dependencies { +// implementation(projects.modules.kxsTsGenCore) + + implementation("org.jetbrains.kotlinx:kotlinx-knit:0.3.0") + + testImplementation(kotlin("test")) + + testImplementation("org.jetbrains.kotlinx:kotlinx-knit-test:0.3.0") +} + + +sourceSets.test { + java.srcDirs( + layout.projectDirectory.dir("example"), + layout.projectDirectory.dir("test"), + ) +} + +knit { + val docsDir = rootProject.layout.projectDirectory.dir("docs") + rootDir = docsDir.asFile + files = project.fileTree(docsDir) { + include("*.md") + } +} + +tasks.test { + dependsOn(tasks.knit) +// finalizedBy(tasks.knitCheck) +} + +tasks.compileKotlin { mustRunAfter(tasks.knit) } + +//tasks.knitCheck { +// dependsOn(tasks.test) +//} diff --git a/docs/knit.properties b/docs/knit.properties new file mode 100644 index 0000000..abfadfa --- /dev/null +++ b/docs/knit.properties @@ -0,0 +1,9 @@ +knit.dir=./knit/example/ +test.dir=./knit/test/ +knit.package=dev.adamko.kotka.example +test.package=dev.adamko.kotka.example.test +# +test.template=./knit/knit-test.ftl +test.language=typescript +knit.include=./knit/knit-include.ftl +test.mode.=joinToString(\"\\n\")\n .shouldBe diff --git a/settings.gradle.kts b/settings.gradle.kts index 6d3d9a7..5d88204 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,6 +2,8 @@ rootProject.name = "kotka-streams" include( + ":docs:code", + ":modules:kotka-streams-extensions", ":modules:kotka-streams-framework", ":modules:kotka-streams-kotlinx-serialization", From 895c02d1dd2aa81e734425637712a404eba1264a Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Sat, 12 Mar 2022 01:24:50 +0100 Subject: [PATCH 09/14] - knit test for 'named.as' replacement - fix slf4j warning - --- buildSrc/build.gradle.kts | 2 + .../kotka/convention/kotlin-jvm.gradle.kts | 7 ++ docs/basics.md | 67 +++++++++++++++++++ docs/code/build.gradle.kts | 7 +- .../example-basics-naming-operators-01.kt | 25 +++++++ docs/code/knit-include.ftl | 6 ++ docs/code/knit-test.ftl | 34 ++++++++++ docs/code/test/BasicsTest.kt | 34 ++++++++++ docs/knit.properties | 12 ++-- gradle/libs.versions.toml | 6 ++ 10 files changed, 190 insertions(+), 10 deletions(-) create mode 100644 docs/basics.md create mode 100644 docs/code/example/example-basics-naming-operators-01.kt create mode 100644 docs/code/knit-include.ftl create mode 100644 docs/code/knit-test.ftl create mode 100644 docs/code/test/BasicsTest.kt diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index b3848bf..941cd6b 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -24,6 +24,8 @@ dependencies { val kotlinxKnitVersion = "0.3.0" implementation("org.jetbrains.kotlinx:kotlinx-knit:${kotlinxKnitVersion}") + + implementation("dev.jacomet.gradle.plugins:logging-capabilities:0.10.0") } val projectJvmTarget = "11" diff --git a/buildSrc/src/main/kotlin/kotka/convention/kotlin-jvm.gradle.kts b/buildSrc/src/main/kotlin/kotka/convention/kotlin-jvm.gradle.kts index 6cf9495..ea29082 100644 --- a/buildSrc/src/main/kotlin/kotka/convention/kotlin-jvm.gradle.kts +++ b/buildSrc/src/main/kotlin/kotka/convention/kotlin-jvm.gradle.kts @@ -6,6 +6,8 @@ plugins { id("kotka.convention.subproject") kotlin("jvm") `java-library` + + id("dev.jacomet.logging-capabilities") } dependencies { @@ -27,6 +29,7 @@ dependencies { testImplementation("io.mockk:mockk:1.12.3") + implementation("org.slf4j:slf4j-simple:1.7.36") } val projectJvmTarget = "11" @@ -66,3 +69,7 @@ java { withJavadocJar() withSourcesJar() } + +loggingCapabilities { + enforceSlf4JSimple() +} diff --git a/docs/basics.md b/docs/basics.md new file mode 100644 index 0000000..37dfe8f --- /dev/null +++ b/docs/basics.md @@ -0,0 +1,67 @@ + + +**Table of contents** + + + + * [Naming operators](#naming-operators) + + + + + + +### Naming operators + +https://kafka.apache.org/documentation/streams/developer-guide/dsl-topology-naming.html + +* `Grouped` +* `StreamJoined` +* `Joined` +* `StreamJoined` +* `Materialized` +* `Named` + +```kotlin + val stream: KStream = builder + .stream("input", consumedAs("Customer_transactions_input_topic")) + + stream + .filter("filter_out_invalid_txns") { _, v -> + v != "invalid_txn" + }.mapValues("Map_values_to_first_6_characters") { _, v -> + v.take(6) + }.to("output", producedAs("Mapped_transactions_output_topic")) +``` + +> You can get the full code [here](./code/example/example-basics-naming-operators-01.kt). +> +```text +Topologies: + Sub-topology: 0 + Source: Customer_transactions_input_topic (topics: [input]) + --> filter_out_invalid_txns + Processor: filter_out_invalid_txns (stores: []) + --> Map_values_to_first_6_characters + <-- Customer_transactions_input_topic + Processor: Map_values_to_first_6_characters (stores: []) + --> Mapped_transactions_output_topic + <-- filter_out_invalid_txns + Sink: Mapped_transactions_output_topic (topic: output) + <-- Map_values_to_first_6_characters +``` + + diff --git a/docs/code/build.gradle.kts b/docs/code/build.gradle.kts index 811d432..e4a2cbf 100644 --- a/docs/code/build.gradle.kts +++ b/docs/code/build.gradle.kts @@ -5,13 +5,12 @@ plugins { dependencies { -// implementation(projects.modules.kxsTsGenCore) - - implementation("org.jetbrains.kotlinx:kotlinx-knit:0.3.0") + implementation(projects.modules.kotkaStreamsExtensions) testImplementation(kotlin("test")) - testImplementation("org.jetbrains.kotlinx:kotlinx-knit-test:0.3.0") + implementation(libs.kotlinx.knit) + testImplementation(libs.kotlinx.knitTest) } diff --git a/docs/code/example/example-basics-naming-operators-01.kt b/docs/code/example/example-basics-naming-operators-01.kt new file mode 100644 index 0000000..b33fbc4 --- /dev/null +++ b/docs/code/example/example-basics-naming-operators-01.kt @@ -0,0 +1,25 @@ +// This file was automatically generated from basics.md by Knit tool. Do not edit. +@file:Suppress("PackageDirectoryMismatch", "unused") +package dev.adamko.kotka.example.exampleBasicsNamingOperators01 + +import dev.adamko.kotka.extensions.* +import org.apache.kafka.streams.* +import dev.adamko.kotka.extensions.streams.* +import org.apache.kafka.streams.kstream.* + +private val builder = StreamsBuilder() + +fun main() { + + val stream: KStream = builder + .stream("input", consumedAs("Customer_transactions_input_topic")) + + stream + .filter("filter_out_invalid_txns") { _, v -> + v != "invalid_txn" + }.mapValues("Map_values_to_first_6_characters") { _, v -> + v.take(6) + }.to("output", producedAs("Mapped_transactions_output_topic")) + + println(builder.build().describe()) +} diff --git a/docs/code/knit-include.ftl b/docs/code/knit-include.ftl new file mode 100644 index 0000000..766a866 --- /dev/null +++ b/docs/code/knit-include.ftl @@ -0,0 +1,6 @@ +<#-- @ftlvariable name="knit.name" type="String" --> +<#-- @ftlvariable name="knit.package" type="String" --> +<#-- @ftlvariable name="file.name" type="String" --> +// This file was automatically generated from ${file.name} by Knit tool. Do not edit. +@file:Suppress("PackageDirectoryMismatch", "unused") +package ${knit.package}.${knit.name} diff --git a/docs/code/knit-test.ftl b/docs/code/knit-test.ftl new file mode 100644 index 0000000..9a39a45 --- /dev/null +++ b/docs/code/knit-test.ftl @@ -0,0 +1,34 @@ +<#-- @ftlvariable name="test.name" type="java.lang.String" --> +<#-- @ftlvariable name="test.package" type="java.lang.String" --> +<#-- @ftlvariable name="test.language" type="java.lang.String" --> +// This file was automatically generated from ${file.name} by Knit tool. Do not edit. +@file:Suppress("JSUnusedLocalSymbols") +package ${test.package} + +import io.kotest.matchers.* +import kotlinx.knit.test.* +import org.junit.jupiter.api.Test + +class ${test.name} { +<#list cases as case><#assign method = test["mode.${case.param}"]!"custom"> + @Test + fun test${case.name}() { + captureOutput("${case.name}") { + ${case.knit.package}.${case.knit.name}.main() + }<#if method != "custom">.${method}( + // language=${test.language} + """ +<#list case.lines as line> + |${line} + + """.trimMargin() + ) +<#else>.also { lines -> + check(${case.param}) + } + + } +<#sep> + + +} diff --git a/docs/code/test/BasicsTest.kt b/docs/code/test/BasicsTest.kt new file mode 100644 index 0000000..86a1e86 --- /dev/null +++ b/docs/code/test/BasicsTest.kt @@ -0,0 +1,34 @@ +// This file was automatically generated from basics.md by Knit tool. Do not edit. +@file:Suppress("JSUnusedLocalSymbols") +package dev.adamko.kotka.example.test + +import io.kotest.matchers.* +import kotlinx.knit.test.* +import org.junit.jupiter.api.Test + +class BasicsTest { + @Test + fun testExampleBasicsNamingOperators01() { + captureOutput("ExampleBasicsNamingOperators01") { + dev.adamko.kotka.example.exampleBasicsNamingOperators01.main() + }.joinToString("\n") + .trim() + .shouldBe( + // language=text + """ + |Topologies: + | Sub-topology: 0 + | Source: Customer_transactions_input_topic (topics: [input]) + | --> filter_out_invalid_txns + | Processor: filter_out_invalid_txns (stores: []) + | --> Map_values_to_first_6_characters + | <-- Customer_transactions_input_topic + | Processor: Map_values_to_first_6_characters (stores: []) + | --> Mapped_transactions_output_topic + | <-- filter_out_invalid_txns + | Sink: Mapped_transactions_output_topic (topic: output) + | <-- Map_values_to_first_6_characters + """.trimMargin() + ) + } +} diff --git a/docs/knit.properties b/docs/knit.properties index abfadfa..2698000 100644 --- a/docs/knit.properties +++ b/docs/knit.properties @@ -1,9 +1,9 @@ -knit.dir=./knit/example/ -test.dir=./knit/test/ +knit.dir=./code/example/ +test.dir=./code/test/ knit.package=dev.adamko.kotka.example test.package=dev.adamko.kotka.example.test # -test.template=./knit/knit-test.ftl -test.language=typescript -knit.include=./knit/knit-include.ftl -test.mode.=joinToString(\"\\n\")\n .shouldBe +test.template=./code/knit-test.ftl +test.language=text +knit.include=./code/knit-include.ftl +test.mode.=joinToString(\"\\n\")\n .trim()\n .shouldBe diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a1a25c5..13f6e32 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,6 +9,8 @@ kafka = "3.1.0" kotlinx-serialization = "1.3.2" +kotlinx-knit = "0.3.0" + ########### [libraries] ########### @@ -21,3 +23,7 @@ kafka-streamsTestUtils = { group = "org.apache.kafka", name = "kafka-streams-tes kotlinx-serialization-bom = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-bom", version.ref = "kotlinx-serialization" } kotlinx-serialization-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-core" } kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json" } + + +kotlinx-knit = { group = "org.jetbrains.kotlinx", name = "kotlinx-knit", version.ref = "kotlinx-knit" } +kotlinx-knitTest = { group = "org.jetbrains.kotlinx", name = "kotlinx-knit-test", version.ref = "kotlinx-knit" } From 3208a8ff690e75a6eee65d129958732d2ee58a8f Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Sat, 12 Mar 2022 11:09:16 +0100 Subject: [PATCH 10/14] rm errant > --- docs/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/basics.md b/docs/basics.md index 37dfe8f..536398f 100644 --- a/docs/basics.md +++ b/docs/basics.md @@ -48,7 +48,7 @@ https://kafka.apache.org/documentation/streams/developer-guide/dsl-topology-nami ``` > You can get the full code [here](./code/example/example-basics-naming-operators-01.kt). -> + ```text Topologies: Sub-topology: 0 From 7ec701af592543bd3e77f45b4d72744ea60404cf Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Sun, 24 Apr 2022 10:58:07 +0200 Subject: [PATCH 11/14] in-progress work on tests --- docs/basics.md | 114 ++++++++++++++++-- .../example-basics-naming-operators-01.kt | 35 ++++-- .../example-basics-naming-operators-02.kt | 42 +++++++ docs/code/test/BasicsTest.kt | 25 ++++ 4 files changed, 198 insertions(+), 18 deletions(-) create mode 100644 docs/code/example/example-basics-naming-operators-02.kt diff --git a/docs/basics.md b/docs/basics.md index 536398f..cfb1c87 100644 --- a/docs/basics.md +++ b/docs/basics.md @@ -5,6 +5,7 @@ * [Naming operators](#naming-operators) + * [Naming operators 2](#naming-operators-2) @@ -35,20 +36,115 @@ https://kafka.apache.org/documentation/streams/developer-guide/dsl-topology-nami * `Materialized` * `Named` + + + + + + + + + +
Plain Kafka StreamsKotka Streams
+ +```kotlin +val stream: KStream = builder + .stream("input", Consumed.`as`("Customer_transactions_input_topic")) + +stream + .filter( + { _, v -> v != "invalid_txn" }, + Named.`as`("filter_out_invalid_txns") + ) + .mapValues( + { _, v -> v.take(6) }, + Named.`as`("Map_values_to_first_6_characters") + ) + .to("output", Produced.`as`("Mapped_transactions_output_topic")) +``` + + + ```kotlin - val stream: KStream = builder - .stream("input", consumedAs("Customer_transactions_input_topic")) - - stream - .filter("filter_out_invalid_txns") { _, v -> - v != "invalid_txn" - }.mapValues("Map_values_to_first_6_characters") { _, v -> - v.take(6) - }.to("output", producedAs("Mapped_transactions_output_topic")) +val stream: KStream = builder +// no need for backticks + .stream("input", consumedAs("Customer_transactions_input_topic")) + +stream + // tasks can be named directly using a string, + // and the lambda expression can be placed outside the parentheses + .filter("filter_out_invalid_txns") { _, v -> + v != "invalid_txn" + }.mapValues("Map_values_to_first_6_characters") { _, v -> + v.take(6) + }.to("output", producedAs("Mapped_transactions_output_topic")) ``` + +
+ > You can get the full code [here](./code/example/example-basics-naming-operators-01.kt). +Both examples produce the same topology: + +```text +Topologies: + Sub-topology: 0 + Source: Customer_transactions_input_topic (topics: [input]) + --> filter_out_invalid_txns + Processor: filter_out_invalid_txns (stores: []) + --> Map_values_to_first_6_characters + <-- Customer_transactions_input_topic + Processor: Map_values_to_first_6_characters (stores: []) + --> Mapped_transactions_output_topic + <-- filter_out_invalid_txns + Sink: Mapped_transactions_output_topic (topic: output) + <-- Map_values_to_first_6_characters +``` + + + +### Naming operators 2 + + + +```kotlin +val stream: KStream = builder + .stream("input", Consumed.`as`("Customer_transactions_input_topic")) + +stream + .filter( + { _, v -> v != "invalid_txn" }, + Named.`as`("filter_out_invalid_txns") + ) + .mapValues( + { _, v -> v.take(6) }, + Named.`as`("Map_values_to_first_6_characters") + ) + .to("output", Produced.`as`("Mapped_transactions_output_topic")) +``` + + +```kotlin +val stream: KStream = builder +// no need for backticks + .stream("input", consumedAs("Customer_transactions_input_topic")) + +stream + // tasks can be named directly using a string, + // and the lambda expression can be placed outside the parentheses + .filter("filter_out_invalid_txns") { _, v -> + v != "invalid_txn" + }.mapValues("Map_values_to_first_6_characters") { _, v -> + v.take(6) + }.to("output", producedAs("Mapped_transactions_output_topic")) +``` + + +> You can get the full code [here](./code/example/example-basics-naming-operators-02.kt). + +Both examples produce the same topology: + ```text Topologies: Sub-topology: 0 diff --git a/docs/code/example/example-basics-naming-operators-01.kt b/docs/code/example/example-basics-naming-operators-01.kt index b33fbc4..9f9a83b 100644 --- a/docs/code/example/example-basics-naming-operators-01.kt +++ b/docs/code/example/example-basics-naming-operators-01.kt @@ -11,15 +11,32 @@ private val builder = StreamsBuilder() fun main() { - val stream: KStream = builder - .stream("input", consumedAs("Customer_transactions_input_topic")) - - stream - .filter("filter_out_invalid_txns") { _, v -> - v != "invalid_txn" - }.mapValues("Map_values_to_first_6_characters") { _, v -> - v.take(6) - }.to("output", producedAs("Mapped_transactions_output_topic")) +val stream: KStream = builder + .stream("input", Consumed.`as`("Customer_transactions_input_topic")) + +stream + .filter( + { _, v -> v != "invalid_txn" }, + Named.`as`("filter_out_invalid_txns") + ) + .mapValues( + { _, v -> v.take(6) }, + Named.`as`("Map_values_to_first_6_characters") + ) + .to("output", Produced.`as`("Mapped_transactions_output_topic")) + +val stream: KStream = builder +// no need for backticks + .stream("input", consumedAs("Customer_transactions_input_topic")) + +stream + // tasks can be named directly using a string, + // and the lambda expression can be placed outside the parentheses + .filter("filter_out_invalid_txns") { _, v -> + v != "invalid_txn" + }.mapValues("Map_values_to_first_6_characters") { _, v -> + v.take(6) + }.to("output", producedAs("Mapped_transactions_output_topic")) println(builder.build().describe()) } diff --git a/docs/code/example/example-basics-naming-operators-02.kt b/docs/code/example/example-basics-naming-operators-02.kt new file mode 100644 index 0000000..3817d11 --- /dev/null +++ b/docs/code/example/example-basics-naming-operators-02.kt @@ -0,0 +1,42 @@ +// This file was automatically generated from basics.md by Knit tool. Do not edit. +@file:Suppress("PackageDirectoryMismatch", "unused") +package dev.adamko.kotka.example.exampleBasicsNamingOperators02 + +import dev.adamko.kotka.extensions.* +import org.apache.kafka.streams.* +import dev.adamko.kotka.extensions.streams.* +import org.apache.kafka.streams.kstream.* + +private val builder = StreamsBuilder() + +fun main() { + +val stream: KStream = builder + .stream("input", Consumed.`as`("Customer_transactions_input_topic")) + +stream + .filter( + { _, v -> v != "invalid_txn" }, + Named.`as`("filter_out_invalid_txns") + ) + .mapValues( + { _, v -> v.take(6) }, + Named.`as`("Map_values_to_first_6_characters") + ) + .to("output", Produced.`as`("Mapped_transactions_output_topic")) + +val stream: KStream = builder +// no need for backticks + .stream("input", consumedAs("Customer_transactions_input_topic")) + +stream + // tasks can be named directly using a string, + // and the lambda expression can be placed outside the parentheses + .filter("filter_out_invalid_txns") { _, v -> + v != "invalid_txn" + }.mapValues("Map_values_to_first_6_characters") { _, v -> + v.take(6) + }.to("output", producedAs("Mapped_transactions_output_topic")) + + println(builder.build().describe()) +} diff --git a/docs/code/test/BasicsTest.kt b/docs/code/test/BasicsTest.kt index 86a1e86..96b0dbd 100644 --- a/docs/code/test/BasicsTest.kt +++ b/docs/code/test/BasicsTest.kt @@ -31,4 +31,29 @@ class BasicsTest { """.trimMargin() ) } + + @Test + fun testExampleBasicsNamingOperators02() { + captureOutput("ExampleBasicsNamingOperators02") { + dev.adamko.kotka.example.exampleBasicsNamingOperators02.main() + }.joinToString("\n") + .trim() + .shouldBe( + // language=text + """ + |Topologies: + | Sub-topology: 0 + | Source: Customer_transactions_input_topic (topics: [input]) + | --> filter_out_invalid_txns + | Processor: filter_out_invalid_txns (stores: []) + | --> Map_values_to_first_6_characters + | <-- Customer_transactions_input_topic + | Processor: Map_values_to_first_6_characters (stores: []) + | --> Mapped_transactions_output_topic + | <-- filter_out_invalid_txns + | Sink: Mapped_transactions_output_topic (topic: output) + | <-- Map_values_to_first_6_characters + """.trimMargin() + ) + } } From da77b839bf553fadb6bf3bfa81bfabc7a3c2635e Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:37:30 +0100 Subject: [PATCH 12/14] tidy up after merge --- buildSrc/build.gradle.kts | 6 +++--- buildSrc/settings.gradle.kts | 2 +- .../buildsrc/convention/kotlin-jvm.gradle.kts | 3 +-- docs/basics.md | 16 ++++++++-------- docs/code/build.gradle.kts | 15 +++++++++++---- .../example-basics-naming-operators-01.kt | 8 ++++---- .../example-basics-naming-operators-02.kt | 8 ++++---- docs/code/knit-test.ftl | 1 + docs/code/test/BasicsTest.kt | 2 ++ gradle/libs.versions.toml | 11 ++--------- .../extensions/processor/RecordExtensionsTest.kt | 2 +- .../kotka/extensions/processor/RecordTests.kt | 2 -- 12 files changed, 38 insertions(+), 38 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 4708e64..9f2c787 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -11,10 +11,10 @@ dependencies { // https://github.com/gradle/gradle/issues/15383#issuecomment-779893192 implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) - val kotlinxKoverVersion = "0.5.0" - implementation("org.jetbrains.kotlinx:kover:${kotlinxKoverVersion}") + val kotlinxKoverVersion = "0.7.5" + implementation("org.jetbrains.kotlinx:kover-gradle-plugin:${kotlinxKoverVersion}") - val kotlinxKnitVersion = "0.3.0" + val kotlinxKnitVersion = "0.5.0" implementation("org.jetbrains.kotlinx:kotlinx-knit:${kotlinxKnitVersion}") implementation("dev.jacomet.gradle.plugins:logging-capabilities:0.10.0") diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts index 086d386..fc270e7 100644 --- a/buildSrc/settings.gradle.kts +++ b/buildSrc/settings.gradle.kts @@ -12,8 +12,8 @@ dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) repositories { - gradlePluginPortal() mavenCentral() + gradlePluginPortal() } versionCatalogs { diff --git a/buildSrc/src/main/kotlin/buildsrc/convention/kotlin-jvm.gradle.kts b/buildSrc/src/main/kotlin/buildsrc/convention/kotlin-jvm.gradle.kts index 753c28b..fbed32e 100644 --- a/buildSrc/src/main/kotlin/buildsrc/convention/kotlin-jvm.gradle.kts +++ b/buildSrc/src/main/kotlin/buildsrc/convention/kotlin-jvm.gradle.kts @@ -3,8 +3,6 @@ package buildsrc.convention import org.gradle.kotlin.dsl.support.kotlinCompilerOptions import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_5 -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_8 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -12,6 +10,7 @@ plugins { id("buildsrc.convention.base") kotlin("jvm") `java-library` + id("org.jetbrains.kotlinx.kover") } kotlin { diff --git a/docs/basics.md b/docs/basics.md index cfb1c87..e3a4ab5 100644 --- a/docs/basics.md +++ b/docs/basics.md @@ -45,10 +45,10 @@ https://kafka.apache.org/documentation/streams/developer-guide/dsl-topology-nami ```kotlin -val stream: KStream = builder +val kafkaStream: KStream = StreamsBuilder() .stream("input", Consumed.`as`("Customer_transactions_input_topic")) -stream +kafkaStream .filter( { _, v -> v != "invalid_txn" }, Named.`as`("filter_out_invalid_txns") @@ -64,11 +64,11 @@ stream ```kotlin -val stream: KStream = builder +val kotkaStream: KStream = StreamsBuilder() // no need for backticks .stream("input", consumedAs("Customer_transactions_input_topic")) -stream +kotkaStream // tasks can be named directly using a string, // and the lambda expression can be placed outside the parentheses .filter("filter_out_invalid_txns") { _, v -> @@ -109,10 +109,10 @@ Topologies: ```kotlin -val stream: KStream = builder +val kafkaStream: KStream = StreamsBuilder() .stream("input", Consumed.`as`("Customer_transactions_input_topic")) -stream +kafkaStream .filter( { _, v -> v != "invalid_txn" }, Named.`as`("filter_out_invalid_txns") @@ -126,11 +126,11 @@ stream ```kotlin -val stream: KStream = builder +val kotkaStream: KStream = StreamsBuilder() // no need for backticks .stream("input", consumedAs("Customer_transactions_input_topic")) -stream +kotkaStream // tasks can be named directly using a string, // and the lambda expression can be placed outside the parentheses .filter("filter_out_invalid_txns") { _, v -> diff --git a/docs/code/build.gradle.kts b/docs/code/build.gradle.kts index e4a2cbf..c45e43d 100644 --- a/docs/code/build.gradle.kts +++ b/docs/code/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - kotka.convention.`kotlin-jvm` + buildsrc.convention.`kotlin-jvm` id("org.jetbrains.kotlinx.knit") } @@ -9,8 +9,14 @@ dependencies { testImplementation(kotlin("test")) + implementation(libs.slf4j.api) + implementation(libs.slf4j.simple) + implementation(libs.kotlinx.knit) testImplementation(libs.kotlinx.knitTest) + + testImplementation(platform(libs.kotest.bom)) + testImplementation(libs.kotest.assertionsCore) } @@ -31,11 +37,12 @@ knit { tasks.test { dependsOn(tasks.knit) + dependsOn(tasks.processResources) // finalizedBy(tasks.knitCheck) } tasks.compileKotlin { mustRunAfter(tasks.knit) } -//tasks.knitCheck { -// dependsOn(tasks.test) -//} +tasks.knitCheck { + dependsOn(tasks.test) +} diff --git a/docs/code/example/example-basics-naming-operators-01.kt b/docs/code/example/example-basics-naming-operators-01.kt index 9f9a83b..d3a74ea 100644 --- a/docs/code/example/example-basics-naming-operators-01.kt +++ b/docs/code/example/example-basics-naming-operators-01.kt @@ -11,10 +11,10 @@ private val builder = StreamsBuilder() fun main() { -val stream: KStream = builder +val kafkaStream: KStream = StreamsBuilder() .stream("input", Consumed.`as`("Customer_transactions_input_topic")) -stream +kafkaStream .filter( { _, v -> v != "invalid_txn" }, Named.`as`("filter_out_invalid_txns") @@ -25,11 +25,11 @@ stream ) .to("output", Produced.`as`("Mapped_transactions_output_topic")) -val stream: KStream = builder +val kotkaStream: KStream = StreamsBuilder() // no need for backticks .stream("input", consumedAs("Customer_transactions_input_topic")) -stream +kotkaStream // tasks can be named directly using a string, // and the lambda expression can be placed outside the parentheses .filter("filter_out_invalid_txns") { _, v -> diff --git a/docs/code/example/example-basics-naming-operators-02.kt b/docs/code/example/example-basics-naming-operators-02.kt index 3817d11..e795732 100644 --- a/docs/code/example/example-basics-naming-operators-02.kt +++ b/docs/code/example/example-basics-naming-operators-02.kt @@ -11,10 +11,10 @@ private val builder = StreamsBuilder() fun main() { -val stream: KStream = builder +val kafkaStream: KStream = StreamsBuilder() .stream("input", Consumed.`as`("Customer_transactions_input_topic")) -stream +kafkaStream .filter( { _, v -> v != "invalid_txn" }, Named.`as`("filter_out_invalid_txns") @@ -25,11 +25,11 @@ stream ) .to("output", Produced.`as`("Mapped_transactions_output_topic")) -val stream: KStream = builder +val kotkaStream: KStream = StreamsBuilder() // no need for backticks .stream("input", consumedAs("Customer_transactions_input_topic")) -stream +kotkaStream // tasks can be named directly using a string, // and the lambda expression can be placed outside the parentheses .filter("filter_out_invalid_txns") { _, v -> diff --git a/docs/code/knit-test.ftl b/docs/code/knit-test.ftl index 9a39a45..1f88bd1 100644 --- a/docs/code/knit-test.ftl +++ b/docs/code/knit-test.ftl @@ -12,6 +12,7 @@ import org.junit.jupiter.api.Test class ${test.name} { <#list cases as case><#assign method = test["mode.${case.param}"]!"custom"> @Test + @org.junit.jupiter.api.Disabled fun test${case.name}() { captureOutput("${case.name}") { ${case.knit.package}.${case.knit.name}.main() diff --git a/docs/code/test/BasicsTest.kt b/docs/code/test/BasicsTest.kt index 96b0dbd..8d951bf 100644 --- a/docs/code/test/BasicsTest.kt +++ b/docs/code/test/BasicsTest.kt @@ -8,6 +8,7 @@ import org.junit.jupiter.api.Test class BasicsTest { @Test + @org.junit.jupiter.api.Disabled fun testExampleBasicsNamingOperators01() { captureOutput("ExampleBasicsNamingOperators01") { dev.adamko.kotka.example.exampleBasicsNamingOperators01.main() @@ -33,6 +34,7 @@ class BasicsTest { } @Test + @org.junit.jupiter.api.Disabled fun testExampleBasicsNamingOperators02() { captureOutput("ExampleBasicsNamingOperators02") { dev.adamko.kotka.example.exampleBasicsNamingOperators02.main() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2876f3a..5e65e10 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,7 +9,7 @@ jvm = "11" kafka = "3.6.1" # https://kafka.apache.org/downloads kotlinx-serialization = "1.6.2" # https://github.com/Kotlin/kotlinx.serialization/releases/tag/v1.3.3 -kotlinx-knit = "0.5.1" # https://github.com/Kotlin/kotlinx-knit/releases +kotlinx-knit = "0.5.0" # https://github.com/Kotlin/kotlinx-knit/releases kotlin-dokka = "1.9.10" # https://search.maven.org/artifact/org.jetbrains.dokka/dokka-gradle-plugin slf4j = "2.0.11" @@ -25,8 +25,6 @@ junit = "5.10.1" # https://github.com/junit-team/junit5/ binaryCompatValidator = "0.12.1" # https://search.maven.org/artifact/org.jetbrains.kotlinx/binary-compatibility-validator dokkatoo = "2.0.0" -kotlinx-knit = "0.3.0" - ########### [libraries] ########### @@ -34,6 +32,7 @@ kotlinx-knit = "0.3.0" kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "kotlin" } kafka-streams = { module = "org.apache.kafka:kafka-streams", version.ref = "kafka" } +kafka-streamsTestUtils = { module = "org.apache.kafka:kafka-streams-test-utils", version.ref = "kafka" } kotlinxSerialization-bom = { module = "org.jetbrains.kotlinx:kotlinx-serialization-bom", version.ref = "kotlinx-serialization" } kotlinxSerialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core" } @@ -61,9 +60,6 @@ kotest-frameworkEngine = { module = "io.kotest:kotest-framework-engine" } kotest-frameworkDatatest = { module = "io.kotest:kotest-framework-datatest" } kotest-runnerJUnit5 = { module = "io.kotest:kotest-runner-junit5" } -kafka-streams = { group = "org.apache.kafka", name = "kafka-streams", version.ref = "kafka" } -kafka-streamsTestUtils = { group = "org.apache.kafka", name = "kafka-streams-test-utils", version.ref = "kafka" } - # Knit kotlinx-knit = { module = "org.jetbrains.kotlinx:kotlinx-knit", version.ref = "kotlinx-knit" } kotlinx-knitTest = { module = "org.jetbrains.kotlinx:kotlinx-knit-test", version.ref = "kotlinx-knit" } @@ -87,9 +83,6 @@ gradlePlugin-kotest = { module = "io.kotest:kotest-framework-multiplatform-plugi gradlePlugin-kotlinxSerialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" } -kotlinx-knit = { group = "org.jetbrains.kotlinx", name = "kotlinx-knit", version.ref = "kotlinx-knit" } -kotlinx-knitTest = { group = "org.jetbrains.kotlinx", name = "kotlinx-knit-test", version.ref = "kotlinx-knit" } - ######### [plugins] ######### diff --git a/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordExtensionsTest.kt b/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordExtensionsTest.kt index 8fea9b1..7357283 100644 --- a/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordExtensionsTest.kt +++ b/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordExtensionsTest.kt @@ -29,7 +29,7 @@ class RecordExtensionsTest : FunSpec({ test("destructuring declaration should return (key, value, timestamp)") { - val (key, value, timestamp) = record + val (key: String, value: String, timestamp: Long) = record key shouldBe "key 123" key shouldBe record.key() diff --git a/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordTests.kt b/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordTests.kt index 20c554f..ed5c07e 100644 --- a/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordTests.kt +++ b/modules/kotka-streams-extensions/src/test/kotlin/dev/adamko/kotka/extensions/processor/RecordTests.kt @@ -66,7 +66,5 @@ class RecordTests : BehaviorSpec({ confirmVerified(mockRecord) } } - } - }) From 091e4023e15e70e05f464fff20939e71d5f7151a Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:13:08 +0100 Subject: [PATCH 13/14] knit tests working --- docs/basics.md | 53 +++++---- docs/code/build.gradle.kts | 9 ++ .../example-basics-naming-operators-01.kt | 39 ++++--- .../example-basics-naming-operators-02.kt | 25 ++-- docs/code/knit-test.ftl | 48 +++++--- docs/code/test/BasicsTest.kt | 108 +++++++++++------- 6 files changed, 181 insertions(+), 101 deletions(-) diff --git a/docs/basics.md b/docs/basics.md index e3a4ab5..2698722 100644 --- a/docs/basics.md +++ b/docs/basics.md @@ -16,12 +16,15 @@ import org.apache.kafka.streams.* import dev.adamko.kotka.extensions.streams.* import org.apache.kafka.streams.kstream.* -private val builder = StreamsBuilder() - fun main() { ----- SUFFIX .*\.kt - println(builder.build().describe()) + println("kafkaStreamBuilder described:") + println(kafkaStreamBuilder.build().describe()) + println("~~~~~~") + println("kotkaStreamBuilder described:") + println(kotkaStreamBuilder.build().describe()) + println("~~~~~~") } --> @@ -45,16 +48,17 @@ https://kafka.apache.org/documentation/streams/developer-guide/dsl-topology-nami ```kotlin -val kafkaStream: KStream = StreamsBuilder() +val kafkaStreamBuilder = StreamsBuilder() +val kafkaTransactions: KStream = kafkaStreamBuilder .stream("input", Consumed.`as`("Customer_transactions_input_topic")) -kafkaStream +kafkaTransactions .filter( - { _, v -> v != "invalid_txn" }, + { _, value -> value != "invalid_txn" }, Named.`as`("filter_out_invalid_txns") ) .mapValues( - { _, v -> v.take(6) }, + { _, value -> value.take(6) }, Named.`as`("Map_values_to_first_6_characters") ) .to("output", Produced.`as`("Mapped_transactions_output_topic")) @@ -64,18 +68,21 @@ kafkaStream ```kotlin -val kotkaStream: KStream = StreamsBuilder() -// no need for backticks +val kotkaStreamBuilder = StreamsBuilder() +val kotkaTransactions: KStream = kotkaStreamBuilder + // no need for backticks .stream("input", consumedAs("Customer_transactions_input_topic")) -kotkaStream +kotkaTransactions // tasks can be named directly using a string, // and the lambda expression can be placed outside the parentheses - .filter("filter_out_invalid_txns") { _, v -> - v != "invalid_txn" - }.mapValues("Map_values_to_first_6_characters") { _, v -> - v.take(6) - }.to("output", producedAs("Mapped_transactions_output_topic")) + .filter(name = "filter_out_invalid_txns") { _, value -> + value != "invalid_txn" + } + .mapValues(name = "Map_values_to_first_6_characters") { _, value -> + value.take(6) + } + .to("output", producedAs("Mapped_transactions_output_topic")) ``` @@ -109,10 +116,11 @@ Topologies: ```kotlin -val kafkaStream: KStream = StreamsBuilder() +val kafkaStreamBuilder = StreamsBuilder() +val kafkaTransactions: KStream = kafkaStreamBuilder .stream("input", Consumed.`as`("Customer_transactions_input_topic")) -kafkaStream +kafkaTransactions .filter( { _, v -> v != "invalid_txn" }, Named.`as`("filter_out_invalid_txns") @@ -126,16 +134,17 @@ kafkaStream ```kotlin -val kotkaStream: KStream = StreamsBuilder() -// no need for backticks +val kotkaStreamBuilder = StreamsBuilder() +val kotkaTransactions: KStream = kotkaStreamBuilder + // no need for backticks .stream("input", consumedAs("Customer_transactions_input_topic")) -kotkaStream +kotkaTransactions // tasks can be named directly using a string, // and the lambda expression can be placed outside the parentheses - .filter("filter_out_invalid_txns") { _, v -> + .filter(name = "filter_out_invalid_txns") { _, v -> v != "invalid_txn" - }.mapValues("Map_values_to_first_6_characters") { _, v -> + }.mapValues(name = "Map_values_to_first_6_characters") { _, v -> v.take(6) }.to("output", producedAs("Mapped_transactions_output_topic")) ``` diff --git a/docs/code/build.gradle.kts b/docs/code/build.gradle.kts index c45e43d..aea3941 100644 --- a/docs/code/build.gradle.kts +++ b/docs/code/build.gradle.kts @@ -46,3 +46,12 @@ tasks.compileKotlin { mustRunAfter(tasks.knit) } tasks.knitCheck { dependsOn(tasks.test) } + +tasks.knit { + inputs.files( + layout.projectDirectory.files( + "knit-tests.ftl", + "knit-includes.ftl", + ) + ).withPropertyName("knitTemplates") +} diff --git a/docs/code/example/example-basics-naming-operators-01.kt b/docs/code/example/example-basics-naming-operators-01.kt index d3a74ea..0d75d4d 100644 --- a/docs/code/example/example-basics-naming-operators-01.kt +++ b/docs/code/example/example-basics-naming-operators-01.kt @@ -7,36 +7,45 @@ import org.apache.kafka.streams.* import dev.adamko.kotka.extensions.streams.* import org.apache.kafka.streams.kstream.* -private val builder = StreamsBuilder() +//private val builder = StreamsBuilder() fun main() { -val kafkaStream: KStream = StreamsBuilder() +val kafkaStreamBuilder = StreamsBuilder() +val kafkaTransactions: KStream = kafkaStreamBuilder .stream("input", Consumed.`as`("Customer_transactions_input_topic")) -kafkaStream +kafkaTransactions .filter( - { _, v -> v != "invalid_txn" }, + { _, value -> value != "invalid_txn" }, Named.`as`("filter_out_invalid_txns") ) .mapValues( - { _, v -> v.take(6) }, + { _, value -> value.take(6) }, Named.`as`("Map_values_to_first_6_characters") ) .to("output", Produced.`as`("Mapped_transactions_output_topic")) -val kotkaStream: KStream = StreamsBuilder() -// no need for backticks +val kotkaStreamBuilder = StreamsBuilder() +val kotkaTransactions: KStream = kotkaStreamBuilder + // no need for backticks .stream("input", consumedAs("Customer_transactions_input_topic")) -kotkaStream +kotkaTransactions // tasks can be named directly using a string, // and the lambda expression can be placed outside the parentheses - .filter("filter_out_invalid_txns") { _, v -> - v != "invalid_txn" - }.mapValues("Map_values_to_first_6_characters") { _, v -> - v.take(6) - }.to("output", producedAs("Mapped_transactions_output_topic")) - - println(builder.build().describe()) + .filter(name = "filter_out_invalid_txns") { _, value -> + value != "invalid_txn" + } + .mapValues(name = "Map_values_to_first_6_characters") { _, value -> + value.take(6) + } + .to("output", producedAs("Mapped_transactions_output_topic")) + + println("kafkaStreamBuilder described:") + println(kafkaStreamBuilder.build().describe()) + println("~~~~~~") + println("kotkaStreamBuilder described:") + println(kotkaStreamBuilder.build().describe()) + println("~~~~~~") } diff --git a/docs/code/example/example-basics-naming-operators-02.kt b/docs/code/example/example-basics-naming-operators-02.kt index e795732..05d422d 100644 --- a/docs/code/example/example-basics-naming-operators-02.kt +++ b/docs/code/example/example-basics-naming-operators-02.kt @@ -7,14 +7,15 @@ import org.apache.kafka.streams.* import dev.adamko.kotka.extensions.streams.* import org.apache.kafka.streams.kstream.* -private val builder = StreamsBuilder() +//private val builder = StreamsBuilder() fun main() { -val kafkaStream: KStream = StreamsBuilder() +val kafkaStreamBuilder = StreamsBuilder() +val kafkaTransactions: KStream = kafkaStreamBuilder .stream("input", Consumed.`as`("Customer_transactions_input_topic")) -kafkaStream +kafkaTransactions .filter( { _, v -> v != "invalid_txn" }, Named.`as`("filter_out_invalid_txns") @@ -25,18 +26,24 @@ kafkaStream ) .to("output", Produced.`as`("Mapped_transactions_output_topic")) -val kotkaStream: KStream = StreamsBuilder() -// no need for backticks +val kotkaStreamBuilder = StreamsBuilder() +val kotkaTransactions: KStream = kotkaStreamBuilder + // no need for backticks .stream("input", consumedAs("Customer_transactions_input_topic")) -kotkaStream +kotkaTransactions // tasks can be named directly using a string, // and the lambda expression can be placed outside the parentheses - .filter("filter_out_invalid_txns") { _, v -> + .filter(name = "filter_out_invalid_txns") { _, v -> v != "invalid_txn" - }.mapValues("Map_values_to_first_6_characters") { _, v -> + }.mapValues(name = "Map_values_to_first_6_characters") { _, v -> v.take(6) }.to("output", producedAs("Mapped_transactions_output_topic")) - println(builder.build().describe()) + println("kafkaStreamBuilder described:") + println(kafkaStreamBuilder.build().describe()) + println("~~~~~~") + println("kotkaStreamBuilder described:") + println(kotkaStreamBuilder.build().describe()) + println("~~~~~~") } diff --git a/docs/code/knit-test.ftl b/docs/code/knit-test.ftl index 1f88bd1..1f49afe 100644 --- a/docs/code/knit-test.ftl +++ b/docs/code/knit-test.ftl @@ -1,7 +1,7 @@ <#-- @ftlvariable name="test.name" type="java.lang.String" --> <#-- @ftlvariable name="test.package" type="java.lang.String" --> <#-- @ftlvariable name="test.language" type="java.lang.String" --> -// This file was automatically generated from ${file.name} by Knit tool. Do not edit. +// Knit tool automatically generated this file from ${file.name}. Do not edit. @file:Suppress("JSUnusedLocalSymbols") package ${test.package} @@ -12,22 +12,42 @@ import org.junit.jupiter.api.Test class ${test.name} { <#list cases as case><#assign method = test["mode.${case.param}"]!"custom"> @Test - @org.junit.jupiter.api.Disabled fun test${case.name}() { - captureOutput("${case.name}") { + + // language=${test.language} + val expected = """ + <#list case.lines as line> + |${line} + + """.trimMargin().trim() + + val output = captureOutput("${case.name}") { ${case.knit.package}.${case.knit.name}.main() - }<#if method != "custom">.${method}( - // language=${test.language} - """ -<#list case.lines as line> - |${line} - - """.trimMargin() - ) -<#else>.also { lines -> - check(${case.param}) } - + .joinToString("\n") + + val kafkaStreamDescription = output + .substringAfter("kafkaStreamBuilder described:", "") + .substringBefore("~~~~~~", missingDelimiterValue = "") + .trim() + val kotkaStreamDescription = output + .substringAfter("kotkaStreamBuilder described:", "") + .substringBefore("~~~~~~", missingDelimiterValue = "") + .trim() + + kafkaStreamDescription.shouldBe(expected) + kafkaStreamDescription.shouldBe(expected) + kafkaStreamDescription.shouldBe(kotkaStreamDescription) + +<#-- <#if method != "custom">.${method}(--> +<#-- // language=${test.language}--> +<#-- """--> +<#-- """--> +<#-- )--> +<#--<#else>.also { lines ->--> +<#-- check(${case.param})--> +<#-- }--> +<#----> } <#sep> diff --git a/docs/code/test/BasicsTest.kt b/docs/code/test/BasicsTest.kt index 8d951bf..edff99e 100644 --- a/docs/code/test/BasicsTest.kt +++ b/docs/code/test/BasicsTest.kt @@ -1,4 +1,4 @@ -// This file was automatically generated from basics.md by Knit tool. Do not edit. +// Knit tool automatically generated this file from basics.md. Do not edit. @file:Suppress("JSUnusedLocalSymbols") package dev.adamko.kotka.example.test @@ -8,54 +8,80 @@ import org.junit.jupiter.api.Test class BasicsTest { @Test - @org.junit.jupiter.api.Disabled fun testExampleBasicsNamingOperators01() { - captureOutput("ExampleBasicsNamingOperators01") { + + // language=text + val expected = """ + |Topologies: + | Sub-topology: 0 + | Source: Customer_transactions_input_topic (topics: [input]) + | --> filter_out_invalid_txns + | Processor: filter_out_invalid_txns (stores: []) + | --> Map_values_to_first_6_characters + | <-- Customer_transactions_input_topic + | Processor: Map_values_to_first_6_characters (stores: []) + | --> Mapped_transactions_output_topic + | <-- filter_out_invalid_txns + | Sink: Mapped_transactions_output_topic (topic: output) + | <-- Map_values_to_first_6_characters + """.trimMargin().trim() + + val output = captureOutput("ExampleBasicsNamingOperators01") { dev.adamko.kotka.example.exampleBasicsNamingOperators01.main() - }.joinToString("\n") + } + .joinToString("\n") + + val kafkaStreamDescription = output + .substringAfter("kafkaStreamBuilder described:", "") + .substringBefore("~~~~~~", missingDelimiterValue = "") .trim() - .shouldBe( - // language=text - """ - |Topologies: - | Sub-topology: 0 - | Source: Customer_transactions_input_topic (topics: [input]) - | --> filter_out_invalid_txns - | Processor: filter_out_invalid_txns (stores: []) - | --> Map_values_to_first_6_characters - | <-- Customer_transactions_input_topic - | Processor: Map_values_to_first_6_characters (stores: []) - | --> Mapped_transactions_output_topic - | <-- filter_out_invalid_txns - | Sink: Mapped_transactions_output_topic (topic: output) - | <-- Map_values_to_first_6_characters - """.trimMargin() - ) + val kotkaStreamDescription = output + .substringAfter("kotkaStreamBuilder described:", "") + .substringBefore("~~~~~~", missingDelimiterValue = "") + .trim() + + kafkaStreamDescription.shouldBe(expected) + kafkaStreamDescription.shouldBe(expected) + kafkaStreamDescription.shouldBe(kotkaStreamDescription) + } @Test - @org.junit.jupiter.api.Disabled fun testExampleBasicsNamingOperators02() { - captureOutput("ExampleBasicsNamingOperators02") { + + // language=text + val expected = """ + |Topologies: + | Sub-topology: 0 + | Source: Customer_transactions_input_topic (topics: [input]) + | --> filter_out_invalid_txns + | Processor: filter_out_invalid_txns (stores: []) + | --> Map_values_to_first_6_characters + | <-- Customer_transactions_input_topic + | Processor: Map_values_to_first_6_characters (stores: []) + | --> Mapped_transactions_output_topic + | <-- filter_out_invalid_txns + | Sink: Mapped_transactions_output_topic (topic: output) + | <-- Map_values_to_first_6_characters + """.trimMargin().trim() + + val output = captureOutput("ExampleBasicsNamingOperators02") { dev.adamko.kotka.example.exampleBasicsNamingOperators02.main() - }.joinToString("\n") + } + .joinToString("\n") + + val kafkaStreamDescription = output + .substringAfter("kafkaStreamBuilder described:", "") + .substringBefore("~~~~~~", missingDelimiterValue = "") .trim() - .shouldBe( - // language=text - """ - |Topologies: - | Sub-topology: 0 - | Source: Customer_transactions_input_topic (topics: [input]) - | --> filter_out_invalid_txns - | Processor: filter_out_invalid_txns (stores: []) - | --> Map_values_to_first_6_characters - | <-- Customer_transactions_input_topic - | Processor: Map_values_to_first_6_characters (stores: []) - | --> Mapped_transactions_output_topic - | <-- filter_out_invalid_txns - | Sink: Mapped_transactions_output_topic (topic: output) - | <-- Map_values_to_first_6_characters - """.trimMargin() - ) + val kotkaStreamDescription = output + .substringAfter("kotkaStreamBuilder described:", "") + .substringBefore("~~~~~~", missingDelimiterValue = "") + .trim() + + kafkaStreamDescription.shouldBe(expected) + kafkaStreamDescription.shouldBe(expected) + kafkaStreamDescription.shouldBe(kotkaStreamDescription) + } } From a544245265e36539153bee525b51dce972d45df6 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:16:02 +0100 Subject: [PATCH 14/14] formatting --- docs/basics.md | 12 +++++++----- .../example/example-basics-naming-operators-01.kt | 2 -- .../example/example-basics-naming-operators-02.kt | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/basics.md b/docs/basics.md index 2698722..895af63 100644 --- a/docs/basics.md +++ b/docs/basics.md @@ -142,11 +142,13 @@ val kotkaTransactions: KStream = kotkaStreamBuilder kotkaTransactions // tasks can be named directly using a string, // and the lambda expression can be placed outside the parentheses - .filter(name = "filter_out_invalid_txns") { _, v -> - v != "invalid_txn" - }.mapValues(name = "Map_values_to_first_6_characters") { _, v -> - v.take(6) - }.to("output", producedAs("Mapped_transactions_output_topic")) + .filter(name = "filter_out_invalid_txns") { _, value -> + value != "invalid_txn" + } + .mapValues(name = "Map_values_to_first_6_characters") { _, value -> + value.take(6) + } + .to("output", producedAs("Mapped_transactions_output_topic")) ``` diff --git a/docs/code/example/example-basics-naming-operators-01.kt b/docs/code/example/example-basics-naming-operators-01.kt index 0d75d4d..d22a9fe 100644 --- a/docs/code/example/example-basics-naming-operators-01.kt +++ b/docs/code/example/example-basics-naming-operators-01.kt @@ -7,8 +7,6 @@ import org.apache.kafka.streams.* import dev.adamko.kotka.extensions.streams.* import org.apache.kafka.streams.kstream.* -//private val builder = StreamsBuilder() - fun main() { val kafkaStreamBuilder = StreamsBuilder() diff --git a/docs/code/example/example-basics-naming-operators-02.kt b/docs/code/example/example-basics-naming-operators-02.kt index 05d422d..17e320e 100644 --- a/docs/code/example/example-basics-naming-operators-02.kt +++ b/docs/code/example/example-basics-naming-operators-02.kt @@ -7,8 +7,6 @@ import org.apache.kafka.streams.* import dev.adamko.kotka.extensions.streams.* import org.apache.kafka.streams.kstream.* -//private val builder = StreamsBuilder() - fun main() { val kafkaStreamBuilder = StreamsBuilder() @@ -34,11 +32,13 @@ val kotkaTransactions: KStream = kotkaStreamBuilder kotkaTransactions // tasks can be named directly using a string, // and the lambda expression can be placed outside the parentheses - .filter(name = "filter_out_invalid_txns") { _, v -> - v != "invalid_txn" - }.mapValues(name = "Map_values_to_first_6_characters") { _, v -> - v.take(6) - }.to("output", producedAs("Mapped_transactions_output_topic")) + .filter(name = "filter_out_invalid_txns") { _, value -> + value != "invalid_txn" + } + .mapValues(name = "Map_values_to_first_6_characters") { _, value -> + value.take(6) + } + .to("output", producedAs("Mapped_transactions_output_topic")) println("kafkaStreamBuilder described:") println(kafkaStreamBuilder.build().describe())