executeAndAwaitJob() !executeJob() ClientLoanIntegrationTest un-ignore

re. FINERACT-885 and FINERACT-922
This commit is contained in:
Michael Vorburger
2020-06-02 19:46:04 +01:00
committed by Yemdjih Kaze Nasser
parent 734cbb1d1f
commit a58b14c9d2
@@ -57,7 +57,6 @@ import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -69,10 +68,11 @@ import org.slf4j.LoggerFactory;
*/ */
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
public class ClientLoanIntegrationTest { public class ClientLoanIntegrationTest {
private final static Logger LOG = LoggerFactory.getLogger(ClientLoanIntegrationTest.class); private final static Logger LOG = LoggerFactory.getLogger(ClientLoanIntegrationTest.class);
public static final String MINIMUM_OPENING_BALANCE = "1000.0"; public static final String MINIMUM_OPENING_BALANCE = "1000.0";
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL"; public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
private static final String NONE = "1"; private static final String NONE = "1";
private static final String CASH_BASED = "2"; private static final String CASH_BASED = "2";
private static final String ACCRUAL_PERIODIC = "3"; private static final String ACCRUAL_PERIODIC = "3";
@@ -97,6 +97,7 @@ public class ClientLoanIntegrationTest {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec); this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
} }
@Test @Test
@@ -715,7 +716,7 @@ public class ClientLoanIntegrationTest {
Integer payPeriodnum = 2; Integer payPeriodnum = 2;
this.loanTransactionHelper.payChargesForLoan(loanID, this.loanTransactionHelper.payChargesForLoan(loanID,
(Integer) getloanCharge(flatAccTransfer, loanCharges).get("id"), LoanTransactionHelper (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); loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
loanSchedule.remove(0); loanSchedule.remove(0);
@@ -2534,10 +2535,8 @@ public class ClientLoanIntegrationTest {
* with calculation type flat * with calculation type flat
*/ */
@Test @Test
@Ignore // TODO FINERACT-885 public void loanWithFlatChargesAndPeriodicAccrualAccountingEnabled() throws InterruptedException {
public void loanWithFlatCahargesAndPeriodicAccrualAccountingEnabled() throws InterruptedException {
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec); this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
@@ -2646,7 +2645,7 @@ public class ClientLoanIntegrationTest {
*/ */
final String jobName = "Add Accrual Transactions"; final String jobName = "Add Accrual Transactions";
this.schedulerJobHelper.executeJob(jobName); this.schedulerJobHelper.executeAndAwaitJob(jobName);
loanSchedule.clear(); loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
@@ -2736,10 +2735,8 @@ public class ClientLoanIntegrationTest {
* with calculation type percentage of amount * with calculation type percentage of amount
*/ */
@Test @Test
@Ignore // TODO FINERACT-885 public void loanWithChargesOfTypeAmountPercentageAndPeriodicAccrualAccountingEnabled() throws InterruptedException {
public void loanWithCahargesOfTypeAmountPercentageAndPeriodicAccrualAccountingEnabled() throws InterruptedException {
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec); this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
@@ -2851,7 +2848,7 @@ public class ClientLoanIntegrationTest {
final String jobName = "Add Accrual Transactions"; final String jobName = "Add Accrual Transactions";
this.schedulerJobHelper.executeJob(jobName); this.schedulerJobHelper.executeAndAwaitJob(jobName);
loanSchedule.clear(); loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
@@ -2941,11 +2938,9 @@ public class ClientLoanIntegrationTest {
* with calculation type percentage of amount and interest * with calculation type percentage of amount and interest
*/ */
@Test @Test
@Ignore // TODO FINERACT-885 public void loanWithChargesOfTypeAmountPlusInterestPercentageAndPeriodicAccrualAccountingEnabled()
public void loanWithCahargesOfTypeAmountPlusInterestPercentageAndPeriodicAccrualAccountingEnabled()
throws InterruptedException { throws InterruptedException {
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec); this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
@@ -3060,7 +3055,7 @@ public class ClientLoanIntegrationTest {
final String jobName = "Add Accrual Transactions"; final String jobName = "Add Accrual Transactions";
this.schedulerJobHelper.executeJob(jobName); this.schedulerJobHelper.executeAndAwaitJob(jobName);
loanSchedule.clear(); loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
@@ -3621,7 +3616,6 @@ public class ClientLoanIntegrationTest {
Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
todaysDate.add(Calendar.DAY_OF_MONTH, -14); todaysDate.add(Calendar.DAY_OF_MONTH, -14);
final String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime()); final String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime());
Integer dayOfMonth = getDayOfMonth(todaysDate);
Integer dayOfWeek = getDayOfWeek(todaysDate); Integer dayOfWeek = getDayOfWeek(todaysDate);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -3967,11 +3961,9 @@ public class ClientLoanIntegrationTest {
} }
@Test @Test
@Ignore // TODO FINERACT-885
public void testLoanScheduleWithInterestRecalculation_WITH_REST_DAILY_INTEREST_COMPOUND_INTEREST_FEE_STRATEGY_WITH_OVERDUE_CHARGE() public void testLoanScheduleWithInterestRecalculation_WITH_REST_DAILY_INTEREST_COMPOUND_INTEREST_FEE_STRATEGY_WITH_OVERDUE_CHARGE()
throws InterruptedException { throws InterruptedException {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy"); DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant()); dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
@@ -4040,7 +4032,7 @@ public class ClientLoanIntegrationTest {
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues); verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
String JobName = "Apply penalty to overdue loans"; String JobName = "Apply penalty to overdue loans";
this.schedulerJobHelper.executeJob(JobName); this.schedulerJobHelper.executeAndAwaitJob(JobName);
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
expectedvalues = new ArrayList<>(); expectedvalues = new ArrayList<>();
@@ -4541,7 +4533,7 @@ public class ClientLoanIntegrationTest {
} }
if (isArrearsBasedOnOriginalSchedule) { if (isArrearsBasedOnOriginalSchedule) {
builder = builder.withArrearsConfiguration(); builder = builder.withArrearsConfiguration();
} }
final String loanProductJSON = builder.build(chargeId); final String loanProductJSON = builder.build(chargeId);
@@ -4815,7 +4807,7 @@ public class ClientLoanIntegrationTest {
final Integer loanProductID = createLoanProduct("0", "0", LoanProductTestBuilder.DEFAULT_STRATEGY, final Integer loanProductID = createLoanProduct("0", "0", LoanProductTestBuilder.DEFAULT_STRATEGY,
ACCRUAL_UPFRONT, assetAccount, incomeAccount, expenseAccount, overpaymentAccount);// , ACCRUAL_UPFRONT, assetAccount, incomeAccount, expenseAccount, overpaymentAccount);// ,
// LoanProductTestBuilder.EQUAL_INSTALLMENTS, // LoanProductTestBuilder.EQUAL_INSTALLMENTS,
// LoanProductTestBuilder.FLAT_BALANCE); // LoanProductTestBuilder.FLAT_BALANCE);
Assert.assertNotNull(loanProductID); Assert.assertNotNull(loanProductID);
@@ -5200,7 +5192,7 @@ public class ClientLoanIntegrationTest {
.withLoanProductConfiguration(loanProductConfigurationAsTrue).build(null)); .withLoanProductConfiguration(loanProductConfigurationAsTrue).build(null));
LOG.info( LOG.info(
"-----------------------LOAN PRODUCT CREATED WITH ATTRIBUTE CONFIGURATION AS TRUE-------------------------- {}" "-----------------------LOAN PRODUCT CREATED WITH ATTRIBUTE CONFIGURATION AS TRUE-------------------------- {}"
, loanProductID); , loanProductID);
Integer loanID = applyForLoanApplicationWithProductConfigurationAsTrue(clientID, loanProductID, proposedAmount); Integer loanID = applyForLoanApplicationWithProductConfigurationAsTrue(clientID, loanProductID, proposedAmount);
LOG.info("------------------------LOAN CREATED WITH ID------------------------------{}" , loanID); LOG.info("------------------------LOAN CREATED WITH ID------------------------------{}" , loanID);
@@ -5351,7 +5343,7 @@ public class ClientLoanIntegrationTest {
dayOfWeek = 7; dayOfWeek = 7;
} }
} }
return Integer.valueOf(dayOfWeek); return dayOfWeek;
} }
private Integer getDayOfMonth(Calendar date) { private Integer getDayOfMonth(Calendar date) {
@@ -5363,6 +5355,6 @@ public class ClientLoanIntegrationTest {
} }
} }
return Integer.valueOf(dayOfMonth); return dayOfMonth;
} }
} }