48 lines
1.3 KiB
Java
48 lines
1.3 KiB
Java
package eu.dnetlib.data.collector.plugins.ariadneplus.isidore;
|
|
|
|
import javax.xml.transform.TransformerFactory;
|
|
|
|
import eu.dnetlib.miscutils.functional.xml.SaxonHelper;
|
|
import org.junit.Before;
|
|
import org.junit.Ignore;
|
|
import org.junit.Test;
|
|
|
|
/**
|
|
* Created by Alessia Bardi on 17/11/2018.
|
|
*
|
|
* @author Alessia Bardi
|
|
*/
|
|
|
|
public class IsidoreIteratorTest {
|
|
|
|
TransformerFactory tf = TransformerFactory.newInstance();
|
|
SaxonHelper saxonHelper = new SaxonHelper();
|
|
|
|
private String baseUrl = "https://api.rechercheisidore.fr/resource/search";
|
|
private String queryParams = "source_tree=10670/3.ji0kr6|10670/2.rao8tk";
|
|
private String pageParam = "page";
|
|
private int startFromPage = 1;
|
|
private String nextPagePath = "//page/@next";
|
|
private String pageSizeParam = "size";
|
|
private int pageSize = 10;
|
|
private String resultTotalXpath = "//replies/meta/@items";
|
|
private String entityXpath = "//reply";
|
|
|
|
@Before
|
|
public void setup(){
|
|
saxonHelper.setSaxonTransformerFactory(tf);
|
|
}
|
|
|
|
@Ignore
|
|
@Test
|
|
public void test(){
|
|
IsidoreIterator rip = new IsidoreIterator(saxonHelper, baseUrl, queryParams,pageParam, startFromPage,
|
|
nextPagePath, pageSizeParam, pageSize, resultTotalXpath, entityXpath);
|
|
while(rip.hasNext()){
|
|
String record = rip.next();
|
|
System.out.println(record);
|
|
}
|
|
}
|
|
|
|
}
|