updated test and fixed assign of access right

This commit is contained in:
Sandro La Bruzzo 2021-03-11 10:41:24 +01:00
parent f5e7c57654
commit a8e5d0ea0d
2 changed files with 9 additions and 10 deletions

View File

@ -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

View File

@ -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))
}
}