Due to a scheduled upgrade to version 14.10, GitLab will be unavailabe on Monday 30.05., from 19:00 until 20:00.

Commit 30906f79 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Fix proxy mapping.

parent da0ddd24
Pipeline #33531 passed with stage
in 1 minute and 49 seconds
......@@ -142,8 +142,7 @@ class MappingConfigurationParser(data: ByteArray) {
when (val key = entry.key) {
// checks of the proxy type is defined locally.
KEYS.proxyType -> {
val field = FieldParsers.parseSimpleAnnotationField(key, entry.value)
digitalObjectFieldMappers.add(MapperParsers.buildAnnotationMappers(field))
digitalObjectFieldMappers.add(MapperParsers.buildAnnotationMappers(entry))
hasProxyType = true
}
KEYS.locator, KEYS.descriptiveNote, KEYS.duration, KEYS.conditionsOfUse, KEYS.conditionsOfAccess ->
......
......@@ -14,15 +14,15 @@ import org.junit.jupiter.api.TestInstance
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class TestMappingParser {
private val path = "src/test/resources"
private fun readFile(fileName: String): String {
return FileInputStream("src/test/resources/output/$fileName.json").readBytes().toString(Charset.defaultCharset())
return FileInputStream("$path/output/$fileName.json").readBytes().toString(Charset.defaultCharset())
}
private val klaxon = Klaxon()
@Test
fun `test minimal mapping parser`() {
val mapping = MappingConfigurationParser(FileInputStream(File("src/test/resources/mapping1.yml")).readBytes())
val mapping = MappingConfigurationParser(FileInputStream(File("$path/mapping1.yml")).readBytes())
assertThat(mapping.get())
.isEqualTo(
MapperConfiguration(
......@@ -39,7 +39,7 @@ class TestMappingParser {
@Test
fun `test sponsor field parser`() {
val mapping = MappingConfigurationParser(FileInputStream(File("src/test/resources/mapping2.yml")).readBytes())
val mapping = MappingConfigurationParser(FileInputStream(File("$path/mapping2.yml")).readBytes())
assertThat(mapping.get())
.isEqualTo(
MapperConfiguration(
......@@ -56,7 +56,7 @@ class TestMappingParser {
@Test
fun `test record parser`() {
val mapping = MappingConfigurationParser(FileInputStream(File("src/test/resources/mapping3.yml")).readBytes())
val mapping = MappingConfigurationParser(FileInputStream(File("$path/mapping3.yml")).readBytes())
val string = klaxon.toJsonString(mapping.get())
assertThat(string)
.isEqualTo(readFile("output3"))
......@@ -64,9 +64,18 @@ class TestMappingParser {
@Test
fun `test skos field parser`() {
val mapping = MappingConfigurationParser(FileInputStream(File("src/test/resources/mapping4.yml")).readBytes())
val mapping = MappingConfigurationParser(FileInputStream(File("$path/mapping4.yml")).readBytes())
val string = klaxon.toJsonString(mapping.get())
assertThat(string)
.isEqualTo(readFile("output4"))
}
@Test
fun `test 5 proxy field on digital object`() {
val mapping = MappingConfigurationParser(FileInputStream(File("$path/mapping5.yml")).readBytes())
val string = klaxon.toJsonString(mapping.get())
assertThat(string)
.isEqualTo(readFile("output5"))
}
}
record:
uri: identifier
type: type
digital:
proxy:
const: "proxy"
rights:
usage:
name:
const: In Copyright (InC)
sameAs:
const: https://rightsstatements.org/vocab/InC/1.0/
access:
const: public
\ No newline at end of file
{"digitalFieldMappers" : [{"constantField" : {"constant" : "proxy", "key" : "proxy"}}, {}, {}], "hasProxyType" : true, "physicalFieldMappers" : [], "recordFieldMappers" : [], "recordType" : {"directField" : "type", "directKey" : "type", "field" : "type", "key" : "type"}, "sponsoredByMemoriav" : false, "uri" : "identifier"}
\ 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