Merge pull request #793 from pramodn02/savings_test

test case corrections
This commit is contained in:
Vishwas Babu A J
2014-03-11 00:13:07 -07:00
4 changed files with 24 additions and 28 deletions
@@ -18,7 +18,6 @@ import org.mifosplatform.integrationtests.common.charges.ChargesHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsAccountHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsProductHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsStatusChecker;
import org.mifosplatform.portfolio.savings.SavingsApiConstants;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
@@ -63,7 +62,7 @@ public class ClientSavingsIntegrationTest {
Assert.assertNotNull(savingsProductID);
HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId);
Assert.assertTrue(modifications.containsKey(SavingsApiConstants.submittedOnDateParamName));
Assert.assertTrue(modifications.containsKey("submittedOnDate"));
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
@@ -4,9 +4,6 @@ import java.util.HashMap;
import org.mifosplatform.integrationtests.common.CommonConstants;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.portfolio.charge.domain.ChargeAppliesTo;
import org.mifosplatform.portfolio.charge.domain.ChargeCalculationType;
import org.mifosplatform.portfolio.charge.domain.ChargeTimeType;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
@@ -16,31 +13,36 @@ public class ChargesHelper {
private static final String CHARGES_URL = "/mifosng-provider/api/v1/charges";
private static final String CREATE_CHARGES_URL = CHARGES_URL + "?" + Utils.TENANT_IDENTIFIER;
private static final Integer CHARGE_APPLIES_TO_SAVINGS = 2;
private static final Integer CHARGE_CALCULATION_TYPE_FLAT = 1;
private static final Integer CHARGE_MONTHLY_FEE = 7;
private static final Integer CHARGE_ANNUAL_FEE = 6;
private static final Integer CHARGE_WITHDRAWAL_FEE = 5;
private final static boolean active = true;
private final static String amount = "100";
private final static Integer chargeAppliesTo = ChargeAppliesTo.SAVINGS.getValue();
private final static Integer chargeCalculationType = ChargeCalculationType.FLAT.getValue();
private final static Integer chargeAppliesTo = CHARGE_APPLIES_TO_SAVINGS;
private final static Integer chargeCalculationType = CHARGE_CALCULATION_TYPE_FLAT;
private final static String currencyCode = "USD";
public final static String feeOnMonthDay = "04 March";
private final static String monthDayFormat = "dd MMM";
private static String getChargeName(){
private static String getChargeName() {
return Utils.randomNameGenerator("Charge_", 6);
}
public static String getSavingsAnnualFeeJSON() {
final HashMap<String, Object> map = populateDefaults();
map.put("feeOnMonthDay", ChargesHelper.feeOnMonthDay);
map.put("chargeTimeType", ChargeTimeType.ANNUAL_FEE.getValue());
map.put("chargeTimeType", CHARGE_ANNUAL_FEE);
String chargesCreateJson = new Gson().toJson(map);
return chargesCreateJson;
}
public static String getSavingsMonthlyFeeJSON() {
final HashMap<String, Object> map = populateDefaults();
map.put("feeOnMonthDay", ChargesHelper.feeOnMonthDay);
map.put("chargeTimeType", ChargeTimeType.MONTHLY_FEE.getValue());
map.put("chargeTimeType", CHARGE_MONTHLY_FEE);
map.put("feeInterval", 2);
String chargesCreateJson = new Gson().toJson(map);
return chargesCreateJson;
@@ -48,13 +50,12 @@ public class ChargesHelper {
public static String getSavingsWithdrawalFeeJSON() {
final HashMap<String, Object> map = populateDefaults();
map.put("chargeTimeType", ChargeTimeType.WITHDRAWAL_FEE.getValue());
map.put("chargeTimeType", CHARGE_WITHDRAWAL_FEE);
String chargesCreateJson = new Gson().toJson(map);
return chargesCreateJson;
}
public static HashMap<String, Object> populateDefaults(){
public static HashMap<String, Object> populateDefaults() {
final HashMap<String, Object> map = new HashMap<String, Object>();
map.put("active", ChargesHelper.active);
map.put("amount", ChargesHelper.amount);
@@ -67,10 +68,9 @@ public class ChargesHelper {
return map;
}
public static Integer createCharges(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,final String request) {
public static Integer createCharges(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String request) {
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CHARGES_URL, request, "resourceId");
}
}
@@ -2,8 +2,6 @@ package org.mifosplatform.integrationtests.common.savings;
import java.util.HashMap;
import org.mifosplatform.portfolio.savings.SavingsApiConstants;
import com.google.gson.Gson;
public class SavingsApplicationTestBuilder {
@@ -15,12 +13,11 @@ public class SavingsApplicationTestBuilder {
public String build(final String ID, final String savingsProductId) {
final HashMap<String, String> map = new HashMap<String, String>();
map.put(SavingsApiConstants.dateFormatParamName, "dd MMMM yyyy");
map.put(SavingsApiConstants.localeParamName, "en_GB");
map.put(SavingsApiConstants.clientIdParamName, ID);
map.put(SavingsApiConstants.productIdParamName, savingsProductId);
map.put(SavingsApiConstants.localeParamName, LOCALE);
map.put(SavingsApiConstants.submittedOnDateParamName, this.submittedOnDate);
map.put("dateFormat", "dd MMMM yyyy");
map.put("clientId", ID);
map.put("productId", savingsProductId);
map.put("locale", LOCALE);
map.put("submittedOnDate", this.submittedOnDate);
String savingsApplicationJSON = new Gson().toJson(map);
System.out.println(savingsApplicationJSON);
return savingsApplicationJSON;
@@ -273,7 +273,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
sqlBuilder.append("c.activation_date as activationDate, c.image_id as imageId, ");
sqlBuilder.append("c.staff_id as staffId, s.display_name as staffName,");
sqlBuilder.append("c.default_savings_product as savingsProductId, sp.name as savingsProductName, ");
sqlBuilder.append("c.default_savings_account as savingsAccountId");
sqlBuilder.append("c.default_savings_account as savingsAccountId, ");
sqlBuilder.append("c.submittedon_date as submittedOnDate, ");
sqlBuilder.append("sbu.username as submittedByUsername, ");