remove unused jobs
This commit is contained in:
committed by
Arnold Gálovics
parent
a5bfa43dad
commit
e7b2d6dff5
+6
-4
@@ -28,6 +28,7 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import org.apache.fineract.infrastructure.jobs.service.JobName;
|
||||
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
@@ -63,7 +64,7 @@ public class SchedulerJobsTest {
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
schedulerJobHelper.updateSchedulerStatus(originalSchedulerStatus);
|
||||
for (int jobId = 1; jobId < JobName.values().length; jobId++) {
|
||||
for (Integer jobId : schedulerJobHelper.getAllSchedulerJobIds()) {
|
||||
schedulerJobHelper.updateSchedulerJob(jobId, originalJobStatus.get(jobId));
|
||||
}
|
||||
}
|
||||
@@ -74,9 +75,10 @@ public class SchedulerJobsTest {
|
||||
// is a
|
||||
// java.util.Date)
|
||||
schedulerJobHelper.updateSchedulerStatus(true);
|
||||
schedulerJobHelper.updateSchedulerJob(1, true);
|
||||
String nextRunTimeText = await().until(() -> (String) schedulerJobHelper.getSchedulerJobById(1).get("nextRunTime"),
|
||||
nextRunTime -> nextRunTime != null);
|
||||
int minJobId = schedulerJobHelper.getAllSchedulerJobIds().stream().mapToInt(number -> number).min().orElse(Integer.MAX_VALUE);
|
||||
schedulerJobHelper.updateSchedulerJob(minJobId, true);
|
||||
String nextRunTimeText = await().until(() -> (String) schedulerJobHelper.getSchedulerJobById(minJobId).get("nextRunTime"),
|
||||
Objects::nonNull);
|
||||
DateTimeFormatter.ISO_INSTANT.parse(nextRunTimeText);
|
||||
}
|
||||
|
||||
|
||||
-113
@@ -67,7 +67,6 @@ import org.apache.fineract.portfolio.account.domain.AccountTransferType;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.MethodOrderer.MethodName;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -454,118 +453,6 @@ public class SchedulerJobsTestResults {
|
||||
"Verifying Arrears Aging after Running Update Loan Arrears Aging Scheduler Job");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateLoanPaidInAdvanceJobOutcome() throws InterruptedException {
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
|
||||
Calendar todayDate = Calendar.getInstance();
|
||||
|
||||
todayDate.add(Calendar.MONTH, -1);
|
||||
final String LOAN_DISBURSEMENT_DATE = dateFormat.format(todayDate.getTime());
|
||||
|
||||
todayDate = Calendar.getInstance();
|
||||
todayDate.add(Calendar.DATE, -5);
|
||||
final String LOAN_FIRST_REPAYMENT_DATE = dateFormat.format(todayDate.getTime());
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
Assertions.assertNotNull(clientID);
|
||||
|
||||
final Integer loanProductID = createLoanProduct(null);
|
||||
Assertions.assertNotNull(loanProductID);
|
||||
|
||||
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
|
||||
Assertions.assertNotNull(loanID);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
|
||||
String loanDetails = this.loanTransactionHelper.getLoanDetails(requestSpec, responseSpec, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID,
|
||||
JsonPath.from(loanDetails).get("netDisbursalAmount").toString());
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
ArrayList<HashMap> loanScheduleBefore = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, responseSpec, loanID);
|
||||
|
||||
Float totalDueForCurrentPeriod = (Float) loanScheduleBefore.get(1).get("totalDueForPeriod");
|
||||
|
||||
this.loanTransactionHelper.makeRepayment(LOAN_FIRST_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
|
||||
|
||||
String JobName = "Update Loan Paid In Advance";
|
||||
this.schedulerJobHelper.executeAndAwaitJob(JobName);
|
||||
// Retrieving Loan Repayment Schedule after the successful
|
||||
// completion of
|
||||
// Update Loan Paid in Advance Scheduler Job
|
||||
ArrayList<HashMap> loanScheduleAfter = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, responseSpec, loanID);
|
||||
|
||||
Float totalPaidInAdvance = (Float) loanScheduleAfter.get(1).get("totalPaidInAdvanceForPeriod");
|
||||
|
||||
Assertions.assertEquals(totalDueForCurrentPeriod, totalPaidInAdvance,
|
||||
"Verifying Loan Repayment in Advance after Running Update Loan Paid in Advance Scheduler Job");
|
||||
}
|
||||
|
||||
// Invalid test case as it won't affect summary (Loan summary is properly
|
||||
// updated before running this job)
|
||||
@Disabled
|
||||
@Test
|
||||
public void testUpdateLoanSummaryJobOutcome() throws InterruptedException {
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
|
||||
Calendar todaysDate = Calendar.getInstance();
|
||||
|
||||
todaysDate.add(Calendar.MONTH, -1);
|
||||
final String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime());
|
||||
|
||||
todaysDate = Calendar.getInstance();
|
||||
todaysDate.add(Calendar.DATE, -5);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
Assertions.assertNotNull(clientID);
|
||||
|
||||
final Integer loanProductID = createLoanProduct(null);
|
||||
Assertions.assertNotNull(loanProductID);
|
||||
|
||||
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
|
||||
Assertions.assertNotNull(loanID);
|
||||
|
||||
Integer disburseChargeId = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanDisbursementJSON());
|
||||
Assertions.assertNotNull(disburseChargeId);
|
||||
|
||||
this.loanTransactionHelper.addChargesForLoan(loanID,
|
||||
LoanTransactionHelper.getDisbursementChargesForLoanAsJSON(disburseChargeId.toString()));
|
||||
ArrayList<HashMap> chargesPendingState = this.loanTransactionHelper.getLoanCharges(loanID);
|
||||
Assertions.assertEquals(1, chargesPendingState.size());
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
|
||||
String loanDetails = this.loanTransactionHelper.getLoanDetails(requestSpec, responseSpec, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID,
|
||||
JsonPath.from(loanDetails).get("netDisbursalAmount").toString());
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
HashMap loanSummaryBefore = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
|
||||
|
||||
String JobName = "Update loan Summary";
|
||||
this.schedulerJobHelper.executeAndAwaitJob(JobName);
|
||||
Float expectedSummaryAfterJob = (Float) loanSummaryBefore.get("totalExpectedRepayment")
|
||||
/* - (Float) loanSummaryBefore.get("feeChargesPaid") */;
|
||||
HashMap loanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
|
||||
Assertions.assertEquals(expectedSummaryAfterJob, (Float) loanSummaryAfter.get("totalExpectedRepayment"),
|
||||
"Verifying Loan Summary after Running Update Loan Summary Scheduler Job");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecuteStandingInstructionsJobOutcome() throws InterruptedException {
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
|
||||
Reference in New Issue
Block a user