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

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": "_:b3",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "aag",
"type": "main"
},
{
"@id": "_:b4",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "StAAG",
"type": "oldMemobase"
},
{
"@id": "https://memobase.ch/institution/aag",
"@id": "https://memobase.ch/institution/completeExampleTest",
"@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",
"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": 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",
"isPublished": false,
"descriptiveNote": [
{
"@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>"
},
{
"@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>"
},
{
"@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
<
{
"@graph": [
{
"@id": "_:b0",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "ORIGINAL_ID",
"type": "original"
},
{
"@id": "_:b1",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "ORIGINAL_SIGNATUR",
"type": "callNumber"
},
{
"@id": "_:b10",
"@type": "https://www.ica.org/standards/RiC/ontology#Record",
"sameAs": "https://example.org/",
"title": {
"@language": "de",
"@value": "Publikation"
}
},
{
"@id": "_:b11",
"@type": "https://www.ica.org/standards/RiC/ontology#DateRange",
"normalizedDateValue": "1920/2020"
},
{
"@id": "_:b12",
"@type": "https://www.ica.org/standards/RiC/ontology#RecordSet",
"sameAs": "http://example.com",
"title": {
"@language": "it",
"@value": "Verwandte Bestände"
}
},
{
"@id": "_:b13",
"@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": "_:b14",
"@type": "https://www.ica.org/standards/RiC/ontology#CorporateBody",
"sameAs": "http://example.org",
"title": {
"@language": "it",
"@value": "Projekt Titel"
},
"type": "memoriavProject"
},
{
"@id": "_:b15",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "OLD_MEMOBASE_ID",
"type": "oldMemobase"
},
{
"@id": "_:b16",
"@type": "https://www.ica.org/standards/RiC/ontology#Record",
"sameAs": "https://example.org/"
},
{
"@id": "_:b17",
"@type": "https://www.ica.org/standards/RiC/ontology#Title",
"title": [
{
"@language": "de",
"@value": "Originaltitle des Bestandes"
},
{
"@language": "fr",
"@value": "Originaltitle des Bestandes"
},
{
"@language": "it",
"@value": "Originaltitle des Bestandes"
}
],
"type": "original"
},
{
"@id": "_:b18",
"@type": "https://www.ica.org/standards/RiC/ontology#Record",
"sameAs": "https://example.org/"
},
{
"@id": "_:b19",
"@type": "https://www.ica.org/standards/RiC/ontology#RecordResourceHoldingRelation",
"recordResourceHoldingRelationHasSource": "https://memobase.ch/recordSet/completeExampleTest",
"recordResourceHoldingRelationHasTarget": "https://memobase.ch/recordSet/testComplete",
"type": "master"
},
{
"@id": "_:b2",
"@type": "https://www.ica.org/standards/RiC/ontology#RecordSet",
"sameAs": "entity:node/120",
"title": {
"@language": "it",
"@value": "Fernsehbestand Bericht vor Acht / Blickpunkt (Memobase Vorgängerversion)"
}
},
{
"@id": "_:b20",
"@type": "https://www.ica.org/standards/RiC/ontology#RecordResourceHoldingRelation",
"recordResourceHoldingRelationHasSource": "https://memobase.ch/recordSet/completeExampleTest",
"recordResourceHoldingRelationHasTarget": "https://memobase.ch/recordSet/testComplete",
"type": "access"
},
{
"@id": "_:b21",
"@type": "https://www.ica.org/standards/RiC/ontology#Title",
"title": [
{
"@language": "de",
"@value": "Complete Example (Record Set)"
},
{
"@language": "fr",
"@value": "Complete Example"
},
{
"@language": "it",
"@value": "Complete Example"
}
],
"type": "main"
},
{
"@id": "_:b22",
"@type": "https://www.ica.org/standards/RiC/ontology#Record",
"sameAs": "https://example.org/",
"title": {
"@language": "de",
"@value": "Publikation"
}
},
{
"@id": "_:b23",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "testComplete",
"type": "main"
},
{
"@id": "_:b3",
"@type": "https://www.ica.org/standards/RiC/ontology#RecordSet",
"sameAs": [
{
"@language": "de",
"@value": "https://example.org"
},
{
"@language": "fr",
"@value": "https://example.org"
},
{
"@language": "it",
"@value": "https://example.org"
}
],
"eventType": "CREATE",
"title": [
{
"@language": "de",
"@value": "Example Bestand"
},
{
"@language": "fr",
"@value": "Example Bestand"
},
{
"@language": "it",
"@value": "Example Bestand"
}
]
},
{
"@id": "_:b4",
"@type": "https://www.ica.org/standards/RiC/ontology#Record",
"sameAs": "https://example.org/",
"eventType": "CREATE",
"title": {
"@language": "it",
"@value": "Publikation"
}
},
{
"@id": "_:b5",
"@type": "https://www.ica.org/standards/RiC/ontology#RecordSet",
"sameAs": "entity:node/120"
},
{
"@id": "_:b6",
"@type": "https://www.ica.org/standards/RiC/ontology#Record",
"sameAs": "https://example.org/",
"title": {
"@language": "it",
"@value": "Publikation"
}
},
{
"@id": "_:b7",
"@type": "https://www.ica.org/standards/RiC/ontology#RecordSet",
"sameAs": "https://example.org"
},
{
"@id": "_:b8",
"@type": "https://www.ica.org/standards/RiC/ontology#RecordResourceHoldingRelation",
"recordResourceHoldingRelationHasSource": "https://memobase.ch/recordSet/completeExampleTest",
"recordResourceHoldingRelationHasTarget": "https://memobase.ch/recordSet/testComplete",
"type": "original"
},
{
"@id": "_:b9",
"@type": "https://www.ica.org/standards/RiC/ontology#CorporateBody",
"sameAs": "http://memobase.ch/de/stock/detail/Tanzarchiv-121",
"eventType": "CREATE",
"title": {
"@language": "de",
"@value": "Videobestand Cathy Sharp Dance Ensemble"
},
"type": "memoriavProject"
},
{
"@id": "https://memobase.ch/recordSet/testComplete",
"@type": "https://www.ica.org/standards/RiC/ontology#RecordSet",
"conformsTo": [
{
"@language": "de",
"@value": "<p>Informationen zur Erschliessung</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>"
},
{
"@language": "it",
"@value": "<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>"
},
{
"@language": "fr",
"@value": "<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>"
}
],
"P60099": [
{
"@language": "it",