Search in sources :

Example 6 with SavingsProductParameters

use of org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters in project head by mifos.

the class AdditionalSavingsAccountTest method savingsAdjustmentsForDepositsWithdrawals.

//http://mifosforge.jira.com/browse/MIFOSTEST-144
// one of the dependent methods throws Exception
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void savingsAdjustmentsForDepositsWithdrawals() throws Exception {
    //Given
    DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
    DateTime targetTime = new DateTime(2011, 1, 1, 13, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    initRemote.dataLoadAndCacheRefresh(dbUnitUtilities, "acceptance_small_008_dbunit.xml", dataSource, selenium);
    //When
    SavingsProductParameters params = getVoluntaryGroupsMonthCalculactionProductParameters(targetTime);
    params.setApplicableFor(SavingsProductParameters.CLIENTS);
    params.setInterestRate("10");
    String savingsId = createSavingsAccount(params);
    DepositWithdrawalSavingsParameters depositParams = new DepositWithdrawalSavingsParameters();
    depositParams = makeDefaultDepositWithdrawal(targetTime, depositParams, savingsId, DepositWithdrawalSavingsParameters.DEPOSIT, "500");
    targetTime = new DateTime(2011, 2, 1, 13, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    depositParams = makeDefaultDepositWithdrawal(targetTime, depositParams, savingsId, DepositWithdrawalSavingsParameters.WITHDRAWAL, "200");
    targetTime = new DateTime(2011, 3, 1, 13, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    navigationHelper.navigateToAdminPage();
    runBatchJobsForSavingsIntPosting();
    navigationHelper.navigateToSavingsAccountDetailPage(savingsId);
    Assert.assertEquals(selenium.getTable("recentActivityForDetailPage.1.2"), "4.1");
    targetTime = new DateTime(2011, 4, 1, 13, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    navigationHelper.navigateToAdminPage();
    runBatchJobsForSavingsIntPosting();
    navigationHelper.navigateToSavingsAccountDetailPage(savingsId);
    Assert.assertEquals(selenium.getTable("recentActivityForDetailPage.1.2"), "2.6");
    SavingsAccountDetailPage savingsAccountDetailPage = new SavingsAccountDetailPage(selenium);
    SavingsApplyAdjustmentPage savingsApplyAdjustmentPage = new SavingsApplyAdjustmentPage(selenium);
    depositParams = makeDefaultDepositWithdrawal(targetTime, depositParams, savingsId, DepositWithdrawalSavingsParameters.DEPOSIT, "123");
    savingsAccountDetailPage = navigationHelper.navigateToSavingsAccountDetailPage(savingsId);
    savingsApplyAdjustmentPage = savingsAccountDetailPage.navigateToApplyAdjustmentPage();
    savingsApplyAdjustmentPage.applyAdjustment("234", "adjustment");
    targetTime = new DateTime(2011, 5, 1, 13, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    navigationHelper.navigateToAdminPage();
    runBatchJobsForSavingsIntPosting();
    navigationHelper.navigateToSavingsAccountDetailPage(savingsId);
    Assert.assertEquals(selenium.getTable("recentActivityForDetailPage.1.2"), "4.4");
    depositParams = makeDefaultDepositWithdrawal(targetTime, depositParams, savingsId, DepositWithdrawalSavingsParameters.WITHDRAWAL, "45");
    savingsAccountDetailPage = navigationHelper.navigateToSavingsAccountDetailPage(savingsId);
    savingsApplyAdjustmentPage = savingsAccountDetailPage.navigateToApplyAdjustmentPage();
    savingsApplyAdjustmentPage.applyAdjustment("55", "adjustment");
    targetTime = new DateTime(2011, 6, 1, 13, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    navigationHelper.navigateToAdminPage();
    runBatchJobsForSavingsIntPosting();
    navigationHelper.navigateToSavingsAccountDetailPage(savingsId);
    Assert.assertEquals(selenium.getTable("recentActivityForDetailPage.1.2"), "4.2");
    depositParams = makeDefaultDepositWithdrawal(targetTime, depositParams, savingsId, DepositWithdrawalSavingsParameters.DEPOSIT, "555");
    savingsAccountDetailPage = navigationHelper.navigateToSavingsAccountDetailPage(savingsId);
    savingsApplyAdjustmentPage = savingsAccountDetailPage.navigateToApplyAdjustmentPage();
    savingsApplyAdjustmentPage.applyAdjustment("444", "adjustment");
    targetTime = new DateTime(2011, 7, 1, 13, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    navigationHelper.navigateToAdminPage();
    runBatchJobsForSavingsIntPosting();
    navigationHelper.navigateToSavingsAccountDetailPage(savingsId);
    Assert.assertEquals(selenium.getTable("recentActivityForDetailPage.1.2"), "7.6");
    //step 12-15
    params = getVoluntaryGroupsMonthCalculactionProductParameters(targetTime);
    params.setApplicableFor(SavingsProductParameters.CLIENTS);
    String savingsId2 = createSavingsAccount(params);
    depositParams = makeDefaultDepositWithdrawal(targetTime, depositParams, savingsId2, DepositWithdrawalSavingsParameters.DEPOSIT, "555");
    depositParams = makeDefaultDepositWithdrawal(targetTime, depositParams, savingsId2, DepositWithdrawalSavingsParameters.WITHDRAWAL, "222");
    // month with last day is a non-working day
    targetTime = new DateTime(2011, 8, 1, 13, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    navigationHelper.navigateToAdminPage();
    runBatchJobsForSavingsIntPosting();
    navigationHelper.navigateToSavingsAccountDetailPage(savingsId2);
    Assert.assertEquals(selenium.getTable("recentActivityForDetailPage.1.2"), "1.4");
}
Also used : SavingsApplyAdjustmentPage(org.mifos.test.acceptance.framework.savings.SavingsApplyAdjustmentPage) SavingsAccountDetailPage(org.mifos.test.acceptance.framework.savings.SavingsAccountDetailPage) SavingsProductParameters(org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters) DateTimeUpdaterRemoteTestingService(org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService) DateTime(org.joda.time.DateTime) DepositWithdrawalSavingsParameters(org.mifos.test.acceptance.framework.savings.DepositWithdrawalSavingsParameters)

Example 7 with SavingsProductParameters

use of org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters in project head by mifos.

the class SavingsImportTest method importSavingAccountsToClientTest.

@Test(enabled = true)
public void importSavingAccountsToClientTest() {
    ManageRolePage manageRolePage = navigationHelper.navigateToAdminPage().navigateToViewRolesPage().navigateToManageRolePage("Admin");
    try {
        manageRolePage.enablePermission("8_8");
    } catch (AssertionError ex) {
        Logger.getAnonymousLogger().info("Permission is marked.");
    }
    manageRolePage.submitAndGotoViewRolesPage();
    String succesNumber = "1";
    String errorNumber = "5";
    arrayOfErrors = buildArrayOfErrorsForImportSavingsTest();
    String importFile = this.getClass().getResource("/ImportSavingsAccountsTest.xls").toString();
    SavingsProductParameters parameters = savingsProductHelper.getGenericSavingsProductParameters(targetTime, SavingsProductParameters.VOLUNTARY, SavingsProductParameters.CLIENTS);
    parameters.setProductInstanceName("importSavings");
    parameters.setShortName("IMP");
    try {
        savingsProductHelper.createSavingsProduct(parameters);
    } catch (AssertionError e) {
        Logger.getAnonymousLogger().info("Product exists");
    }
    ImportSavingsReviewPage reviewPage = adminTestHelper.loadImportSavingsFileAndSubmitForReview(importFile);
    reviewPage.validateErrors(arrayOfErrors);
    reviewPage.validateSuccesText(succesNumber);
    ImportSavingsSaveSummaryPage summaryPage = reviewPage.saveSuccessfullRows();
    summaryPage.verifySuccesString(succesNumber);
    summaryPage.verifyErrorString(errorNumber);
}
Also used : ManageRolePage(org.mifos.test.acceptance.framework.admin.ManageRolePage) ImportSavingsSaveSummaryPage(org.mifos.test.acceptance.framework.admin.ImportSavingsSaveSummaryPage) SavingsProductParameters(org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters) ImportSavingsReviewPage(org.mifos.test.acceptance.framework.admin.ImportSavingsReviewPage) Test(org.testng.annotations.Test)

Example 8 with SavingsProductParameters

use of org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters in project head by mifos.

the class SavingsProductHelper method getVoluntaryClients3MonthCalculactionPostingProductParameters.

public SavingsProductParameters getVoluntaryClients3MonthCalculactionPostingProductParameters(DateTime startDate) {
    SavingsProductParameters params = getGenericSavingsProductParameters(startDate, SavingsProductParameters.VOLUNTARY, SavingsProductParameters.CLIENTS);
    params.setDaysOrMonthsForInterestCalculation(params.MONTHS);
    params.setInterestRate("5");
    params.setFrequencyOfInterestPostings("3");
    params.setNumberOfDaysOrMonthsForInterestCalculation("3");
    params.setBalanceUsedForInterestCalculation(SavingsProductParameters.MINIMUM_BALANCE);
    params.setMandatoryAmount("100000");
    params.setStartDateDD("15");
    params.setStartDateMM("2");
    params.setStartDateYYYY("2011");
    return params;
}
Also used : SavingsProductParameters(org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters)

Example 9 with SavingsProductParameters

use of org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters in project head by mifos.

the class SavingsProductHelper method getGenericSavingsProductParameters.

/**
     * This method return a fully useable parameter object for the type of deposit (mandatory/voluntary)
     * and applicable for (clients/groups/centers).
     * @return Parameters like noted above.
     * @param typeOfDeposits
     * @param applicableFor
     */
public SavingsProductParameters getGenericSavingsProductParameters(DateTime startDate, int typeOfDeposits, int applicableFor) {
    SavingsProductParameters params = new SavingsProductParameters();
    params.setProductInstanceName("Savings product test" + StringUtil.getRandomString(3));
    params.setShortName(StringUtil.getRandomString(4));
    params.setProductCategory(SavingsProductParameters.OTHER);
    params.setStartDateDD(Integer.valueOf(startDate.getDayOfMonth()).toString());
    params.setStartDateMM(Integer.valueOf(startDate.getMonthOfYear()).toString());
    params.setStartDateYYYY(Integer.valueOf(startDate.getYearOfEra()).toString());
    params.setApplicableFor(applicableFor);
    params.setTypeOfDeposits(typeOfDeposits);
    // these two settings are not required in all configurations
    // but they're good to have anyway
    params.setMandatoryAmount("10");
    params.setAmountAppliesTo(SavingsProductParameters.WHOLE_GROUP);
    params.setInterestRate("4");
    params.setBalanceUsedForInterestCalculation(SavingsProductParameters.AVERAGE_BALANCE);
    params.setDaysOrMonthsForInterestCalculation(SavingsProductParameters.MONTHS);
    params.setNumberOfDaysOrMonthsForInterestCalculation("3");
    params.setFrequencyOfInterestPostings("6");
    params.setGlCodeForDeposit("24101 - Mandatory Savings Accounts");
    params.setGlCodeForInterest("41102 - Interest on clients mandatory savings");
    return params;
}
Also used : SavingsProductParameters(org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters)

Example 10 with SavingsProductParameters

use of org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters in project head by mifos.

the class SavingsProductHelper method getMandatoryClientsMinimumBalanceSavingsProductParameters.

public SavingsProductParameters getMandatoryClientsMinimumBalanceSavingsProductParameters(DateTime startDate) {
    SavingsProductParameters params = getGenericSavingsProductParameters(startDate, SavingsProductParameters.MANDATORY, SavingsProductParameters.CLIENTS);
    params.setDaysOrMonthsForInterestCalculation(params.DAYS);
    params.setInterestRate("1");
    params.setFrequencyOfInterestPostings("1");
    params.setNumberOfDaysOrMonthsForInterestCalculation("1");
    params.setBalanceUsedForInterestCalculation(SavingsProductParameters.MINIMUM_BALANCE);
    params.setMandatoryAmount("100000");
    return params;
}
Also used : SavingsProductParameters(org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters)

Aggregations

SavingsProductParameters (org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters)27 DateTime (org.joda.time.DateTime)20 DefineNewSavingsProductConfirmationPage (org.mifos.test.acceptance.framework.savingsproduct.DefineNewSavingsProductConfirmationPage)12 DateTimeUpdaterRemoteTestingService (org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService)8 EditAccountStatusParameters (org.mifos.test.acceptance.framework.account.EditAccountStatusParameters)7 Test (org.testng.annotations.Test)7 DepositWithdrawalSavingsParameters (org.mifos.test.acceptance.framework.savings.DepositWithdrawalSavingsParameters)6 SavingsAccountDetailPage (org.mifos.test.acceptance.framework.savings.SavingsAccountDetailPage)5 CreateSavingsAccountSearchParameters (org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSearchParameters)3 CreateSavingsAccountSubmitParameters (org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSubmitParameters)3 DefineNewSavingsProductPage (org.mifos.test.acceptance.framework.savingsproduct.DefineNewSavingsProductPage)2 EditSavingsProductPage (org.mifos.test.acceptance.framework.savingsproduct.EditSavingsProductPage)2 EditSavingsProductPreviewPage (org.mifos.test.acceptance.framework.savingsproduct.EditSavingsProductPreviewPage)2 SavingsProductDetailsPage (org.mifos.test.acceptance.framework.savingsproduct.SavingsProductDetailsPage)2 AdminPage (org.mifos.test.acceptance.framework.admin.AdminPage)1 ImportSavingsReviewPage (org.mifos.test.acceptance.framework.admin.ImportSavingsReviewPage)1 ImportSavingsSaveSummaryPage (org.mifos.test.acceptance.framework.admin.ImportSavingsSaveSummaryPage)1 ManageRolePage (org.mifos.test.acceptance.framework.admin.ManageRolePage)1 ClientViewDetailsPage (org.mifos.test.acceptance.framework.client.ClientViewDetailsPage)1 CreateLoanAccountSearchParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters)1