From 6d11356204105ff7cf2ce006fcec27fc6dfef2fa Mon Sep 17 00:00:00 2001 From: Pramod Nuthakki Date: Tue, 11 Mar 2014 12:35:40 +0530 Subject: [PATCH] test case corrections --- .../ClientSavingsIntegrationTest.java | 3 +- .../common/charges/ChargesHelper.java | 34 +++++++++---------- .../SavingsApplicationTestBuilder.java | 13 +++---- .../ClientReadPlatformServiceImpl.java | 2 +- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientSavingsIntegrationTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientSavingsIntegrationTest.java index 0bb3a3cb5..bc7b72d88 100755 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientSavingsIntegrationTest.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientSavingsIntegrationTest.java @@ -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); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/charges/ChargesHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/charges/ChargesHelper.java index f52901330..16c860de1 100755 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/charges/ChargesHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/charges/ChargesHelper.java @@ -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 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 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 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 populateDefaults(){ + public static HashMap populateDefaults() { final HashMap map = new HashMap(); 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"); } - - - + } \ No newline at end of file diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsApplicationTestBuilder.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsApplicationTestBuilder.java index ab17d11ed..818e87d4e 100755 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsApplicationTestBuilder.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsApplicationTestBuilder.java @@ -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 map = new HashMap(); - 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; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java index 8cc29daab..f39112f6c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java @@ -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, ");