generated from GenomicDataInfrastructure/oss-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from GenomicDataInfrastructure/ART-6899
feat: add dataset relations and dictionary
- Loading branch information
Showing
4 changed files
with
205 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,20 @@ | |
|
||
package io.github.genomicdatainfrastructure.discovery.services; | ||
|
||
import io.github.genomicdatainfrastructure.discovery.model.ContactPoint; | ||
import io.github.genomicdatainfrastructure.discovery.model.DatasetDictionaryEntry; | ||
import io.github.genomicdatainfrastructure.discovery.model.DatasetRelationEntry; | ||
import io.github.genomicdatainfrastructure.discovery.model.RetrievedDataset; | ||
import io.github.genomicdatainfrastructure.discovery.model.RetrievedDistribution; | ||
import io.github.genomicdatainfrastructure.discovery.model.ValueLabel; | ||
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.*; | ||
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanContactPoint; | ||
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanDatasetDictionaryEntry; | ||
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanDatasetRelationEntry; | ||
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanOrganization; | ||
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanPackage; | ||
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanResource; | ||
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanTag; | ||
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanValueLabel; | ||
import io.github.genomicdatainfrastructure.discovery.utils.PackageShowMapper; | ||
import org.junit.jupiter.api.Test; | ||
|
||
|
@@ -29,12 +39,13 @@ void accepts_empty_package() { | |
|
||
var actual = PackageShowMapper.from(ckanPackage); | ||
var expected = RetrievedDataset.builder() | ||
.conformsTo(List.of()) | ||
.distributions(List.of()) | ||
.hasVersions(List.of()) | ||
.languages(List.of()) | ||
.themes(List.of()) | ||
.keywords(List.of()) | ||
.contacts(List.of()) | ||
.datasetRelationships(List.of()) | ||
.dataDictionary(List.of()) | ||
.build(); | ||
|
||
assertThat(actual) | ||
|
@@ -71,20 +82,10 @@ void can_parse() { | |
.name("en") | ||
.build())) | ||
.contactUri("contactUri") | ||
.hasVersion(List.of( | ||
CkanValueLabel.builder() | ||
.displayName("version") | ||
.name("1") | ||
.build())) | ||
.accessRights(CkanValueLabel.builder() | ||
.displayName("accessRights") | ||
.name("public") | ||
.build()) | ||
.conformsTo(List.of( | ||
CkanValueLabel.builder() | ||
.displayName("conformsTo") | ||
.name("conforms") | ||
.build())) | ||
.provenance("provenance") | ||
.spatialUri(CkanValueLabel.builder() | ||
.displayName("spatial") | ||
|
@@ -104,6 +105,24 @@ void can_parse() { | |
.lastModified("2024-03-19T13:37:05.472970") | ||
.build() | ||
)) | ||
.contacts(List.of( | ||
CkanContactPoint.builder().name("Contact 1").email("[email protected]") | ||
.build(), | ||
CkanContactPoint.builder().name("Contact 2").email("[email protected]") | ||
.build() | ||
)) | ||
.datasetRelationships(List.of( | ||
CkanDatasetRelationEntry.builder().target("Dataset 1").relation( | ||
"Relation 1").build(), | ||
CkanDatasetRelationEntry.builder().target("Dataset 2").relation( | ||
"Relation 2").build() | ||
)) | ||
.dataDictionary(List.of( | ||
CkanDatasetDictionaryEntry.builder().name("Entry 1").type("Type 1") | ||
.description("Description 1").build(), | ||
CkanDatasetDictionaryEntry.builder().name("Entry 2").type("Type 2") | ||
.description("Description 2").build() | ||
)) | ||
.build(); | ||
|
||
var actual = PackageShowMapper.from(ckanPackage); | ||
|
@@ -133,22 +152,10 @@ void can_parse() { | |
.value("contactUri") | ||
.label("contactUri") | ||
.build()) | ||
.hasVersions(List.of( | ||
ValueLabel.builder() | ||
.value("1") | ||
.label("version") | ||
.build() | ||
)) | ||
.accessRights(ValueLabel.builder() | ||
.value("public") | ||
.label("accessRights") | ||
.build()) | ||
.conformsTo(List.of( | ||
ValueLabel.builder() | ||
.value("conforms") | ||
.label("conformsTo") | ||
.build() | ||
)) | ||
.provenance("provenance") | ||
.keywords(List.of(ValueLabel.builder() | ||
.label("key-tag") | ||
|
@@ -172,6 +179,24 @@ void can_parse() { | |
.modifiedAt(parse("2024-03-19T13:37:05.472970", DATE_FORMATTER)) | ||
.build() | ||
)) | ||
.contacts(List.of( | ||
ContactPoint.builder().name("Contact 1").email("[email protected]") | ||
.build(), | ||
ContactPoint.builder().name("Contact 2").email("[email protected]") | ||
.build() | ||
)) | ||
.datasetRelationships(List.of( | ||
DatasetRelationEntry.builder().relation("Relation 1").target("Dataset 1") | ||
.build(), | ||
DatasetRelationEntry.builder().relation("Relation 2").target("Dataset 2") | ||
.build() | ||
)) | ||
.dataDictionary(List.of( | ||
DatasetDictionaryEntry.builder().name("Entry 1").type("Type 1").description( | ||
"Description 1").build(), | ||
DatasetDictionaryEntry.builder().name("Entry 2").type("Type 2").description( | ||
"Description 2").build() | ||
)) | ||
.build(); | ||
|
||
assertThat(actual) | ||
|