http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/4b1ec9ef/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithWaiveInterestAndWriteOffIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithWaiveInterestAndWriteOffIntegrationTest.java
 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithWaiveInterestAndWriteOffIntegrationTest.java
new file mode 100644
index 0000000..5258337
--- /dev/null
+++ 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithWaiveInterestAndWriteOffIntegrationTest.java
@@ -0,0 +1,204 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.integrationtests;
+
+import java.util.HashMap;
+
+import org.apache.fineract.integrationtests.common.ClientHelper;
+import org.apache.fineract.integrationtests.common.Utils;
+import 
org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
+import 
org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
+import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
+import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.jayway.restassured.builder.RequestSpecBuilder;
+import com.jayway.restassured.builder.ResponseSpecBuilder;
+import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.specification.RequestSpecification;
+import com.jayway.restassured.specification.ResponseSpecification;
+
+/**
+ * Client Loan Integration Test for checking Loan Disbursement with Waive
+ * Interest and Write-Off.
+ */
+@SuppressWarnings({ "rawtypes" })
+public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
+
+    private ResponseSpecification responseSpec;
+    private RequestSpecification requestSpec;
+
+    private final String LP_PRINCIPAL = "12,000.00", LP_REPAYMENTS = "2", 
LP_REPAYMENT_PERIOD = "6", LP_INTEREST_RATE = "1",
+            PRINCIPAL = "4,500.00", LOAN_TERM_FREQUENCY = "18", 
NUMBER_OF_REPAYMENTS = "9", REPAYMENT_PERIOD = "2",
+            DISBURSEMENT_DATE = "30 October 2010", 
LOAN_APPLICATION_SUBMISSION_DATE = "23 September 2010",
+            EXPECTED_DISBURSAL_DATE = "28 October 2010", 
RATE_OF_INTEREST_PER_PERIOD = "2", DATE_OF_JOINING = "04 March 2009",
+            INTEREST_VALUE_AMOUNT = "40.00";
+    private LoanTransactionHelper loanTransactionHelper;
+
+    @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();
+        this.loanTransactionHelper = new 
LoanTransactionHelper(this.requestSpec, this.responseSpec);
+    }
+
+    @Test
+    public void checkClientLoanCreateAndDisburseFlow() {
+        // CREATE CLIENT
+        final Integer clientID = ClientHelper.createClient(this.requestSpec, 
this.responseSpec, this.DATE_OF_JOINING);
+        ClientHelper.verifyClientCreatedOnServer(this.requestSpec, 
this.responseSpec, clientID);
+
+        // CREATE LOAN PRODUCT
+        final Integer loanProductID = createLoanProduct();
+        // APPLY FOR LOAN
+        final Integer loanID = applyForLoanApplication(clientID, 
loanProductID);
+
+        HashMap loanStatusHashMap = 
LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
+        LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
+
+        System.out.println("-----------------------------------APPROVE 
LOAN-----------------------------------------");
+        loanStatusHashMap = this.loanTransactionHelper.approveLoan("28 
September 2010", loanID);
+        LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
+        LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
+
+        // UNDO APPROVAL
+        loanStatusHashMap = this.loanTransactionHelper.undoApproval(loanID);
+        LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
+
+        System.out.println("-----------------------------------RE-APPROVE 
LOAN-----------------------------------------");
+        loanStatusHashMap = this.loanTransactionHelper.approveLoan("1 October 
2010", loanID);
+        LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
+        LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
+
+        // DISBURSE
+        loanStatusHashMap = 
this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
+        System.out.println("DISBURSE " + loanStatusHashMap);
+        LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
+
+        // PERFORM REPAYMENTS AND CHECK LOAN STATUS
+        this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, 4000.0F, 
loanID);
+        this.loanTransactionHelper.makeRepayment("1 January 2011", 540.0f, 
loanID);
+
+        // UNDO DISBURSE LOAN
+        loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID);
+        LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
+
+        // DIBURSE AGAIN
+        loanStatusHashMap = 
this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
+        System.out.println("DISBURSE " + loanStatusHashMap);
+        LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
+
+        // MAKE REPAYMENTS
+        final float repayment_with_interest = 540.0f;
+        final float repayment_without_interest = 500.0f;
+
+        this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, 4000.0F, 
loanID);
+        this.loanTransactionHelper.makeRepayment("1 January 2011", 
repayment_with_interest, loanID);
+        this.loanTransactionHelper.makeRepayment("1 March 2011", 
repayment_with_interest, loanID);
+        this.loanTransactionHelper.waiveInterest("1 May 2011", 
this.INTEREST_VALUE_AMOUNT, loanID);
+        this.loanTransactionHelper.makeRepayment("1 May 2011", 
repayment_without_interest, loanID);
+        this.loanTransactionHelper.makeRepayment("1 July 2011", 
repayment_with_interest, loanID);
+        this.loanTransactionHelper.waiveInterest("1 September 2011", 
this.INTEREST_VALUE_AMOUNT, loanID);
+        this.loanTransactionHelper.makeRepayment("1 September 2011", 
repayment_without_interest, loanID);
+        this.loanTransactionHelper.makeRepayment("1 November 2011", 
repayment_with_interest, loanID);
+        this.loanTransactionHelper.waiveInterest("1 January 2012", 
this.INTEREST_VALUE_AMOUNT, loanID);
+        this.loanTransactionHelper.makeRepayment("1 January 2012", 
repayment_without_interest, loanID);
+        this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(7, 1000.0f, 
loanID);
+
+        // WRITE OFF LOAN AND CHECK ACCOUNT IS CLOSED
+        
LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("1
 March 2012", loanID));
+
+    }
+
+    @Test
+    public void checkClientLoan_WRITTEN_OFF() {
+        // CREATE CLIENT
+        final Integer clientID = ClientHelper.createClient(this.requestSpec, 
this.responseSpec, this.DATE_OF_JOINING);
+        ClientHelper.verifyClientCreatedOnServer(this.requestSpec, 
this.responseSpec, clientID);
+
+        // CREATE LOAN PRODUCT
+        final Integer loanProductID = createLoanProduct();
+        // APPLY FOR LOAN
+        final Integer loanID = applyForLoanApplication(clientID, 
loanProductID);
+
+        HashMap loanStatusHashMap = 
LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
+        LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
+
+        System.out.println("-----------------------------------APPROVE 
LOAN-----------------------------------------");
+        loanStatusHashMap = this.loanTransactionHelper.approveLoan("28 
September 2010", loanID);
+        LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
+        LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
+
+        // DISBURSE
+        loanStatusHashMap = 
this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
+        System.out.println("DISBURSE " + loanStatusHashMap);
+        LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
+
+        // MAKE REPAYMENTS
+        final float repayment_with_interest = 680.0f;
+
+        this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, 4000.0F, 
loanID);
+        this.loanTransactionHelper.makeRepayment("1 January 2011", 
repayment_with_interest, loanID);
+
+        HashMap toLoanSummaryAfter = 
this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
+        Assert.assertTrue("Checking for Principal paid ",
+                new Float("500.0").compareTo(new 
Float(String.valueOf(toLoanSummaryAfter.get("principalPaid")))) == 0);
+        Assert.assertTrue("Checking for interestPaid paid ",
+                new Float("180.0").compareTo(new 
Float(String.valueOf(toLoanSummaryAfter.get("interestPaid")))) == 0);
+        Assert.assertTrue("Checking for total paid ",
+                new Float("680.0").compareTo(new 
Float(String.valueOf(toLoanSummaryAfter.get("totalRepayment")))) == 0);
+
+        // WRITE OFF LOAN AND CHECK ACCOUNT IS CLOSED
+        
LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("1
 January 2011", loanID));
+        toLoanSummaryAfter = 
this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
+        Assert.assertTrue("Checking for Principal written off ",
+                new Float("4000.0").compareTo(new 
Float(String.valueOf(toLoanSummaryAfter.get("principalWrittenOff")))) == 0);
+        Assert.assertTrue("Checking for interestPaid written off ",
+                new Float("1440.0").compareTo(new 
Float(String.valueOf(toLoanSummaryAfter.get("interestWrittenOff")))) == 0);
+        Assert.assertTrue("Checking for total written off ",
+                new Float("5440.0").compareTo(new 
Float(String.valueOf(toLoanSummaryAfter.get("totalWrittenOff")))) == 0);
+
+    }
+
+    private Integer createLoanProduct() {
+        System.out.println("------------------------------CREATING NEW LOAN 
PRODUCT ---------------------------------------");
+        final String loanProductJSON = new 
LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL).withRepaymentTypeAsMonth()
+                
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
+                
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
+                
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().build(null);
+
+        return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
+    }
+
+    private Integer applyForLoanApplication(final Integer clientID, final 
Integer loanProductID) {
+        System.out.println("--------------------------------APPLYING FOR LOAN 
APPLICATION--------------------------------");
+        final String loanApplicationJSON = new 
LoanApplicationTestBuilder().withPrincipal(this.PRINCIPAL)
+                
.withLoanTermFrequency(this.LOAN_TERM_FREQUENCY).withLoanTermFrequencyAsMonths()
+                
.withNumberOfRepayments(this.NUMBER_OF_REPAYMENTS).withRepaymentEveryAfter(this.REPAYMENT_PERIOD)
+                
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod(this.RATE_OF_INTEREST_PER_PERIOD)
+                
.withInterestTypeAsFlatBalance().withAmortizationTypeAsEqualInstallments()
+                
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod().withExpectedDisbursementDate(this.EXPECTED_DISBURSAL_DATE)
+                
.withSubmittedOnDate(this.LOAN_APPLICATION_SUBMISSION_DATE).build(clientID.toString(),
 loanProductID.toString(), null);
+        return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/4b1ec9ef/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithdrawnByApplicantIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithdrawnByApplicantIntegrationTest.java
 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithdrawnByApplicantIntegrationTest.java
new file mode 100644
index 0000000..4313c39
--- /dev/null
+++ 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithdrawnByApplicantIntegrationTest.java
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.integrationtests;
+
+import java.util.HashMap;
+
+import org.apache.fineract.integrationtests.common.ClientHelper;
+import org.apache.fineract.integrationtests.common.Utils;
+import 
org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
+import 
org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
+import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
+import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.jayway.restassured.builder.RequestSpecBuilder;
+import com.jayway.restassured.builder.ResponseSpecBuilder;
+import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.specification.RequestSpecification;
+import com.jayway.restassured.specification.ResponseSpecification;
+
+@SuppressWarnings("rawtypes")
+public class LoanWithdrawnByApplicantIntegrationTest {
+
+    private ResponseSpecification responseSpec;
+    private RequestSpecification requestSpec;
+    private LoanTransactionHelper loanTransactionHelper;
+
+    @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();
+
+        this.loanTransactionHelper = new 
LoanTransactionHelper(this.requestSpec, this.responseSpec);
+    }
+
+    @Test
+    public void loanWithdrawnByApplicant() {
+        final Integer clientID = ClientHelper.createClient(this.requestSpec, 
this.responseSpec, "01 January 2012");
+        final Integer loanProductID = 
this.loanTransactionHelper.getLoanProductId(new 
LoanProductTestBuilder().build(null));
+        final Integer loanID = applyForLoanApplication(clientID, 
loanProductID);
+
+        HashMap loanStatusHashMap = 
LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
+        LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
+
+        this.loanTransactionHelper.withdrawLoanApplicationByClient("03 April 
2012", loanID);
+        loanStatusHashMap = 
LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
+        LoanStatusChecker.verifyLoanAccountIsNotActive(loanStatusHashMap);
+
+    }
+
+    private Integer applyForLoanApplication(final Integer clientID, final 
Integer loanProductID) {
+        final String loanApplication = new 
LoanApplicationTestBuilder().withPrincipal("5000").withLoanTermFrequency("5")
+                
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("5").withRepaymentEveryAfter("1")
+                
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("2").withExpectedDisbursementDate("04
 April 2012")
+                .withSubmittedOnDate("02 April 
2012").build(clientID.toString(), loanProductID.toString(), null);
+        return this.loanTransactionHelper.getLoanId(loanApplication);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/4b1ec9ef/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/MinimumDaysBetweenDisbursalAndFirstRepaymentTest.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/MinimumDaysBetweenDisbursalAndFirstRepaymentTest.java
 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/MinimumDaysBetweenDisbursalAndFirstRepaymentTest.java
new file mode 100644
index 0000000..f0d6f19
--- /dev/null
+++ 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/MinimumDaysBetweenDisbursalAndFirstRepaymentTest.java
@@ -0,0 +1,220 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.integrationtests;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.fineract.integrationtests.common.CalendarHelper;
+import org.apache.fineract.integrationtests.common.ClientHelper;
+import org.apache.fineract.integrationtests.common.CommonConstants;
+import org.apache.fineract.integrationtests.common.GroupHelper;
+import org.apache.fineract.integrationtests.common.Utils;
+import 
org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
+import 
org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
+import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
+import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.jayway.restassured.builder.RequestSpecBuilder;
+import com.jayway.restassured.builder.ResponseSpecBuilder;
+import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.specification.RequestSpecification;
+import com.jayway.restassured.specification.ResponseSpecification;
+
+/**
+ * Test the creation, approval and rejection of a loan reschedule request
+ **/
+@SuppressWarnings({ "rawtypes" })
+public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest {
+
+    private ResponseSpecification responseSpec;
+    private ResponseSpecification responseSpecForStatusCode403;
+    private RequestSpecification requestSpec;
+    private LoanTransactionHelper loanTransactionHelper;
+    private Integer clientId;
+    private Integer groupId;
+    private Integer groupCalendarId;
+    private Integer loanProductId;
+    private Integer loanId;
+    private final String loanPrincipalAmount = "100000.00";
+    private final String numberOfRepayments = "12";
+    private final String interestRatePerPeriod = "18";
+    private final String groupActivationDate = "1 August 2014";
+
+    @Before
+    public void setup() {
+        Utils.initializeRESTAssured();
+    }
+
+    /*
+     * MinimumDaysBetweenDisbursalAndFirstRepayment is set to 7 days and days
+     * between disbursal date and first repayment is set as 7. system should
+     * allow to create this loan and allow to disburse
+     */
+    @Test
+    public void 
createLoanEntity_WITH_DAY_BETWEEN_DISB_DATE_AND_REPAY_START_DATE_GREATER_THAN_MIN_DAY_CRITERIA()
 {
+
+        this.requestSpec = new 
RequestSpecBuilder().setContentType(ContentType.JSON).build();
+        this.requestSpec.header("Authorization", "Basic " + 
Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
+        this.responseSpec = new 
ResponseSpecBuilder().expectStatusCode(200).build();
+        this.loanTransactionHelper = new 
LoanTransactionHelper(this.requestSpec, this.responseSpec);
+
+        // create all required entities
+        this.createRequiredEntities();
+
+        final String disbursalDate = "4 September 2014";
+        final String firstRepaymentDate = "11 September 2014";
+
+        final String loanApplicationJSON = new 
LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
+                
.withLoanTermFrequency(numberOfRepayments).withLoanTermFrequencyAsWeeks().withNumberOfRepayments(numberOfRepayments)
+                
.withRepaymentEveryAfter("1").withRepaymentFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments()
+                
.withInterestCalculationPeriodTypeAsDays().withInterestRatePerPeriod(interestRatePerPeriod)
+                
.withRepaymentFrequencyTypeAsWeeks().withSubmittedOnDate(disbursalDate).withExpectedDisbursementDate(disbursalDate)
+                
.withPrincipalGrace("2").withInterestGrace("2").withFirstRepaymentDate(firstRepaymentDate)
+                .build(this.clientId.toString(), 
this.loanProductId.toString(), null);
+
+        this.loanId = 
this.loanTransactionHelper.getLoanId(loanApplicationJSON);
+
+        // Test for loan account is created
+        Assert.assertNotNull(this.loanId);
+        HashMap loanStatusHashMap = 
LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, 
this.loanId);
+        LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
+
+        // Test for loan account is created, can be approved
+        this.loanTransactionHelper.approveLoan(disbursalDate, this.loanId);
+        loanStatusHashMap = 
LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, 
this.loanId);
+        LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
+
+        // Test for loan account approved can be disbursed
+        this.loanTransactionHelper.disburseLoan(disbursalDate, this.loanId);
+        loanStatusHashMap = 
LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, 
this.loanId);
+        LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
+
+    }
+
+    /*
+     * MinimumDaysBetweenDisbursalAndFirstRepayment is set to 7 days and days
+     * between disbursal date and first repayment is set as 7. system should
+     * allow to create this loan and allow to disburse
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void 
createLoanEntity_WITH_DAY_BETWEEN_DISB_DATE_AND_REPAY_START_DATE_LESS_THAN_MIN_DAY_CRITERIA()
 {
+
+        this.requestSpec = new 
RequestSpecBuilder().setContentType(ContentType.JSON).build();
+        this.requestSpec.header("Authorization", "Basic " + 
Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
+        this.responseSpec = new 
ResponseSpecBuilder().expectStatusCode(200).build();
+        this.responseSpecForStatusCode403 = new 
ResponseSpecBuilder().expectStatusCode(403).build();
+        this.loanTransactionHelper = new 
LoanTransactionHelper(this.requestSpec, this.responseSpec);
+        // create all required entities
+        this.createRequiredEntities();
+
+        // loanTransactionHelper is reassigned to accept 403 status code from
+        // server
+        this.loanTransactionHelper = new 
LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
+
+        final String disbursalDate = "4 September 2014";
+        final String firstRepaymentDate = "5 September 2014";
+
+        final String loanApplicationJSON = new 
LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
+                
.withLoanTermFrequency(numberOfRepayments).withLoanTermFrequencyAsWeeks().withNumberOfRepayments(numberOfRepayments)
+                
.withRepaymentEveryAfter("1").withRepaymentFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments()
+                
.withInterestCalculationPeriodTypeAsDays().withInterestRatePerPeriod(interestRatePerPeriod)
+                
.withRepaymentFrequencyTypeAsWeeks().withSubmittedOnDate(disbursalDate).withExpectedDisbursementDate(disbursalDate)
+                
.withPrincipalGrace("2").withInterestGrace("2").withFirstRepaymentDate(firstRepaymentDate)
+                .build(this.clientId.toString(), 
this.loanProductId.toString(), null);
+
+        List<HashMap> error = (List<HashMap>) 
this.loanTransactionHelper.createLoanAccount(loanApplicationJSON,
+                CommonConstants.RESPONSE_ERROR);
+        
assertEquals("error.msg.loan.days.between.first.repayment.and.disbursal.are.less.than.minimum.allowed",
+                error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
+
+    }
+
+    /**
+     * Creates the client, loan product, and loan entities
+     **/
+    private void createRequiredEntities() {
+        final String minimumDaysBetweenDisbursalAndFirstRepayment = "7"; // &
+                                                                         // 
days
+        this.createGroupEntityWithCalendar();
+        this.createClientEntity();
+        this.associateClientToGroup(this.groupId, this.clientId);
+        
this.createLoanProductEntity(minimumDaysBetweenDisbursalAndFirstRepayment);
+
+    }
+
+    /*
+     * Associate client to the group
+     */
+
+    private void associateClientToGroup(final Integer groupId, final Integer 
clientId) {
+        GroupHelper.associateClient(this.requestSpec, this.responseSpec, 
groupId.toString(), clientId.toString());
+        GroupHelper.verifyGroupMembers(this.requestSpec, this.responseSpec, 
groupId, clientId);
+    }
+
+    /*
+     * Create a new group
+     */
+
+    private void createGroupEntityWithCalendar() {
+        this.groupId = GroupHelper.createGroup(this.requestSpec, 
this.responseSpec, this.groupActivationDate);
+        GroupHelper.verifyGroupCreatedOnServer(this.requestSpec, 
this.responseSpec, this.groupId);
+
+        final String startDate = this.groupActivationDate;
+        final String frequency = "2"; // 2:Weekly
+        final String interval = "1"; // Every one week
+        final String repeatsOnDay = "1"; // 1:Monday
+
+        
this.setGroupCalendarId(CalendarHelper.createMeetingCalendarForGroup(this.requestSpec,
 this.responseSpec, this.groupId, startDate,
+                frequency, interval, repeatsOnDay));
+    }
+
+    /**
+     * create a new client
+     **/
+    private void createClientEntity() {
+        this.clientId = ClientHelper.createClient(this.requestSpec, 
this.responseSpec);
+        ClientHelper.verifyClientCreatedOnServer(this.requestSpec, 
this.responseSpec, this.clientId);
+    }
+
+    /**
+     * create a new loan product
+     **/
+    private void createLoanProductEntity(final String 
minimumDaysBetweenDisbursalAndFirstRepayment) {
+        final String loanProductJSON = new 
LoanProductTestBuilder().withPrincipal(loanPrincipalAmount)
+                
.withNumberOfRepayments(numberOfRepayments).withinterestRatePerPeriod(interestRatePerPeriod)
+                .withInterestRateFrequencyTypeAsYear()
+                
.withMinimumDaysBetweenDisbursalAndFirstRepayment(minimumDaysBetweenDisbursalAndFirstRepayment).build(null);
+        this.loanProductId = 
this.loanTransactionHelper.getLoanProductId(loanProductJSON);
+    }
+
+    public Integer getGroupCalendarId() {
+        return groupCalendarId;
+    }
+
+    public void setGroupCalendarId(Integer groupCalendarId) {
+        this.groupCalendarId = groupCalendarId;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/4b1ec9ef/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/OfficeIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/OfficeIntegrationTest.java
 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/OfficeIntegrationTest.java
new file mode 100644
index 0000000..574ba6c
--- /dev/null
+++ 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/OfficeIntegrationTest.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.integrationtests;
+
+import org.apache.fineract.integrationtests.common.OfficeDomain;
+import org.apache.fineract.integrationtests.common.OfficeHelper;
+import org.apache.fineract.integrationtests.common.Utils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.jayway.restassured.builder.RequestSpecBuilder;
+import com.jayway.restassured.builder.ResponseSpecBuilder;
+import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.specification.RequestSpecification;
+import com.jayway.restassured.specification.ResponseSpecification;
+
+public class OfficeIntegrationTest {
+
+       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();
+       }
+
+       @Test
+       public void testOfficeModification() {
+               OfficeHelper oh = new OfficeHelper(requestSpec, responseSpec);
+               int officeId = oh.createOffice("01 July 2007");
+               String name = Utils.randomNameGenerator("New_Office_", 4);
+               String date = "02 July 2007";
+               String[] dateArr = { "2007", "7", "2" };
+
+               oh.updateOffice(officeId, name, date);
+               OfficeDomain newOffice = oh.retrieveOfficeByID(officeId);
+
+               Assert.assertTrue(name.equals(newOffice.getName()));
+               Assert.assertArrayEquals(dateArr, newOffice.getOpeningDate());
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/4b1ec9ef/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PasswordPreferencesIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PasswordPreferencesIntegrationTest.java
 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PasswordPreferencesIntegrationTest.java
new file mode 100644
index 0000000..388c13e
--- /dev/null
+++ 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PasswordPreferencesIntegrationTest.java
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.integrationtests;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.fineract.integrationtests.common.CommonConstants;
+import org.apache.fineract.integrationtests.common.PasswordPreferencesHelper;
+import org.apache.fineract.integrationtests.common.Utils;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.jayway.restassured.builder.RequestSpecBuilder;
+import com.jayway.restassured.builder.ResponseSpecBuilder;
+import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.specification.RequestSpecification;
+import com.jayway.restassured.specification.ResponseSpecification;
+
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class PasswordPreferencesIntegrationTest {
+
+    private ResponseSpecification responseSpec;
+    private RequestSpecification requestSpec;
+    private ResponseSpecification generalResponseSpec;
+
+    @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();
+        this.generalResponseSpec = new ResponseSpecBuilder().build();
+
+    }
+
+    @Test
+    public void updatePasswordPreferences() {
+        String validationPolicyId = "2";
+        PasswordPreferencesHelper.updatePasswordPreferences(requestSpec, 
responseSpec, validationPolicyId);
+        this.validateIfThePasswordIsUpdated(validationPolicyId);
+    }
+
+    private void validateIfThePasswordIsUpdated(String validationPolicyId){
+        Integer id = 
PasswordPreferencesHelper.getActivePasswordPreference(requestSpec, 
responseSpec);
+        assertEquals(validationPolicyId, id.toString());
+        System.out.println("---------------------------------PASSWORD 
PREFERENCE VALIDATED SUCCESSFULLY-----------------------------------------");
+
+    }
+    
+    @Test
+    public void updateWithInvalidPolicyId() {
+        String invalidValidationPolicyId = "2000";
+        final List<HashMap> error = (List) 
PasswordPreferencesHelper.updateWithInvalidValidationPolicyId(requestSpec, 
generalResponseSpec, invalidValidationPolicyId, 
+                CommonConstants.RESPONSE_ERROR);
+        assertEquals("Password Validation Policy with identifier 2000 does not 
exist", "error.msg.password.validation.policy.id.invalid",
+                error.get(0).get("userMessageGlobalisationCode"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/4b1ec9ef/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PaymentTypeIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PaymentTypeIntegrationTest.java
 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PaymentTypeIntegrationTest.java
new file mode 100644
index 0000000..4bc07bc
--- /dev/null
+++ 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PaymentTypeIntegrationTest.java
@@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.integrationtests;
+
+import java.util.HashMap;
+
+import org.apache.fineract.integrationtests.common.PaymentTypeDomain;
+import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
+import org.apache.fineract.integrationtests.common.Utils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.jayway.restassured.builder.RequestSpecBuilder;
+import com.jayway.restassured.builder.ResponseSpecBuilder;
+import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.specification.RequestSpecification;
+import com.jayway.restassured.specification.ResponseSpecification;
+
+public class PaymentTypeIntegrationTest {
+
+    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();
+
+    }
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    @Test
+    public void testPaymentType() {
+        String name = PaymentTypeHelper.randomNameGenerator("P_T", 5);
+        String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 
15);
+        Boolean isCashPayment = true;
+        Integer position = 1;
+
+        Integer paymentTypeId = 
PaymentTypeHelper.createPaymentType(requestSpec, responseSpec, name, 
description, isCashPayment, position);
+        Assert.assertNotNull(paymentTypeId);
+        PaymentTypeHelper.verifyPaymentTypeCreatedOnServer(requestSpec, 
responseSpec, paymentTypeId);
+        PaymentTypeDomain paymentTypeResponse = 
PaymentTypeHelper.retrieveById(requestSpec, responseSpec, paymentTypeId);
+        Assert.assertEquals(name, paymentTypeResponse.getName());
+        Assert.assertEquals(description, paymentTypeResponse.getDescription());
+        Assert.assertEquals(isCashPayment, 
paymentTypeResponse.getIsCashPayment());
+        Assert.assertEquals(position, paymentTypeResponse.getPosition());
+
+        // Update Payment Type
+        String newName = PaymentTypeHelper.randomNameGenerator("P_TU", 5);
+        String newDescription = 
PaymentTypeHelper.randomNameGenerator("PTU_Desc", 15);
+        Boolean isCashPaymentUpdatedValue = false;
+        Integer newPosition = 2;
+
+        HashMap request = new HashMap();
+        request.put("name", newName);
+        request.put("description", newDescription);
+        request.put("isCashPayment", isCashPaymentUpdatedValue);
+        request.put("position", newPosition);
+        PaymentTypeHelper.updatePaymentType(paymentTypeId, request, 
requestSpec, responseSpec);
+        PaymentTypeDomain paymentTypeUpdatedResponse = 
PaymentTypeHelper.retrieveById(requestSpec, responseSpec, paymentTypeId);
+        Assert.assertEquals(newName, paymentTypeUpdatedResponse.getName());
+        Assert.assertEquals(newDescription, 
paymentTypeUpdatedResponse.getDescription());
+        Assert.assertEquals(isCashPaymentUpdatedValue, 
paymentTypeUpdatedResponse.getIsCashPayment());
+        Assert.assertEquals(newPosition, 
paymentTypeUpdatedResponse.getPosition());
+
+        // Delete
+        Integer deletedPaymentTypeId = 
PaymentTypeHelper.deletePaymentType(paymentTypeId, requestSpec, responseSpec);
+        Assert.assertEquals(paymentTypeId, deletedPaymentTypeId);
+        ResponseSpecification responseSpecification = new 
ResponseSpecBuilder().expectStatusCode(404).build();
+        PaymentTypeHelper.retrieveById(requestSpec, responseSpecification, 
paymentTypeId);
+
+    }
+
+}


Reply via email to