Commit eb921fcd authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Update test to use new classes.

parent 14799e2e
......@@ -19,8 +19,7 @@ import ch.memobase.Service
import org.apache.kafka.common.serialization.StringDeserializer
import org.apache.kafka.common.serialization.StringSerializer
import org.apache.kafka.streams.TopologyTestDriver
import org.apache.kafka.streams.test.ConsumerRecordFactory
import org.assertj.core.api.Assertions
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import java.io.File
......@@ -37,23 +36,16 @@ class TestProcessing {
@Test
fun `test processor`() {
val service = Service("app.yml")
val testDriver = TopologyTestDriver(KafkaTopology(service.settings).prepare().build(), service.settings.kafkaStreamsSettings)
val factory = ConsumerRecordFactory(
StringSerializer(), StringSerializer()
)
testDriver.pipeInput(
factory.create(
service.settings.inputTopic, "identifier-key", readFile("input.json")
)
)
val testDriver =
TopologyTestDriver(KafkaTopology(service.settings).prepare().build(), service.settings.kafkaStreamsSettings)
val inputTopic =
testDriver.createInputTopic(service.settings.inputTopic, StringSerializer(), StringSerializer())
val outputTopic =
testDriver.createOutputTopic(service.settings.outputTopic, StringDeserializer(), StringDeserializer())
val record = testDriver.readOutput(
service.settings.outputTopic,
StringDeserializer(),
StringDeserializer()
)
Assertions.assertThat(record.value())
inputTopic.pipeInput("identifier-key", readFile("input.json"))
val record = outputTopic.readRecord()
assertThat(record.value())
.isEqualTo(readFile("output.json"))
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment