1
|
package eu.dnetlib.data.collector.plugins.projects.gtr2;
|
2
|
|
3
|
import java.util.Iterator;
|
4
|
|
5
|
import org.junit.Assert;
|
6
|
import org.junit.Before;
|
7
|
import org.junit.Test;
|
8
|
|
9
|
public class Gtr2Test {
|
10
|
|
11
|
private String baseURL = "http://gtr.rcuk.ac.uk/gtr/api";
|
12
|
private Gtr2Helper helper;
|
13
|
private Gtr2ProjectsIterable it;
|
14
|
|
15
|
@Before
|
16
|
public void prepare(){
|
17
|
helper =new Gtr2Helper();
|
18
|
}
|
19
|
|
20
|
@Test
|
21
|
public void testOne() throws Exception {
|
22
|
String s = helper.processProject("http://gtr.rcuk.ac.uk/gtr/api/projects/E178742B-571B-498F-8402-122F17C47546", "xmlns:ns=\"http:///afgshs\"");
|
23
|
System.out.println(s);
|
24
|
}
|
25
|
|
26
|
|
27
|
@Test
|
28
|
public void testPaging() throws Exception{
|
29
|
it = new Gtr2ProjectsIterable(baseURL);
|
30
|
it.setHelper(helper);
|
31
|
it.setMaxPages(2);
|
32
|
Iterator<String> iterator = it.iterator();
|
33
|
while(iterator.hasNext()){
|
34
|
String res = iterator.next();
|
35
|
Assert.assertNotNull(res);
|
36
|
// System.out.println();
|
37
|
}
|
38
|
|
39
|
}
|
40
|
}
|