Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@
import org.apache.fineract.integrationtests.common.BusinessStepHelper;
import org.apache.fineract.integrationtests.common.ClientHelper;
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.SchedulerJobHelper;
import org.apache.fineract.integrationtests.common.Utils;
import org.apache.fineract.integrationtests.common.accounting.Account;
import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
Expand Down Expand Up @@ -81,9 +79,7 @@ public class CobPartitioningTest {
private static Account INCOME_ACCOUNT;
private static Account OVERPAYMENT_ACCOUNT;
private static FinancialActivityAccountHelper FINANCIAL_ACTIVITY_ACCOUNT_HELPER;
private static ExternalAssetOwnerHelper EXTERNAL_ASSET_OWNER_HELPER;
private static LoanTransactionHelper LOAN_TRANSACTION_HELPER;
private static SchedulerJobHelper SCHEDULER_JOB_HELPER;
private static LocalDate TODAYS_DATE;

@BeforeAll
Expand All @@ -93,8 +89,6 @@ public static void setupInvestorBusinessStep() {
REQUEST_SPEC.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
RESPONSE_SPEC = new ResponseSpecBuilder().expectStatusCode(200).build();
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);
LOAN_TRANSACTION_HELPER = new LoanTransactionHelper(REQUEST_SPEC, RESPONSE_SPEC);

Expand Down Expand Up @@ -133,10 +127,11 @@ public void testLoanCOBPartitioningQuery() throws InterruptedException {

// Let's create 1, 2, ..., N-1, N loans
final CountDownLatch createLatch = new CountDownLatch(N);
Integer loanProductID = createLoanProduct();
for (int i = 0; i < N; i++) {
Future<?> unused = executorService.submit(() -> {
Integer clientID = createClient();
Integer loanID = createLoanForClient(clientID);
Integer loanID = createLoanForClient(clientID, loanProductID);
loanIds.add(loanID);
createLatch.countDown();
});
Expand Down Expand Up @@ -200,14 +195,19 @@ private Integer createClient() {
return clientID;
}

@NotNull
private Integer createLoanForClient(Integer clientID) {
private Integer createLoanProduct() {
Integer overdueFeeChargeId = ChargesHelper.createCharges(REQUEST_SPEC, RESPONSE_SPEC,
ChargesHelper.getLoanOverdueFeeJSONWithCalculationTypePercentage("1"));
Assertions.assertNotNull(overdueFeeChargeId);

Integer loanProductID = createLoanProduct(overdueFeeChargeId.toString());
Assertions.assertNotNull(loanProductID);
return loanProductID;
}

@NotNull
private Integer createLoanForClient(Integer clientID, Integer loanProductID) {

HashMap loanStatusHashMap;

Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), "10 January 2020");
Expand Down