Project

General

Profile

1
package eu.dnetlib.data.utils;
2

    
3
import java.io.IOException;
4

    
5
import javax.xml.bind.JAXBException;
6

    
7
import org.apache.commons.io.IOUtils;
8
import org.junit.Ignore;
9
import org.junit.Test;
10

    
11
import com.google.gson.JsonSyntaxException;
12

    
13
import eu.dnetlib.data.mdstore.plugins.objects.MdRecord;
14
import eu.dnetlib.data.mdstore.plugins.objects.MdRecordConvertUtils;
15

    
16
public class BibTexConverterTest {
17

    
18
	@Test
19
	@Ignore
20
	public void testAsBibTex_1() {
21

    
22
		final MdRecord record = new MdRecord();
23

    
24
		record.setId("1234");
25
		record.setTitle("The D-NET software toolkit A framework for the realization, maintenance, and operation of aggregative infrastructures");
26

    
27
		record.getCreators().add("Manghi P.");
28
		record.getCreators().add("Artini M.");
29

    
30
		record.setPublisher("Emerald, Bradford, Regno Unito");
31
		record.getDois().add("10.1108/PROG-08-2013-0045");
32
		record.setDate(2014);
33
		record.setSource("Program (Lond., 1966) 48 (2014): 322–354. doi:10.1108/PROG-08-2013-0045");
34
		record.setType("Journal article");
35

    
36
		final String bib = BibTexConverter.asBibTex(record);
37

    
38
		System.out.println(bib);
39

    
40
	}
41

    
42
	@Test
43
	@Ignore
44
	public void testAsBibTex_3() {
45

    
46
		final MdRecord record = new MdRecord();
47

    
48
		record.setId("oai:it.cnr:prodotti:462344");
49
		record.setTitle("Discriminating stress from cognitive load using contactless thermal imaging devices");
50

    
51
		record.getCreators().add("Gioia F.");
52
		record.getCreators().add("Pascali M. A.");
53

    
54
		record.setPublisher("IEEE, New York, USA");
55
		record.getDois().add("10.1109/embc46164.2021.9630860");
56
		record.setDate(2021);
57
		record.setSource(
58
				"EMBC 2021 - 43rd Annual International Conference of the IEEE Engineering in Medicine & Biology Society, pp. 608–611, Online Conference, 30/10/2021, 5/11/2021");
59
		record.setType("Conference article");
60

    
61
		final String bib = BibTexConverter.asBibTex(record);
62

    
63
		System.out.println(bib);
64

    
65
	}
66

    
67
	@Test
68
	@Ignore
69
	public void testAsBibTex_article_source_1() {
70

    
71
		final MdRecord record = new MdRecord();
72

    
73
		record.setId("1234");
74
		record.setType("Journal article");
75

    
76
		record.setSource("Internet of Things 13 (2020): 1–14");
77

    
78
		final String bib = BibTexConverter.asBibTex(record);
79

    
80
		System.out.println(bib);
81

    
82
	}
83

    
84
	@Test
85
	@Ignore
86
	public void testAsBibTex_file() throws JsonSyntaxException, IOException, JAXBException {
87

    
88
		final String xml = IOUtils.toString(getClass().getResourceAsStream("record.xml"));
89

    
90
		final MdRecord record = MdRecordConvertUtils.fromString(xml);
91

    
92
		final String bib = BibTexConverter.asBibTex(record);
93

    
94
		System.out.println(bib);
95

    
96
	}
97
}
(1-1/2)