Project

General

Profile

1
package eu.dnetlib.data.collector.plugins;
2

    
3
import java.util.HashMap;
4

    
5
import org.junit.Assert;
6
import org.junit.Before;
7
import org.junit.Test;
8
import org.springframework.core.io.ClassPathResource;
9
import org.springframework.core.io.Resource;
10

    
11
import eu.dnetlib.data.collector.rmi.CollectorServiceException;
12
import eu.dnetlib.data.collector.rmi.InterfaceDescriptor;
13

    
14
public class FileGZipCollectorPluginTest {
15

    
16
	private Resource gzResource = new ClassPathResource("eu/dnetlib/data/collector/plugins/opendoar.xml.gz");
17
	private InterfaceDescriptor descr;
18
	private FileGZipCollectorPlugin plugin;
19

    
20
	@Before
21
	public void setUp() throws Exception {
22
		descr = new InterfaceDescriptor();
23
		String thePath = gzResource.getFile().getAbsolutePath();
24
		descr.setBaseUrl("file://" + thePath);
25
		HashMap<String, String> params = new HashMap<String, String>();
26
		params.put("splitOnElement", "repository");
27
		descr.setParams(params);
28
		plugin = new FileGZipCollectorPlugin();
29
	}
30

    
31
	@Test
32
	public void test() throws CollectorServiceException {
33
		int i = 0;
34
		for (String s : plugin.collect(descr, null, null)) {
35
			Assert.assertTrue(s.length() > 0);
36
			i++;
37
			break;
38
		}
39
		Assert.assertTrue(i > 0);
40
	}
41

    
42
}
(1-1/2)