Project

General

Profile

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 2018-08-06
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";                  //  add  new
26
	private String query = "q=%28sources%3ASocArXiv+AND+type%3Apreprint%29";
27

    
28

    
29
	@Ignore
30
	@Test
31
	public void test(){
32
		final RestIterator iterator = new RestIterator(baseUrl, resumptionType, resumptionParam, resumptionXpath, resultTotalXpath, resultFormatParam, resultFormatValue, resultSizeParam, resultSizeValue, query, entityXpath);
33
		int i =20;
34
		while (iterator.hasNext() && i > 0) {
35
			String result = iterator.next();
36
			
37
			i--;
38
		}
39
	}
40
}
41

    
(2-2/2)