Commit 40565bec authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Add no changes test

parent d645b8d1
Pipeline #10667 passed with stages
in 6 minutes and 54 seconds
......@@ -23,6 +23,5 @@ data class TestParams(
val inputFileName: String,
val expectedOutputKey: String,
val expectedOutputFile: String,
val expectedProcessReport: String,
val processReport: String
val expectedProcessReport: String
)
......@@ -53,9 +53,9 @@ class Tests {
init {
val files = listOf(
Pair("/base/test_record_set_1/media", "MEI_49884.jpg"),
Pair("/base/test_record_set_1/media", "MEI_49885.jpg"),
Pair("/base/test_record_set_1/media", "MEI_49886.jpg")
Pair("/base/test_record_set_1/media", "MEI_49884.jpg"),
Pair("/base/test_record_set_1/media", "MEI_49885.jpg"),
Pair("/base/test_record_set_1/media", "MEI_49886.jpg")
)
for (pair in files) {
......@@ -71,13 +71,13 @@ class Tests {
val factory = ConsumerRecordFactory(StringSerializer(), StringSerializer())
val value = readFile(params.inputFileName)
testDriver.pipeInput(
factory.create(service.settings.inputTopic, params.key, value)
factory.create(service.settings.inputTopic, params.key, value)
)
var record = testDriver.readOutput(
service.settings.outputTopic,
StringDeserializer(),
StringDeserializer()
service.settings.outputTopic,
StringDeserializer(),
StringDeserializer()
)
assertThat(record).isNotNull
var count = 0
......@@ -92,43 +92,49 @@ class Tests {
}.sorted().reduce { acc, s -> acc + "\n" + s }
assertThat(record)
.isNotNull
.hasFieldOrPropertyWithValue("key", params.expectedOutputKey)
.isNotNull
.hasFieldOrPropertyWithValue("key", params.expectedOutputKey)
assertThat(sortedResult).isEqualTo(readFile(params.expectedOutputFile))
val reportedRecord = testDriver.readOutput(
"${service.settings.outputTopic}-reporting",
StringDeserializer(),
StringDeserializer()
"${service.settings.outputTopic}-reporting",
StringDeserializer(),
StringDeserializer()
)
if (reportedRecord != null) {
val data = reportedRecord.value()
val report = Klaxon().parse<Report>(data)
assertThat(report)
.isNotNull
.isEqualTo(Klaxon().parse<Report>(readFile(params.expectedProcessReport)))
.isEqualTo(Klaxon().parse<Report>(readFile(params.expectedProcessReport)))
} else {
log.error("No report for record $record.")
}
record = testDriver.readOutput(
service.settings.outputTopic,
StringDeserializer(),
StringDeserializer()
service.settings.outputTopic,
StringDeserializer(),
StringDeserializer()
)
}
}
private fun testParams() = Stream.of(
TestParams(
"test1.yml",
"https://memobase.ch/instantiation/digital/BAZ-MEI_49885-1",
"input1.nt",
"https://memobase.ch/instantiation/digital/BAZ-MEI_49885-1",
"output1.nt",
"output1.json",
"processOutput1.json"
)
TestParams(
"test1.yml",
"https://memobase.ch/instantiation/digital/BAZ-MEI_49885-1",
"input1.nt",
"https://memobase.ch/instantiation/digital/BAZ-MEI_49885-1",
"output1.nt",
"output1.json"
),
TestParams(
"test1.yml",
"https://memobase.ch/instantiation/physical/BAZ-MEI_49885-0",
"input2.nt",
"https://memobase.ch/instantiation/physical/BAZ-MEI_49885-0",
"output2.nt",
"output2.json"
)
)
}
<https://memobase.ch/instantiation/physical/BAZ-MEI_49885-0> <https://www.ica.org/standards/RiC/ontology#type> "physicalObject" .
<https://memobase.ch/instantiation/physical/BAZ-MEI_49885-0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Instantiation> .
\ No newline at end of file
{
"id": "https://memobase.ch/instantiation/physical/BAZ-MEI_49885-0",
"status": "SUCCESS",
"message": "No changes made."
}
\ No newline at end of file
<https://memobase.ch/instantiation/physical/BAZ-MEI_49885-0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Instantiation> .
<https://memobase.ch/instantiation/physical/BAZ-MEI_49885-0> <https://www.ica.org/standards/RiC/ontology#type> "physicalObject" .
\ No newline at end of file
Supports Markdown
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