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
|
* @author js
|
11
|
*
|
12
|
*/
|
13
|
public class RestIteratorTest {
|
14
|
|
15
|
private String baseUrl = "https://share.osf.io/api/v2/search/creativeworks/_search";
|
16
|
private String resumptionType = "count";
|
17
|
private String resumptionParam = "from";
|
18
|
private String resumptionXpath = "";
|
19
|
private String resultTotalXpath = "//hits/total";
|
20
|
private String resultFormatParam = "format";
|
21
|
private String resultFormatValue = "json";
|
22
|
private String resultSizeParam = "size";
|
23
|
private String query = "q=%28sources%3ASocArXiv+AND+type%3Apreprint%29";
|
24
|
|
25
|
|
26
|
@Ignore
|
27
|
@Test
|
28
|
public void test(){
|
29
|
final RestIterator iterator = new RestIterator(baseUrl, resumptionType, resumptionParam, resumptionXpath, resultTotalXpath, resultFormatParam, resultFormatValue, resultSizeParam, query);
|
30
|
int i =20;
|
31
|
while (iterator.hasNext() && i > 0) {
|
32
|
String result = iterator.next();
|
33
|
|
34
|
i--;
|
35
|
}
|
36
|
}
|
37
|
}
|
38
|
|