diff --git a/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/uw/UnpayWallToOAF.scala b/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/uw/UnpayWallToOAF.scala index 7119bbc123..0972d55de3 100644 --- a/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/uw/UnpayWallToOAF.scala +++ b/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/uw/UnpayWallToOAF.scala @@ -83,7 +83,7 @@ object UnpayWallToOAF { val i :Instance= new Instance() i.setCollectedfrom(createUnpayWallCollectedFrom()) - i.setAccessright(getOpenAccessQualifier()) +// i.setAccessright(getOpenAccessQualifier()) i.setUrl(List(oaLocation.url.get).asJava) // Ticket #6281 added pid to Instance @@ -101,6 +101,7 @@ object UnpayWallToOAF { a.setSchemeid(ModelConstants.DNET_ACCESS_MODES) a.setSchemename(ModelConstants.DNET_ACCESS_MODES) a.setOpenAccessRoute(colour.get) + i.setAccessright(a) } pub.setInstance(List(i).asJava) pub diff --git a/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/doiboost/uw/UnpayWallMappingTest.scala b/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/doiboost/uw/UnpayWallMappingTest.scala index 8a6dd279b6..3e4acdffbb 100644 --- a/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/doiboost/uw/UnpayWallMappingTest.scala +++ b/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/doiboost/uw/UnpayWallMappingTest.scala @@ -1,6 +1,8 @@ package eu.dnetlib.doiboost.uw -import org.codehaus.jackson.map.{ObjectMapper, SerializationConfig} + +import com.fasterxml.jackson.databind.ObjectMapper +import eu.dnetlib.dhp.schema.oaf.OpenAccessRoute import org.junit.jupiter.api.Test import scala.io.Source @@ -31,19 +33,15 @@ class UnpayWallMappingTest { assertNotNull(line) assertTrue(line.nonEmpty) } - mapper.getSerializationConfig.enable(SerializationConfig.Feature.INDENT_OUTPUT) + val l = Ilist.lines.next() - logger.info(mapper.writeValueAsString(UnpayWallToOAF.convertToOAF(l))) - - - - - - + val item = UnpayWallToOAF.convertToOAF(l) + assertEquals(item.getInstance().get(0).getAccessright.getOpenAccessRoute, OpenAccessRoute.bronze) + logger.info(mapper.writeValueAsString(item)) } }