forked from D-Net/dnet-hadoop
fixed test
This commit is contained in:
parent
fbad4988be
commit
39337d8a8a
|
@ -38,6 +38,8 @@ class QueryTest {
|
||||||
def myQuery(spark:SparkSession, sc:SparkContext): Unit = {
|
def myQuery(spark:SparkSession, sc:SparkContext): Unit = {
|
||||||
implicit val mapEncoderPub: Encoder[Publication] = Encoders.kryo[Publication]
|
implicit val mapEncoderPub: Encoder[Publication] = Encoders.kryo[Publication]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val mapper = new ObjectMapper()
|
val mapper = new ObjectMapper()
|
||||||
mapper.getSerializationConfig.enable(SerializationConfig.Feature.INDENT_OUTPUT)
|
mapper.getSerializationConfig.enable(SerializationConfig.Feature.INDENT_OUTPUT)
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,15 @@ package eu.dnetlib.dhp.export
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.format.DateTimeFormatter
|
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.oaf.Relation
|
||||||
import eu.dnetlib.dhp.schema.scholexplorer.{DLIDataset, DLIPublication}
|
import eu.dnetlib.dhp.schema.scholexplorer.{DLIDataset, DLIPublication}
|
||||||
|
|
||||||
import org.codehaus.jackson.map.{ObjectMapper, SerializationConfig}
|
import org.codehaus.jackson.map.{ObjectMapper, SerializationConfig}
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
import scala.io.Source
|
import scala.io.Source
|
||||||
|
import scala.collection.JavaConverters._
|
||||||
class ExportDLITOOAFTest {
|
class ExportDLITOOAFTest {
|
||||||
|
|
||||||
val mapper = new ObjectMapper()
|
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
|
@Test
|
||||||
def testMappingRele():Unit = {
|
def testMappingRele():Unit = {
|
||||||
|
|
||||||
val r:Relation = new Relation
|
val r:Relation = new Relation
|
||||||
r.setSource("60|fbff1d424e045eecf24151a5fe3aa738")
|
r.setSource("60|fbff1d424e045eecf24151a5fe3aa738")
|
||||||
r.setTarget("50|dedup_wf_001::ec409f09e63347d4e834087fe1483877")
|
r.setTarget("50|dedup_wf_001::ec409f09e63347d4e834087fe1483877")
|
||||||
|
r.setRelType("IsReferencedBy")
|
||||||
|
|
||||||
|
|
||||||
val r1 =DLIToOAF.convertDLIRelation(r)
|
val r1 =DLIToOAF.convertDLIRelation(r)
|
||||||
println(r1.getSource, r1.getTarget)
|
println(r1.getSource, r1.getTarget)
|
||||||
|
|
Loading…
Reference in New Issue