fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vorbur...@apache.org
Subject [fineract] 06/07: Fineract-614: Updating Global Configurations Fixing some rebase conflicts Change to imports on IntegrationTest for CheckStyle
Date Fri, 13 Mar 2020 16:15:45 GMT
This is an automated email from the ASF dual-hosted git repository.

vorburger pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git

commit 8df44af628a171c2708997cc7125460d4f601f74
Author: Angel Cajas <angel.cj.o@gmail.com>
AuthorDate: Wed Feb 5 14:28:38 2020 -0600

    Fineract-614:
    Updating Global Configurations
    Fixing some rebase conflicts
    Change to imports on IntegrationTest for CheckStyle
---
 .../fineract/integrationtests/RatesTest.java       |  58 +++++------
 .../integrationtests/common/rates/RatesHelper.java | 109 +++++++++++----------
 2 files changed, 88 insertions(+), 79 deletions(-)

diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RatesTest.java
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RatesTest.java
index 0feb648..25c2600 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RatesTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RatesTest.java
@@ -23,49 +23,51 @@ import com.jayway.restassured.builder.ResponseSpecBuilder;
 import com.jayway.restassured.http.ContentType;
 import com.jayway.restassured.specification.RequestSpecification;
 import com.jayway.restassured.specification.ResponseSpecification;
+import java.util.ArrayList;
+import java.util.HashMap;
 import org.apache.fineract.integrationtests.common.Utils;
 import org.apache.fineract.integrationtests.common.rates.RatesHelper;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-
 @SuppressWarnings({"rawtypes"})
 public class RatesTest {
 
-    private ResponseSpecification responseSpec;
-    private RequestSpecification requestSpec;
+  private ResponseSpecification responseSpec;
+  private RequestSpecification requestSpec;
+
+  @Before
+  public void setup() {
+    Utils.initializeRESTAssured();
+    this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
+    this.requestSpec.header("Authorization",
+        "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
+    this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
+  }
 
-    @Before
-    public void setup() {
-        Utils.initializeRESTAssured();
-        this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
-        this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
-        this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
-    }
+  @Test
+  public void testRatesForLoans() {
 
-    @Test
-    public void testRatesForLoans() {
+    // Retrieving all Rates
+    ArrayList<HashMap> allRatesData = RatesHelper.getRates(this.requestSpec, this.responseSpec);
+    Assert.assertNotNull(allRatesData);
 
-        // Retrieving all Rates
-        ArrayList<HashMap> allRatesData = RatesHelper.getRates(this.requestSpec, this.responseSpec);
-        Assert.assertNotNull(allRatesData);
+    // Testing Creation and Update of Loan Rate
+    final Integer loanRateId = RatesHelper.createRates(this.requestSpec, this.responseSpec,
+        RatesHelper.getLoanRateJSON());
+    Assert.assertNotNull(loanRateId);
 
-        // Testing Creation and Update of Loan Rate
-        final Integer loanRateId = RatesHelper.createRates(this.requestSpec, this.responseSpec,
-                RatesHelper.getLoanRateJSON());
-        Assert.assertNotNull(loanRateId);
+    //Update Rate percentage
+    HashMap changes = RatesHelper.updateRates(this.requestSpec, this.responseSpec, loanRateId,
+        RatesHelper.getModifyRateJSON());
 
-        //Update Rate percentage
-        HashMap changes = RatesHelper.updateRates(this.requestSpec, this.responseSpec, loanRateId,
-                RatesHelper.getModifyRateJSON());
+    HashMap rateDataAfterChanges = RatesHelper
+        .getRateById(this.requestSpec, this.responseSpec, loanRateId);
+    Assert.assertEquals("Verifying Rate after modification", rateDataAfterChanges.get("percentage"),
+        changes.get("percentage"));
 
-        HashMap rateDataAfterChanges = RatesHelper.getRateById(this.requestSpec, this.responseSpec,
loanRateId);
-        Assert.assertEquals("Verifying Rate after modification", rateDataAfterChanges.get("percentage"),
changes.get("percentage"));
+  }
 
-    }
 
-   
 }
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/rates/RatesHelper.java
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/rates/RatesHelper.java
index 43fd0d7..01688b5 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/rates/RatesHelper.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/rates/RatesHelper.java
@@ -21,71 +21,78 @@ package org.apache.fineract.integrationtests.common.rates;
 import com.google.gson.Gson;
 import com.jayway.restassured.specification.RequestSpecification;
 import com.jayway.restassured.specification.ResponseSpecification;
-import org.apache.fineract.integrationtests.common.CommonConstants;
-import org.apache.fineract.integrationtests.common.Utils;
-
 import java.util.ArrayList;
 import java.util.HashMap;
+import org.apache.fineract.integrationtests.common.CommonConstants;
+import org.apache.fineract.integrationtests.common.Utils;
 
-@SuppressWarnings({ "rawtypes", "unchecked" })
+@SuppressWarnings({"rawtypes", "unchecked"})
 public class RatesHelper {
 
-    private static final String RATES_URL = "/fineract-provider/api/v1/rates";
-    private static final String CREATE_RATES_URL = RATES_URL + "?" + Utils.TENANT_IDENTIFIER;
-    private final static String PERCENTAGE = "10";
-    private final static Integer PRODUCT_APPLY_LOAN = 1;
-    private final static Boolean ACTIVE = true;
+  private static final String RATES_URL = "/fineract-provider/api/v1/rates";
+  private static final String CREATE_RATES_URL = RATES_URL + "?" + Utils.TENANT_IDENTIFIER;
+  private final static String PERCENTAGE = "10";
+  private final static Integer PRODUCT_APPLY_LOAN = 1;
+  private final static Boolean ACTIVE = true;
 
-    public static ArrayList<HashMap> getRates(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
-        return (ArrayList) Utils.performServerGet(requestSpec, responseSpec, RATES_URL +
"?" + Utils.TENANT_IDENTIFIER, "");
-    }
+  public static ArrayList<HashMap> getRates(final RequestSpecification requestSpec,
+      final ResponseSpecification responseSpec) {
+    return (ArrayList) Utils
+        .performServerGet(requestSpec, responseSpec, RATES_URL + "?" + Utils.TENANT_IDENTIFIER,
"");
+  }
 
 
-    public static Integer createRates(final RequestSpecification requestSpec, final ResponseSpecification
responseSpec,
-                                      final String request) {
-        return Utils.performServerPost(requestSpec, responseSpec, CREATE_RATES_URL, request,
"resourceId");
-    }
+  public static Integer createRates(final RequestSpecification requestSpec,
+      final ResponseSpecification responseSpec,
+      final String request) {
+    return Utils
+        .performServerPost(requestSpec, responseSpec, CREATE_RATES_URL, request, "resourceId");
+  }
 
-    public static HashMap getRateById(final RequestSpecification requestSpec, final ResponseSpecification
responseSpec,
-                                      final Integer rateId) {
-        return Utils.performServerGet(requestSpec, responseSpec, RATES_URL + "/" + rateId
+ "?" + Utils.TENANT_IDENTIFIER, "");
-    }
+  public static HashMap getRateById(final RequestSpecification requestSpec,
+      final ResponseSpecification responseSpec,
+      final Integer rateId) {
+    return Utils.performServerGet(requestSpec, responseSpec,
+        RATES_URL + "/" + rateId + "?" + Utils.TENANT_IDENTIFIER, "");
+  }
 
-    public static HashMap updateRates(final RequestSpecification requestSpec, final ResponseSpecification
responseSpec,
-                                      final Integer rateId, final String request) {
-        return Utils.performServerPut(requestSpec, responseSpec, RATES_URL + "/" + rateId
+ "?" + Utils.TENANT_IDENTIFIER, request,
-                CommonConstants.RESPONSE_CHANGES);
-    }
+  public static HashMap updateRates(final RequestSpecification requestSpec,
+      final ResponseSpecification responseSpec,
+      final Integer rateId, final String request) {
+    return Utils.performServerPut(requestSpec, responseSpec,
+        RATES_URL + "/" + rateId + "?" + Utils.TENANT_IDENTIFIER, request,
+        CommonConstants.RESPONSE_CHANGES);
+  }
 
-    public static String getLoanRateJSON() {
-        return getLoanRateJSON(RatesHelper.PRODUCT_APPLY_LOAN, RatesHelper.PERCENTAGE);
-    }
+  public static String getLoanRateJSON() {
+    return getLoanRateJSON(RatesHelper.PRODUCT_APPLY_LOAN, RatesHelper.PERCENTAGE);
+  }
 
-    public static String getLoanRateJSON(final Integer productApply, final String percentage)
{
-        final HashMap<String, Object> map = populateDefaultsForLoan();
-        map.put("percentage", percentage);
-        map.put("productApply", productApply);
-        String crateRateJSON = new Gson().toJson(map);
-        return crateRateJSON;
-    }
+  public static String getLoanRateJSON(final Integer productApply, final String percentage)
{
+    final HashMap<String, Object> map = populateDefaultsForLoan();
+    map.put("percentage", percentage);
+    map.put("productApply", productApply);
+    String crateRateJSON = new Gson().toJson(map);
+    return crateRateJSON;
+  }
 
-    public static HashMap<String, Object> populateDefaultsForLoan() {
-        final HashMap<String, Object> map = new HashMap<>();
-        map.put("active", RatesHelper.ACTIVE);
-        map.put("percentage", RatesHelper.PERCENTAGE);
-        map.put("locale", "en");
-        map.put("productApply", RatesHelper.PRODUCT_APPLY_LOAN);
-        map.put("name", Utils.randomNameGenerator("Rate_Loans_", 6));
-        return map;
-    }
+  public static HashMap<String, Object> populateDefaultsForLoan() {
+    final HashMap<String, Object> map = new HashMap<>();
+    map.put("active", RatesHelper.ACTIVE);
+    map.put("percentage", RatesHelper.PERCENTAGE);
+    map.put("locale", "en");
+    map.put("productApply", RatesHelper.PRODUCT_APPLY_LOAN);
+    map.put("name", Utils.randomNameGenerator("Rate_Loans_", 6));
+    return map;
+  }
 
-    public static String getModifyRateJSON() {
-        final HashMap<String, Object> map = new HashMap<>();
-        map.put("percentage", "15.0");
-        map.put("locale", "en");
-        String json = new Gson().toJson(map);
-        return json;
-    }
+  public static String getModifyRateJSON() {
+    final HashMap<String, Object> map = new HashMap<>();
+    map.put("percentage", "15.0");
+    map.put("locale", "en");
+    String json = new Gson().toJson(map);
+    return json;
+  }
 
 }
 


Mime
View raw message