diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java index dc7dc28c5..c193fd32f 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java @@ -113,7 +113,6 @@ public class SchedulerJobsTestResults { } @Test - @Disabled // TODO FINERACT-924 public void testApplyAnnualFeeForSavingsJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); @@ -149,7 +148,7 @@ public class SchedulerJobsTestResults { String JobName = "Apply Annual Fee For Savings"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, annualFeeChargeId); @@ -168,7 +167,6 @@ public class SchedulerJobsTestResults { } @Test - @Disabled public void testInterestPostingForSavingsJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); @@ -198,7 +196,7 @@ public class SchedulerJobsTestResults { String JobName = "Post Interest For Savings"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); final HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId); Assertions.assertNotSame(summaryBefore.get("accountBalance"), summaryAfter.get("accountBalance"), @@ -207,7 +205,6 @@ public class SchedulerJobsTestResults { } @Test - @Disabled // TODO FINERACT-857 public void testTransferFeeForLoansFromSavingsJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); @@ -265,7 +262,7 @@ public class SchedulerJobsTestResults { final HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId); String JobName = "Transfer Fee For Loans From Savings"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); final HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId); final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, @@ -281,7 +278,6 @@ public class SchedulerJobsTestResults { } @Test - @Disabled // TODO FINERACT-923 public void testApplyHolidaysToLoansJobOutcome() throws InterruptedException { this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); @@ -342,7 +338,7 @@ public class SchedulerJobsTestResults { String JobName = "Apply Holidays To Loans"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); final ArrayList repaymentScheduleDataAfterJob = this.loanTransactionHelper .getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); @@ -360,7 +356,6 @@ public class SchedulerJobsTestResults { } @Test - @Disabled // TODO FINERACT-857 public void testApplyDueFeeChargesForSavingsJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); @@ -398,7 +393,7 @@ public class SchedulerJobsTestResults { String JobName = "Pay Due Savings Charges"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId); final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, @@ -413,7 +408,6 @@ public class SchedulerJobsTestResults { } @Test - @Disabled // TODO FINERACT-857 public void testUpdateAccountingRunningBalancesJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); @@ -455,7 +449,7 @@ public class SchedulerJobsTestResults { String JobName = "Update Accounting Running Balances"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); final HashMap runningBalanceAfter = this.accountHelper .getAccountingWithRunningBalanceById(accountID.toString()); @@ -467,7 +461,6 @@ public class SchedulerJobsTestResults { } @Test - @Disabled // TODO FINERACT-857 public void testUpdateLoanArrearsAgingJobOutcome() throws InterruptedException { this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); @@ -495,7 +488,7 @@ public class SchedulerJobsTestResults { String JobName = "Update Loan Arrears Ageing"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); HashMap loanSummaryData = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID); @@ -508,7 +501,6 @@ public class SchedulerJobsTestResults { } @Test - @Disabled // TODO FINERACT-857 public void testUpdateLoanPaidInAdvanceJobOutcome() throws InterruptedException { this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); @@ -556,7 +548,7 @@ public class SchedulerJobsTestResults { loanID); String JobName = "Update Loan Paid In Advance"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); // Retrieving Loan Repayment Schedule after the successful // completion of // Update Loan Paid in Advance Scheduler Job @@ -625,7 +617,7 @@ public class SchedulerJobsTestResults { this.responseSpec, loanID); String JobName = "Update loan Summary"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); Float expectedSummaryAfterJob = (Float) loanSummaryBefore.get("totalExpectedRepayment") /* - (Float) loanSummaryBefore.get("feeChargesPaid") */; HashMap loanSummaryAfter = this.loanTransactionHelper.getLoanSummary(this.requestSpec, @@ -636,7 +628,6 @@ public class SchedulerJobsTestResults { } @Test - @Disabled // TODO FINERACT-857 public void testExecuteStandingInstructionsJobOutcome() throws InterruptedException { this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); @@ -701,7 +692,7 @@ public class SchedulerJobsTestResults { Assertions.assertNotNull(standingInstructionId); String JobName = "Execute Standing Instruction"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsId); Float fromSavingsBalanceAfter = (Float) fromSavingsSummaryAfter.get("accountBalance"); @@ -732,7 +723,6 @@ public class SchedulerJobsTestResults { } @Test - @Disabled public void testApplyPenaltyForOverdueLoansJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); @@ -767,7 +757,7 @@ public class SchedulerJobsTestResults { .getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); String JobName = "Apply penalty to overdue loans"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId); @@ -787,7 +777,6 @@ public class SchedulerJobsTestResults { } @Test - @Disabled // TODO FINERACT-857 public void testAvoidUnncessaryPenaltyWhenAmountZeroForOverdueLoansJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); @@ -824,7 +813,7 @@ public class SchedulerJobsTestResults { String JobName = "Apply penalty to overdue loans"; Integer jobId = 12; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); Map schedulerJob = this.schedulerJobHelper.getSchedulerJobById(jobId); @@ -856,7 +845,6 @@ public class SchedulerJobsTestResults { } @Test - @Disabled // TODO FINERACT-857 public void testUpdateOverdueDaysForNPA() throws InterruptedException { this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); @@ -887,14 +875,13 @@ public class SchedulerJobsTestResults { Assertions.assertFalse(isNPABefore); // Integer jobId = (Integer) allSchedulerJobsData.get(1).get("jobId"); String JobName = "Update Non Performing Assets"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); final Boolean isNPAAfter = (Boolean) this.loanTransactionHelper.getLoanDetail(requestSpec, responseSpec, loanID, "isNPA"); Assertions.assertTrue(isNPAAfter); } @Test - @Disabled // TODO FINERACT-857 public void testInterestTransferForSavings() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); @@ -977,7 +964,7 @@ public class SchedulerJobsTestResults { - Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT); String JobName = "Transfer Interest To Savings"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); fixedDepositSummary = savingsAccountHelper.getSavingsSummary(fixedDepositAccountId); assertEquals(Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT), fixedDepositSummary.get("accountBalance"), diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java index 785769634..c0700e8ed 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java @@ -2928,6 +2928,7 @@ public class SavingsAccount extends AbstractPersistableCustom { transactions.size(); charges.size(); savingsOfficerHistory.size(); + if(group != null) { Office dummyOffice = group.getOffice(); } // Ensure lazy loading of group if set } public void updateSavingsAccountSummary(final List transactions) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountChargeRepository.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountChargeRepository.java index d9a2731db..177fe3a3e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountChargeRepository.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountChargeRepository.java @@ -29,7 +29,7 @@ public interface SavingsAccountChargeRepository extends JpaRepository { @Query("select sac from SavingsAccountCharge sac where sac.id =:id and sac.savingsAccount.id = :savingsAccountId") - SavingsAccountCharge findByIdAndSavingsAccountId(Long id, Long savingsAccountId); + SavingsAccountCharge findByIdAndSavingsAccountId(@Param("id") Long id, @Param("savingsAccountId") Long savingsAccountId); @Query("select sac from SavingsAccountCharge sac where sac.dueDate <=:transactionDate and sac.waived = 0 and sac.paid=0 order by sac.dueDate") List findPendingCharges(@Param("transactionDate") Date transactionDate); diff --git a/fineract-provider/src/main/java/org/apache/fineract/scheduledjobs/service/ScheduledJobRunnerServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/scheduledjobs/service/ScheduledJobRunnerServiceImpl.java index e62491ea7..b2a1b001d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/scheduledjobs/service/ScheduledJobRunnerServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/scheduledjobs/service/ScheduledJobRunnerServiceImpl.java @@ -229,7 +229,7 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService LOG.error("Apply annual fee failed for account: {} with message {}", savingsAccountReference.getAccountNo(), error); } } catch (final Exception ex) { - // need to handle this scenario + LOG.error("Apply annual fee failed for account: {}", savingsAccountReference.getAccountNo(), ex); } } @@ -250,6 +250,9 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService for (final ApiParameterError error : errors) { LOG.error("Apply Charges due for savings failed for account {} with message: {}", savingsAccountReference.getAccountNo(), error.getDeveloperMessage(), e); } + } catch (final Exception ex) { + exceptions.add(ex); + LOG.error("Apply Charges due for savings failed for account: {}", savingsAccountReference.getAccountNo(), ex); } } LOG.info("{}: Savings accounts affected by update: {}", ThreadLocalContextUtil.getTenant().getName(), chargesDueData.size()); @@ -307,7 +310,7 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService LOG.error("Update maturity details failed for account: {} with message {}", depositAccount.accountNo(), error.getDeveloperMessage()); } } catch (final Exception ex) { - // need to handle this scenario + LOG.error("Update maturity details failed for account: {}", depositAccount.accountNo(), ex); } }