Project

General

Profile

« Previous | Next » 

Revision 58341

ClaimEntity: Add information about the dashboard where the claim was created

Properties:
add properties for the different services
create beans properly
production or beta is decided from the services urls in properties

Migration:
create migration method: CopyFromBetaToProduction for communities

View differences:

ExternalParserTest.java
1 1
package eu.dnetlib.data.claims.parser;
2 2

  
3 3
import eu.dnetlib.data.claims.entity.Result;
4
import eu.dnetlib.data.claims.handler.DirectIndexHandler;
4 5
import eu.dnetlib.data.claims.utils.ClaimUtils;
6
import eu.dnetlib.data.claims.utils.SearchUtils;
5 7
import org.apache.log4j.BasicConfigurator;
6 8
import org.junit.Assert;
7 9
import org.junit.Before;
8 10
import org.junit.Test;
11
import org.springframework.beans.factory.annotation.Autowired;
12
import org.springframework.context.ApplicationContext;
13
import org.springframework.context.support.ClassPathXmlApplicationContext;
9 14

  
10 15
/**
11 16
 * Created by kiatrop on 23/2/2016.
12 17
 */
13 18
public class ExternalParserTest {
19
//    @Autowired
20
    SearchUtils searchUtils;
14 21

  
15

  
16 22
    @Before
17 23
    public void init() throws Exception {
18 24
        BasicConfigurator.configure();
25
        ApplicationContext context = new ClassPathXmlApplicationContext("eu/dnetlib/data/claims/springContext-claims.xml");
26

  
27
        searchUtils = context.getBean(SearchUtils.class);
28

  
19 29
    }
20 30
    private String crossrefJson = "{\"status\":\"ok\",\"message-type\":\"work-list\",\"message-version\":\"1.0.0\",\"message\":" +
21 31
            "{\"query\":{\"search-terms\":null,\"start-index\":0},\"items-per-page\":20,\"items\":[{\"indexed\":" +
......
65 75
        Assert.assertEquals("Y. Fontyn", result.getAuthors().get(5+""));
66 76
    }
67 77

  
68
    private String orcidXml2 = "<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 {\\&amp;} 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>";
78
    private String orcidXml2 = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
79
            "<activities:works path=\"/0000-0002-3477-3082/works\" 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" +
80
            "<common:last-modified-date>2015-07-16T22:57:28.480Z</common:last-modified-date>\n" +
81
            "<activities:group>\n" +
82
            "<common:last-modified-date>2015-07-16T22:57:28.344Z</common:last-modified-date>\n" +
83
            "<common:external-ids>\n" +
84
            "<common:external-id>\n" +
85
            "<common:external-id-type>doi</common:external-id-type>\n" +
86
            "<common:external-id-value>10.1007/978-3-642-27169-4_2</common:external-id-value>\n" +
87
            "<common:external-id-url/>\n" +
88
            "<common:external-id-relationship>self</common:external-id-relationship>\n" +
89
            "</common:external-id>\n" +
90
            "</common:external-ids>\n" +
91
            "<work:work-summary put-code=\"5288651\" path=\"/0000-0002-3477-3082/work/5288651\" visibility=\"public\" display-index=\"0\">\n" +
92
            "<common:created-date>2013-03-08T03:19:36.095Z</common:created-date>\n" +
93
            "<common:last-modified-date>2015-07-16T22:57:28.264Z</common:last-modified-date>\n" +
94
            "<common:source>\n" +
95
            "<common:source-orcid>\n" +
96
            "<common:uri>https://orcid.org/0000-0002-3477-3082</common:uri>\n" +
97
            "<common:path>0000-0002-3477-3082</common:path>\n" +
98
            "<common:host>orcid.org</common:host>\n" +
99
            "</common:source-orcid>\n" +
100
            "<common:source-name>Natalia Manola</common:source-name>\n" +
101
            "</common:source>\n" +
102
            "<work:title>\n" +
103
            "<common:title>\n" +
104
            "A Survey of Context-Aware Cross-Digital Library Personalization\n" +
105
            "</common:title>\n" +
106
            "</work:title>\n" +
107
            "<common:external-ids>\n" +
108
            "<common:external-id>\n" +
109
            "<common:external-id-type>doi</common:external-id-type>\n" +
110
            "<common:external-id-value>10.1007/978-3-642-27169-4_2</common:external-id-value>\n" +
111
            "<common:external-id-url/>\n" +
112
            "<common:external-id-relationship>self</common:external-id-relationship>\n" +
113
            "</common:external-id>\n" +
114
            "</common:external-ids>\n" +
115
            "<work:type>book-chapter</work:type>\n" +
116
            "<common:publication-date>\n" +
117
            "<common:year>2012</common:year>\n" +
118
            "</common:publication-date>\n" +
119
            "</work:work-summary>\n" +
120
            "<work:work-summary put-code=\"5288654\" path=\"/0000-0002-3477-3082/work/5288654\" visibility=\"public\" display-index=\"0\">\n" +
121
            "<common:created-date>2013-03-08T03:19:36.116Z</common:created-date>\n" +
122
            "<common:last-modified-date>2015-07-16T22:57:28.344Z</common:last-modified-date>\n" +
123
            "<common:source>\n" +
124
            "<common:source-client-id>\n" +
125
            "<common:uri>https://orcid.org/client/0000-0002-5982-8983</common:uri>\n" +
126
            "<common:path>0000-0002-5982-8983</common:path>\n" +
127
            "<common:host>orcid.org</common:host>\n" +
128
            "</common:source-client-id>\n" +
129
            "<common:source-name>Scopus - Elsevier</common:source-name>\n" +
130
            "</common:source>\n" +
131
            "<work:title>\n" +
132
            "<common:title>\n" +
133
            "A survey of context-aware cross-digital library personalization\n" +
134
            "</common:title>\n" +
135
            "</work:title>\n" +
136
            "<common:external-ids>\n" +
137
            "<common:external-id>\n" +
138
            "<common:external-id-type>doi</common:external-id-type>\n" +
139
            "<common:external-id-value>10.1007/978-3-642-27169-4_2</common:external-id-value>\n" +
140
            "<common:external-id-url/>\n" +
141
            "<common:external-id-relationship>self</common:external-id-relationship>\n" +
142
            "</common:external-id>\n" +
143
            "</common:external-ids>\n" +
144
            "<work:type>journal-article</work:type>\n" +
145
            "<common:publication-date>\n" +
146
            "<common:year>2011</common:year>\n" +
147
            "</common:publication-date>\n" +
148
            "</work:work-summary>\n" +
149
            "</activities:group>\n" +
150
            "</activities:works>";
181 151

  
182 152
    private String orcidXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
183 153
            "<activities:works path=\"/0000-0002-9414-646X/works\" 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" +
......
246 216

  
247 217
    }
248 218
    @Test
219
    public void orcidSecond2ResultTest() throws Exception {
220
        String id =  "0000-0002-3477-3082-5288650";
221
        Result result = ExternalRecordParser.orcid2Result(searchUtils.fetchResultXMLFromOrcid(id.substring(0, 19)),id);
222
        System.out.println(result);
223
         id =  "0000-0002-3477-3082-5288651";
224
         result = ExternalRecordParser.orcid2Result(searchUtils.fetchResultXMLFromOrcid(id.substring(0, 19)),id);
225
        System.out.println(result);
226
//        System.out.println(result.getTitle() + result.getAccessRights());
227
        Assert.assertNull(result.getAccessRights());
228
        Assert.assertNull(result.getBestLicense());
229
        Assert.assertEquals("openaire____::orcid", result.getCollectedFrom());
230
//        Assert.assertEquals("10.1109/smc.2015.229", result.getDoi());
231
        Assert.assertEquals(id, result.getOrcidworkid());
232
        Assert.assertNull(result.getOai());
233
        Assert.assertNotNull(result.getOpenaireId());//        Assert.assertNull(result.getOpenaireId());
234
        Assert.assertNull(result.getPmcid());
235
        Assert.assertEquals(ClaimUtils.PUBLICATION, result.getResultType());
236
//        Assert.assertEquals("A Survey of Context-Aware Cross-Digital Library Personalization\n", result.getTitle());
237
        Assert.assertEquals("xml", result.getRecordFormat());
238
//        Assert.assertEquals("https://dx.doi.org/10.1007/978-3-642-27169-4_2", result.getExternalUrl());
239
        Assert.assertNull(result.getEmbargoEndDate());
240

  
241
    }
242
    @Test
249 243
    public void orcid2Result2Test() {
250 244
        Result result = ExternalRecordParser.orcid2Result(orcidXml, "0000-0001-5264-4324-43079714");
251 245
        System.out.println(result);
......
266 260
    }
267 261

  
268 262

  
263

  
269 264
    private String dataciteXml = "<rdf:RDF\n" +
270 265
            "    xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n" +
271 266
            "    xmlns:owl=\"http://www.w3.org/2002/07/owl#\"\n" +

Also available in: Unified diff