[MIFOSX-1047] Added test cases for Apply Penalty to overdue loans Job
This commit is contained in:
+1
-1
@@ -311,7 +311,7 @@ public class AccountTransferTest {
|
|||||||
.withInterestRateFrequencyTypeAsMonths() //
|
.withInterestRateFrequencyTypeAsMonths() //
|
||||||
.withAmortizationTypeAsEqualInstallments() //
|
.withAmortizationTypeAsEqualInstallments() //
|
||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.build();
|
.build(null);
|
||||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -186,7 +186,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
||||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||||
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRuleAsAccrualBased(accounts).build();
|
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRuleAsAccrualBased(accounts).build(null);
|
||||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
.withInterestRateFrequencyTypeAsMonths() //
|
.withInterestRateFrequencyTypeAsMonths() //
|
||||||
.withAmortizationTypeAsEqualInstallments() //
|
.withAmortizationTypeAsEqualInstallments() //
|
||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.build();
|
.build(null);
|
||||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+41
-36
@@ -39,60 +39,65 @@ public class GlobalConfigurationTest {
|
|||||||
this.responseSpec);
|
this.responseSpec);
|
||||||
Assert.assertNotNull(globalConfig);
|
Assert.assertNotNull(globalConfig);
|
||||||
|
|
||||||
// Updating Value for penalty-wait-period Global Configuration
|
String configName = "penalty-wait-period";
|
||||||
Integer configId = (Integer) globalConfig.get(7).get("id");
|
for (Integer configIndex = 0; configIndex < (globalConfig.size() - 1); configIndex++) {
|
||||||
Assert.assertNotNull(configId);
|
if (globalConfig.get(configIndex).get("name").equals(configName)) {
|
||||||
|
Integer configId = (Integer) globalConfig.get(configIndex).get("id");
|
||||||
|
Assert.assertNotNull(configId);
|
||||||
|
|
||||||
HashMap configDataBefore = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
HashMap configDataBefore = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
||||||
configId.toString());
|
configId.toString());
|
||||||
Assert.assertNotNull(configDataBefore);
|
Assert.assertNotNull(configDataBefore);
|
||||||
|
|
||||||
Integer value = (Integer) configDataBefore.get("value") + 1;
|
Integer value = (Integer) configDataBefore.get("value") + 1;
|
||||||
|
|
||||||
configId = this.globalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
// Updating Value for penalty-wait-period Global Configuration
|
||||||
configId.toString(), value.toString());
|
configId = this.globalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||||
Assert.assertNotNull(configId);
|
configId.toString(), value.toString());
|
||||||
|
Assert.assertNotNull(configId);
|
||||||
|
|
||||||
HashMap configDataAfter = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
HashMap configDataAfter = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
||||||
configId.toString());
|
configId.toString());
|
||||||
|
|
||||||
// Verifying Value for penalty-wait-period after Updation
|
// Verifying Value for penalty-wait-period after Updation
|
||||||
Assert.assertEquals("Verifying Global Config Value after Updation", value, configDataAfter.get("value"));
|
Assert.assertEquals("Verifying Global Config Value after Updation", value, configDataAfter.get("value"));
|
||||||
|
|
||||||
// Updating Enabled Flag for penalty-wait-period Global Configuration
|
// Updating Enabled Flag for penalty-wait-period Global
|
||||||
Boolean enabled = (Boolean) globalConfig.get(7).get("enabled");
|
// Configuration
|
||||||
|
Boolean enabled = (Boolean) globalConfig.get(configIndex).get("enabled");
|
||||||
|
|
||||||
if (enabled == true) {
|
if (enabled == true) {
|
||||||
enabled = false;
|
enabled = false;
|
||||||
} else {
|
} else {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
configId = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||||
|
configId.toString(), enabled);
|
||||||
|
|
||||||
|
configDataAfter = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
||||||
|
configId.toString());
|
||||||
|
|
||||||
|
// Verifying Enabled Flag for penalty-wait-period after Updation
|
||||||
|
Assert.assertEquals("Verifying Enabled Flag Global Config after Updation", enabled, configDataAfter.get("enabled"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configId = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
|
||||||
configId.toString(), enabled);
|
|
||||||
|
|
||||||
configDataAfter = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
|
||||||
configId.toString());
|
|
||||||
|
|
||||||
// Verifying Enabled Flag for penalty-wait-period after Updation
|
|
||||||
Assert.assertEquals("Verifying Enabled Flag Global Config after Updation", enabled, configDataAfter.get("enabled"));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGlobalConfigurationIsCacheEnabled() {
|
public void testGlobalConfigurationIsCacheEnabled() {
|
||||||
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
// Retrieving Is Cache Enabled Global Configuration details
|
// Retrieving Is Cache Enabled Global Configuration details
|
||||||
ArrayList<HashMap> isCacheGlobalConfig = this.globalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(
|
ArrayList<HashMap> isCacheGlobalConfig = this.globalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec,
|
||||||
this.requestSpec, this.responseSpec);
|
this.responseSpec);
|
||||||
Assert.assertNotNull(isCacheGlobalConfig);
|
Assert.assertNotNull(isCacheGlobalConfig);
|
||||||
|
|
||||||
for (Integer cacheType = 0; cacheType <= ((isCacheGlobalConfig.size()) - 1); cacheType++) {
|
for (Integer cacheType = 0; cacheType <= ((isCacheGlobalConfig.size()) - 1); cacheType++) {
|
||||||
|
|
||||||
// Retrieving Is Cache Enabled Global Configuration details
|
// Retrieving Is Cache Enabled Global Configuration details
|
||||||
isCacheGlobalConfig = this.globalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(
|
isCacheGlobalConfig = this.globalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec, this.responseSpec);
|
||||||
this.requestSpec, this.responseSpec);
|
|
||||||
Assert.assertNotNull(isCacheGlobalConfig);
|
Assert.assertNotNull(isCacheGlobalConfig);
|
||||||
|
|
||||||
HashMap cacheTypeAsHashMap = (HashMap) isCacheGlobalConfig.get(cacheType).get("cacheType");
|
HashMap cacheTypeAsHashMap = (HashMap) isCacheGlobalConfig.get(cacheType).get("cacheType");
|
||||||
|
|||||||
+1
-1
@@ -66,7 +66,7 @@ public class GroupLoanIntegrationTest {
|
|||||||
.withInterestRateFrequencyTypeAsMonths() //
|
.withInterestRateFrequencyTypeAsMonths() //
|
||||||
.withAmortizationTypeAsEqualInstallments() //
|
.withAmortizationTypeAsEqualInstallments() //
|
||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.build();
|
.build(null);
|
||||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -116,7 +116,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
|||||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL).withRepaymentTypeAsMonth()
|
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL).withRepaymentTypeAsMonth()
|
||||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||||
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().build();
|
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().build(null);
|
||||||
|
|
||||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ public class LoanWithdrawnByApplicantIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
public void loanWithdrawnByApplicant() {
|
public void loanWithdrawnByApplicant() {
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
|
||||||
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder().build());
|
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder().build(null));
|
||||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||||
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@ public class SchedulerJobsTest {
|
|||||||
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(allSchedulerJobsData);
|
Assert.assertNotNull(allSchedulerJobsData);
|
||||||
|
|
||||||
for (Integer jobIndex = 0; jobIndex <= ((allSchedulerJobsData.size()) - 1); jobIndex++) {
|
for (Integer jobIndex = 0; jobIndex < allSchedulerJobsData.size(); jobIndex++) {
|
||||||
|
|
||||||
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
||||||
|
|
||||||
|
|||||||
+444
-284
@@ -111,38 +111,47 @@ public class SchedulerJobsTestResults {
|
|||||||
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(allSchedulerJobsData);
|
Assert.assertNotNull(allSchedulerJobsData);
|
||||||
|
|
||||||
Integer jobId = (Integer) allSchedulerJobsData.get(3).get("jobId");
|
// Integer jobId = (Integer) allSchedulerJobsData.get(3).get("jobId");
|
||||||
|
|
||||||
HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
String JobName = "Apply Annual Fee For Savings";
|
||||||
|
for (Integer jobIndex = 0; jobIndex < allSchedulerJobsData.size(); jobIndex++) {
|
||||||
|
if (allSchedulerJobsData.get(jobIndex).get("displayName").equals(JobName)) {
|
||||||
|
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
||||||
|
|
||||||
// Executing Scheduler Job
|
HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||||
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
|
||||||
|
|
||||||
// Retrieving Scheduler Job by ID
|
// Executing Scheduler Job
|
||||||
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
|
||||||
|
|
||||||
// Waiting for Job to Complete
|
// Retrieving Scheduler Job by ID
|
||||||
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Thread.sleep(120000);
|
Assert.assertNotNull(schedulerJob);
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
|
||||||
Assert.assertNotNull(schedulerJob);
|
// Waiting for Job to Complete
|
||||||
System.out.println("Job is Still Running");
|
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
||||||
|
Thread.sleep(120000);
|
||||||
|
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
System.out.println("Job is Still Running");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
||||||
|
jobId.toString());
|
||||||
|
|
||||||
|
// Verifying the Status of the Recently executed Scheduler Job
|
||||||
|
Assert.assertEquals("Verifying Last Scheduler Job Status", "success",
|
||||||
|
jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
||||||
|
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, annualFeeChargeId);
|
||||||
|
|
||||||
|
Float chargeAmount = (Float) chargeData.get("amount");
|
||||||
|
|
||||||
|
final HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||||
|
Assert.assertEquals("Verifying Annual Fee after Running Scheduler Job for Apply Anual Fee", chargeAmount,
|
||||||
|
(Float) summaryAfter.get("totalAnnualFees"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
|
||||||
jobId.toString());
|
|
||||||
|
|
||||||
// Verifying the Status of the Recently executed Scheduler Job
|
|
||||||
Assert.assertEquals("Verifying Last Scheduler Job Status", "success", jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
|
||||||
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, annualFeeChargeId);
|
|
||||||
|
|
||||||
Float chargeAmount = (Float) chargeData.get("amount");
|
|
||||||
|
|
||||||
final HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
|
||||||
Assert.assertEquals("Verifying Annual Fee after Running Scheduler Job for Apply Anual Fee", chargeAmount,
|
|
||||||
(Float) summaryAfter.get("totalAnnualFees"));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -173,35 +182,43 @@ public class SchedulerJobsTestResults {
|
|||||||
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(allSchedulerJobsData);
|
Assert.assertNotNull(allSchedulerJobsData);
|
||||||
|
|
||||||
Integer jobId = (Integer) allSchedulerJobsData.get(5).get("jobId");
|
// Integer jobId = (Integer) allSchedulerJobsData.get(5).get("jobId");
|
||||||
|
String JobName = "Post Interest For Savings";
|
||||||
|
for (Integer jobIndex = 0; jobIndex < allSchedulerJobsData.size(); jobIndex++) {
|
||||||
|
if (allSchedulerJobsData.get(jobIndex).get("displayName").equals(JobName)) {
|
||||||
|
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
||||||
|
|
||||||
final HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
final HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||||
|
|
||||||
// Executing Scheduler Job
|
// Executing Scheduler Job
|
||||||
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
||||||
|
|
||||||
// Retrieving Scheduler Job by ID
|
// Retrieving Scheduler Job by ID
|
||||||
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
|
||||||
// Waiting for Job to complete
|
// Waiting for Job to complete
|
||||||
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
||||||
Thread.sleep(120000);
|
Thread.sleep(120000);
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
System.out.println("Job is Still Running");
|
System.out.println("Job is Still Running");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
||||||
|
jobId.toString());
|
||||||
|
|
||||||
|
// Verifying the Status of the Recently executed Scheduler Job
|
||||||
|
Assert.assertEquals("Verifying Last Scheduler Job Status", "success",
|
||||||
|
jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
||||||
|
|
||||||
|
final HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||||
|
|
||||||
|
Assert.assertNotSame("Verifying the Balance after running Post Interest for Savings Job",
|
||||||
|
summaryBefore.get("accountBalance"), summaryAfter.get("accountBalance"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
|
||||||
jobId.toString());
|
|
||||||
|
|
||||||
// Verifying the Status of the Recently executed Scheduler Job
|
|
||||||
Assert.assertEquals("Verifying Last Scheduler Job Status", "success", jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
|
||||||
|
|
||||||
final HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
|
||||||
|
|
||||||
Assert.assertNotSame("Verifying the Balance after running Post Interest for Savings Job", summaryBefore.get("accountBalance"),
|
|
||||||
summaryAfter.get("accountBalance"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -230,7 +247,7 @@ public class SchedulerJobsTestResults {
|
|||||||
savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
|
savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
|
||||||
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
||||||
|
|
||||||
final Integer loanProductID = createLoanProduct();
|
final Integer loanProductID = createLoanProduct(null);
|
||||||
Assert.assertNotNull(loanProductID);
|
Assert.assertNotNull(loanProductID);
|
||||||
|
|
||||||
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), savingsId.toString());
|
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), savingsId.toString());
|
||||||
@@ -257,42 +274,50 @@ public class SchedulerJobsTestResults {
|
|||||||
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(allSchedulerJobsData);
|
Assert.assertNotNull(allSchedulerJobsData);
|
||||||
|
|
||||||
Integer jobId = (Integer) allSchedulerJobsData.get(6).get("jobId");
|
// Integer jobId = (Integer) allSchedulerJobsData.get(6).get("jobId");
|
||||||
|
String JobName = "Transfer Fee For Loans From Savings";
|
||||||
|
for (Integer jobIndex = 0; jobIndex < allSchedulerJobsData.size(); jobIndex++) {
|
||||||
|
if (allSchedulerJobsData.get(jobIndex).get("displayName").equals(JobName)) {
|
||||||
|
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
||||||
|
|
||||||
final HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
final HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||||
|
|
||||||
// Executing Scheduler Job
|
// Executing Scheduler Job
|
||||||
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
||||||
|
|
||||||
// Retrieving Scheduler Job by ID
|
// Retrieving Scheduler Job by ID
|
||||||
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
|
||||||
// Waiting for Job to complete
|
// Waiting for Job to complete
|
||||||
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
||||||
Thread.sleep(120000);
|
Thread.sleep(120000);
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
System.out.println("Job is Still Running");
|
System.out.println("Job is Still Running");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
||||||
|
jobId.toString());
|
||||||
|
|
||||||
|
// Verifying the Status of the Recently executed Scheduler Job
|
||||||
|
Assert.assertEquals("Verifying Last Scheduler Job Status", "success",
|
||||||
|
jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
||||||
|
|
||||||
|
final HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||||
|
|
||||||
|
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
||||||
|
|
||||||
|
Float chargeAmount = (Float) chargeData.get("amount");
|
||||||
|
|
||||||
|
final Float balance = (Float) summaryBefore.get("accountBalance") - chargeAmount;
|
||||||
|
|
||||||
|
Assert.assertEquals("Verifying the Balance after running Transfer Fee for Loans from Savings", balance,
|
||||||
|
(Float) summaryAfter.get("accountBalance"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
|
||||||
jobId.toString());
|
|
||||||
|
|
||||||
// Verifying the Status of the Recently executed Scheduler Job
|
|
||||||
Assert.assertEquals("Verifying Last Scheduler Job Status", "success", jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
|
||||||
|
|
||||||
final HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
|
||||||
|
|
||||||
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
|
||||||
|
|
||||||
Float chargeAmount = (Float) chargeData.get("amount");
|
|
||||||
|
|
||||||
final Float balance = (Float) summaryBefore.get("accountBalance") - chargeAmount;
|
|
||||||
|
|
||||||
Assert.assertEquals("Verifying the Balance after running Transfer Fee for Loans from Savings", balance,
|
|
||||||
(Float) summaryAfter.get("accountBalance"));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -308,7 +333,7 @@ public class SchedulerJobsTestResults {
|
|||||||
Integer holidayId = this.holidayHelper.createHolidays(this.requestSpec, this.responseSpec);
|
Integer holidayId = this.holidayHelper.createHolidays(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(holidayId);
|
Assert.assertNotNull(holidayId);
|
||||||
|
|
||||||
final Integer loanProductID = createLoanProduct();
|
final Integer loanProductID = createLoanProduct(null);
|
||||||
Assert.assertNotNull(loanProductID);
|
Assert.assertNotNull(loanProductID);
|
||||||
|
|
||||||
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
|
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
|
||||||
@@ -348,46 +373,54 @@ public class SchedulerJobsTestResults {
|
|||||||
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(allSchedulerJobsData);
|
Assert.assertNotNull(allSchedulerJobsData);
|
||||||
|
|
||||||
Integer jobId = (Integer) allSchedulerJobsData.get(4).get("jobId");
|
// Integer jobId = (Integer) allSchedulerJobsData.get(4).get("jobId");
|
||||||
|
String JobName = "Apply Holidays To Loans";
|
||||||
|
for (Integer jobIndex = 0; jobIndex < allSchedulerJobsData.size(); jobIndex++) {
|
||||||
|
if (allSchedulerJobsData.get(jobIndex).get("displayName").equals(JobName)) {
|
||||||
|
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
||||||
|
|
||||||
final ArrayList<HashMap> repaymentScheduleDataBeforeJob = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
|
final ArrayList<HashMap> repaymentScheduleDataBeforeJob = this.loanTransactionHelper.getLoanRepaymentSchedule(
|
||||||
this.responseSpec, loanID);
|
this.requestSpec, this.responseSpec, loanID);
|
||||||
|
|
||||||
holidayId = this.holidayHelper.activateHolidays(this.requestSpec, this.responseSpec, holidayId.toString());
|
holidayId = this.holidayHelper.activateHolidays(this.requestSpec, this.responseSpec, holidayId.toString());
|
||||||
Assert.assertNotNull(holidayId);
|
Assert.assertNotNull(holidayId);
|
||||||
|
|
||||||
// Executing Scheduler Job
|
// Executing Scheduler Job
|
||||||
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
||||||
|
|
||||||
// Retrieving Scheduler Job by ID
|
// Retrieving Scheduler Job by ID
|
||||||
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
|
||||||
// Waiting for Job to complete
|
// Waiting for Job to complete
|
||||||
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
||||||
Thread.sleep(120000);
|
Thread.sleep(120000);
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
System.out.println("Job is Still Running");
|
System.out.println("Job is Still Running");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
||||||
|
jobId.toString());
|
||||||
|
|
||||||
|
// Verifying the Status of the Recently executed Scheduler Job
|
||||||
|
Assert.assertEquals("Verifying Last Scheduler Job Status", "success",
|
||||||
|
jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
||||||
|
|
||||||
|
final ArrayList<HashMap> repaymentScheduleDataAfterJob = this.loanTransactionHelper.getLoanRepaymentSchedule(
|
||||||
|
this.requestSpec, this.responseSpec, loanID);
|
||||||
|
|
||||||
|
HashMap holidayData = this.holidayHelper.getHolidayById(this.requestSpec, this.responseSpec, holidayId.toString());
|
||||||
|
ArrayList<Integer> repaymentsRescheduledDate = (ArrayList<Integer>) holidayData.get("repaymentsRescheduledTo");
|
||||||
|
|
||||||
|
ArrayList<Integer> rescheduleDateAfter = (ArrayList<Integer>) repaymentScheduleDataAfterJob.get(2).get("fromDate");
|
||||||
|
|
||||||
|
Assert.assertEquals("Verifying Repayment Rescheduled Date after Running Apply Holidays to Loans Scheduler Job",
|
||||||
|
repaymentsRescheduledDate, repaymentsRescheduledDate);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
|
||||||
jobId.toString());
|
|
||||||
|
|
||||||
// Verifying the Status of the Recently executed Scheduler Job
|
|
||||||
Assert.assertEquals("Verifying Last Scheduler Job Status", "success", jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
|
||||||
|
|
||||||
final ArrayList<HashMap> repaymentScheduleDataAfterJob = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
|
|
||||||
this.responseSpec, loanID);
|
|
||||||
|
|
||||||
HashMap holidayData = this.holidayHelper.getHolidayById(this.requestSpec, this.responseSpec, holidayId.toString());
|
|
||||||
ArrayList<Integer> repaymentsRescheduledDate = (ArrayList<Integer>) holidayData.get("repaymentsRescheduledTo");
|
|
||||||
|
|
||||||
ArrayList<Integer> rescheduleDateAfter = (ArrayList<Integer>) repaymentScheduleDataAfterJob.get(2).get("fromDate");
|
|
||||||
|
|
||||||
Assert.assertEquals("Verifying Repayment Rescheduled Date after Running Apply Holidays to Loans Scheduler Job",
|
|
||||||
repaymentsRescheduledDate, repaymentsRescheduledDate);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -426,43 +459,51 @@ public class SchedulerJobsTestResults {
|
|||||||
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(allSchedulerJobsData);
|
Assert.assertNotNull(allSchedulerJobsData);
|
||||||
|
|
||||||
Integer jobId = (Integer) allSchedulerJobsData.get(7).get("jobId");
|
// Integer jobId = (Integer) allSchedulerJobsData.get(7).get("jobId");
|
||||||
|
String JobName = "Pay Due Savings Charges";
|
||||||
|
for (Integer jobIndex = 0; jobIndex < allSchedulerJobsData.size(); jobIndex++) {
|
||||||
|
if (allSchedulerJobsData.get(jobIndex).get("displayName").equals(JobName)) {
|
||||||
|
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
||||||
|
|
||||||
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
|
||||||
HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||||
|
|
||||||
// Executing Scheduler Job
|
// Executing Scheduler Job
|
||||||
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
||||||
|
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
|
||||||
// Waiting for Job to complete
|
// Waiting for Job to complete
|
||||||
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
||||||
Thread.sleep(120000);
|
Thread.sleep(120000);
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
System.out.println("Job is Still Running");
|
System.out.println("Job is Still Running");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
||||||
|
jobId.toString());
|
||||||
|
|
||||||
|
// Verifying the Status of the Recently executed Scheduler Job
|
||||||
|
Assert.assertEquals("Verifying Last Scheduler Job Status", "success",
|
||||||
|
jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
||||||
|
|
||||||
|
HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||||
|
|
||||||
|
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
||||||
|
|
||||||
|
Float chargeAmount = (Float) chargeData.get("amount");
|
||||||
|
|
||||||
|
final Float balance = (Float) summaryBefore.get("accountBalance") - chargeAmount;
|
||||||
|
|
||||||
|
Assert.assertEquals("Verifying the Balance after running Pay due Savings Charges", balance,
|
||||||
|
(Float) summaryAfter.get("accountBalance"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
|
||||||
jobId.toString());
|
|
||||||
|
|
||||||
// Verifying the Status of the Recently executed Scheduler Job
|
|
||||||
Assert.assertEquals("Verifying Last Scheduler Job Status", "success", jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
|
||||||
|
|
||||||
HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
|
||||||
|
|
||||||
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
|
||||||
|
|
||||||
Float chargeAmount = (Float) chargeData.get("amount");
|
|
||||||
|
|
||||||
final Float balance = (Float) summaryBefore.get("accountBalance") - chargeAmount;
|
|
||||||
|
|
||||||
Assert.assertEquals("Verifying the Balance after running Pay due Savings Charges", balance,
|
|
||||||
(Float) summaryAfter.get("accountBalance"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -501,38 +542,46 @@ public class SchedulerJobsTestResults {
|
|||||||
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(allSchedulerJobsData);
|
Assert.assertNotNull(allSchedulerJobsData);
|
||||||
|
|
||||||
Integer jobId = (Integer) allSchedulerJobsData.get(8).get("jobId");
|
// Integer jobId = (Integer) allSchedulerJobsData.get(8).get("jobId");
|
||||||
|
String JobName = "Update Accounting Running Balances";
|
||||||
|
for (Integer jobIndex = 0; jobIndex < allSchedulerJobsData.size(); jobIndex++) {
|
||||||
|
if (allSchedulerJobsData.get(jobIndex).get("displayName").equals(JobName)) {
|
||||||
|
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
||||||
|
|
||||||
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
|
||||||
// Executing Scheduler Job
|
// Executing Scheduler Job
|
||||||
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
||||||
|
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
|
||||||
// Waiting for Job to complete
|
// Waiting for Job to complete
|
||||||
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
||||||
Thread.sleep(120000);
|
Thread.sleep(120000);
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
System.out.println("Job is Still Running");
|
System.out.println("Job is Still Running");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
||||||
|
jobId.toString());
|
||||||
|
|
||||||
|
// Verifying the Status of the Recently executed Scheduler Job
|
||||||
|
Assert.assertEquals("Verifying Last Scheduler Job Status", "success",
|
||||||
|
jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
||||||
|
|
||||||
|
final HashMap runningBalanceAfter = this.accountHelper.getAccountingWithRunningBalanceById(accountID.toString());
|
||||||
|
|
||||||
|
final Integer INT_BALANCE = new Integer(MINIMUM_OPENING_BALANCE);
|
||||||
|
|
||||||
|
Assert.assertEquals("Verifying Account Running Balance after running Update Accounting Running Balances Scheduler Job",
|
||||||
|
INT_BALANCE, runningBalanceAfter.get("organizationRunningBalance"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
|
||||||
jobId.toString());
|
|
||||||
|
|
||||||
// Verifying the Status of the Recently executed Scheduler Job
|
|
||||||
Assert.assertEquals("Verifying Last Scheduler Job Status", "success", jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
|
||||||
|
|
||||||
final HashMap runningBalanceAfter = this.accountHelper.getAccountingWithRunningBalanceById(accountID.toString());
|
|
||||||
|
|
||||||
final Integer INT_BALANCE = new Integer(MINIMUM_OPENING_BALANCE);
|
|
||||||
|
|
||||||
Assert.assertEquals("Verifying Account Running Balance after running Update Accounting Running Balances Scheduler Job",
|
|
||||||
INT_BALANCE, runningBalanceAfter.get("organizationRunningBalance"));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -543,7 +592,7 @@ public class SchedulerJobsTestResults {
|
|||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientID);
|
Assert.assertNotNull(clientID);
|
||||||
|
|
||||||
final Integer loanProductID = createLoanProduct();
|
final Integer loanProductID = createLoanProduct(null);
|
||||||
Assert.assertNotNull(loanProductID);
|
Assert.assertNotNull(loanProductID);
|
||||||
|
|
||||||
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
|
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
|
||||||
@@ -561,36 +610,45 @@ public class SchedulerJobsTestResults {
|
|||||||
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(allSchedulerJobsData);
|
Assert.assertNotNull(allSchedulerJobsData);
|
||||||
|
|
||||||
Integer jobId = (Integer) allSchedulerJobsData.get(1).get("jobId");
|
// Integer jobId = (Integer) allSchedulerJobsData.get(1).get("jobId");
|
||||||
|
String JobName = "Update Loan Arrears Ageing";
|
||||||
|
for (Integer jobIndex = 0; jobIndex < allSchedulerJobsData.size(); jobIndex++) {
|
||||||
|
if (allSchedulerJobsData.get(jobIndex).get("displayName").equals(JobName)) {
|
||||||
|
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
||||||
|
|
||||||
// Executing Scheduler Job
|
// Executing Scheduler Job
|
||||||
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
||||||
|
|
||||||
// Retrieving Scheduler Job by ID
|
// Retrieving Scheduler Job by ID
|
||||||
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
|
||||||
// Waiting for Job to complete
|
// Waiting for Job to complete
|
||||||
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
||||||
Thread.sleep(120000);
|
Thread.sleep(120000);
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
System.out.println("Job is Still Running");
|
System.out.println("Job is Still Running");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
||||||
|
jobId.toString());
|
||||||
|
|
||||||
|
// Verifying the Status of the Recently executed Scheduler Job
|
||||||
|
Assert.assertEquals("Verifying Last Scheduler Job Status", "success",
|
||||||
|
jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
||||||
|
|
||||||
|
HashMap loanSummaryData = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
|
||||||
|
|
||||||
|
Float totalLoanArrearsAging = (Float) loanSummaryData.get("principalOverdue")
|
||||||
|
+ (Float) loanSummaryData.get("interestOverdue");
|
||||||
|
|
||||||
|
Assert.assertEquals("Verifying Arrears Aging after Running Update Loan Arrears Aging Scheduler Job", totalLoanArrearsAging,
|
||||||
|
loanSummaryData.get("totalOverdue"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
|
||||||
jobId.toString());
|
|
||||||
|
|
||||||
// Verifying the Status of the Recently executed Scheduler Job
|
|
||||||
Assert.assertEquals("Verifying Last Scheduler Job Status", "success", jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
|
||||||
|
|
||||||
HashMap loanSummaryData = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
|
|
||||||
|
|
||||||
Float totalLoanArrearsAging = (Float) loanSummaryData.get("principalOverdue") + (Float) loanSummaryData.get("interestOverdue");
|
|
||||||
|
|
||||||
Assert.assertEquals("Verifying Arrears Aging after Running Update Loan Arrears Aging Scheduler Job", totalLoanArrearsAging,
|
|
||||||
loanSummaryData.get("totalOverdue"));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -613,7 +671,7 @@ public class SchedulerJobsTestResults {
|
|||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientID);
|
Assert.assertNotNull(clientID);
|
||||||
|
|
||||||
final Integer loanProductID = createLoanProduct();
|
final Integer loanProductID = createLoanProduct(null);
|
||||||
Assert.assertNotNull(loanProductID);
|
Assert.assertNotNull(loanProductID);
|
||||||
|
|
||||||
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
|
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
|
||||||
@@ -640,41 +698,50 @@ public class SchedulerJobsTestResults {
|
|||||||
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(allSchedulerJobsData);
|
Assert.assertNotNull(allSchedulerJobsData);
|
||||||
|
|
||||||
Integer jobId = (Integer) allSchedulerJobsData.get(2).get("jobId");
|
// Integer jobId = (Integer) allSchedulerJobsData.get(2).get("jobId");
|
||||||
|
String JobName = "Update Loan Paid In Advance";
|
||||||
|
for (Integer jobIndex = 0; jobIndex < allSchedulerJobsData.size(); jobIndex++) {
|
||||||
|
if (allSchedulerJobsData.get(jobIndex).get("displayName").equals(JobName)) {
|
||||||
|
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
||||||
|
|
||||||
// Executing Scheduler Job
|
// Executing Scheduler Job
|
||||||
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
||||||
|
|
||||||
// Retrieving Scheduler Job by ID
|
// Retrieving Scheduler Job by ID
|
||||||
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
|
||||||
// Waiting for Job to complete
|
// Waiting for Job to complete
|
||||||
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
||||||
Thread.sleep(120000);
|
Thread.sleep(120000);
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
System.out.println("Job is Still Running");
|
System.out.println("Job is Still Running");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
||||||
|
jobId.toString());
|
||||||
|
|
||||||
|
// Verifying the Status of the Recently executed Scheduler Job
|
||||||
|
Assert.assertEquals("Verifying Last Scheduler Job Status", "success",
|
||||||
|
jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
||||||
|
|
||||||
|
// Retrieving Loan Repayment Schedule after the successful
|
||||||
|
// completion of
|
||||||
|
// Update Loan Paid in Advance Scheduler Job
|
||||||
|
ArrayList<HashMap> loanScheduleAfter = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
|
||||||
|
this.responseSpec, loanID);
|
||||||
|
|
||||||
|
loanSummary = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
|
||||||
|
|
||||||
|
Float totalPaidInAdvance = (Float) loanScheduleAfter.get(1).get("totalPaidInAdvanceForPeriod");
|
||||||
|
|
||||||
|
Assert.assertEquals("Verifying Loan Repayment in Advance after Running Update Loan Paid in Advance Scheduler Job",
|
||||||
|
totalDueForCurrentPeriod, totalPaidInAdvance);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
|
||||||
jobId.toString());
|
|
||||||
|
|
||||||
// Verifying the Status of the Recently executed Scheduler Job
|
|
||||||
Assert.assertEquals("Verifying Last Scheduler Job Status", "success", jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
|
||||||
|
|
||||||
// Retrieving Loan Repayment Schedule after the successful completion of
|
|
||||||
// Update Loan Paid in Advance Scheduler Job
|
|
||||||
ArrayList<HashMap> loanScheduleAfter = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
|
|
||||||
loanID);
|
|
||||||
|
|
||||||
loanSummary = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
|
|
||||||
|
|
||||||
Float totalPaidInAdvance = (Float) loanScheduleAfter.get(1).get("totalPaidInAdvanceForPeriod");
|
|
||||||
|
|
||||||
Assert.assertEquals("Verifying Loan Repayment in Advance after Running Update Loan Paid in Advance Scheduler Job",
|
|
||||||
totalDueForCurrentPeriod, totalPaidInAdvance);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -697,7 +764,7 @@ public class SchedulerJobsTestResults {
|
|||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientID);
|
Assert.assertNotNull(clientID);
|
||||||
|
|
||||||
final Integer loanProductID = createLoanProduct();
|
final Integer loanProductID = createLoanProduct(null);
|
||||||
Assert.assertNotNull(loanProductID);
|
Assert.assertNotNull(loanProductID);
|
||||||
|
|
||||||
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
|
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
|
||||||
@@ -726,35 +793,43 @@ public class SchedulerJobsTestResults {
|
|||||||
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(allSchedulerJobsData);
|
Assert.assertNotNull(allSchedulerJobsData);
|
||||||
|
|
||||||
Integer jobId = (Integer) allSchedulerJobsData.get(0).get("jobId");
|
// Integer jobId = (Integer) allSchedulerJobsData.get(0).get("jobId");
|
||||||
|
String JobName = "Update loan Summary";
|
||||||
|
for (Integer jobIndex = 0; jobIndex < allSchedulerJobsData.size(); jobIndex++) {
|
||||||
|
if (allSchedulerJobsData.get(jobIndex).get("displayName").equals(JobName)) {
|
||||||
|
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
||||||
|
|
||||||
// Executing Scheduler Job
|
// Executing Scheduler Job
|
||||||
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
||||||
|
|
||||||
// Retrieving Scheduler Job by ID
|
// Retrieving Scheduler Job by ID
|
||||||
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
|
||||||
// Waiting for Job to complete
|
// Waiting for Job to complete
|
||||||
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
||||||
Thread.sleep(120000);
|
Thread.sleep(120000);
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
System.out.println("Job is Still Running");
|
System.out.println("Job is Still Running");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
||||||
|
jobId.toString());
|
||||||
|
|
||||||
|
// Verifying the Status of the Recently executed Scheduler Job
|
||||||
|
Assert.assertEquals("Verifying Last Scheduler Job Status", "success",
|
||||||
|
jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
||||||
|
|
||||||
|
Float expectedSummaryAfterJob = (Float) loanSummaryBefore.get("totalExpectedRepayment")
|
||||||
|
- (Float) loanSummaryBefore.get("feeChargesPaid");
|
||||||
|
HashMap loanSummaryAfter = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
|
||||||
|
Assert.assertEquals("Verifying Loan Summary after Running Update Loan Summary Scheduler Job", expectedSummaryAfterJob,
|
||||||
|
(Float) loanSummaryAfter.get("totalExpectedRepayment"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
|
||||||
jobId.toString());
|
|
||||||
|
|
||||||
// Verifying the Status of the Recently executed Scheduler Job
|
|
||||||
Assert.assertEquals("Verifying Last Scheduler Job Status", "success", jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
|
||||||
|
|
||||||
Float expectedSummaryAfterJob = (Float) loanSummaryBefore.get("totalExpectedRepayment")
|
|
||||||
- (Float) loanSummaryBefore.get("feeChargesPaid");
|
|
||||||
HashMap loanSummaryAfter = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
|
|
||||||
Assert.assertEquals("Verifying Loan Summary after Running Update Loan Summary Scheduler Job", expectedSummaryAfterJob,
|
|
||||||
(Float) loanSummaryAfter.get("totalExpectedRepayment"));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -822,44 +897,129 @@ public class SchedulerJobsTestResults {
|
|||||||
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(allSchedulerJobsData);
|
Assert.assertNotNull(allSchedulerJobsData);
|
||||||
|
|
||||||
Integer jobId = (Integer) allSchedulerJobsData.get(9).get("jobId");
|
// Integer jobId = (Integer) allSchedulerJobsData.get(9).get("jobId");
|
||||||
|
String JobName = "Execute Standing Instruction";
|
||||||
|
for (Integer jobIndex = 0; jobIndex < allSchedulerJobsData.size(); jobIndex++) {
|
||||||
|
if (allSchedulerJobsData.get(jobIndex).get("displayName").equals(JobName)) {
|
||||||
|
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
||||||
|
|
||||||
// Executing Scheduler Job
|
// Executing Scheduler Job
|
||||||
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
||||||
|
|
||||||
// Retrieving Scheduler Job by ID
|
// Retrieving Scheduler Job by ID
|
||||||
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
|
||||||
// Waiting for Job to complete
|
// Waiting for Job to complete
|
||||||
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
||||||
Thread.sleep(120000);
|
Thread.sleep(120000);
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
Assert.assertNotNull(schedulerJob);
|
Assert.assertNotNull(schedulerJob);
|
||||||
System.out.println("Job is Still Running");
|
System.out.println("Job is Still Running");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
||||||
|
jobId.toString());
|
||||||
|
|
||||||
|
// Verifying the Status of the Recently executed Scheduler Job
|
||||||
|
Assert.assertEquals("Verifying Last Scheduler Job Status", "success",
|
||||||
|
jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
||||||
|
|
||||||
|
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsId);
|
||||||
|
Float fromSavingsBalanceAfter = (Float) fromSavingsSummaryAfter.get("accountBalance");
|
||||||
|
|
||||||
|
HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsId);
|
||||||
|
Float toSavingsBalanceAfter = (Float) toSavingsSummaryAfter.get("accountBalance");
|
||||||
|
|
||||||
|
final HashMap standingInstructionData = this.standingInstructionsHelper.getStandingInstructionById(standingInstructionId
|
||||||
|
.toString());
|
||||||
|
Float expectedFromSavingsBalance = fromSavingsBalanceBefore - (Float) standingInstructionData.get("amount");
|
||||||
|
Float expectedToSavingsBalance = toSavingsBalanceBefore + (Float) standingInstructionData.get("amount");
|
||||||
|
|
||||||
|
Assert.assertEquals("Verifying From Savings Balance after Successful completion of Scheduler Job",
|
||||||
|
expectedFromSavingsBalance, fromSavingsBalanceAfter);
|
||||||
|
Assert.assertEquals("Verifying To Savings Balance after Successful completion of Scheduler Job", expectedToSavingsBalance,
|
||||||
|
toSavingsBalanceAfter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
}
|
||||||
jobId.toString());
|
|
||||||
|
|
||||||
// Verifying the Status of the Recently executed Scheduler Job
|
@Test
|
||||||
Assert.assertEquals("Verifying Last Scheduler Job Status", "success", jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
public void testApplyPenaltyForOverdueLoansJobOutcome() throws InterruptedException {
|
||||||
|
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||||
|
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
|
||||||
|
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsId);
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Float fromSavingsBalanceAfter = (Float) fromSavingsSummaryAfter.get("accountBalance");
|
Assert.assertNotNull(clientID);
|
||||||
|
|
||||||
HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsId);
|
Integer overdueFeeChargeId = ChargesHelper
|
||||||
Float toSavingsBalanceAfter = (Float) toSavingsSummaryAfter.get("accountBalance");
|
.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getLoanOverdueFeeJSON());
|
||||||
|
Assert.assertNotNull(overdueFeeChargeId);
|
||||||
|
|
||||||
final HashMap standingInstructionData = this.standingInstructionsHelper
|
final Integer loanProductID = createLoanProduct(overdueFeeChargeId.toString());
|
||||||
.getStandingInstructionById(standingInstructionId.toString());
|
Assert.assertNotNull(loanProductID);
|
||||||
Float expectedFromSavingsBalance = fromSavingsBalanceBefore - (Float) standingInstructionData.get("amount");
|
|
||||||
Float expectedToSavingsBalance = toSavingsBalanceBefore + (Float) standingInstructionData.get("amount");
|
|
||||||
|
|
||||||
Assert.assertEquals("Verifying From Savings Balance after Successful completion of Scheduler Job", expectedFromSavingsBalance,
|
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
|
||||||
fromSavingsBalanceAfter);
|
Assert.assertNotNull(loanID);
|
||||||
Assert.assertEquals("Verifying To Savings Balance after Successful completion of Scheduler Job", expectedToSavingsBalance,
|
|
||||||
toSavingsBalanceAfter);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||||
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
|
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
|
||||||
|
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||||
|
|
||||||
|
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_DISBURSAL_DATE, loanID);
|
||||||
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
|
ArrayList<HashMap> repaymentScheduleDataBefore = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
|
||||||
|
this.responseSpec, loanID);
|
||||||
|
|
||||||
|
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
||||||
|
Assert.assertNotNull(allSchedulerJobsData);
|
||||||
|
|
||||||
|
String JobName = "Apply penalty to overdue loans";
|
||||||
|
for (Integer jobIndex = 0; jobIndex < allSchedulerJobsData.size(); jobIndex++) {
|
||||||
|
if (allSchedulerJobsData.get(jobIndex).get("displayName").equals(JobName)) {
|
||||||
|
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
||||||
|
|
||||||
|
// Executing Scheduler Job
|
||||||
|
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, this.responseSpecForSchedulerJob, jobId.toString());
|
||||||
|
|
||||||
|
// Retrieving Scheduler Job by ID
|
||||||
|
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
|
||||||
|
// Waiting for Job to complete
|
||||||
|
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
||||||
|
Thread.sleep(120000);
|
||||||
|
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
||||||
|
Assert.assertNotNull(schedulerJob);
|
||||||
|
System.out.println("Job is Still Running");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
||||||
|
jobId.toString());
|
||||||
|
|
||||||
|
// Verifying the Status of the Recently executed Scheduler Job
|
||||||
|
Assert.assertEquals("Verifying Last Scheduler Job Status", "success",
|
||||||
|
jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
||||||
|
|
||||||
|
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
||||||
|
|
||||||
|
Float chargeAmount = (Float) chargeData.get("amount");
|
||||||
|
|
||||||
|
ArrayList<HashMap> repaymentScheduleDataAfter = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
|
||||||
|
this.responseSpec, loanID);
|
||||||
|
|
||||||
|
Assert.assertEquals("Verifying From Penalty Charges due fot first Repayment after Successful completion of Scheduler Job",
|
||||||
|
chargeAmount, (Float) repaymentScheduleDataAfter.get(1).get("penaltyChargesDue"));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -884,7 +1044,7 @@ public class SchedulerJobsTestResults {
|
|||||||
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
|
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer createLoanProduct() {
|
private Integer createLoanProduct(final String chargeId) {
|
||||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||||
final String loanProductJSON = new LoanProductTestBuilder() //
|
final String loanProductJSON = new LoanProductTestBuilder() //
|
||||||
.withPrincipal("15,000.00") //
|
.withPrincipal("15,000.00") //
|
||||||
@@ -895,7 +1055,7 @@ public class SchedulerJobsTestResults {
|
|||||||
.withInterestRateFrequencyTypeAsMonths() //
|
.withInterestRateFrequencyTypeAsMonths() //
|
||||||
.withAmortizationTypeAsEqualInstallments() //
|
.withAmortizationTypeAsEqualInstallments() //
|
||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.build();
|
.build(chargeId);
|
||||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-2
@@ -1,6 +1,8 @@
|
|||||||
package org.mifosplatform.integrationtests.common.loans;
|
package org.mifosplatform.integrationtests.common.loans;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.mifosplatform.integrationtests.common.Utils;
|
import org.mifosplatform.integrationtests.common.Utils;
|
||||||
@@ -49,9 +51,16 @@ public class LoanProductTestBuilder {
|
|||||||
private String maxPrincipal = "100000.00";
|
private String maxPrincipal = "100000.00";
|
||||||
private Account[] accountList = null;
|
private Account[] accountList = null;
|
||||||
|
|
||||||
public String build() {
|
public String build(final String chargeId) {
|
||||||
final HashMap<String, String> map = new HashMap<String, String>();
|
final HashMap<String, Object> map = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
if (chargeId != null) {
|
||||||
|
List<HashMap<String, String>> charges = new ArrayList<HashMap<String, String>>();
|
||||||
|
HashMap<String, String> chargeMap = new HashMap<String, String>();
|
||||||
|
chargeMap.put("id", chargeId);
|
||||||
|
charges.add(chargeMap);
|
||||||
|
map.put("charges", charges);
|
||||||
|
}
|
||||||
map.put("name", this.nameOfLoanProduct);
|
map.put("name", this.nameOfLoanProduct);
|
||||||
map.put("shortName", this.shortName);
|
map.put("shortName", this.shortName);
|
||||||
map.put("currencyCode", this.currencyCode);
|
map.put("currencyCode", this.currencyCode);
|
||||||
|
|||||||
Reference in New Issue
Block a user