From 883dcd910ebd8e6337a9ce8a5fd197837d1abf79 Mon Sep 17 00:00:00 2001 From: Sandro La Bruzzo Date: Wed, 10 May 2023 09:05:23 +0200 Subject: [PATCH] Make the tests compilable --- .../dnetlib/dhp/common/MdStoreClientTest.java | 2 +- .../dhp/common/vocabulary/VocabularyTest.java | 25 ++++++++----------- .../dhp/schema/oaf/utils/orp-rohub.json | 2 +- .../DataciteToOAFTransformation.scala | 4 +-- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/dhp-common/src/test/java/eu/dnetlib/dhp/common/MdStoreClientTest.java b/dhp-common/src/test/java/eu/dnetlib/dhp/common/MdStoreClientTest.java index f38d04979..b7f358bb4 100644 --- a/dhp-common/src/test/java/eu/dnetlib/dhp/common/MdStoreClientTest.java +++ b/dhp-common/src/test/java/eu/dnetlib/dhp/common/MdStoreClientTest.java @@ -15,7 +15,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class MdStoreClientTest { - @Test + public void testMongoCollection() throws IOException { final MdstoreClient client = new MdstoreClient("mongodb://localhost:27017", "mdstore"); diff --git a/dhp-common/src/test/java/eu/dnetlib/dhp/common/vocabulary/VocabularyTest.java b/dhp-common/src/test/java/eu/dnetlib/dhp/common/vocabulary/VocabularyTest.java index 958806837..68e88fbf5 100644 --- a/dhp-common/src/test/java/eu/dnetlib/dhp/common/vocabulary/VocabularyTest.java +++ b/dhp-common/src/test/java/eu/dnetlib/dhp/common/vocabulary/VocabularyTest.java @@ -1,25 +1,21 @@ package eu.dnetlib.dhp.common.vocabulary; -import static org.mockito.Mockito.lenient; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; -import java.util.Objects; - +import eu.dnetlib.dhp.schema.oaf.Qualifier; +import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; +import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; import org.apache.commons.io.IOUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import eu.dnetlib.dhp.schema.oaf.Qualifier; -import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; -import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; +import java.io.IOException; +import java.util.List; +import java.util.Objects; + +import static org.mockito.Mockito.lenient; @ExtendWith(MockitoExtension.class) public class VocabularyTest { @@ -69,11 +65,12 @@ public class VocabularyTest { } else { System.out.println("syn=" + s1 + " term = " + t1.getClassid() + " " + t1.getClassname()); + Qualifier synonymAsQualifier = vocabularies.getSynonymAsQualifier("dnet:result_typologies", t1.getClassid()); + if (synonymAsQualifier!= null) System.out .println( - vocabularies.getSynonymAsQualifier("dnet:result_typologies", t1.getClassid()).getClassname()); + synonymAsQualifier.getClassname()); } } - } } diff --git a/dhp-common/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/orp-rohub.json b/dhp-common/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/orp-rohub.json index c0f13ffbf..7ecd7ab48 100644 --- a/dhp-common/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/orp-rohub.json +++ b/dhp-common/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/orp-rohub.json @@ -50,7 +50,7 @@ "pid": [] } ], - "resulttype": "other", + "resulttype": "otherresearchproduct", "language": { "classid": "UNKNOWN", "classname": "Unknown", diff --git a/dhp-workflows/dhp-aggregation/src/main/scala/eu/dnetlib/dhp/datacite/DataciteToOAFTransformation.scala b/dhp-workflows/dhp-aggregation/src/main/scala/eu/dnetlib/dhp/datacite/DataciteToOAFTransformation.scala index c7d6216c1..6e1c6f698 100644 --- a/dhp-workflows/dhp-aggregation/src/main/scala/eu/dnetlib/dhp/datacite/DataciteToOAFTransformation.scala +++ b/dhp-workflows/dhp-aggregation/src/main/scala/eu/dnetlib/dhp/datacite/DataciteToOAFTransformation.scala @@ -639,9 +639,9 @@ object DataciteToOAFTransformation { Relation.RELCLASS.exists(r.relationType) && validIdentifiersInRelation(r.relatedIdentifierType) ) .map(r => { - val subRelType = Relation.SUBRELTYPE.valueOf(r.relationType) + val rc = Relation.RELCLASS.valueOf(r.relationType) val target = DHPUtils.generateUnresolvedIdentifier(r.relatedIdentifier, r.relatedIdentifierType) - relation(id, target, subRelType, Relation.RELCLASS.valueOf(r.relationType), date) + relation(id, target, rc.getSubRel, rc, date) }) val citationRels: List[Relation] = rels .filter(r =>validIdentifiersInRelation(r.relatedIdentifierType) &&