2020-09-28 12:02:48 +02:00
|
|
|
|
|
|
|
package eu.dnetlib.dhp.actionmanager.project;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.nio.file.Files;
|
|
|
|
import java.nio.file.Path;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
2020-10-01 11:16:22 +02:00
|
|
|
import org.junit.jupiter.api.Assertions;
|
2020-09-28 12:02:48 +02:00
|
|
|
import org.junit.jupiter.api.BeforeAll;
|
2020-10-30 17:01:48 +01:00
|
|
|
import org.junit.jupiter.api.Disabled;
|
2020-09-28 12:02:48 +02:00
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
import eu.dnetlib.dhp.actionmanager.project.utils.EXCELParser;
|
2021-02-12 12:31:02 +01:00
|
|
|
import eu.dnetlib.dhp.collection.CollectorException;
|
|
|
|
import eu.dnetlib.dhp.collection.HttpConnector2;
|
2020-09-28 12:02:48 +02:00
|
|
|
|
2020-10-30 17:01:48 +01:00
|
|
|
@Disabled
|
2020-09-28 12:02:48 +02:00
|
|
|
public class EXCELParserTest {
|
|
|
|
|
|
|
|
private static Path workingDir;
|
2021-08-11 12:18:20 +02:00
|
|
|
private final HttpConnector2 httpConnector = new HttpConnector2();
|
2021-05-20 15:54:44 +02:00
|
|
|
private static final String URL = "https://cordis.europa.eu/data/reference/cordisref-h2020topics.xlsx";
|
2020-09-28 12:02:48 +02:00
|
|
|
|
|
|
|
@BeforeAll
|
|
|
|
public static void beforeAll() throws IOException {
|
|
|
|
workingDir = Files.createTempDirectory(CSVParserTest.class.getSimpleName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2021-08-11 12:13:22 +02:00
|
|
|
void test1() throws CollectorException, IOException, InvalidFormatException, ClassNotFoundException,
|
2020-09-28 12:02:48 +02:00
|
|
|
IllegalAccessException, InstantiationException {
|
|
|
|
|
|
|
|
EXCELParser excelParser = new EXCELParser();
|
|
|
|
|
|
|
|
List<Object> pl = excelParser
|
2021-05-20 15:54:44 +02:00
|
|
|
.parse(
|
|
|
|
httpConnector.getInputSourceAsStream(URL), "eu.dnetlib.dhp.actionmanager.project.utils.EXCELTopic",
|
|
|
|
"Topics");
|
2020-09-28 12:02:48 +02:00
|
|
|
|
2021-05-20 15:54:44 +02:00
|
|
|
Assertions.assertEquals(3878, pl.size());
|
2020-10-01 11:16:22 +02:00
|
|
|
|
2020-09-28 12:02:48 +02:00
|
|
|
}
|
|
|
|
}
|