Project

General

Profile

1
package eu.dnetlib.parthenos.rdf;
2

    
3
import eu.dnetlib.parthenos.publisher.SaxonHelper;
4
import net.sf.saxon.s9api.SaxonApiException;
5
import org.junit.Before;
6
import org.junit.Test;
7
import org.junit.runner.RunWith;
8
import org.junit.runners.JUnit4;
9

    
10
import static org.junit.Assert.assertEquals;
11

    
12
/**
13
 * Created by Alessia Bardi on 15/03/2018.
14
 *
15
 * @author Alessia Bardi
16
 */
17
@RunWith(JUnit4.class)
18
public class RecordParserHelperTest {
19

    
20
	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://parthenos.d4science.org/handle/Parthenos/REG/Actor/Eleni%20Vernardaki</dri:objIdentifier><dri:datasourceapi>api_________::parthenos___::parthenos::topLevel</dri:datasourceapi><dri:datasourcename>PARTHENOS</dri:datasourcename></header><metadata>\n"
21
			+ "<rdf:RDF\n"
22
			+ "\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"
23
			+ "\txmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" >\n"
24
			+ "  <rdf:Description rdf:about=\"http://parthenos.d4science.org/handle/Parthenos/REG/Actor/Eleni%20Vernardaki\">\n"
25
			+ "    <rdf:type rdf:resource=\"http://www.cidoc-crm.org/cidoc-crm/E39_Actor\" />\n"
26
			+ "    <rdf:type rdf:resource=\"http://www.cidoc-crm.org/cidoc-crm/E1_CRM_Entity\" />\n"
27
			+ "    <rdf:type rdf:resource=\"http://www.cidoc-crm.org/cidoc-crm/E77_Persistent_Item\" />\n"
28
			+ "  </rdf:Description>\n"
29
			+ "</rdf:RDF></metadata></record>";
30

    
31

    
32
	private RecordParserHelper help;
33
	private SaxonHelper saxonHelper;
34

    
35
	@Before
36
	public void setup() throws SaxonApiException {
37
		saxonHelper = new SaxonHelper();
38
		help = new RecordParserHelper();
39
		help.setSaxonHelper(saxonHelper);
40
		help.init();
41
	}
42

    
43
	@Test
44
	public void testGetObjId(){
45
		assertEquals("http://parthenos.d4science.org/handle/Parthenos/REG/Actor/Eleni%20Vernardaki", help.getObjIdentifier(testRecord));
46
	}
47

    
48
}
    (1-1/1)