FINERACT-1724
- no need to create a new loan product for each loan - unused variables removed.
This commit is contained in:
+9
-9
@@ -46,9 +46,7 @@ import org.apache.fineract.integrationtests.common.BusinessDateHelper;
|
|||||||
import org.apache.fineract.integrationtests.common.BusinessStepHelper;
|
import org.apache.fineract.integrationtests.common.BusinessStepHelper;
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.CollateralManagementHelper;
|
import org.apache.fineract.integrationtests.common.CollateralManagementHelper;
|
||||||
import org.apache.fineract.integrationtests.common.ExternalAssetOwnerHelper;
|
|
||||||
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
|
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
|
||||||
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.accounting.Account;
|
import org.apache.fineract.integrationtests.common.accounting.Account;
|
||||||
import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
|
import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
|
||||||
@@ -81,9 +79,7 @@ public class CobPartitioningTest {
|
|||||||
private static Account INCOME_ACCOUNT;
|
private static Account INCOME_ACCOUNT;
|
||||||
private static Account OVERPAYMENT_ACCOUNT;
|
private static Account OVERPAYMENT_ACCOUNT;
|
||||||
private static FinancialActivityAccountHelper FINANCIAL_ACTIVITY_ACCOUNT_HELPER;
|
private static FinancialActivityAccountHelper FINANCIAL_ACTIVITY_ACCOUNT_HELPER;
|
||||||
private static ExternalAssetOwnerHelper EXTERNAL_ASSET_OWNER_HELPER;
|
|
||||||
private static LoanTransactionHelper LOAN_TRANSACTION_HELPER;
|
private static LoanTransactionHelper LOAN_TRANSACTION_HELPER;
|
||||||
private static SchedulerJobHelper SCHEDULER_JOB_HELPER;
|
|
||||||
private static LocalDate TODAYS_DATE;
|
private static LocalDate TODAYS_DATE;
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
@@ -93,8 +89,6 @@ public class CobPartitioningTest {
|
|||||||
REQUEST_SPEC.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
REQUEST_SPEC.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||||
RESPONSE_SPEC = new ResponseSpecBuilder().expectStatusCode(200).build();
|
RESPONSE_SPEC = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
AccountHelper accountHelper = new AccountHelper(REQUEST_SPEC, RESPONSE_SPEC);
|
AccountHelper accountHelper = new AccountHelper(REQUEST_SPEC, RESPONSE_SPEC);
|
||||||
EXTERNAL_ASSET_OWNER_HELPER = new ExternalAssetOwnerHelper();
|
|
||||||
SCHEDULER_JOB_HELPER = new SchedulerJobHelper(REQUEST_SPEC);
|
|
||||||
FINANCIAL_ACTIVITY_ACCOUNT_HELPER = new FinancialActivityAccountHelper(REQUEST_SPEC);
|
FINANCIAL_ACTIVITY_ACCOUNT_HELPER = new FinancialActivityAccountHelper(REQUEST_SPEC);
|
||||||
LOAN_TRANSACTION_HELPER = new LoanTransactionHelper(REQUEST_SPEC, RESPONSE_SPEC);
|
LOAN_TRANSACTION_HELPER = new LoanTransactionHelper(REQUEST_SPEC, RESPONSE_SPEC);
|
||||||
|
|
||||||
@@ -133,10 +127,11 @@ public class CobPartitioningTest {
|
|||||||
|
|
||||||
// Let's create 1, 2, ..., N-1, N loans
|
// Let's create 1, 2, ..., N-1, N loans
|
||||||
final CountDownLatch createLatch = new CountDownLatch(N);
|
final CountDownLatch createLatch = new CountDownLatch(N);
|
||||||
|
Integer loanProductID = createLoanProduct();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < N; i++) {
|
||||||
Future<?> unused = executorService.submit(() -> {
|
Future<?> unused = executorService.submit(() -> {
|
||||||
Integer clientID = createClient();
|
Integer clientID = createClient();
|
||||||
Integer loanID = createLoanForClient(clientID);
|
Integer loanID = createLoanForClient(clientID, loanProductID);
|
||||||
loanIds.add(loanID);
|
loanIds.add(loanID);
|
||||||
createLatch.countDown();
|
createLatch.countDown();
|
||||||
});
|
});
|
||||||
@@ -200,14 +195,19 @@ public class CobPartitioningTest {
|
|||||||
return clientID;
|
return clientID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
private Integer createLoanProduct() {
|
||||||
private Integer createLoanForClient(Integer clientID) {
|
|
||||||
Integer overdueFeeChargeId = ChargesHelper.createCharges(REQUEST_SPEC, RESPONSE_SPEC,
|
Integer overdueFeeChargeId = ChargesHelper.createCharges(REQUEST_SPEC, RESPONSE_SPEC,
|
||||||
ChargesHelper.getLoanOverdueFeeJSONWithCalculationTypePercentage("1"));
|
ChargesHelper.getLoanOverdueFeeJSONWithCalculationTypePercentage("1"));
|
||||||
Assertions.assertNotNull(overdueFeeChargeId);
|
Assertions.assertNotNull(overdueFeeChargeId);
|
||||||
|
|
||||||
Integer loanProductID = createLoanProduct(overdueFeeChargeId.toString());
|
Integer loanProductID = createLoanProduct(overdueFeeChargeId.toString());
|
||||||
Assertions.assertNotNull(loanProductID);
|
Assertions.assertNotNull(loanProductID);
|
||||||
|
return loanProductID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Integer createLoanForClient(Integer clientID, Integer loanProductID) {
|
||||||
|
|
||||||
HashMap loanStatusHashMap;
|
HashMap loanStatusHashMap;
|
||||||
|
|
||||||
Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), "10 January 2020");
|
Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), "10 January 2020");
|
||||||
|
|||||||
Reference in New Issue
Block a user