Commit 2e03248d authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Fix bug in Ingester

was serializing as RDF/XML... and update test for docker image.
parent 5f72ede9
Pipeline #11734 passed with stages
in 5 minutes and 19 seconds
...@@ -48,9 +48,10 @@ class Ingester(private val producer: Producer, private val sftpClient: SftpClien ...@@ -48,9 +48,10 @@ class Ingester(private val producer: Producer, private val sftpClient: SftpClien
val recordOutput = StringWriter() val recordOutput = StringWriter()
val recordPair = rdfHandler.getRecord() val recordPair = rdfHandler.getRecord()
recordPair.second.write(recordOutput) recordPair.second.write(recordOutput, "NTRIPLES")
try { try {
fedoraClient.createOrUpdateRdfResource(URI(recordPair.first), recordOutput.toString(), RdfContentTypes.NTRIPLES) val data = recordOutput.toString()
fedoraClient.createOrUpdateRdfResource(URI(recordPair.first), data, RdfContentTypes.NTRIPLES)
log.info("Ingested record ${recordPair.first}.") log.info("Ingested record ${recordPair.first}.")
producer.sendReport( producer.sendReport(
Report(recordPair.first, ReportStatus.success, "Ingested record in fedora.")) Report(recordPair.first, ReportStatus.success, "Ingested record in fedora."))
...@@ -62,7 +63,7 @@ class Ingester(private val producer: Producer, private val sftpClient: SftpClien ...@@ -62,7 +63,7 @@ class Ingester(private val producer: Producer, private val sftpClient: SftpClien
rdfHandler.getInstantiations().forEach { instantiationPair -> rdfHandler.getInstantiations().forEach { instantiationPair ->
val instantiationOutput = StringWriter() val instantiationOutput = StringWriter()
instantiationPair.second.write(instantiationOutput) instantiationPair.second.write(instantiationOutput, "NTRIPLES")
try { try {
val data = instantiationOutput.toString() val data = instantiationOutput.toString()
fedoraClient.createOrUpdateRdfResource(URI(instantiationPair.first), data, RdfContentTypes.NTRIPLES) fedoraClient.createOrUpdateRdfResource(URI(instantiationPair.first), data, RdfContentTypes.NTRIPLES)
......
...@@ -88,7 +88,8 @@ class ServiceTest { ...@@ -88,7 +88,8 @@ class ServiceTest {
reportConsumer.subscribe(listOf("test-ingest-out")) reportConsumer.subscribe(listOf("test-ingest-out"))
} }
// TODO: Change to correct test // TODO: Test works with local docker
// docker run --rm -p 8081:8080 --name=fcrepo5 fcrepo/fcrepo:5.1.0
@ParameterizedTest @ParameterizedTest
@MethodSource("kafkaTests") @MethodSource("kafkaTests")
fun testRun(params: TestParams) { fun testRun(params: TestParams) {
...@@ -123,7 +124,8 @@ class ServiceTest { ...@@ -123,7 +124,8 @@ class ServiceTest {
assertThat(totalConsumerRecords) assertThat(totalConsumerRecords)
.size().isEqualTo(3) .size().isEqualTo(3)
*/
*/
} }
private fun kafkaTests() = Stream.of( private fun kafkaTests() = Stream.of(
......
This diff is collapsed.
...@@ -7,8 +7,8 @@ app: ...@@ -7,8 +7,8 @@ app:
appDirectory: /memobase/test_record_set_1 appDirectory: /memobase/test_record_set_1
fedora: fedora:
username: fedoraAdmin username: fedoraAdmin
password: ${FEDORA_PASSWORD:?system} password: fedoraAdmin
internalBaseUrl: http://localhost:8080/fcrepo/rest/ internalBaseUrl: http://localhost:8081/fcrepo/rest/
externalBaseUrl: https://memobase.ch/ externalBaseUrl: https://memobase.ch/
kafka: kafka:
consumer: consumer:
......
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