From a58b14c9d2161d6dd3a3aba23b00e8d86fa42cff Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Mon, 1 Jun 2020 15:29:13 +0200 Subject: [PATCH] executeAndAwaitJob() !executeJob() ClientLoanIntegrationTest un-ignore re. FINERACT-885 and FINERACT-922 --- .../ClientLoanIntegrationTest.java | 40 ++++++++----------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java index c65eacf74..e96b3d55b 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java @@ -57,7 +57,6 @@ import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker; import org.joda.time.LocalDate; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -69,10 +68,11 @@ import org.slf4j.LoggerFactory; */ @SuppressWarnings({ "rawtypes", "unchecked" }) public class ClientLoanIntegrationTest { + private final static Logger LOG = LoggerFactory.getLogger(ClientLoanIntegrationTest.class); + public static final String MINIMUM_OPENING_BALANCE = "1000.0"; public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL"; - private static final String NONE = "1"; private static final String CASH_BASED = "2"; private static final String ACCRUAL_PERIODIC = "3"; @@ -97,6 +97,7 @@ public class ClientLoanIntegrationTest { this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec); + this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); } @Test @@ -715,7 +716,7 @@ public class ClientLoanIntegrationTest { Integer payPeriodnum = 2; this.loanTransactionHelper.payChargesForLoan(loanID, (Integer) getloanCharge(flatAccTransfer, loanCharges).get("id"), LoanTransactionHelper - .getPayChargeJSON(SavingsAccountHelper.TRANSACTION_DATE, String.valueOf(payPeriodnum))); + .getPayChargeJSON(SavingsAccountHelper.TRANSACTION_DATE, String.valueOf(payPeriodnum))); loanCharges = this.loanTransactionHelper.getLoanCharges(loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); loanSchedule.remove(0); @@ -2534,10 +2535,8 @@ public class ClientLoanIntegrationTest { * with calculation type flat */ @Test - @Ignore // TODO FINERACT-885 - public void loanWithFlatCahargesAndPeriodicAccrualAccountingEnabled() throws InterruptedException { + public void loanWithFlatChargesAndPeriodicAccrualAccountingEnabled() throws InterruptedException { this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec); - this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); @@ -2646,7 +2645,7 @@ public class ClientLoanIntegrationTest { */ final String jobName = "Add Accrual Transactions"; - this.schedulerJobHelper.executeJob(jobName); + this.schedulerJobHelper.executeAndAwaitJob(jobName); loanSchedule.clear(); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); @@ -2736,10 +2735,8 @@ public class ClientLoanIntegrationTest { * with calculation type percentage of amount */ @Test - @Ignore // TODO FINERACT-885 - public void loanWithCahargesOfTypeAmountPercentageAndPeriodicAccrualAccountingEnabled() throws InterruptedException { + public void loanWithChargesOfTypeAmountPercentageAndPeriodicAccrualAccountingEnabled() throws InterruptedException { this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec); - this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); @@ -2851,7 +2848,7 @@ public class ClientLoanIntegrationTest { final String jobName = "Add Accrual Transactions"; - this.schedulerJobHelper.executeJob(jobName); + this.schedulerJobHelper.executeAndAwaitJob(jobName); loanSchedule.clear(); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); @@ -2941,11 +2938,9 @@ public class ClientLoanIntegrationTest { * with calculation type percentage of amount and interest */ @Test - @Ignore // TODO FINERACT-885 - public void loanWithCahargesOfTypeAmountPlusInterestPercentageAndPeriodicAccrualAccountingEnabled() + public void loanWithChargesOfTypeAmountPlusInterestPercentageAndPeriodicAccrualAccountingEnabled() throws InterruptedException { this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec); - this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); @@ -3060,7 +3055,7 @@ public class ClientLoanIntegrationTest { final String jobName = "Add Accrual Transactions"; - this.schedulerJobHelper.executeJob(jobName); + this.schedulerJobHelper.executeAndAwaitJob(jobName); loanSchedule.clear(); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); @@ -3621,7 +3616,6 @@ public class ClientLoanIntegrationTest { Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate.add(Calendar.DAY_OF_MONTH, -14); final String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime()); - Integer dayOfMonth = getDayOfMonth(todaysDate); Integer dayOfWeek = getDayOfWeek(todaysDate); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); @@ -3967,11 +3961,9 @@ public class ClientLoanIntegrationTest { } @Test - @Ignore // TODO FINERACT-885 public void testLoanScheduleWithInterestRecalculation_WITH_REST_DAILY_INTEREST_COMPOUND_INTEREST_FEE_STRATEGY_WITH_OVERDUE_CHARGE() throws InterruptedException { this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); - this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy"); dateFormat.setTimeZone(Utils.getTimeZoneOfTenant()); @@ -4040,7 +4032,7 @@ public class ClientLoanIntegrationTest { verifyLoanRepaymentSchedule(loanSchedule, expectedvalues); String JobName = "Apply penalty to overdue loans"; - this.schedulerJobHelper.executeJob(JobName); + this.schedulerJobHelper.executeAndAwaitJob(JobName); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); expectedvalues = new ArrayList<>(); @@ -4541,7 +4533,7 @@ public class ClientLoanIntegrationTest { } if (isArrearsBasedOnOriginalSchedule) { - builder = builder.withArrearsConfiguration(); + builder = builder.withArrearsConfiguration(); } final String loanProductJSON = builder.build(chargeId); @@ -4815,7 +4807,7 @@ public class ClientLoanIntegrationTest { final Integer loanProductID = createLoanProduct("0", "0", LoanProductTestBuilder.DEFAULT_STRATEGY, ACCRUAL_UPFRONT, assetAccount, incomeAccount, expenseAccount, overpaymentAccount);// , - // LoanProductTestBuilder.EQUAL_INSTALLMENTS, + // LoanProductTestBuilder.EQUAL_INSTALLMENTS, // LoanProductTestBuilder.FLAT_BALANCE); Assert.assertNotNull(loanProductID); @@ -5200,7 +5192,7 @@ public class ClientLoanIntegrationTest { .withLoanProductConfiguration(loanProductConfigurationAsTrue).build(null)); LOG.info( "-----------------------LOAN PRODUCT CREATED WITH ATTRIBUTE CONFIGURATION AS TRUE-------------------------- {}" - , loanProductID); + , loanProductID); Integer loanID = applyForLoanApplicationWithProductConfigurationAsTrue(clientID, loanProductID, proposedAmount); LOG.info("------------------------LOAN CREATED WITH ID------------------------------{}" , loanID); @@ -5351,7 +5343,7 @@ public class ClientLoanIntegrationTest { dayOfWeek = 7; } } - return Integer.valueOf(dayOfWeek); + return dayOfWeek; } private Integer getDayOfMonth(Calendar date) { @@ -5363,6 +5355,6 @@ public class ClientLoanIntegrationTest { } } - return Integer.valueOf(dayOfMonth); + return dayOfMonth; } }