You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by vo...@apache.org on 2020/06/14 12:09:50 UTC
[fineract] branch develop updated: FINERACT-857: Fixing scheduler
integration tests and migrating to executeAndAwaitJob (#1049)
This is an automated email from the ASF dual-hosted git repository.
vorburger pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new e8ecd79 FINERACT-857: Fixing scheduler integration tests and migrating to executeAndAwaitJob (#1049)
e8ecd79 is described below
commit e8ecd79b9d70da1cdad1f5e1c7af80ef815d95f5
Author: Petri Tuomola <pt...@users.noreply.github.com>
AuthorDate: Sun Jun 14 15:09:41 2020 +0300
FINERACT-857: Fixing scheduler integration tests and migrating to executeAndAwaitJob (#1049)
Co-authored-by: Michael Vorburger ⛑️ <mi...@vorburger.ch>
---
.../integrationtests/SchedulerJobsTestResults.java | 41 ++++++++--------------
.../portfolio/savings/domain/SavingsAccount.java | 1 +
.../domain/SavingsAccountChargeRepository.java | 2 +-
.../service/ScheduledJobRunnerServiceImpl.java | 7 ++--
4 files changed, 21 insertions(+), 30 deletions(-)
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 dc7dc28..c193fd3 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<HashMap> 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<String, Object> 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 7857696..c0700e8 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<SavingsAccountTransaction> 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 d9a2731..177fe3a 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<SavingsAcc
JpaSpecificationExecutor<SavingsAccountCharge> {
@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<SavingsAccountCharge> 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 e62491e..b2a1b00 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);
}
}