Commit 3d631a1b authored by Jonas Waeber's avatar Jonas Waeber

Fix institution tests.

parent 560d5d54
package org.memobase
import ch.memobase.reporting.Report
import ch.memobase.reporting.ReportStatus
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.registerKotlinModule
import io.mockk.every
......@@ -40,7 +41,7 @@ class TestInstitutionSearchDoc {
TestUtilities.translationMappers
)
val input = JSON.unpack(JSON.parse(readFile("input-prod.json")))
val input = JSON.unpack(JSON.parse(readFile("completeExample.json")))
val builder = InstitutionSearchDocBuilder(TestUtilities.translationMappers, elastic)
val output = builder.transform("aag", input) as InstitutionSearchDoc
......@@ -66,10 +67,10 @@ class TestInstitutionSearchDoc {
fun `integration test institution`() {
val settings = App.createSettings("kafkaTest1.yml")
every { TestUtilities.elasticSearchWrapperMocked.countNumberOfDocuments("sts-001") } returns 123
every { TestUtilities.elasticSearchWrapperMocked.countNumberOfDocuments("testComplete") } returns 123
every {
TestUtilities.elasticSearchWrapperMocked.getDocumentTypesFromRecords(
"sts-001",
"testComplete",
"recordSet.facet"
)
} returns listOf(
......@@ -86,8 +87,8 @@ class TestInstitutionSearchDoc {
testDriver.pipeInput(
factory.create(
settings.inputTopic,
"https://memobase.ch/institution/sts",
readFile("input.json")
"https://memobase.ch/institution/completeExampleTest",
readFile("completeExample.json")
)
)
......@@ -108,20 +109,20 @@ class TestInstitutionSearchDoc {
val key = record.key()
val value = record.value().replace(TestUtilities.dateRegex, "2020")
val resultValue = readFile("output.json").replace(TestUtilities.dateRegex, "2020")
val resultValue = readFile("completeExample.json").replace(TestUtilities.dateRegex, "2020")
assertAll("",
{
assertThat(value)
.isEqualTo(resultValue)
},
{ assertThat(key).isEqualTo("sts") },
{ assertThat(reportKey).isEqualTo("sts") },
{ assertThat(key).isEqualTo("completeExampleTest") },
{ assertThat(reportKey).isEqualTo("completeExampleTest") },
{
assertThat(reportValue).isEqualTo(
Report(
"sts",
"SUCCESS",
"completeExampleTest",
ReportStatus.success,
"Transformed message into search doc.",
Service.name
)
......
......@@ -2,20 +2,38 @@
"@graph": [
{
"@id": "_:b0",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "completeExampleTest",
"type": "main"
},
{
"@id": "_:b1",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "OLD_MEMOBASE_ID",
"type": "oldMemobase"
},
{
"@id": "_:b2",
"@type": "https://www.ica.org/standards/RiC/ontology#Place",
"P131": [
"_:b1",
"_:b2"
"_:b4",
"_:b3"
],
"P17": "http://www.wikidata.org/entity/Q39",
"P281": "5001",
"P625": "8.049455603, 47.38787196",
"P6375": "Entfelderstrasse 22",
"P669": "Entfelderstrasse",
"P670": "22"
"P281": "1000",
"P625": "51.47879, -0.010677",
"P6375": "Street Address",
"P669": "Street",
"P670": "Address"
},
{
"@id": "_:b1",
"@id": "_:b3",
"@type": "https://www.ica.org/standards/RiC/ontology#Place",
"name": "City",
"type": "municipality"
},
{
"@id": "_:b4",
"@type": "https://www.ica.org/standards/RiC/ontology#Place",
"sameAs": "http://www.wikidata.org/entity/Q11972",
"name": [
......@@ -29,129 +47,105 @@
},
{
"@language": "it",
"@value": "Argovie"
"@value": "Argovia"
}
],
"type": "canton"
},
{
"@id": "_:b2",
"@type": "https://www.ica.org/standards/RiC/ontology#Place",
"name": "Aarau",
"type": "municipality"
},
"@id": "https://memobase.ch/institution/completeExampleTest",
"@type": "https://www.ica.org/standards/RiC/ontology#CorporateBody",
"P18": "https://mb-wf1.memobase.unibas.ch/sites/default/files/styles/teaser/public/2021-02/vitrine1_hero.jpg?itok=S-b5nq1p",
"P2699": "https://archive-online.com",
"P31": "http://www.wikidata.org/entity/Q2029941",
"P791": "ISIL-NUMBER",
"P856": "https://website.com",
"P968": "test@email.com",
"eventType": "CREATE",
"isPublished": false,
"descriptiveNote": [
{
"@id": "_:b3",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "aag",
"type": "main"
"@language": "de",
"@value": "<p>Beschreibung (DE)</p>\r\n\r\n<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>"
},
{
"@id": "_:b4",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "StAAG",
"type": "oldMemobase"
"@language": "it",
"@value": "<p>Beschreibung (IT)</p>\r\n\r\n<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>"
},
{
"@id": "https://memobase.ch/institution/aag",
"@type": "https://www.ica.org/standards/RiC/ontology#CorporateBody",
"P2699": "https://www.ag.ch/staatsarchiv/suche/suchinfo.aspx",
"P31": "http://www.wikidata.org/entity/Q166118",
"P791": "CH-000051-7",
"P856": "https://www.ag.ch/staatsarchiv",
"P968": "staatsarchiv@ag.ch",
"eventType": "CREATE",
"isPublished": true,
"descriptiveNote": {
"@language": "de",
"@value": "<p>Das Staatsarchiv Aargau ist das zentrale Archiv des Kantons und seiner Rechtsvorgänger. Es sammelt das archivalische Kulturgut des Kantons und sorgt für die fachgerechte Aufbewahrung, Erschliessung und Vermittlung. Seine Bestände reichen vom Hochmittelalter bis in die Gegenwart. Neben wertvollen Urkunden und Zeugnissen vormoderner Herrschaftsfixierung bewahrt das Staatsarchiv die systematische Dokumentation der Verwaltungstätigkeit seit der Kantonsgründung 1803. Seine Kernbestände ergänzt es durch Nachlässe privater Herkunft, die von öffentlichem Interesse sind. Seit 2009 ist das Staatsarchiv Aargau im Besitz der Fotobestände aus dem Pressehaus Ringier. Diese umfassen ca. 6-7 Mio Bilder. Die Bilder decken ungefähr den Zeitraum 1930-2000 ab, mit einem Schwerpunkt auf der Zeit zwischen 1950-2000.</p>"
},
"hasLocation": "_:b0",
"@language": "fr",
"@value": "<p>Beschreibung (FR)</p>\r\n\r\n<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>"
}
],
"hasLocation": "_:b2",
"identifiedBy": [
"_:b3",
"_:b4"
"_:b1",
"_:b0"
],
"isHolderOf": "https://memobase.ch/recordSet/aag-001",
"isHolderOf": "https://memobase.ch/recordSet/testComplete",
"name": [
{
"@language": "de",
"@value": "Staatsarchiv des Kantons Aargau"
"@value": "Complete Example"
},
{
"@language": "it",
"@value": "Archivio cantonale del Argovia"
"@language": "fr",
"@value": "Complete Example"
},
{
"@language": "fr",
"@value": "Archives de l’Etat Argovie"
"@language": "it",
"@value": "Complete Example"
}
],
"type": "memobaseInstitution"
}
],
"@context": {
"P669": {
"@id": "http://www.wikidata.org/prop/direct/P669"
},
"P670": {
"@id": "http://www.wikidata.org/prop/direct/P670"
},
"P6375": {
"@id": "http://www.wikidata.org/prop/direct/P6375"
},
"P281": {
"@id": "http://www.wikidata.org/prop/direct/P281"
},
"P625": {
"@id": "http://www.wikidata.org/prop/direct/P625"
},
"P131": {
"@id": "http://www.wikidata.org/prop/direct/P131",
"@type": "@id"
"type": {
"@id": "https://www.ica.org/standards/RiC/ontology#type"
},
"P17": {
"@id": "http://www.wikidata.org/prop/direct/P17",
"@type": "@id"
"identifier": {
"@id": "https://www.ica.org/standards/RiC/ontology#identifier"
},
"name": {
"@id": "https://www.ica.org/standards/RiC/ontology#name"
"P791": {
"@id": "http://www.wikidata.org/prop/direct/P791"
},
"type": {
"@id": "https://www.ica.org/standards/RiC/ontology#type"
"descriptiveNote": {
"@id": "https://www.ica.org/standards/RiC/ontology#descriptiveNote"
},
"identifiedBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#identifiedBy",
"@type": "@id"
},
"P968": {
"@id": "http://www.wikidata.org/prop/direct/P968"
},
"eventType": {
"@id": "https://memobase.ch/internal/eventType"
"isPublished": {
"@id": "https://memobase.ch/internal/isPublished",
"@type": "http://www.w3.org/2001/XMLSchema#boolean"
},
"isHolderOf": {
"@id": "https://www.ica.org/standards/RiC/ontology#isHolderOf"
"P2699": {
"@id": "http://www.wikidata.org/prop/direct/P2699"
},
"hasLocation": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasLocation",
"@type": "@id"
},
"isPublished": {
"@id": "https://memobase.ch/internal/isPublished",
"@type": "http://www.w3.org/2001/XMLSchema#boolean"
"P18": {
"@id": "http://www.wikidata.org/prop/direct/P18"
},
"P791": {
"@id": "http://www.wikidata.org/prop/direct/P791"
},
"descriptiveNote": {
"@id": "https://www.ica.org/standards/RiC/ontology#descriptiveNote"
},
"P2699": {
"@id": "http://www.wikidata.org/prop/direct/P2699"
"P968": {
"@id": "http://www.wikidata.org/prop/direct/P968"
},
"P856": {
"@id": "http://www.wikidata.org/prop/direct/P856"
},
"isHolderOf": {
"@id": "https://www.ica.org/standards/RiC/ontology#isHolderOf"
},
"name": {
"@id": "https://www.ica.org/standards/RiC/ontology#name"
},
"eventType": {
"@id": "https://memobase.ch/internal/eventType"
},
"P31": {
"@id": "http://www.wikidata.org/prop/direct/P31",
"@type": "@id"
......@@ -159,8 +153,28 @@
"sameAs": {
"@id": "http://schema.org/sameAs"
},
"identifier": {
"@id": "https://www.ica.org/standards/RiC/ontology#identifier"
"P669": {
"@id": "http://www.wikidata.org/prop/direct/P669"
},
"P670": {
"@id": "http://www.wikidata.org/prop/direct/P670"
},
"P6375": {
"@id": "http://www.wikidata.org/prop/direct/P6375"
},
"P281": {
"@id": "http://www.wikidata.org/prop/direct/P281"
},
"P625": {
"@id": "http://www.wikidata.org/prop/direct/P625"
},
"P131": {
"@id": "http://www.wikidata.org/prop/direct/P131",
"@type": "@id"
},
"P17": {
"@id": "http://www.wikidata.org/prop/direct/P17",
"@type": "@id"
}
}
}
\ No newline at end of file
This diff is collapsed.
{
"@graph": [
{
"@id": "_:b0",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "Tanzarchiv-36560",
"type": "oldMemobase"
},
{
"@id": "_:b1",
"@type": "https://www.ica.org/standards/RiC/ontology#DateRange",
"normalizedDateValue": "1983/1985"
},
{
"@id": "_:b2",
"@type": "https://www.ica.org/standards/RiC/ontology#Title",
"title": [
{
"@language": "de",
"@value": "Videobestand Marie-Jane Otth"
},
{
"@language": "fr",
"@value": "Videobestand Marie-Jane Otth"
},
{
"@language": "it",
"@value": "Videobestand Marie-Jane Otth"
}
],
"type": "main"
},
{
"@id": "_:b3",
"@type": "https://www.ica.org/standards/RiC/ontology#Language",
"sameAs": "http://www.wikidata.org/entity/Q188",
"name": [
{
"@language": "de",
"@value": "Deutsch"
},
{
"@language": "fr",
"@value": "Allemand"
},
{
"@language": "it",
"@value": "Tedesco"
}
],
"type": "metadata"
},
{
"@id": "_:b4",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "sap-021",
"type": "main"
},
{
"@id": "https://memobase.ch/recordSet/sap-021",
"@type": "https://www.ica.org/standards/RiC/ontology#RecordSet",
"P60451": "https://memobase.ch/institution/mrv",
"eventType": "CREATE",
"isPublished": true,
"hasLanguage": "_:b3",
"hasTitle": "_:b2",
"heldBy": "https://memobase.ch/institution/sap",
"identifiedBy": [
"_:b0",
"_:b4"
],
"isAssociatedWithDate": "_:b1",
"title": [
{
"@language": "de",
"@value": "Videobestand Marie-Jane Otth"
},
{
"@language": "fr",
"@value": "Videobestand Marie-Jane Otth"
},
{
"@language": "it",
"@value": "Videobestand Marie-Jane Otth"
}
]
}
],
"@context": {
"type": {
"@id": "https://www.ica.org/standards/RiC/ontology#type"
},
"identifier": {
"@id": "https://www.ica.org/standards/RiC/ontology#identifier"
},
"normalizedDateValue": {
"@id": "https://www.ica.org/standards/RiC/ontology#normalizedDateValue"
},
"title": {
"@id": "https://www.ica.org/standards/RiC/ontology#title"
},
"identifiedBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#identifiedBy",
"@type": "@id"
},
"isAssociatedWithDate": {
"@id": "https://www.ica.org/standards/RiC/ontology#isAssociatedWithDate",
"@type": "@id"
},
"hasTitle": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasTitle",
"@type": "@id"
},
"hasLanguage": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasLanguage",
"@type": "@id"
},
"heldBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#heldBy"
},
"P60451": {
"@id": "http://rdaregistry.info/Elements/u/P60451",
"@type": "@id"
},
"eventType": {
"@id": "https://memobase.ch/internal/eventType"
},
"isPublished": {
"@id": "https://memobase.ch/internal/isPublished",
"@type": "http://www.w3.org/2001/XMLSchema#boolean"
},
"name": {
"@id": "https://www.ica.org/standards/RiC/ontology#name"
},
"sameAs": {
"@id": "http://schema.org/sameAs"
}
}
}
\ 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