1
|
package eu.dnetlib.data.collector.plugins.oaisets;
|
2
|
|
3
|
import java.util.HashMap;
|
4
|
import javax.annotation.Resource;
|
5
|
|
6
|
import com.google.common.base.Joiner;
|
7
|
import eu.dnetlib.data.collector.rmi.CollectorServiceException;
|
8
|
import eu.dnetlib.data.collector.rmi.InterfaceDescriptor;
|
9
|
import org.junit.Before;
|
10
|
import org.junit.Ignore;
|
11
|
import org.junit.Test;
|
12
|
import org.junit.runner.RunWith;
|
13
|
import org.springframework.test.context.ContextConfiguration;
|
14
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
15
|
|
16
|
@RunWith(SpringJUnit4ClassRunner.class)
|
17
|
@ContextConfiguration(value = "applicationContext-OaiSetsCollectorPluginTest.xml")
|
18
|
public class OaiSetsCollectorPluginTest {
|
19
|
|
20
|
private OaiSetsCollectorPlugin oaiSetsPlugin;
|
21
|
@Resource
|
22
|
OaiSetsIteratorFactory oaiSetsIteratorFactory;
|
23
|
|
24
|
private static final String BASE_URL = "http://oai.cwi.nl/oai";
|
25
|
private static final String BASE_URL_DATACITE = "http://oai.datacite.org/oai";
|
26
|
|
27
|
@Before
|
28
|
public void setUp() throws Exception {
|
29
|
oaiSetsPlugin = new OaiSetsCollectorPlugin();
|
30
|
oaiSetsPlugin.setOaiSetsIteratorFactory(oaiSetsIteratorFactory);
|
31
|
}
|
32
|
|
33
|
@Ignore
|
34
|
@Test
|
35
|
public void testCollect() throws CollectorServiceException {
|
36
|
final InterfaceDescriptor iface = new InterfaceDescriptor();
|
37
|
iface.setId("123");
|
38
|
iface.setProtocol("oai_set");
|
39
|
iface.setBaseUrl(BASE_URL);
|
40
|
iface.setParams(new HashMap<String, String>());
|
41
|
|
42
|
Iterable<String> sets = oaiSetsPlugin.collect(iface, null, null);
|
43
|
System.out.println(Joiner.on(",").join(sets));
|
44
|
}
|
45
|
|
46
|
@Ignore
|
47
|
@Test
|
48
|
public void testCollectDatacite() throws CollectorServiceException {
|
49
|
final InterfaceDescriptor iface = new InterfaceDescriptor();
|
50
|
iface.setId("123");
|
51
|
iface.setProtocol("oai_set");
|
52
|
iface.setBaseUrl(BASE_URL_DATACITE);
|
53
|
iface.setParams(new HashMap<String, String>());
|
54
|
|
55
|
Iterable<String> sets = oaiSetsPlugin.collect(iface, null, null);
|
56
|
System.out.println(Joiner.on(",").join(sets));
|
57
|
}
|
58
|
}
|