AriadnePlus/dnet-ariadneplus-publisher/test/main/java/eu/dnetlib/ariadneplus/rdf/RecordParserHelperTest.java

49 lines
1.9 KiB
Java

package eu.dnetlib.ariadneplus.rdf;
import eu.dnetlib.ariadneplus.publisher.SaxonHelper;
import net.sf.saxon.s9api.SaxonApiException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import static org.junit.Assert.assertEquals;
/**
* Created by Alessia Bardi on 15/03/2018.
*
* @author Alessia Bardi
*/
@RunWith(JUnit4.class)
public class RecordParserHelperTest {
private String testRecord = "<record xmlns=\"http://www.openarchives.org/OAI/2.0/\"><header xmlns:dri=\"http://www.driver-repository.eu/namespace/dri\"><dri:objIdentifier>http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Actor/Eleni%20Vernardaki</dri:objIdentifier><dri:datasourceapi>api_________::ariadneplus___::ariadneplus::topLevel</dri:datasourceapi><dri:datasourcename>ARIADNEPLUS</dri:datasourcename></header><metadata>\n"
+ "<rdf:RDF\n"
+ "\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"
+ "\txmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" >\n"
+ " <rdf:Description rdf:about=\"http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Actor/Eleni%20Vernardaki\">\n"
+ " <rdf:type rdf:resource=\"http://www.cidoc-crm.org/cidoc-crm/E39_Actor\" />\n"
+ " <rdf:type rdf:resource=\"http://www.cidoc-crm.org/cidoc-crm/E1_CRM_Entity\" />\n"
+ " <rdf:type rdf:resource=\"http://www.cidoc-crm.org/cidoc-crm/E77_Persistent_Item\" />\n"
+ " </rdf:Description>\n"
+ "</rdf:RDF></metadata></record>";
private RecordParserHelper help;
private SaxonHelper saxonHelper;
@Before
public void setup() throws SaxonApiException {
saxonHelper = new SaxonHelper();
help = new RecordParserHelper();
help.setSaxonHelper(saxonHelper);
help.init();
}
@Test
public void testGetObjId(){
assertEquals("http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Actor/Eleni%20Vernardaki", help.getObjIdentifier(testRecord));
}
}