FINERACT-1396: Bulk Import Feature

This commit is contained in:
xurror
2021-10-09 09:03:44 +08:00
committed by Petri Tuomola
parent d2521886ba
commit 0b51ab2429
13 changed files with 468 additions and 41 deletions
@@ -47,6 +47,7 @@ import org.apache.fineract.integrationtests.common.OfficeDomain;
import org.apache.fineract.integrationtests.common.OfficeHelper;
import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
import org.apache.fineract.integrationtests.common.Utils;
import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
import org.apache.fineract.integrationtests.common.funds.FundsHelper;
import org.apache.fineract.integrationtests.common.funds.FundsResourceHandler;
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
@@ -66,6 +67,7 @@ public class LoanImportHandlerTest {
private static final Logger LOG = LoggerFactory.getLogger(LoanImportHandlerTest.class);
private static final String CREATE_CLIENT_URL = "/fineract-provider/api/v1/clients?" + Utils.TENANT_IDENTIFIER;
private static final String CREATE_CHARGE_URL = "/fineract-provider/api/v1/charges?" + Utils.TENANT_IDENTIFIER;
public static final String DATE_FORMAT = "dd MMMM yyyy";
private ResponseSpecification responseSpec;
@@ -120,6 +122,14 @@ public class LoanImportHandlerTest {
collateralHashMap.put("quantity", "1");
collaterals.add(collateralHashMap);
final String disbursementChargeJsonString = ChargesHelper.getLoanDisbursementJSON();
final Integer disbursementChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, disbursementChargeJsonString);
final JsonPath disbursementChargeJSON = JsonPath.from(disbursementChargeJsonString);
Assertions.assertNotNull(disbursementChargeId, "Could not create charge");
// in order to populate helper sheets
Integer outcome_group_creation = GroupHelper.createGroup(requestSpec, responseSpec, true);
Assertions.assertNotNull(outcome_group_creation, "Could not create group");
@@ -200,6 +210,10 @@ public class LoanImportHandlerTest {
firstLoanRow.createCell(LoanConstants.REPAYMENT_TYPE_COL).setCellValue(paymentTypeName);
firstLoanRow.createCell(LoanConstants.LOAN_COLLATERAL_ID).setCellValue(collaterals.get(0).get("clientCollateralId").toString());
firstLoanRow.createCell(LoanConstants.LOAN_COLLATERAL_QUANTITY).setCellValue(collaterals.get(0).get("quantity").toString());
firstLoanRow.createCell(LoanConstants.CHARGE_NAME_1).setCellValue(disbursementChargeJSON.getString("name"));
firstLoanRow.createCell(LoanConstants.CHARGE_AMOUNT_1).setCellValue(disbursementChargeJSON.getFloat("amount"));
firstLoanRow.createCell(LoanConstants.CHARGE_AMOUNT_TYPE_1)
.setCellValue(disbursementChargeJSON.getString("chargeCalculationType.value"));
String currentdirectory = new File("").getAbsolutePath();
File directory = new File(currentdirectory + File.separator + "src" + File.separator + "integrationTest" + File.separator