Revision 61055
Added by Alessia Bardi almost 3 years ago
RestCollectorPluginTest.java | ||
---|---|---|
4 | 4 |
package eu.dnetlib.data.collector.plugins.rest; |
5 | 5 |
|
6 | 6 |
import java.util.HashMap; |
7 |
import java.util.Map; |
|
7 | 8 |
|
8 | 9 |
import org.junit.Assert; |
9 | 10 |
import org.junit.Before; |
... | ... | |
22 | 23 |
|
23 | 24 |
//Settings for FCT rest endpoint |
24 | 25 |
|
25 |
private String baseUrl = "https://etl.ptcris.pt/services/searches/projects"; |
|
26 |
private String resumptionType = "page"; |
|
27 |
private String resumptionParam = "page"; |
|
28 |
private String resumptionXpath = ""; |
|
29 |
private String resultTotalXpath = "//*[local-name()='paging']/*[local-name()='maxPages']"; |
|
30 |
private String entityXpath = "//*[local-name()='ListRecords']/*[local-name()='record']"; |
|
31 |
private String resultFormatParam = ""; |
|
32 |
private String resultFormatValue = "xml"; // Change from lowerCase to one UpperCase |
|
33 |
private String resultSizeParam = "recordsPerPage"; |
|
34 |
private String resultSizeValue = "100"; |
|
35 |
private String authMethod = "basic"; |
|
36 |
private String authToken = "T1BFTkFJUkVfQURNSU46NC01ITM1NkZNOQ=="; |
|
37 |
private String resultOffsetParam = ""; |
|
38 |
private String query = "startDateFrom=1999-01-01&startDateTo=1999-12-31&pagination=true"; |
|
26 |
// private String baseUrl = "https://etl.ptcris.pt/services/searches/projects"; |
|
27 |
// private String resumptionType = "page"; |
|
28 |
// private String resumptionParam = "page"; |
|
29 |
// private String resumptionXpath = ""; |
|
30 |
// private String resultTotalXpath = "//*[local-name()='paging']/*[local-name()='maxPages']"; |
|
31 |
// private String entityXpath = "//*[local-name()='ListRecords']/*[local-name()='record']"; |
|
32 |
// private String resultFormatParam = ""; |
|
33 |
// private String resultFormatValue = "xml"; // Change from lowerCase to one UpperCase |
|
34 |
// private String resultSizeParam = "recordsPerPage"; |
|
35 |
// private String resultSizeValue = "100"; |
|
36 |
// private String authMethod = "basic"; |
|
37 |
// private String authToken = "T1BFTkFJUkVfQURNSU46NC01ITM1NkZNOQ=="; |
|
38 |
// private String resultOffsetParam = ""; |
|
39 |
// private String query = "startDateFrom=1999-01-01&startDateTo=1999-12-31&pagination=true"; |
|
40 |
//private String requestHeader = ""; |
|
39 | 41 |
|
40 | 42 |
//private String baseUrl = "https://share.osf.io/api/v2/search/creativeworks/_search"; |
41 | 43 |
//private String resumptionType = "count"; |
... | ... | |
50 | 52 |
//// private String query = "q=%28sources%3ASocArXiv+AND+type%3Apreprint%29"; |
51 | 53 |
//private String query = "q=%28sources%3AengrXiv+AND+type%3Apreprint%29"; |
52 | 54 |
//// private String query = "=(sources:engrXiv AND type:preprint)"; |
53 |
|
|
55 |
//private String requestHeader = ""; |
|
56 |
|
|
57 |
//config for Enermaps |
|
58 |
private String baseUrl = "https://lab.idiap.ch/enermaps/api/datacite"; |
|
59 |
private String authMethod = ""; |
|
60 |
private String authToken = ""; |
|
61 |
private String entityXpath = "//data"; |
|
62 |
private String query = " "; |
|
63 |
private String requestHeader = "{\"Accept\":\"application/vnd.pgrst.object+json\"}"; |
|
64 |
private String resultFormatParam = ""; |
|
65 |
private String resultFormatValue = "json"; |
|
66 |
private String resultOutputFormat = ""; |
|
67 |
private String resultSizeParam = ""; |
|
68 |
private String resultSizeValue = ""; |
|
69 |
private String resultTotalXpath = "fake"; |
|
70 |
private String resumptionParam = "fake"; |
|
71 |
private String resumptionType = "discover"; |
|
72 |
private String resumptionXpath = "/fake"; |
|
73 |
private String idxpath = "//data/id"; |
|
74 |
|
|
54 | 75 |
private String protocolDescriptor = "rest_json2xml"; |
55 | 76 |
private InterfaceDescriptor ifDesc = new InterfaceDescriptor(); |
56 | 77 |
private RestCollectorPlugin rcp; |
... | ... | |
65 | 86 |
params.put("resultFormatParam", resultFormatParam); |
66 | 87 |
params.put("resultFormatValue", resultFormatValue); |
67 | 88 |
params.put("resultSizeParam", resultSizeParam); |
68 |
params.put("resultSizeValue", resultSizeValue);
|
|
89 |
params.put("resultSizeValue", resultSizeValue);
|
|
69 | 90 |
params.put("queryParams", query); |
70 | 91 |
params.put("entityXpath", entityXpath); |
71 | 92 |
|
72 | 93 |
params.put("authMethod", authMethod); |
73 | 94 |
params.put("authToken", authToken); |
95 |
params.put("requestHeaderMap", requestHeader); |
|
74 | 96 |
|
75 | 97 |
ifDesc.setBaseUrl(baseUrl); |
76 | 98 |
ifDesc.setParams(params); |
Also available in: Unified diff
#6720: added tests for enermaps API