Fixed OfficeImportTest
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
cfe5848a02
commit
6eb3873a5b
+13
-5
@@ -30,6 +30,7 @@ import java.io.OutputStream;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.infrastructure.bulkimport.constants.LoanConstants;
|
||||
import org.apache.fineract.infrastructure.bulkimport.constants.OfficeConstants;
|
||||
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
|
||||
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
||||
@@ -40,10 +41,14 @@ import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class OfficeImportHandlerTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(OfficeImportHandlerTest.class);
|
||||
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
|
||||
@@ -60,7 +65,6 @@ public class OfficeImportHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testOfficeImport() throws IOException, InterruptedException, NoSuchFieldException, ParseException {
|
||||
OfficeHelper officeHelper=new OfficeHelper(requestSpec,responseSpec);
|
||||
Workbook workbook=officeHelper.getOfficeWorkBook("dd MMMM yyyy");
|
||||
@@ -80,7 +84,7 @@ public class OfficeImportHandlerTest {
|
||||
"resources"+File.separator+"bulkimport"+File.separator+"importhandler"+File.separator+"office");
|
||||
if (!directory.exists()) {
|
||||
directory.mkdirs();
|
||||
}
|
||||
}
|
||||
File file= new File(directory+File.separator+"Office.xls");
|
||||
OutputStream outputStream=new FileOutputStream(file);
|
||||
workbook.write(outputStream);
|
||||
@@ -91,7 +95,7 @@ public class OfficeImportHandlerTest {
|
||||
Assert.assertNotNull(importDocumentId);
|
||||
|
||||
// Wait for the creation of output excel
|
||||
Thread.sleep(3000);
|
||||
Thread.sleep(10000);
|
||||
|
||||
//check status column of output excel
|
||||
String location=officeHelper.getOutputTemplateLocation(importDocumentId);
|
||||
@@ -99,7 +103,11 @@ public class OfficeImportHandlerTest {
|
||||
Workbook outputWorkbook=new HSSFWorkbook(fileInputStream);
|
||||
Sheet officeSheet = outputWorkbook.getSheet(TemplatePopulateImportConstants.OFFICE_SHEET_NAME);
|
||||
Row row= officeSheet.getRow(1);
|
||||
|
||||
LOG.info("Output location: {}", location);
|
||||
LOG.info("Failure reason column: {}", row.getCell(OfficeConstants.STATUS_COL).getStringCellValue());
|
||||
|
||||
Assert.assertEquals("Imported",row.getCell(OfficeConstants.STATUS_COL).getStringCellValue());
|
||||
|
||||
outputWorkbook.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user