Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
libraries
Mapper Service Configuration
Commits
b23d2404
Commit
b23d2404
authored
Feb 02, 2021
by
Jonas Waeber
Browse files
Add local test run class.
parent
354a93db
Pipeline
#21015
passed with stage
in 2 minutes and 3 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/main/kotlin/builder/RecordResource.kt
View file @
b23d2404
...
...
@@ -171,7 +171,7 @@ abstract class RecordResource(institutionId: String) : IResource {
blank
.
addProperty
(
RICO
.
regulates
,
resource
)
resource
.
addProperty
(
RICO
.
regulatedBy
,
blank
)
}
else
{
log
.
error
(
"Add no rule for type $type, because there were no content properties mapped."
)
log
.
error
(
"Add
ed
no rule for type $type, because there were no content properties mapped."
)
}
}
...
...
src/test/kotlin/ch/memobase/test/LocalTestRun.kt
0 → 100644
View file @
b23d2404
/*
* Mapper Service Configuration
* Copyright (C) 2020 Memoriav
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package
org.memobase.test
import
ch.memobase.builder.ResourceBuilder
import
ch.memobase.mapping.MappingConfigurationParser
import
ch.memobase.settings.HeaderMetadata
import
com.beust.klaxon.Klaxon
import
java.io.File
import
java.io.FileOutputStream
import
org.junit.jupiter.api.Disabled
import
org.junit.jupiter.api.Test
import
org.junit.jupiter.api.TestInstance
@TestInstance
(
TestInstance
.
Lifecycle
.
PER_CLASS
)
@Disabled
class
LocalTestRun
{
private
val
headerMetadata
=
HeaderMetadata
(
"snp-001"
,
"1"
,
"snp"
,
false
,
"record"
,
"identifierMain"
,
0
,
0
,
0
,
0
)
@Test
@Disabled
fun
`test
local
folder`
()
{
val
folder
=
"/home/jonas/memobase/data/snp-001"
val
inputFolder
=
"/home/jonas/memobase/data/test/step-2"
val
outputFolder
=
"/home/jonas/memobase/data/test/step-3"
val
mappingFile
=
"/config/mapping.yml"
val
klaxon
=
Klaxon
()
val
configurationParser
=
MappingConfigurationParser
(
File
(
folder
+
mappingFile
).
readBytes
())
val
configuration
=
configurationParser
.
get
()
File
(
inputFolder
)
.
walk
(
FileWalkDirection
.
TOP_DOWN
)
.
maxDepth
(
1
)
.
filter
{
it
.
isFile
}
.
map
{
Pair
(
it
.
name
,
it
)
}
.
map
{
Pair
(
it
.
first
,
klaxon
.
parse
<
Map
<
String
,
Any
>>(
it
.
second
).
orEmpty
())
}
.
map
{
val
builder
=
ResourceBuilder
(
it
.
second
,
configuration
,
headerMetadata
.
institutionId
,
headerMetadata
.
recordSetId
,
headerMetadata
.
isPublished
)
builder
.
extractRecordId
()
builder
.
extractRecordTypeValue
()
.
generateRecord
()
.
generatePhysicalObject
()
.
generateDigitalObject
()
.
addDerivedConnection
()
.
writeRecord
()
}
.
forEach
{
result
->
FileOutputStream
(
File
(
outputFolder
+
"/"
+
result
.
first
.
substringAfterLast
(
"/"
))).
use
{
it
.
bufferedWriter
().
use
{
writer
->
writer
.
write
(
result
.
second
)
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment