1
|
package eu.dnetlib.data.claims.migration.parser;
|
2
|
|
3
|
import eu.dnetlib.data.claims.migration.entity.Result;
|
4
|
import eu.dnetlib.data.claimsDemo.ClaimUtils;
|
5
|
import org.apache.log4j.BasicConfigurator;
|
6
|
import org.junit.Assert;
|
7
|
import org.junit.Before;
|
8
|
import org.junit.Test;
|
9
|
|
10
|
/**
|
11
|
* Created by kiatrop on 23/2/2016.
|
12
|
*/
|
13
|
public class ExternalParserTest {
|
14
|
|
15
|
|
16
|
@Before
|
17
|
public void init() throws Exception {
|
18
|
BasicConfigurator.configure();
|
19
|
}
|
20
|
private String crossrefJson = "{\"status\":\"ok\",\"message-type\":\"work-list\",\"message-version\":\"1.0.0\",\"message\":" +
|
21
|
"{\"query\":{\"search-terms\":null,\"start-index\":0},\"items-per-page\":20,\"items\":[{\"indexed\":" +
|
22
|
"{\"date-parts\":[[2015,12,28]], \"date-time\":\"2015-12-28T17:45:59Z\",\"timestamp\":1451324759779}," +
|
23
|
"\"reference-count\":0,\"publisher\":\"Society for Neuroscience\", \"issue\":\"17\"," +
|
24
|
"\"published-print\":{\"date-parts\":[[2012,4,25]]},\"DOI\":\"10.1523\\/jneurosci.2900-11.2012\"," +
|
25
|
"\"type\":\"journal-article\",\"created\": {\"date-parts\":[[2012,4,25]]," +
|
26
|
"\"date-time\":\"2012-04-25T16:38:54Z\",\"timestamp\":1335371934000},\"page\":\"5728-5736\"," +
|
27
|
"\"source\":\"CrossRef\",\"title\":[\"Imaging Microglial\\/Macrophage Activation in Spinal Cords of " +
|
28
|
"Experimental Autoimmune Encephalomyelitis Rats by Positron Emission Tomography Using the Mitochondrial " +
|
29
|
"18 kDa Translocator Protein Radioligand [18F]DPA-714\"]," +
|
30
|
"\"prefix\":\"http:\\/\\/id.crossref.org\\/prefix\\/10.1523\",\"volume\":\"32\",\"author\":" +
|
31
|
"[{\"affiliation\":[],\"family\":\"Abourbeh\",\"given\":\"G.\"},{\"affiliation\":[],\"family\":\"Theze\"," +
|
32
|
"\"given\":\"B.\"},{\"affiliation\":[],\"family\":\"Maroy\",\"given\":\"R.\"},{\"affiliation\":[],\"family\":" +
|
33
|
"\"Dubois\",\"given\":\"A.\"},{\"affiliation\":[],\"family\":\"Brulon\",\"given\":\"V.\"}," +
|
34
|
"{\"affiliation\":[],\"family\":\"Fontyn\",\"given\":\"Y.\"},{\"affiliation\":[],\"family\":\"Dolle\"," +
|
35
|
"\"given\":\"F.\"},{\"affiliation\":[],\"family\":\"Tavitian\",\"given\":\"B.\"},{\"affiliation\":[]," +
|
36
|
"\"family\":\"Boisgard\",\"given\":\"R.\"}],\"member\":\"http:\\/\\/id.crossref.org\\/member\\/393\"," +
|
37
|
"\"published-online\":{\"date-parts\":[[2012,4,25]]},\"container-title\":[\"Journal of Neuroscience\"]," +
|
38
|
"\"deposited\":{\"date-parts\":[[2014,2,27]],\"date-time\":\"2014-02-27T06:42:02Z\",\"timestamp\":1393483322000}," +
|
39
|
"\"score\":1.0,\"subtitle\":[],\"issued\":{\"date-parts\":[[2012,4,25]]}," +
|
40
|
"\"URL\":\"http:\\/\\/dx.doi.org\\/10.1523\\/jneurosci.2900-11.2012\",\"ISSN\":[\"0270-6474\",\"1529-2401\"]," +
|
41
|
"\"subject\":[\"Neuroscience(all)\"]}],\"total-results\":1,\"facets\":{}}}" +
|
42
|
"";
|
43
|
|
44
|
|
45
|
@Test
|
46
|
public void crossref2ResultTest(){
|
47
|
Result result = ExternalRecordParser.crossref2Result(crossrefJson);
|
48
|
|
49
|
Assert.assertNull(result.getAccessRights());
|
50
|
Assert.assertNull(result.getBestLicense());
|
51
|
Assert.assertEquals("openaire____::crossref", result.getCollectedFrom());
|
52
|
Assert.assertEquals("10.1523/jneurosci.2900-11.2012", result.getDoi());
|
53
|
Assert.assertNull(result.getOai());
|
54
|
Assert.assertNotNull(result.getOpenaireId());// Assert.assertNull(result.getOpenaireId());
|
55
|
Assert.assertNull(result.getPmcid());
|
56
|
Assert.assertEquals(ClaimUtils.PUBLICATION, result.getResultType());
|
57
|
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());
|
58
|
Assert.assertEquals("json", result.getRecordFormat());
|
59
|
Assert.assertEquals("https://dx.doi.org/10.1523/jneurosci.2900-11.2012", result.getExternalUrl());
|
60
|
Assert.assertNull(result.getEmbargoEndDate());
|
61
|
Assert.assertNull(result.getOrcidworkid());
|
62
|
|
63
|
Assert.assertEquals(9, result.getAuthors().size());
|
64
|
Assert.assertEquals("G. Abourbeh", result.getAuthors().get(0+""));
|
65
|
Assert.assertEquals("Y. Fontyn", result.getAuthors().get(5+""));
|
66
|
}
|
67
|
|
68
|
private String orcidXml = "<orcid-message xmlns=\"http://www.orcid.org/ns/orcid\">\n" +
|
69
|
" <message-version>1.1</message-version>\n" +
|
70
|
" <orcid-profile type=\"user\">\n" +
|
71
|
" <orcid-identifier>\n" +
|
72
|
" <uri>http://orcid.org/0000-0002-9414-646X</uri>\n" +
|
73
|
" <path>0000-0002-9414-646X</path>\n" +
|
74
|
" <host>orcid.org</host>\n" +
|
75
|
" </orcid-identifier>\n" +
|
76
|
" <orcid-preferences>\n" +
|
77
|
" <locale>es</locale>\n" +
|
78
|
" </orcid-preferences>\n" +
|
79
|
" <orcid-history>\n" +
|
80
|
" <creation-method>website</creation-method>\n" +
|
81
|
" <completion-date>2013-01-11T14:07:54.194Z</completion-date>\n" +
|
82
|
" <submission-date>2013-01-11T13:27:46.558Z</submission-date>\n" +
|
83
|
" <last-modified-date>2016-01-27T16:06:13.543Z</last-modified-date>\n" +
|
84
|
" <claimed>true</claimed>\n" +
|
85
|
" </orcid-history>\n" +
|
86
|
" <orcid-activities>\n" +
|
87
|
" <orcid-works>\n" +
|
88
|
" <orcid-work put-code=\"21755327\" visibility=\"public\">\n" +
|
89
|
" <work-title>\n" +
|
90
|
" <title>Providing Ubiquitous Positioning in Outdoor Environments</title>\n" +
|
91
|
" </work-title>\n" +
|
92
|
" <journal-title>2015 IEEE International Conference on Systems, Man, and Cybernetics</journal-title>\n" +
|
93
|
" <work-citation>\n" +
|
94
|
" <work-citation-type>bibtex</work-citation-type>\n" +
|
95
|
" <citation>@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}}</citation>\n" +
|
96
|
" </work-citation>\n" +
|
97
|
" <work-type>conference-paper</work-type>\n" +
|
98
|
" <publication-date>\n" +
|
99
|
" <year>2015</year>\n" +
|
100
|
" <month>10</month>\n" +
|
101
|
" </publication-date>\n" +
|
102
|
" <work-external-identifiers>\n" +
|
103
|
" <work-external-identifier>\n" +
|
104
|
" <work-external-identifier-type>doi</work-external-identifier-type>\n" +
|
105
|
" <work-external-identifier-id>10.1109/smc.2015.229</work-external-identifier-id>\n" +
|
106
|
" </work-external-identifier>\n" +
|
107
|
" </work-external-identifiers>\n" +
|
108
|
" <work-contributors>\n" +
|
109
|
" <contributor>\n" +
|
110
|
" <credit-name visibility=\"public\">Daniel Moreno</credit-name>\n" +
|
111
|
" <contributor-attributes>\n" +
|
112
|
" <contributor-role>author</contributor-role>\n" +
|
113
|
" </contributor-attributes>\n" +
|
114
|
" </contributor>\n" +
|
115
|
" <contributor>\n" +
|
116
|
" <credit-name visibility=\"public\">Sergio F. Ochoa</credit-name>\n" +
|
117
|
" <contributor-attributes>\n" +
|
118
|
" <contributor-role>author</contributor-role>\n" +
|
119
|
" </contributor-attributes>\n" +
|
120
|
" </contributor>\n" +
|
121
|
" <contributor>\n" +
|
122
|
" <credit-name visibility=\"public\">Roc Meseguer</credit-name>\n" +
|
123
|
" <contributor-attributes>\n" +
|
124
|
" <contributor-role>author</contributor-role>\n" +
|
125
|
" </contributor-attributes>\n" +
|
126
|
" </contributor>\n" +
|
127
|
" </work-contributors>\n" +
|
128
|
" <work-source>\n" +
|
129
|
" <uri>http://orcid.org/0000-0002-3054-1567</uri>\n" +
|
130
|
" <path>0000-0002-3054-1567</path>\n" +
|
131
|
" <host>orcid.org</host>\n" +
|
132
|
" </work-source>\n" +
|
133
|
" </orcid-work>\n" +
|
134
|
" <orcid-work put-code=\"19191618\" visibility=\"public\">\n" +
|
135
|
" <work-title>\n" +
|
136
|
" <title>A Context-Aware Model to Provide Positioning in Disaster Relief Scenarios</title>\n" +
|
137
|
" </work-title>\n" +
|
138
|
" <journal-title>Sensors</journal-title>\n" +
|
139
|
" <work-citation>\n" +
|
140
|
" <work-citation-type>bibtex</work-citation-type>\n" +
|
141
|
" <citation>@article{Moreno_2015,doi = {10.3390/s151025176},url = {http://dx.doi.org/10.3390/s151025176},year = 2015,month = {sep},publisher = {{MDPI} {AG}},volume = {15},number = {10},pages = {25176--25207},author = {Daniel Moreno and Sergio Ochoa and Roc Meseguer},title = {A Context-Aware Model to Provide Positioning in Disaster Relief Scenarios},journal = {Sensors}}</citation>\n" +
|
142
|
" </work-citation>\n" +
|
143
|
" <work-type>journal-article</work-type>\n" +
|
144
|
" <publication-date>\n" +
|
145
|
" <year>2015</year>\n" +
|
146
|
" <month>09</month>\n" +
|
147
|
" </publication-date>\n" +
|
148
|
" <work-external-identifiers>\n" +
|
149
|
" <work-external-identifier>\n" +
|
150
|
" <work-external-identifier-type>doi</work-external-identifier-type>\n" +
|
151
|
" <work-external-identifier-id>10.3390/s151025176</work-external-identifier-id>\n" +
|
152
|
" </work-external-identifier>\n" +
|
153
|
" </work-external-identifiers>\n" +
|
154
|
" <work-contributors>\n" +
|
155
|
" <contributor>\n" +
|
156
|
" <credit-name visibility=\"public\">Daniel Moreno</credit-name>\n" +
|
157
|
" <contributor-attributes>\n" +
|
158
|
" <contributor-role>author</contributor-role>\n" +
|
159
|
" </contributor-attributes>\n" +
|
160
|
" </contributor>\n" +
|
161
|
" <contributor>\n" +
|
162
|
" <credit-name visibility=\"public\">Sergio Ochoa</credit-name>\n" +
|
163
|
" <contributor-attributes>\n" +
|
164
|
" <contributor-role>author</contributor-role>\n" +
|
165
|
" </contributor-attributes>\n" +
|
166
|
" </contributor>\n" +
|
167
|
" <contributor>\n" +
|
168
|
" <credit-name visibility=\"public\">Roc Meseguer</credit-name>\n" +
|
169
|
" <contributor-attributes>\n" +
|
170
|
" <contributor-role>author</contributor-role>\n" +
|
171
|
" </contributor-attributes>\n" +
|
172
|
" </contributor>\n" +
|
173
|
" </work-contributors>\n" +
|
174
|
" <work-source>\n" +
|
175
|
" <uri>http://orcid.org/0000-0002-3054-1567</uri>\n" +
|
176
|
" <path>0000-0002-3054-1567</path>\n" +
|
177
|
" <host>orcid.org</host>\n" +
|
178
|
" </work-source>\n" +
|
179
|
" </orcid-work>" +
|
180
|
"</orcid-works></orcid-activities></orcid-profile></orcid-message>";
|
181
|
|
182
|
@Test
|
183
|
public void orcid2ResultTest() {
|
184
|
Result result = ExternalRecordParser.orcid2Result(orcidXml, "0000-0002-9414-646X-21755327");
|
185
|
|
186
|
Assert.assertNull(result.getAccessRights());
|
187
|
Assert.assertNull(result.getBestLicense());
|
188
|
Assert.assertEquals("openaire____::orcid", result.getCollectedFrom());
|
189
|
Assert.assertEquals("10.1109/smc.2015.229", result.getDoi());
|
190
|
Assert.assertEquals("0000-0002-9414-646X-21755327", result.getOrcidworkid());
|
191
|
Assert.assertNull(result.getOai());
|
192
|
Assert.assertNotNull(result.getOpenaireId());// Assert.assertNull(result.getOpenaireId());
|
193
|
Assert.assertNull(result.getPmcid());
|
194
|
Assert.assertEquals(ClaimUtils.PUBLICATION, result.getResultType());
|
195
|
Assert.assertEquals("Providing Ubiquitous Positioning in Outdoor Environments", result.getTitle());
|
196
|
Assert.assertEquals("xml", result.getRecordFormat());
|
197
|
Assert.assertEquals("https://dx.doi.org/10.1109/smc.2015.229", result.getExternalUrl());
|
198
|
Assert.assertNull(result.getEmbargoEndDate());
|
199
|
|
200
|
}
|
201
|
|
202
|
|
203
|
private String dataciteXml = "<rdf:RDF\n" +
|
204
|
" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n" +
|
205
|
" xmlns:owl=\"http://www.w3.org/2002/07/owl#\"\n" +
|
206
|
" xmlns:j.0=\"http://purl.org/dc/terms/\" > \n" +
|
207
|
" <rdf:Description rdf:about=\"http://dx.doi.org/10.5060/D4RN35SD/USGS85K1_041\">\n" +
|
208
|
" <j.0:creator>Krimmel, Robert</j.0:creator>\n" +
|
209
|
" <j.0:publisher>National Snow and Ice Data Center/World Data Center for Glaciology, Boulder</j.0:publisher>\n" +
|
210
|
" <j.0:title>Chocolate Glacier</j.0:title>\n" +
|
211
|
" <j.0:date>2008</j.0:date>\n" +
|
212
|
" <owl:sameAs>doi:10.5060/D4RN35SD/USGS85K1_041</owl:sameAs>\n" +
|
213
|
" <owl:sameAs>info:doi/10.5060/D4RN35SD/USGS85K1_041</owl:sameAs>\n" +
|
214
|
" <j.0:identifier>10.5060/D4RN35SD/USGS85K1_041</j.0:identifier>\n" +
|
215
|
" </rdf:Description>\n" +
|
216
|
"</rdf:RDF>\n";
|
217
|
|
218
|
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\":\"PHJlc291cmNlIHhtbG5zPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtMyIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtMyBodHRwOi8vc2NoZW1hLmRhdGFjaXRlLm9yZy9tZXRhL2tlcm5lbC0zL21ldGFkYXRhLnhzZCI+CiAgPGlkZW50aWZpZXIgaWRlbnRpZmllclR5cGU9IkRPSSI+MTAuNTI4MS96ZW5vZG8uNTQ3MzA8L2lkZW50aWZpZXI+CiAgPGNyZWF0b3JzPgogICAgPGNyZWF0b3I+CiAgICAgIDxjcmVhdG9yTmFtZT5NYW5vbGEsIE5hdGFsaWEgPC9jcmVhdG9yTmFtZT4KICAgICAgPGFmZmlsaWF0aW9uPk9wZW5BSVJFPC9hZmZpbGlhdGlvbj4KICAgIDwvY3JlYXRvcj4KICA8L2NyZWF0b3JzPgogIDx0aXRsZXM+CiAgICA8dGl0bGU+RnJvbSBPcGVuIEFjY2VzcyB0byBPcGVuIFNjaWVuY2U8L3RpdGxlPgogIDwvdGl0bGVzPgogIDxwdWJsaXNoZXI+WmVub2RvPC9wdWJsaXNoZXI+CiAgPHB1YmxpY2F0aW9uWWVhcj4yMDE2PC9wdWJsaWNhdGlvblllYXI+CiAgPHN1YmplY3RzPgogICAgPHN1YmplY3Q+UEFTVEVVUjRPQTwvc3ViamVjdD4KICAgIDxzdWJqZWN0Pk9wZW4gQWNjZXNzPC9zdWJqZWN0PgogICAgPHN1YmplY3Q+UHJlc2VudGF0aW9uPC9zdWJqZWN0PgogIDwvc3ViamVjdHM+CiAgPGNvbnRyaWJ1dG9ycz4KICAgIDxjb250cmlidXRvciBjb250cmlidXRvclR5cGU9IkZ1bmRlciI+CiAgICAgIDxjb250cmlidXRvck5hbWU+RXVyb3BlYW4gQ29tbWlzc2lvbjwvY29udHJpYnV0b3JOYW1lPgogICAgICA8bmFtZUlkZW50aWZpZXIgbmFtZUlkZW50aWZpZXJTY2hlbWU9ImluZm8iPmluZm86ZXUtcmVwby9ncmFudEFncmVlbWVudC9FQy9GUDcvNjExNzQyPC9uYW1lSWRlbnRpZmllcj4KICAgIDwvY29udHJpYnV0b3I+CiAgPC9jb250cmlidXRvcnM+CiAgPGRhdGVzPgogICAgPGRhdGUgZGF0ZVR5cGU9Iklzc3VlZCI+MjAxNi0wNS0xODwvZGF0ZT4KICA8L2RhdGVzPgogIDxyZXNvdXJjZVR5cGUgcmVzb3VyY2VUeXBlR2VuZXJhbD0iVGV4dCI+UHJlc2VudGF0aW9uPC9yZXNvdXJjZVR5cGU+CiAgPGFsdGVybmF0ZUlkZW50aWZpZXJzPgogICAgPGFsdGVybmF0ZUlkZW50aWZpZXIgYWx0ZXJuYXRlSWRlbnRpZmllclR5cGU9IlVSTCI+aHR0cDovL3plbm9kby5vcmcvcmVjb3JkLzU0NzMwPC9hbHRlcm5hdGVJZGVudGlmaWVyPgogICAgPGFsdGVybmF0ZUlkZW50aWZpZXIgYWx0ZXJuYXRlSWRlbnRpZmllclR5cGU9IlVSTCI+aHR0cDovL3d3dy5wYXN0ZXVyNG9hLmV1L3NpdGVzL3Bhc3RldXI0b2EvZmlsZXMvZ2VuZXJpYy9OYXRhbGlhJTIwTWFub2xhJTIwUERGLnBkZjwvYWx0ZXJuYXRlSWRlbnRpZmllcj4KICA8L2FsdGVybmF0ZUlkZW50aWZpZXJzPgogIDxyZWxhdGVkSWRlbnRpZmllcnM+CiAgICA8cmVsYXRlZElkZW50aWZpZXIgcmVsYXRpb25UeXBlPSJIYXNQYXJ0IiByZWxhdGVkSWRlbnRpZmllclR5cGU9IlVSTCI+aHR0cHM6Ly96ZW5vZG8ub3JnL3JlY29yZC81NDczMC9maWxlcy8xOF9OYXRhbGlhX01hbm9sYV9QREYucGRmPC9yZWxhdGVkSWRlbnRpZmllcj4KICA8L3JlbGF0ZWRJZGVudGlmaWVycz4KICA8cmlnaHRzTGlzdD4KICAgIDxyaWdodHMgcmlnaHRzVVJJPSJpbmZvOmV1LXJlcG8vc2VtYW50aWNzL29wZW5BY2Nlc3MiPk9wZW4gQWNjZXNzPC9yaWdodHM+CiAgICA8cmlnaHRzIHJpZ2h0c1VSST0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbGljZW5zZXMvYnkvNC4wLyI+Q3JlYXRpdmUgQ29tbW9ucyBBdHRyaWJ1dGlvbiA0LjAgSW50ZXJuYXRpb25hbDwvcmlnaHRzPgogIDwvcmlnaHRzTGlzdD4KICA8ZGVzY3JpcHRpb25zPgogICAgPGRlc2NyaXB0aW9uIGRlc2NyaXB0aW9uVHlwZT0iQWJzdHJhY3QiPiZsdDtwJmd0O1ByZXNlbnRhdGlvbiBnaXZlbiBhdCB0aGUgUEFTVEVVUjRPQSBjb25mZXJlbmNlIC0mYW1wO25ic3A7R3JlZW4gTGlnaHQgZm9yIE9wZW4gQWNjZXNzOiBBbGlnbmluZyBFdXJvcGUmYW1wO3JzcXVvO3MgT0EgUG9saWNpZXMsIEFtc3RlcmRhbSwgMTd0aC0xOHRoIE1heSAyMDE2LiZsdDsvcCZndDs8L2Rlc2NyaXB0aW9uPgogIDwvZGVzY3JpcHRpb25zPgo8L3Jlc291cmNlPgo=\"},\"relationships\":{\"data-center\":{\"meta\":{}},\"member\":{\"meta\":{}},\"resource-type\":{\"meta\":{}}}}}";
|
219
|
|
220
|
@Test
|
221
|
public void datacite2ResultTest() {
|
222
|
Result result = ExternalRecordParser.datacite2Result(dataciteXml);
|
223
|
|
224
|
Assert.assertNull(result.getAccessRights());
|
225
|
Assert.assertNull(result.getBestLicense());
|
226
|
Assert.assertEquals("openaire____::datacite", result.getCollectedFrom());
|
227
|
Assert.assertEquals("10.5060/D4RN35SD/USGS85K1_041", result.getDoi());
|
228
|
Assert.assertNull(result.getOrcidworkid());
|
229
|
Assert.assertNull(result.getOai());
|
230
|
Assert.assertNotNull(result.getOpenaireId());// Assert.assertNull(result.getOpenaireId());
|
231
|
Assert.assertNull(result.getPmcid());
|
232
|
Assert.assertEquals(ClaimUtils.DATASET, result.getResultType());
|
233
|
Assert.assertEquals("Chocolate Glacier", result.getTitle());
|
234
|
Assert.assertEquals("xml", result.getRecordFormat());
|
235
|
Assert.assertEquals("http://dx.doi.org/10.5060/D4RN35SD/USGS85K1_041", result.getExternalUrl());
|
236
|
Assert.assertNull(result.getEmbargoEndDate());
|
237
|
|
238
|
}
|
239
|
|
240
|
@Test
|
241
|
public void dataciteJsonResultTest() {
|
242
|
Result result = ExternalRecordParser.dataciteJson2Result(dataciteJson);
|
243
|
|
244
|
Assert.assertNull(result.getAccessRights());
|
245
|
Assert.assertNull(result.getBestLicense());
|
246
|
Assert.assertEquals("openaire____::datacite", result.getCollectedFrom());
|
247
|
Assert.assertEquals("10.5281/ZENODO.54730", result.getDoi());
|
248
|
Assert.assertNull(result.getOrcidworkid());
|
249
|
Assert.assertNull(result.getOai());
|
250
|
Assert.assertNotNull(result.getOpenaireId());// Assert.assertNull(result.getOpenaireId());
|
251
|
Assert.assertNull(result.getPmcid());
|
252
|
Assert.assertEquals(ClaimUtils.DATASET, result.getResultType());
|
253
|
Assert.assertEquals("From Open Access to Open Science", result.getTitle());
|
254
|
Assert.assertEquals("json", result.getRecordFormat());
|
255
|
Assert.assertEquals("https://dx.doi.org/10.5281/ZENODO.54730", result.getExternalUrl());
|
256
|
Assert.assertNull(result.getEmbargoEndDate());
|
257
|
|
258
|
}
|
259
|
@Test
|
260
|
public void testMD5() throws Exception {
|
261
|
String id = "10.1016/j.engstruct.2013.03.014";
|
262
|
String createdId = ExternalRecordParser.createOpenaireId(id);
|
263
|
String openaireId = "userclaim___::07ec9eb2278a11e352e3fa93a621411d";
|
264
|
Assert.assertEquals(createdId,openaireId);
|
265
|
|
266
|
}
|
267
|
}
|