From 39337d8a8a172a49120fa4aff16258f0d58c1f2d Mon Sep 17 00:00:00 2001 From: Sandro La Bruzzo Date: Mon, 2 Nov 2020 09:26:25 +0100 Subject: [PATCH] fixed test --- .../eu/dnetlib/dhp/doiboost/QueryTest.scala | 2 ++ .../dhp/export/ExportDLITOOAFTest.scala | 20 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/dhp/doiboost/QueryTest.scala b/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/dhp/doiboost/QueryTest.scala index 243719549..b3402ee9f 100644 --- a/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/dhp/doiboost/QueryTest.scala +++ b/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/dhp/doiboost/QueryTest.scala @@ -38,6 +38,8 @@ class QueryTest { def myQuery(spark:SparkSession, sc:SparkContext): Unit = { implicit val mapEncoderPub: Encoder[Publication] = Encoders.kryo[Publication] + + val mapper = new ObjectMapper() mapper.getSerializationConfig.enable(SerializationConfig.Feature.INDENT_OUTPUT) diff --git a/dhp-workflows/dhp-graph-provision-scholexplorer/src/test/java/eu/dnetlib/dhp/export/ExportDLITOOAFTest.scala b/dhp-workflows/dhp-graph-provision-scholexplorer/src/test/java/eu/dnetlib/dhp/export/ExportDLITOOAFTest.scala index cb04cf9e9..c62d169bc 100644 --- a/dhp-workflows/dhp-graph-provision-scholexplorer/src/test/java/eu/dnetlib/dhp/export/ExportDLITOOAFTest.scala +++ b/dhp-workflows/dhp-graph-provision-scholexplorer/src/test/java/eu/dnetlib/dhp/export/ExportDLITOOAFTest.scala @@ -3,14 +3,15 @@ package eu.dnetlib.dhp.export import java.time.LocalDateTime import java.time.format.DateTimeFormatter +import eu.dnetlib.dhp.provision.scholix.Scholix +import eu.dnetlib.dhp.provision.scholix.summary.ScholixSummary import eu.dnetlib.dhp.schema.oaf.Relation import eu.dnetlib.dhp.schema.scholexplorer.{DLIDataset, DLIPublication} - import org.codehaus.jackson.map.{ObjectMapper, SerializationConfig} import org.junit.jupiter.api.Test import scala.io.Source - +import scala.collection.JavaConverters._ class ExportDLITOOAFTest { val mapper = new ObjectMapper() @@ -22,12 +23,27 @@ class ExportDLITOOAFTest { } + def extractDatasources(s:Scholix):List[String]= { + s.getTarget.getCollectedFrom.asScala.map(c => c.getProvider.getName)(collection.breakOut) + } + + + def extractDatasources(s:ScholixSummary):List[String] = { + + s.getDatasources.asScala.map(c => c.getDatasourceName)(collection.breakOut) + + + } + + @Test def testMappingRele():Unit = { val r:Relation = new Relation r.setSource("60|fbff1d424e045eecf24151a5fe3aa738") r.setTarget("50|dedup_wf_001::ec409f09e63347d4e834087fe1483877") + r.setRelType("IsReferencedBy") + val r1 =DLIToOAF.convertDLIRelation(r) println(r1.getSource, r1.getTarget)