forked from D-Net/dnet-hadoop
updated test and fixed assign of access right
This commit is contained in:
parent
f5e7c57654
commit
a8e5d0ea0d
|
@ -83,7 +83,7 @@ object UnpayWallToOAF {
|
||||||
val i :Instance= new Instance()
|
val i :Instance= new Instance()
|
||||||
|
|
||||||
i.setCollectedfrom(createUnpayWallCollectedFrom())
|
i.setCollectedfrom(createUnpayWallCollectedFrom())
|
||||||
i.setAccessright(getOpenAccessQualifier())
|
// i.setAccessright(getOpenAccessQualifier())
|
||||||
i.setUrl(List(oaLocation.url.get).asJava)
|
i.setUrl(List(oaLocation.url.get).asJava)
|
||||||
|
|
||||||
// Ticket #6281 added pid to Instance
|
// Ticket #6281 added pid to Instance
|
||||||
|
@ -101,6 +101,7 @@ object UnpayWallToOAF {
|
||||||
a.setSchemeid(ModelConstants.DNET_ACCESS_MODES)
|
a.setSchemeid(ModelConstants.DNET_ACCESS_MODES)
|
||||||
a.setSchemename(ModelConstants.DNET_ACCESS_MODES)
|
a.setSchemename(ModelConstants.DNET_ACCESS_MODES)
|
||||||
a.setOpenAccessRoute(colour.get)
|
a.setOpenAccessRoute(colour.get)
|
||||||
|
i.setAccessright(a)
|
||||||
}
|
}
|
||||||
pub.setInstance(List(i).asJava)
|
pub.setInstance(List(i).asJava)
|
||||||
pub
|
pub
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package eu.dnetlib.doiboost.uw
|
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 org.junit.jupiter.api.Test
|
||||||
|
|
||||||
import scala.io.Source
|
import scala.io.Source
|
||||||
|
@ -31,19 +33,15 @@ class UnpayWallMappingTest {
|
||||||
assertNotNull(line)
|
assertNotNull(line)
|
||||||
assertTrue(line.nonEmpty)
|
assertTrue(line.nonEmpty)
|
||||||
}
|
}
|
||||||
mapper.getSerializationConfig.enable(SerializationConfig.Feature.INDENT_OUTPUT)
|
|
||||||
|
|
||||||
|
|
||||||
val l = Ilist.lines.next()
|
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))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue