1
|
package eu.dnetlib.data.collector.plugins.ftp;
|
2
|
|
3
|
import java.util.Set;
|
4
|
|
5
|
import com.google.common.collect.Sets;
|
6
|
import org.junit.Ignore;
|
7
|
import org.junit.Test;
|
8
|
|
9
|
import static org.junit.Assert.assertFalse;
|
10
|
import static org.junit.Assert.assertTrue;
|
11
|
|
12
|
@Ignore
|
13
|
public class FtpIteratorTest {
|
14
|
|
15
|
private String baseUrl = "ftp://ftp.eagle.research-infrastructures.eu/content/ELTE";
|
16
|
private String username = "eaglecontent";
|
17
|
private String password = "$eagl3$CP";
|
18
|
private boolean isRecursive = true;
|
19
|
private Set<String> extensions = Sets.newHashSet("xml");
|
20
|
|
21
|
@Test
|
22
|
public void test() {
|
23
|
final FtpIterator iterator = new FtpIterator(baseUrl, username, password, isRecursive, extensions, null);
|
24
|
int i =5;
|
25
|
while (iterator.hasNext() && i > 0) {
|
26
|
iterator.next();
|
27
|
i--;
|
28
|
}
|
29
|
}
|
30
|
|
31
|
@Test
|
32
|
public void testIncremental() {
|
33
|
final FtpIterator iterator = new FtpIterator(baseUrl, username, password, isRecursive, extensions, "2016-01-04");
|
34
|
assertTrue(iterator.hasNext());
|
35
|
int i =5;
|
36
|
while (iterator.hasNext() && i > 0) {
|
37
|
iterator.next();
|
38
|
i--;
|
39
|
}
|
40
|
}
|
41
|
|
42
|
@Test
|
43
|
public void testIncrementalNoRecords() {
|
44
|
final FtpIterator iterator = new FtpIterator(baseUrl, username, password, isRecursive, extensions, "2017-01-04");
|
45
|
assertFalse(iterator.hasNext());
|
46
|
|
47
|
}
|
48
|
|
49
|
}
|