1
|
/**
|
2
|
*
|
3
|
*/
|
4
|
package eu.dnetlib.data.collector.plugins.rest;
|
5
|
|
6
|
import org.junit.Ignore;
|
7
|
import org.junit.Test;
|
8
|
|
9
|
/**
|
10
|
*
|
11
|
* @author js, Andreas Czerniak
|
12
|
* @date 2020-04-08
|
13
|
*/
|
14
|
public class RestIteratorTest {
|
15
|
|
16
|
private String baseUrl = "https://share.osf.io/api/v2/search/creativeworks/_search";
|
17
|
private String resumptionType = "count";
|
18
|
private String resumptionParam = "from";
|
19
|
private String resumptionXpath = "";
|
20
|
private String resultTotalXpath = "//hits/total";
|
21
|
private String entityXpath = "//hits/hits";
|
22
|
private String resultFormatParam = "format";
|
23
|
private String resultFormatValue = "Json"; // Change from lowerCase to one UpperCase
|
24
|
private String resultSizeParam = "size";
|
25
|
private String resultSizeValue = "10";
|
26
|
private String authMethod = "";
|
27
|
private String authToken = "";
|
28
|
private String resultOffsetParam = "cursor";
|
29
|
private String query = "q=%28sources%3ASocArXiv+AND+type%3Apreprint%29";
|
30
|
|
31
|
|
32
|
@Ignore
|
33
|
@Test
|
34
|
public void test(){
|
35
|
final RestIterator iterator = new RestIterator(baseUrl, resumptionType, resumptionParam, resumptionXpath, resultTotalXpath, resultFormatParam, resultFormatValue, resultSizeParam, resultSizeValue, query, entityXpath, authMethod, authToken, resultOffsetParam);
|
36
|
int i =20;
|
37
|
while (iterator.hasNext() && i > 0) {
|
38
|
String result = iterator.next();
|
39
|
|
40
|
i--;
|
41
|
}
|
42
|
}
|
43
|
}
|
44
|
|