refactoring

This commit is contained in:
Miriam Baglioni 2020-10-01 11:16:22 +02:00
parent 706a80a29a
commit c107f193c9
1 changed files with 3 additions and 46 deletions

View File

@ -7,6 +7,7 @@ import java.nio.file.Path;
import java.util.List; import java.util.List;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -35,52 +36,8 @@ public class EXCELParserTest {
List<Object> pl = excelParser List<Object> pl = excelParser
.parse(httpConnector.getInputSourceAsStream(URL), "eu.dnetlib.dhp.actionmanager.project.utils.ExcelTopic"); .parse(httpConnector.getInputSourceAsStream(URL), "eu.dnetlib.dhp.actionmanager.project.utils.ExcelTopic");
System.out.println(pl.size()); Assertions.assertEquals(3837, pl.size());
// OPCPackage pkg = OPCPackage.open(httpConnector.getInputSourceAsStream(URL));
// XSSFWorkbook wb = new XSSFWorkbook(pkg);
//
// XSSFSheet sheet = wb.getSheet("cordisref-H2020topics");
//
// DataFormatter dataFormatter = new DataFormatter();
// Iterator<Row> rowIterator = sheet.rowIterator();
// List<String> headers = new ArrayList<>();
// int count = 0;
// while (rowIterator.hasNext() && count <= 10) {
// Row row = rowIterator.next();
//
//
// if(count == 0){
// // Now let's iterate over the columns of the current row
// Iterator<Cell> cellIterator = row.cellIterator();
//
// while(cellIterator.hasNext()){
// Cell cell = cellIterator.next();
// headers.add(dataFormatter.formatCellValue(cell));
// }
// }else{
// Class<?> clazz = Class.forName("eu.dnetlib.dhp.actionmanager.project.utils.EXCELTopic");
// final Object cc = clazz.newInstance();
//
// for(int i =0; i<headers.size(); i++){
// Cell cell = row.getCell(i);
// FieldUtils.writeField(cc, headers.get(i),dataFormatter.formatCellValue(cell), true);
//
// }
//
// System.out.println(new Gson().toJson(cc));
// }
//
// count += 1;
// }
////
//// Iterator<org.apache.poi.ss.usermodel.Sheet> iterator = wb.sheetIterator();
//// System.out.println("Retrieving Sheets using Iterator");
//// while (iterator.hasNext()) {
//// Sheet sheet = iterator.next();
//// System.out.println("=> " + sheet.getSheetName());
//// }
//
// pkg.close();
} }
} }