Added some printlns while testing

This commit is contained in:
Alessia Bardi 2022-04-15 14:42:59 +02:00
parent b3c803e223
commit 48b135190e
2 changed files with 11 additions and 6 deletions

View File

@ -24,7 +24,6 @@ public class ThanadosIterator extends ThreadSafeIterator {
private final CloseableHttpClient client = HttpClients.createDefault();
private String baseUrl;
private String currentLine;
private List<String> identifiers;
private int counter = 0;
private String urlFormat = "%s/%s?format=xml";
@ -50,6 +49,7 @@ public class ThanadosIterator extends ThreadSafeIterator {
if (counter <= this.identifiers.size()) {
String toDownload = String.format(urlFormat, baseUrl, identifiers.get(counter));
log.debug("Downloading "+toDownload);
System.out.println("Downloading "+toDownload);
return download(toDownload);
} else {
throw new CollectorServiceRuntimeException("Iterator has reached the end");

View File

@ -1,8 +1,14 @@
package eu.dnetlib.data.collector.plugins.ariadneplus.thanados;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@Ignore
public class ThanadosIteratorTest {
@ -12,20 +18,19 @@ public class ThanadosIteratorTest {
@Test
public void testDownloadList(){
it = new ThanadosIterator("", sitelist);
int count = 0;
it.getIdentifiers().stream().forEach(id -> System.out.println(id));
System.out.println(it.getIdentifiers().size());
}
@Test
public void testDownload(){
public void testDownload() throws IOException {
int count = 0;
it = new ThanadosIterator("https://thanados.openatlas.eu/api/0.3/subunits/", sitelist);
it = new ThanadosIterator("https://thanados.openatlas.eu/api/0.3/subunits", sitelist);
while(it.hasNext()){
it.next();
count++;
System.out.println(count);
}
System.out.println(count);
System.out.println("DONE");
}
}