1
|
package eu.dnetlib.data.collector.plugins.oai;
|
2
|
|
3
|
import java.util.HashMap;
|
4
|
|
5
|
import eu.dnetlib.data.collector.plugins.HttpConnector;
|
6
|
import eu.dnetlib.data.collector.rmi.InterfaceDescriptor;
|
7
|
import org.junit.Before;
|
8
|
import org.junit.Ignore;
|
9
|
import org.junit.Test;
|
10
|
|
11
|
public class OaiCollectorPluginRealTest {
|
12
|
|
13
|
private OaiCollectorPlugin oai;
|
14
|
|
15
|
// private static final String BASE_URL = "http://oai.d.efg.research-infrastructures.eu/oai.do";
|
16
|
// private static final String FORMAT = "oai_dc";
|
17
|
// private static final String SETS = "d937bab1-d44c-44aa-bf7d-df5312a3b623, e5b14959-1e87-4c07-9f85-942c9cdd9136, 13302eb6-764a-4ed2-8d08-2a1c9526f442, 31701e97-096f-4266-81b5-30b9bc3a06b0";
|
18
|
|
19
|
private static final String BASE_URL = "https://dev.textgridlab.org/1.0/tgoaipmh/oai";
|
20
|
//private static final String BASE_URL = "https://rifj.ifj.edu.pl/oai/request";
|
21
|
private static final String FORMAT = "oai_datacite";
|
22
|
//private static final String FORMAT = "oai_dc";
|
23
|
private static final String SETS = "";
|
24
|
|
25
|
@Before
|
26
|
public void setUp() {
|
27
|
oai = new OaiCollectorPlugin();
|
28
|
HttpConnector connector = new HttpConnector();
|
29
|
OaiIteratorFactory oif = new OaiIteratorFactory();
|
30
|
oif.setHttpConnector(connector);
|
31
|
oai.setOaiIteratorFactory(oif);
|
32
|
}
|
33
|
|
34
|
@Test
|
35
|
@Ignore
|
36
|
public void testCollect() throws Exception {
|
37
|
final InterfaceDescriptor iface = new InterfaceDescriptor();
|
38
|
iface.setId("123");
|
39
|
iface.setProtocol("OAI");
|
40
|
iface.setBaseUrl(BASE_URL);
|
41
|
iface.setParams(new HashMap<String, String>());
|
42
|
iface.getParams().put("format", FORMAT);
|
43
|
iface.getParams().put("set", SETS);
|
44
|
|
45
|
int count = 0;
|
46
|
for (String s : oai.collect(iface, null, null)) {
|
47
|
System.out.println(s);
|
48
|
count++;
|
49
|
}
|
50
|
System.out.println("TOTAL: " + count);
|
51
|
}
|
52
|
|
53
|
}
|