From 2d3f7d1eb4be258e029b737fbdc24fb606ca36ca Mon Sep 17 00:00:00 2001 From: Alessia Bardi Date: Tue, 9 Jun 2020 18:07:14 +0200 Subject: [PATCH] fixed log classes to make the ORCID test run --- .../java/eu/dnetlib/doiboost/orcid/ORCIDToOAF.scala | 12 +++--------- .../doiboost/orcid/MappingORCIDToOAFTest.scala | 8 +++----- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/orcid/ORCIDToOAF.scala b/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/orcid/ORCIDToOAF.scala index 7b344f4a5c..f230c604f7 100644 --- a/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/orcid/ORCIDToOAF.scala +++ b/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/orcid/ORCIDToOAF.scala @@ -1,16 +1,10 @@ package eu.dnetlib.doiboost.orcid -import java.io.IOException - import eu.dnetlib.dhp.schema.oaf.{Author, Publication} import eu.dnetlib.doiboost.DoiBoostMappingUtil import eu.dnetlib.doiboost.DoiBoostMappingUtil.{ORCID, PID_TYPES, createSP, generateDataInfo, generateIdentifier} -import eu.dnetlib.doiboost.crossref.Crossref2Oaf import org.apache.commons.lang.StringUtils import org.codehaus.jackson.map.ObjectMapper -import org.json4s -import org.json4s.DefaultFormats -import org.json4s.jackson.JsonMethods.parse import org.slf4j.{Logger, LoggerFactory} import scala.collection.JavaConverters._ @@ -22,7 +16,7 @@ case class ORCIDItem(oid:String,name:String,surname:String,creditName:String,err case class ORCIDElement(doi:String, authors:List[ORCIDItem]) {} object ORCIDToOAF { - val logger: Logger = LoggerFactory.getLogger(Crossref2Oaf.getClass) + val logger: Logger = LoggerFactory.getLogger(ORCIDToOAF.getClass) val mapper = new ObjectMapper def isJsonValid(inputStr: String): Boolean = { @@ -57,7 +51,7 @@ object ORCIDToOAF { pub.setId(generateIdentifier(pub, doi.toLowerCase)) try{ pub.setAuthor(input.authors.map(a=> { - generateAuhtor(a.name, a.surname, a.creditName, a.oid) + generateAuthor(a.name, a.surname, a.creditName, a.oid) }).asJava) pub.setCollectedfrom(List(DoiBoostMappingUtil.createORIDCollectedFrom()).asJava) pub.setDataInfo(DoiBoostMappingUtil.generateDataInfo()) @@ -69,7 +63,7 @@ object ORCIDToOAF { } } - def generateAuhtor(given: String, family: String, fullName:String, orcid: String): Author = { + def generateAuthor(given: String, family: String, fullName:String, orcid: String): Author = { val a = new Author a.setName(given) a.setSurname(family) diff --git a/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/doiboost/orcid/MappingORCIDToOAFTest.scala b/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/doiboost/orcid/MappingORCIDToOAFTest.scala index 158746ab52..5b82409421 100644 --- a/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/doiboost/orcid/MappingORCIDToOAFTest.scala +++ b/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/doiboost/orcid/MappingORCIDToOAFTest.scala @@ -1,16 +1,14 @@ package eu.dnetlib.doiboost.orcid -import eu.dnetlib.dhp.schema.oaf.Publication -import eu.dnetlib.doiboost.crossref.Crossref2Oaf -import org.codehaus.jackson.map.{ObjectMapper, SerializationConfig} +import org.codehaus.jackson.map.ObjectMapper +import org.junit.jupiter.api.Assertions._ import org.junit.jupiter.api.Test import org.slf4j.{Logger, LoggerFactory} -import org.junit.jupiter.api.Assertions._ import scala.io.Source class MappingORCIDToOAFTest { - val logger: Logger = LoggerFactory.getLogger(Crossref2Oaf.getClass) + val logger: Logger = LoggerFactory.getLogger(ORCIDToOAF.getClass) val mapper = new ObjectMapper() @Test