1
|
package eu.dnetlib.data.claims.parser;
|
2
|
|
3
|
import eu.dnetlib.data.claims.entity.Result;
|
4
|
import eu.dnetlib.data.claims.utils.ClaimUtils;
|
5
|
import eu.dnetlib.data.claims.utils.SearchUtils;
|
6
|
import org.apache.logging.log4j.Level;
|
7
|
import org.apache.logging.log4j.core.config.Configurator;
|
8
|
import org.apache.logging.log4j.core.config.DefaultConfiguration;
|
9
|
import org.junit.Assert;
|
10
|
import org.junit.Before;
|
11
|
import org.junit.Test;
|
12
|
import org.springframework.context.ApplicationContext;
|
13
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
14
|
|
15
|
/**
|
16
|
* Created by kiatrop on 23/2/2016.
|
17
|
*/
|
18
|
public class ExternalParserTest {
|
19
|
// @Autowired
|
20
|
SearchUtils searchUtils;
|
21
|
|
22
|
@Before
|
23
|
public void init() throws Exception {
|
24
|
Configurator.initialize(new DefaultConfiguration());
|
25
|
Configurator.setRootLevel(Level.INFO);
|
26
|
ApplicationContext context = new ClassPathXmlApplicationContext("eu/dnetlib/data/claims/springContext-claims.xml");
|
27
|
|
28
|
searchUtils = context.getBean(SearchUtils.class);
|
29
|
|
30
|
}
|
31
|
private String crossrefJson = "{\"status\":\"ok\",\"message-type\":\"work-list\",\"message-version\":\"1.0.0\",\"message\":" +
|
32
|
"{\"query\":{\"search-terms\":null,\"start-index\":0},\"items-per-page\":20,\"items\":[{\"indexed\":" +
|
33
|
"{\"date-parts\":[[2015,12,28]], \"date-time\":\"2015-12-28T17:45:59Z\",\"timestamp\":1451324759779}," +
|
34
|
"\"reference-count\":0,\"publisher\":\"Society for Neuroscience\", \"issue\":\"17\"," +
|
35
|
"\"published-print\":{\"date-parts\":[[2012,4,25]]},\"DOI\":\"10.1523\\/jneurosci.2900-11.2012\"," +
|
36
|
"\"type\":\"journal-article\",\"created\": {\"date-parts\":[[2012,4,25]]," +
|
37
|
"\"date-time\":\"2012-04-25T16:38:54Z\",\"timestamp\":1335371934000},\"page\":\"5728-5736\"," +
|
38
|
"\"source\":\"CrossRef\",\"title\":[\"Imaging Microglial\\/Macrophage Activation in Spinal Cords of " +
|
39
|
"Experimental Autoimmune Encephalomyelitis Rats by Positron Emission Tomography Using the Mitochondrial " +
|
40
|
"18 kDa Translocator Protein Radioligand [18F]DPA-714\"]," +
|
41
|
"\"prefix\":\"http:\\/\\/id.crossref.org\\/prefix\\/10.1523\",\"volume\":\"32\",\"author\":" +
|
42
|
"[{\"affiliation\":[],\"family\":\"Abourbeh\",\"given\":\"G.\"},{\"affiliation\":[],\"family\":\"Theze\"," +
|
43
|
"\"given\":\"B.\"},{\"affiliation\":[],\"family\":\"Maroy\",\"given\":\"R.\"},{\"affiliation\":[],\"family\":" +
|
44
|
"\"Dubois\",\"given\":\"A.\"},{\"affiliation\":[],\"family\":\"Brulon\",\"given\":\"V.\"}," +
|
45
|
"{\"affiliation\":[],\"family\":\"Fontyn\",\"given\":\"Y.\"},{\"affiliation\":[],\"family\":\"Dolle\"," +
|
46
|
"\"given\":\"F.\"},{\"affiliation\":[],\"family\":\"Tavitian\",\"given\":\"B.\"},{\"affiliation\":[]," +
|
47
|
"\"family\":\"Boisgard\",\"given\":\"R.\"}],\"member\":\"http:\\/\\/id.crossref.org\\/member\\/393\"," +
|
48
|
"\"published-online\":{\"date-parts\":[[2012,4,25]]},\"container-title\":[\"Journal of Neuroscience\"]," +
|
49
|
"\"deposited\":{\"date-parts\":[[2014,2,27]],\"date-time\":\"2014-02-27T06:42:02Z\",\"timestamp\":1393483322000}," +
|
50
|
"\"score\":1.0,\"subtitle\":[],\"issued\":{\"date-parts\":[[2012,4,25]]}," +
|
51
|
"\"URL\":\"http:\\/\\/dx.doi.org\\/10.1523\\/jneurosci.2900-11.2012\",\"ISSN\":[\"0270-6474\",\"1529-2401\"]," +
|
52
|
"\"subject\":[\"Neuroscience(all)\"]}],\"total-results\":1,\"facets\":{}}}" +
|
53
|
"";
|
54
|
|
55
|
|
56
|
@Test
|
57
|
public void crossref2ResultTest(){
|
58
|
Result result = ExternalRecordParser.crossref2Result(crossrefJson);
|
59
|
|
60
|
Assert.assertNull(result.getAccessRights());
|
61
|
Assert.assertNull(result.getBestLicense());
|
62
|
Assert.assertEquals("openaire____::crossref", result.getCollectedFrom());
|
63
|
Assert.assertEquals("10.1523/jneurosci.2900-11.2012", result.getDoi());
|
64
|
Assert.assertNull(result.getOai());
|
65
|
Assert.assertNotNull(result.getOpenaireId());// Assert.assertNull(result.getOpenaireId());
|
66
|
Assert.assertNull(result.getPmcid());
|
67
|
Assert.assertEquals(ClaimUtils.PUBLICATION, result.getResultType());
|
68
|
Assert.assertEquals("Imaging Microglial/Macrophage Activation in Spinal Cords of Experimental Autoimmune Encephalomyelitis Rats by Positron Emission Tomography Using the Mitochondrial 18 kDa Translocator Protein Radioligand [18F]DPA-714", result.getTitle());
|
69
|
Assert.assertEquals("json", result.getRecordFormat());
|
70
|
Assert.assertEquals("https://dx.doi.org/10.1523/jneurosci.2900-11.2012", result.getExternalUrl());
|
71
|
Assert.assertNull(result.getEmbargoEndDate());
|
72
|
Assert.assertNull(result.getOrcidworkid());
|
73
|
|
74
|
Assert.assertEquals(9, result.getAuthors().size());
|
75
|
Assert.assertEquals("G. Abourbeh", result.getAuthors().get(0+""));
|
76
|
Assert.assertEquals("Y. Fontyn", result.getAuthors().get(5+""));
|
77
|
}
|
78
|
|
79
|
private String orcidXml2 = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
|
80
|
"<work:work put-code=\"43079714\" path=\"/0000-0001-5264-4324/work/43079714\" visibility=\"public\" xmlns:internal=\"http://www.orcid.org/ns/internal\" xmlns:funding=\"http://www.orcid.org/ns/funding\" xmlns:preferences=\"http://www.orcid.org/ns/preferences\" xmlns:address=\"http://www.orcid.org/ns/address\" xmlns:education=\"http://www.orcid.org/ns/education\" xmlns:work=\"http://www.orcid.org/ns/work\" xmlns:deprecated=\"http://www.orcid.org/ns/deprecated\" xmlns:other-name=\"http://www.orcid.org/ns/other-name\" xmlns:history=\"http://www.orcid.org/ns/history\" xmlns:employment=\"http://www.orcid.org/ns/employment\" xmlns:error=\"http://www.orcid.org/ns/error\" xmlns:common=\"http://www.orcid.org/ns/common\" xmlns:person=\"http://www.orcid.org/ns/person\" xmlns:activities=\"http://www.orcid.org/ns/activities\" xmlns:record=\"http://www.orcid.org/ns/record\" xmlns:researcher-url=\"http://www.orcid.org/ns/researcher-url\" xmlns:peer-review=\"http://www.orcid.org/ns/peer-review\" xmlns:personal-details=\"http://www.orcid.org/ns/personal-details\" xmlns:bulk=\"http://www.orcid.org/ns/bulk\" xmlns:keyword=\"http://www.orcid.org/ns/keyword\" xmlns:email=\"http://www.orcid.org/ns/email\" xmlns:external-identifier=\"http://www.orcid.org/ns/external-identifier\">\n" +
|
81
|
" <common:created-date>2018-03-29T08:12:17.179Z</common:created-date>\n" +
|
82
|
" <common:last-modified-date>2018-03-29T08:12:17.179Z</common:last-modified-date>\n" +
|
83
|
" <common:source>\n" +
|
84
|
" <common:source-orcid>\n" +
|
85
|
" <common:uri>https://orcid.org/0000-0001-5264-4324</common:uri>\n" +
|
86
|
" <common:path>0000-0001-5264-4324</common:path>\n" +
|
87
|
" <common:host>orcid.org</common:host>\n" +
|
88
|
" </common:source-orcid>\n" +
|
89
|
" <common:source-name>Bastien Mérigot</common:source-name>\n" +
|
90
|
" </common:source>\n" +
|
91
|
" <work:title>\n" +
|
92
|
" <common:title>A three-dimensional view on biodiversity changes: spatial, temporal, and functional perspectives on fish communities in the Baltic Sea</common:title>\n" +
|
93
|
" </work:title>\n" +
|
94
|
" <work:journal-title>ICES Journal of Marine Science</work:journal-title>\n" +
|
95
|
" <work:citation>\n" +
|
96
|
" <work:citation-type>bibtex</work:citation-type>\n" +
|
97
|
" <work:citation-value>@article{doi:10.1093/icesjms/fsy027, author= {Frelat, Romain and Orio, Alessandro and Casini, Michele and Lehmann, Andreas and Mérigot, Bastien and Otto, Saskia A and Sguotti, Camilla and Möllmann, Christian and Handling editor: Marta Coll}, title= {A three-dimensional view on biodiversity changes: spatial, temporal, and functional perspectives on fish communities in the Baltic Sea}, journal= {ICES Journal of Marine Science}, volume= {}, number= {}, pages= {fsy027}, year= {2018}, doi= {10.1093/icesjms/fsy027}, URL= {http://dx.doi.org/10.1093/icesjms/fsy027}, eprint= {/oup/backfile/content_public/journal/icesjms/pap/10.1093_icesjms_fsy027/1/fsy027.pdf}}\n" +
|
98
|
"\n" +
|
99
|
"</work:citation-value>\n" +
|
100
|
" </work:citation>\n" +
|
101
|
" <work:type>journal-article</work:type>\n" +
|
102
|
" <common:publication-date>\n" +
|
103
|
" <common:year>2018</common:year>\n" +
|
104
|
" </common:publication-date>\n" +
|
105
|
" <common:external-ids>\n" +
|
106
|
" <common:external-id>\n" +
|
107
|
" <common:external-id-type>doi</common:external-id-type>\n" +
|
108
|
" <common:external-id-value>10.1093/icesjms/fsy027</common:external-id-value>\n" +
|
109
|
" <common:external-id-relationship>self</common:external-id-relationship>\n" +
|
110
|
" </common:external-id>\n" +
|
111
|
" <common:external-id>\n" +
|
112
|
" <common:external-id-type>arxiv</common:external-id-type>\n" +
|
113
|
" <common:external-id-value>/oup/backfile/content_public/journal/icesjms/pap/10.1093_icesjms_fsy027/1/fsy027.pdf</common:external-id-value>\n" +
|
114
|
" <common:external-id-relationship>self</common:external-id-relationship>\n" +
|
115
|
" </common:external-id>\n" +
|
116
|
" </common:external-ids>\n" +
|
117
|
" <work:url>http://dx.doi.org/10.1093/icesjms/fsy027</work:url>\n" +
|
118
|
" <work:contributors/>\n" +
|
119
|
"</work:work>";
|
120
|
|
121
|
private String orcidXml ="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
|
122
|
"<work:work put-code=\"21755327\" path=\"/0000-0002-9414-646X/work/21755327\" visibility=\"public\" xmlns:internal=\"http://www.orcid.org/ns/internal\" xmlns:funding=\"http://www.orcid.org/ns/funding\" xmlns:preferences=\"http://www.orcid.org/ns/preferences\" xmlns:address=\"http://www.orcid.org/ns/address\" xmlns:education=\"http://www.orcid.org/ns/education\" xmlns:work=\"http://www.orcid.org/ns/work\" xmlns:deprecated=\"http://www.orcid.org/ns/deprecated\" xmlns:other-name=\"http://www.orcid.org/ns/other-name\" xmlns:history=\"http://www.orcid.org/ns/history\" xmlns:employment=\"http://www.orcid.org/ns/employment\" xmlns:error=\"http://www.orcid.org/ns/error\" xmlns:common=\"http://www.orcid.org/ns/common\" xmlns:person=\"http://www.orcid.org/ns/person\" xmlns:activities=\"http://www.orcid.org/ns/activities\" xmlns:record=\"http://www.orcid.org/ns/record\" xmlns:researcher-url=\"http://www.orcid.org/ns/researcher-url\" xmlns:peer-review=\"http://www.orcid.org/ns/peer-review\" xmlns:personal-details=\"http://www.orcid.org/ns/personal-details\" xmlns:bulk=\"http://www.orcid.org/ns/bulk\" xmlns:keyword=\"http://www.orcid.org/ns/keyword\" xmlns:email=\"http://www.orcid.org/ns/email\" xmlns:external-identifier=\"http://www.orcid.org/ns/external-identifier\">\n" +
|
123
|
" <common:created-date>2016-01-22T14:30:35.071Z</common:created-date>\n" +
|
124
|
" <common:last-modified-date>2016-01-22T14:32:26.233Z</common:last-modified-date>\n" +
|
125
|
" <common:source>\n" +
|
126
|
" <common:source-client-id>\n" +
|
127
|
" <common:uri>https://orcid.org/client/0000-0002-3054-1567</common:uri>\n" +
|
128
|
" <common:path>0000-0002-3054-1567</common:path>\n" +
|
129
|
" <common:host>orcid.org</common:host>\n" +
|
130
|
" </common:source-client-id>\n" +
|
131
|
" <common:source-name>Crossref Metadata Search</common:source-name>\n" +
|
132
|
" </common:source>\n" +
|
133
|
" <work:title>\n" +
|
134
|
" <common:title>Providing Ubiquitous Positioning in Outdoor Environments</common:title>\n" +
|
135
|
" </work:title>\n" +
|
136
|
" <work:journal-title>2015 IEEE International Conference on Systems, Man, and Cybernetics</work:journal-title>\n" +
|
137
|
" <work:citation>\n" +
|
138
|
" <work:citation-type>bibtex</work:citation-type>\n" +
|
139
|
" <work:citation-value>@inproceedings{Moreno_2015,doi = {10.1109/smc.2015.229},url = {http://dx.doi.org/10.1109/smc.2015.229},year = 2015,month = {oct},publisher = {Institute of Electrical {\\&} Electronics Engineers ({IEEE})},author = {Daniel Moreno and Sergio F. Ochoa and Roc Meseguer},title = {Providing Ubiquitous Positioning in Outdoor Environments},booktitle = {2015 {IEEE} International Conference on Systems, Man, and Cybernetics}}</work:citation-value>\n" +
|
140
|
" </work:citation>\n" +
|
141
|
" <work:type>conference-paper</work:type>\n" +
|
142
|
" <common:publication-date>\n" +
|
143
|
" <common:year>2015</common:year>\n" +
|
144
|
" <common:month>10</common:month>\n" +
|
145
|
" </common:publication-date>\n" +
|
146
|
" <common:external-ids>\n" +
|
147
|
" <common:external-id>\n" +
|
148
|
" <common:external-id-type>doi</common:external-id-type>\n" +
|
149
|
" <common:external-id-value>10.1109/smc.2015.229</common:external-id-value>\n" +
|
150
|
" <common:external-id-relationship>self</common:external-id-relationship>\n" +
|
151
|
" </common:external-id>\n" +
|
152
|
" </common:external-ids>\n" +
|
153
|
" <work:contributors>\n" +
|
154
|
" <work:contributor>\n" +
|
155
|
" <work:credit-name>Daniel Moreno</work:credit-name>\n" +
|
156
|
" <work:contributor-attributes>\n" +
|
157
|
" <work:contributor-role>author</work:contributor-role>\n" +
|
158
|
" </work:contributor-attributes>\n" +
|
159
|
" </work:contributor>\n" +
|
160
|
" <work:contributor>\n" +
|
161
|
" <work:credit-name>Sergio F. Ochoa</work:credit-name>\n" +
|
162
|
" <work:contributor-attributes>\n" +
|
163
|
" <work:contributor-role>author</work:contributor-role>\n" +
|
164
|
" </work:contributor-attributes>\n" +
|
165
|
" </work:contributor>\n" +
|
166
|
" <work:contributor>\n" +
|
167
|
" <work:credit-name>Roc Meseguer</work:credit-name>\n" +
|
168
|
" <work:contributor-attributes>\n" +
|
169
|
" <work:contributor-role>author</work:contributor-role>\n" +
|
170
|
" </work:contributor-attributes>\n" +
|
171
|
" </work:contributor>\n" +
|
172
|
" </work:contributors>\n" +
|
173
|
"</work:work>";
|
174
|
@Test
|
175
|
public void orcid2ResultTest() {
|
176
|
Result result = ExternalRecordParser.orcid2Result(orcidXml, "0000-0002-9414-646X-21755327");
|
177
|
System.out.println(result);
|
178
|
System.out.println(result.getTitle() + result.getAccessRights());
|
179
|
Assert.assertNull(result.getAccessRights());
|
180
|
Assert.assertNull(result.getBestLicense());
|
181
|
Assert.assertEquals("openaire____::orcid", result.getCollectedFrom());
|
182
|
Assert.assertEquals("10.1109/smc.2015.229", result.getDoi());
|
183
|
Assert.assertEquals("0000-0002-9414-646X-21755327", result.getOrcidworkid());
|
184
|
Assert.assertNull(result.getOai());
|
185
|
Assert.assertNotNull(result.getOpenaireId());// Assert.assertNull(result.getOpenaireId());
|
186
|
Assert.assertNull(result.getPmcid());
|
187
|
Assert.assertEquals(ClaimUtils.PUBLICATION, result.getResultType());
|
188
|
Assert.assertEquals("Providing Ubiquitous Positioning in Outdoor Environments", result.getTitle());
|
189
|
Assert.assertEquals("xml", result.getRecordFormat());
|
190
|
Assert.assertEquals("https://dx.doi.org/10.1109/smc.2015.229", result.getExternalUrl());
|
191
|
Assert.assertNull(result.getEmbargoEndDate());
|
192
|
|
193
|
}
|
194
|
@Test
|
195
|
public void orcidSecond2ResultTest() throws Exception {
|
196
|
String id = "0000-0002-3477-3082-5288650";
|
197
|
Result result = ExternalRecordParser.orcid2Result(searchUtils.fetchResultXMLFromOrcid(id),id);
|
198
|
System.out.println(result);
|
199
|
id = "0000-0002-3477-3082-5288651";
|
200
|
result = ExternalRecordParser.orcid2Result(searchUtils.fetchResultXMLFromOrcid(id),id);
|
201
|
System.out.println(result);
|
202
|
// System.out.println(result.getTitle() + result.getAccessRights());
|
203
|
Assert.assertNull(result.getAccessRights());
|
204
|
Assert.assertNull(result.getBestLicense());
|
205
|
Assert.assertEquals("openaire____::orcid", result.getCollectedFrom());
|
206
|
// Assert.assertEquals("10.1109/smc.2015.229", result.getDoi());
|
207
|
Assert.assertEquals(id, result.getOrcidworkid());
|
208
|
Assert.assertNull(result.getOai());
|
209
|
Assert.assertNotNull(result.getOpenaireId());// Assert.assertNull(result.getOpenaireId());
|
210
|
Assert.assertNull(result.getPmcid());
|
211
|
Assert.assertEquals(ClaimUtils.PUBLICATION, result.getResultType());
|
212
|
// Assert.assertEquals("A Survey of Context-Aware Cross-Digital Library Personalization\n", result.getTitle());
|
213
|
Assert.assertEquals("xml", result.getRecordFormat());
|
214
|
// Assert.assertEquals("https://dx.doi.org/10.1007/978-3-642-27169-4_2", result.getExternalUrl());
|
215
|
Assert.assertNull(result.getEmbargoEndDate());
|
216
|
|
217
|
}
|
218
|
@Test
|
219
|
public void orcid2Result2Test() {
|
220
|
Result result = ExternalRecordParser.orcid2Result(orcidXml2, "0000-0001-5264-4324-43079714");
|
221
|
System.out.println(result);
|
222
|
Assert.assertNull(result.getAccessRights());
|
223
|
Assert.assertNull(result.getBestLicense());
|
224
|
Assert.assertEquals("openaire____::orcid", result.getCollectedFrom());
|
225
|
Assert.assertEquals("10.1093/icesjms/fsy027", result.getDoi());
|
226
|
Assert.assertEquals("0000-0001-5264-4324-43079714", result.getOrcidworkid());
|
227
|
Assert.assertNull(result.getOai());
|
228
|
Assert.assertNotNull(result.getOpenaireId());// Assert.assertNull(result.getOpenaireId());
|
229
|
Assert.assertNull(result.getPmcid());
|
230
|
Assert.assertEquals(ClaimUtils.PUBLICATION, result.getResultType());
|
231
|
Assert.assertEquals("A three-dimensional view on biodiversity changes: spatial, temporal, and functional perspectives on fish communities in the Baltic Sea", result.getTitle());
|
232
|
Assert.assertEquals("xml", result.getRecordFormat());
|
233
|
Assert.assertEquals("https://dx.doi.org/10.1093/icesjms/fsy027", result.getExternalUrl());
|
234
|
Assert.assertNull(result.getEmbargoEndDate());
|
235
|
|
236
|
}
|
237
|
|
238
|
|
239
|
|
240
|
private String dataciteXml = "<rdf:RDF\n" +
|
241
|
" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n" +
|
242
|
" xmlns:owl=\"http://www.w3.org/2002/07/owl#\"\n" +
|
243
|
" xmlns:j.0=\"http://purl.org/dc/terms/\" > \n" +
|
244
|
" <rdf:Description rdf:about=\"http://dx.doi.org/10.5060/D4RN35SD/USGS85K1_041\">\n" +
|
245
|
" <j.0:creator>Krimmel, Robert</j.0:creator>\n" +
|
246
|
" <j.0:publisher>National Snow and Ice Data Center/World Data Center for Glaciology, Boulder</j.0:publisher>\n" +
|
247
|
" <j.0:title>Chocolate Glacier</j.0:title>\n" +
|
248
|
" <j.0:date>2008</j.0:date>\n" +
|
249
|
" <owl:sameAs>doi:10.5060/D4RN35SD/USGS85K1_041</owl:sameAs>\n" +
|
250
|
" <owl:sameAs>info:doi/10.5060/D4RN35SD/USGS85K1_041</owl:sameAs>\n" +
|
251
|
" <j.0:identifier>10.5060/D4RN35SD/USGS85K1_041</j.0:identifier>\n" +
|
252
|
" </rdf:Description>\n" +
|
253
|
"</rdf:RDF>\n";
|
254
|
|
255
|
private String dataciteJson = "{\"data\":{\"id\":\"https://doi.org/10.5281/ZENODO.54730\",\"type\":\"works\",\"attributes\":{\"doi\":\"10.5281/ZENODO.54730\",\"url\":null,\"author\":[{\"family\":\"Manola\",\"given\":\"Natalia\"}],\"title\":\"From Open Access to Open Science\",\"container-title\":\"Zenodo\",\"description\":\"Presentation given at the PASTEUR4OA conference - Green Light for Open Access: Aligning Europe’s OA Policies, Amsterdam, 17th-18th May 2016.\",\"resource-type-subtype\":\"Presentation\",\"data-center-id\":\"cern.zenodo\",\"member-id\":\"cern\",\"resource-type-id\":\"text\",\"version\":null,\"license\":\"https://creativecommons.org/licenses/by/4.0/\",\"schema-version\":\"3\",\"results\":[],\"related-identifiers\":[],\"published\":\"2016\",\"deposited\":\"2016-06-03T17:03:51Z\",\"updated\":\"2016-06-03T17:03:51Z\",\"media\":null,\"xml\":\"PHJlc291cmNlIHhtbG5zPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtMyIgeG1sbnM6eHNpPSJodH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PSJpbmZvOmV1LXJlcG8vc2VtYW50aWNzL29wZW5BY2Nlc3MiPk9wZW4gQWNjZXNzPC9yaWdodHM+CiAgICA8cmlnaHRzIHJpZ2h0c1VSST0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbGljZW5zZXMvYnkvNC4wLyI+Q3JlYXRpdmUgQ29tbW9ucyBBdHRyaWJ1dGlvbiA0LjAgSW50ZXJuYXRpb25hbDwvcmlnaHRzPgogIDwvcmlnaHRzTGlzdD4KICA8ZGVzY3JpcHRpb25zPgogICAgPGRlc2NyaXB0aW9uIGRlc2NyaXB0aW9uVHlwZT0iQWJzdHJhY3QiPiZsdDtwJmd0O1ByZXNlbnRhdGlvbiBnaXZlbiBhdCB0aGUgUEFTVEVVUjRPQSBjb25mZXJlbmNlIC0mYW1wO25ic3A7R3JlZW4gTGlnaHQgZm9yIE9wZW4gQWNjZXNzOiBBbGlnbmluZyBFdXJvcGUmYW1wO3JzcXVvO3MgT0EgUG9saWNpZXMsIEFtc3RlcmRhbSwgMTd0aC0xOHRoIE1heSAyMDE2LiZsdDsvcCZndDs8L2Rlc2NyaXB0aW9uPgogIDwvZGVzY3JpcHRpb25zPgo8L3Jlc291cmNlPgo=\"},\"relationships\":{\"data-center\":{\"meta\":{}},\"member\":{\"meta\":{}},\"resource-type\":{\"meta\":{}}}}}";
|
256
|
|
257
|
@Test
|
258
|
public void datacite2ResultTest() {
|
259
|
Result result = ExternalRecordParser.datacite2Result(dataciteXml);
|
260
|
|
261
|
Assert.assertNull(result.getAccessRights());
|
262
|
Assert.assertNull(result.getBestLicense());
|
263
|
Assert.assertEquals("openaire____::datacite", result.getCollectedFrom());
|
264
|
Assert.assertEquals("10.5060/D4RN35SD/USGS85K1_041", result.getDoi());
|
265
|
Assert.assertNull(result.getOrcidworkid());
|
266
|
Assert.assertNull(result.getOai());
|
267
|
Assert.assertNotNull(result.getOpenaireId());// Assert.assertNull(result.getOpenaireId());
|
268
|
Assert.assertNull(result.getPmcid());
|
269
|
Assert.assertEquals(ClaimUtils.DATASET, result.getResultType());
|
270
|
Assert.assertEquals("Chocolate Glacier", result.getTitle());
|
271
|
Assert.assertEquals("xml", result.getRecordFormat());
|
272
|
Assert.assertEquals("http://dx.doi.org/10.5060/D4RN35SD/USGS85K1_041", result.getExternalUrl());
|
273
|
Assert.assertNull(result.getEmbargoEndDate());
|
274
|
|
275
|
}
|
276
|
|
277
|
@Test
|
278
|
public void dataciteJsonResultTest() {
|
279
|
Result result = ExternalRecordParser.dataciteJson2Result(dataciteJson);
|
280
|
|
281
|
Assert.assertNull(result.getAccessRights());
|
282
|
Assert.assertNull(result.getBestLicense());
|
283
|
Assert.assertEquals("openaire____::datacite", result.getCollectedFrom());
|
284
|
Assert.assertEquals("10.5281/ZENODO.54730", result.getDoi());
|
285
|
Assert.assertNull(result.getOrcidworkid());
|
286
|
Assert.assertNull(result.getOai());
|
287
|
Assert.assertNotNull(result.getOpenaireId());// Assert.assertNull(result.getOpenaireId());
|
288
|
Assert.assertNull(result.getPmcid());
|
289
|
Assert.assertEquals(ClaimUtils.DATASET, result.getResultType());
|
290
|
Assert.assertEquals("From Open Access to Open Science", result.getTitle());
|
291
|
Assert.assertEquals("json", result.getRecordFormat());
|
292
|
Assert.assertEquals("https://dx.doi.org/10.5281/ZENODO.54730", result.getExternalUrl());
|
293
|
Assert.assertNull(result.getEmbargoEndDate());
|
294
|
|
295
|
}
|
296
|
@Test
|
297
|
public void testMD5() throws Exception {
|
298
|
String id = "10.1016/j.engstruct.2013.03.014";
|
299
|
String createdId = ExternalRecordParser.createOpenaireId(id);
|
300
|
String openaireId = "userclaim___::07ec9eb2278a11e352e3fa93a621411d";
|
301
|
Assert.assertEquals(createdId,openaireId);
|
302
|
|
303
|
}
|
304
|
}
|