2020-07-10 14:44:50 +02:00
|
|
|
package eu.dnetlib.dhp.sx.ebi
|
|
|
|
|
2021-05-04 14:54:12 +02:00
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper
|
|
|
|
import eu.dnetlib.dhp.sx.ebi.model.PMParser
|
2020-07-10 14:44:50 +02:00
|
|
|
import org.junit.jupiter.api.Test
|
|
|
|
|
2021-05-04 14:54:12 +02:00
|
|
|
import scala.io.Source
|
|
|
|
import scala.xml.pull.XMLEventReader
|
|
|
|
|
2020-07-10 14:44:50 +02:00
|
|
|
class TestEBI {
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-04 14:54:12 +02:00
|
|
|
@Test
|
2020-07-10 14:44:50 +02:00
|
|
|
def testEBIData() = {
|
2021-05-04 14:54:12 +02:00
|
|
|
val inputXML = Source.fromInputStream(getClass.getResourceAsStream("pubmed.xml")).mkString
|
|
|
|
val xml = new XMLEventReader(Source.fromBytes(inputXML.getBytes()))
|
2020-07-10 14:44:50 +02:00
|
|
|
|
2021-05-04 14:54:12 +02:00
|
|
|
val mapper = new ObjectMapper()
|
2020-07-10 14:44:50 +02:00
|
|
|
|
2021-05-04 14:54:12 +02:00
|
|
|
new PMParser(xml).foreach(s =>println(mapper.writeValueAsString(s)))
|
2020-07-10 14:44:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|