Commit e1e770e9 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Fix test

parent 2713e1cb
Pipeline #10602 failed with stages
in 1 minute and 33 seconds
......@@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import com.beust.klaxon.Klaxon
import java.io.File
import java.nio.charset.Charset
import java.util.stream.Stream
......@@ -29,11 +30,7 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource
import org.memobase.ConditionalTargets
import org.memobase.DateFacetBuilder
import org.memobase.EntityTransform
import org.memobase.LiteralTransform
import org.memobase.SearchDocTransformConfig
import org.memobase.Service
import org.memobase.YamlLoader
......@@ -46,24 +43,12 @@ class Test {
return File("$resourcePath/$fileName").readText(Charset.defaultCharset())
}
private fun reportingTopic(value: String) = "$value-reporting"
@Test
fun `test mapping config`() {
val mapping = YamlLoader("src/test/resources/testMapping.yml").load()
assertThat(mapping)
assertThat(Klaxon().toJsonString(mapping))
.isEqualTo(
SearchDocTransformConfig(
listOf(LiteralTransform("dct:abstract", "abstract", true)),
listOf(
EntityTransform(
"rico:hasTitle",
"rico:title",
"title",
listOf(ConditionalTargets("", "", ""))
)
)
)
"{\"entities\" : [{\"conditionalTargets\" : [], \"isCreationRelation\" : false, \"isDate\" : true, \"property\" : \"dct:temporal\", \"source\" : \"\", \"target\" : \"temporal\"}, {\"conditionalTargets\" : [], \"isCreationRelation\" : true, \"isDate\" : false, \"property\" : \"rico:recordResourceOrInstantiationIsSourceOfCreationRelation\", \"source\" : \"rico:name\", \"target\" : \"\"}, {\"conditionalTargets\" : [], \"isCreationRelation\" : false, \"isDate\" : false, \"property\" : \"rdau:P60556\", \"source\" : \"rico:name\", \"target\" : \"placeCaptureRaw\"}, {\"conditionalTargets\" : [{\"conditionPattern\" : \"holder\", \"conditionProperty\" : \"rico:type\", \"target\" : \"rightsHolder\"}], \"isCreationRelation\" : false, \"isDate\" : false, \"property\" : \"rico:regulatedBy\", \"source\" : \"rico:name\", \"target\" : \"\"}], \"literals\" : [{\"hasLanguageTags\" : true, \"source\" : \"dct:abstract\", \"target\" : \"abstract\"}, {\"hasLanguageTags\" : false, \"source\" : \"@id\", \"target\" : \"id\"}, {\"hasLanguageTags\" : false, \"source\" : \"schema:sameAs\", \"target\" : \"sameAs\"}]}"
)
}
......
......@@ -2,13 +2,25 @@ literals:
- source: "dct:abstract"
target: "abstract"
hasLanguageTags: true
- source: "@id"
target: "id"
- source: "schema:sameAs"
target: "sameAs"
entities:
- property: "rico:hasTitle"
source: "rico:title"
target: "title"
ricoTypeCondition: "main"
- property: "dct:temporal"
target: "temporal"
isDate: true
- property: "rico:recordResourceOrInstantiationIsSourceOfCreationRelation"
source: "rico:name"
isCreationRelation: true
- property: "rdau:P60556"
source: "rico:name"
target: "placeCaptureRaw"
- property: "rico:regulatedBy"
source: "rico:name"
conditionalTargets:
- conditionPattern: "holder"
conditionProperty: "rico:type"
target: "rightsHolder"
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