Compare commits
508
Commits
5c9028fcd0
...
982d3d340a
@@ -17,3 +17,10 @@
|
|||||||
#
|
#
|
||||||
build/*
|
build/*
|
||||||
.gradle/*
|
.gradle/*
|
||||||
|
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
|
||||||
|
# Incremental "docker build" is faster if we can modify the Dockerfile
|
||||||
|
# without "COPY ." re-transferring everything into the builder container.
|
||||||
|
Dockerfile
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Please make sure these boxes are checked before submitting your pull request - t
|
|||||||
|
|
||||||
- [ ] Coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions have been followed.
|
- [ ] Coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions have been followed.
|
||||||
|
|
||||||
- [ ] API documentation at https://github.com/apache/fineract/blob/develop/api-docs/apiLive.htm has been updated with details of any API changes.
|
- [ ] API documentation at fineract-provider/src/main/resources/static/api-docs/apiLive.htm has been updated with details of any API changes.
|
||||||
|
|
||||||
- [ ] Integration tests have been created/updated for verifying the changes made.
|
- [ ] Integration tests have been created/updated for verifying the changes made.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# This is the GitHub Action which
|
||||||
|
# automatically updates https://www.fineract.dev
|
||||||
|
#
|
||||||
|
# see https://jira.apache.org/jira/browse/FINERACT-970
|
||||||
|
# https://github.com/marketplace/actions/setup-gcloud-environment
|
||||||
|
# and http://blog2.vorburger.ch/2020/05/fineractdev-cicd-from-github-to-google.html
|
||||||
|
#
|
||||||
|
# Created by Michael Vorburger.ch for Fineract in May 2020.
|
||||||
|
#
|
||||||
|
|
||||||
|
name: Deploy to https://www.fineract.dev
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup-build-deploy:
|
||||||
|
name: Deploy on Fineract.dev
|
||||||
|
if: github.repository == 'apache/fineract'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
|
||||||
|
with:
|
||||||
|
project_id: ${{ secrets.GOOGLE_PROJECT_ID }}
|
||||||
|
service_account_key: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS}}
|
||||||
|
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- run: gcloud components install beta
|
||||||
|
|
||||||
|
- run: JOBS=$(gcloud beta builds list --ongoing --format="value[terminator=' '](id)") && [ ! -z "$JOBS" ] && echo "Cancelling $JOBS..." && gcloud builds cancel $JOBS --no-user-output-enabled || true
|
||||||
|
|
||||||
|
- run: gcloud beta builds triggers run deploy-demo --branch master --format=none
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
name: "Validate Gradle Wrapper"
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validation:
|
||||||
|
name: "Validation"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: gradle/wrapper-validation-action@v1
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# https://github.com/marketplace/actions/automatic-rebase (https://github.com/cirrus-actions/rebase)
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
name: Automatic Rebase
|
||||||
|
jobs:
|
||||||
|
rebase:
|
||||||
|
name: Rebase
|
||||||
|
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Automatic Rebase
|
||||||
|
uses: cirrus-actions/rebase@1.3
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# https://github.com/marketplace/actions/close-stale-issues
|
||||||
|
# https://github.com/actions/stale/blob/master/action.yml
|
||||||
|
# https://github.com/actions/stale
|
||||||
|
name: Mark stale issues and pull requests
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * *"
|
||||||
|
jobs:
|
||||||
|
stale:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/stale@v1
|
||||||
|
with:
|
||||||
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# stale-issue-message: 'Stale issue message'
|
||||||
|
# stale-issue-label: 'no-issue-activity'
|
||||||
|
stale-pr-message: 'This pull request seems to be stale. Are you still planning to work on it? We will automatically close it in 30 days.'
|
||||||
|
stale-pr-label: 'stale'
|
||||||
|
days-before-stale: 30
|
||||||
|
days-before-close: 30
|
||||||
+9
-1
@@ -2,6 +2,9 @@
|
|||||||
*.jar
|
*.jar
|
||||||
*.war
|
*.war
|
||||||
*.ear
|
*.ear
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
.gradle
|
.gradle
|
||||||
build
|
build
|
||||||
*.iml
|
*.iml
|
||||||
@@ -9,4 +12,9 @@ build
|
|||||||
*.iws
|
*.iws
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
.idea
|
.idea
|
||||||
gradle
|
catalina.base_IS_UNDEFINED/
|
||||||
|
keystore.jks
|
||||||
|
bin/
|
||||||
|
fineract-provider/src/main/resources/application.properties
|
||||||
|
.lock
|
||||||
|
fineract-provider/out/
|
||||||
|
|||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
# https://www.gitpod.io
|
||||||
|
# https://www.gitpod.io/docs/41_Config_Gitpod_File/
|
||||||
|
# https://github.com/gitpod-io/workspace-images/tree/master/mysql
|
||||||
|
|
||||||
|
image: gitpod/workspace-mysql
|
||||||
|
ports:
|
||||||
|
- port: 3306
|
||||||
|
onOpen: ignore
|
||||||
|
- port: 8005
|
||||||
|
onOpen: ignore
|
||||||
|
- port: 8009
|
||||||
|
onOpen: ignore
|
||||||
|
- port: 8080
|
||||||
|
- port: 8081
|
||||||
|
onOpen: ignore
|
||||||
|
- port: 8443
|
||||||
|
tasks:
|
||||||
|
- command: |
|
||||||
|
# NB MySQL on GitPod.io is currently quite slow.
|
||||||
|
# similar to .travis.yml, but using authentication_string= instead of password= due to mysql major version difference
|
||||||
|
mysql -e "USE mysql;\nUPDATE user SET authentication_string=PASSWORD('mysql') WHERE user='root';\nFLUSH PRIVILEGES;\n"
|
||||||
|
./gradlew createDB -PdbName=fineract_tenants
|
||||||
|
./gradlew createDB -PdbName=fineract_default
|
||||||
|
./gradlew build -x test
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"files.exclude": {
|
||||||
|
"**/.classpath": true,
|
||||||
|
"**/.project": true,
|
||||||
|
"**/.settings": true,
|
||||||
|
"**/.factorypath": true
|
||||||
|
}
|
||||||
|
}
|
||||||
+35
-14
@@ -16,25 +16,42 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
# https://issues.apache.org/jira/browse/FINERACT-763
|
# https://docs.travis-ci.com/user/reference/linux/
|
||||||
dist: trusty
|
# Must use a fixed distribution (and remember to occassionally upgrade..)
|
||||||
|
# to avoid surprise changes such as https://issues.apache.org/jira/browse/FINERACT-763
|
||||||
|
dist: bionic
|
||||||
|
|
||||||
language: java
|
language: generic
|
||||||
|
|
||||||
jdk:
|
|
||||||
- openjdk8
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- mysql
|
- mysql
|
||||||
|
- docker
|
||||||
|
|
||||||
# Hardcoding system time as a temporary fix for running buggy test cases
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
# https://httpie.org is used by the docker-compose test below
|
||||||
|
- httpie
|
||||||
|
|
||||||
|
# See https://issues.apache.org/jira/browse/FINERACT-937 for background re. what below is all about..
|
||||||
|
# We basically remove the outdated OpenJDK 11.0.2 which Travis image grabbed from java.net in
|
||||||
|
# https://github.com/travis-ci/travis-cookbooks/blob/master/cookbooks/travis_jdk/files/install-jdk.sh#L200
|
||||||
|
# (which has 11.0.2 hard-coded!), and instead replace it with the latest openjdk-11-jdk-headless Ubuntu package.
|
||||||
|
# NB /usr/local/lib/jvm/openjdk11/bin is also on the PATH, but there's no need to change it (because we rm -rf anyway)
|
||||||
before_install:
|
before_install:
|
||||||
- echo "USE mysql;\nUPDATE user SET password=PASSWORD('mysql') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root
|
- echo $JAVA_HOME
|
||||||
- mysql -u root -pmysql -e 'CREATE DATABASE IF NOT EXISTS `mifosplatform-tenants`;'
|
- which java
|
||||||
- mysql -u root -pmysql -e 'CREATE DATABASE IF NOT EXISTS `mifostenant-default`;'
|
- sudo rm -rf /usr/local/lib/jvm/
|
||||||
|
- sudo apt-get install -y openjdk-11-jdk-headless
|
||||||
|
- export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
|
||||||
|
- which java
|
||||||
|
- java -version
|
||||||
|
- $JAVA_HOME/bin/java -version
|
||||||
|
- echo "USE mysql;\nALTER USER 'root'@'localhost' IDENTIFIED BY 'mysql';\n" | mysql -u root
|
||||||
|
- mysql -u root -pmysql -e 'CREATE DATABASE IF NOT EXISTS `fineract_tenants`;'
|
||||||
|
- mysql -u root -pmysql -e 'CREATE DATABASE IF NOT EXISTS `fineract_default`;'
|
||||||
|
# Hardcoding the time zone is a temporary fix for https://issues.apache.org/jira/browse/FINERACT-723
|
||||||
- export TZ=Asia/Kolkata
|
- export TZ=Asia/Kolkata
|
||||||
- sudo service ntp stop
|
|
||||||
- sudo date --set="23 February 2019 01:02:03"
|
|
||||||
|
|
||||||
# https://docs.travis-ci.com/user/languages/java/#caching
|
# https://docs.travis-ci.com/user/languages/java/#caching
|
||||||
before_cache:
|
before_cache:
|
||||||
@@ -53,5 +70,9 @@ cache:
|
|||||||
# https://jira.apache.org/jira/browse/FINERACT-732 removed that again, because it made Travis CI fail.
|
# https://jira.apache.org/jira/browse/FINERACT-732 removed that again, because it made Travis CI fail.
|
||||||
script:
|
script:
|
||||||
- date
|
- date
|
||||||
- ./gradlew --console=plain licenseMain licenseTest licenseIntegrationTest test
|
# using "&&" instead of several "-" means that integrationTest does not run if test fails,
|
||||||
- ./gradlew --console=plain clean integrationTest
|
# and Docker test does not run if integration test fails, which makes PR failure easier to understand.
|
||||||
|
# @see https://docs.travis-ci.com/user/job-lifecycle/#customizing-the-build-phase
|
||||||
|
- ./gradlew --console=plain licenseMain licenseTest licenseIntegrationTest check && ./gradlew --console=plain integrationTest --fail-fast && sudo service mysql stop && docker-compose build && docker-compose up -d && sleep 30s && http --verify=no --timeout 240 --check-status get https://localhost:8443/fineract-provider/actuator/health && (( $(http --verify=no --timeout 30 --check-status --body get https://localhost:8443/fineract-provider/actuator/info | wc --chars) > 100 ))
|
||||||
|
# We stop the mysql system service when running the Docker test to avoid port 3306 conflicts (unless we run the mysql in docker-compose on another port; req. FINERACT-773)
|
||||||
|
# The fany /actuator/info test makes sure that has more than 100 characters of JSON to test that the git.properties worked (see FINERACT-983)
|
||||||
|
|||||||
+23
-16
@@ -15,25 +15,32 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
FROM openjdk:11 AS builder
|
||||||
|
|
||||||
FROM bitnami/tomcat:7.0.94 as fineract
|
RUN apt-get update -qq && apt-get install -y wget
|
||||||
|
|
||||||
USER root
|
|
||||||
RUN apt-get update -qq && apt-get install -y git openjdk-8-jdk wget
|
|
||||||
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/jre
|
|
||||||
|
|
||||||
RUN mkdir fineract
|
|
||||||
COPY . fineract
|
COPY . fineract
|
||||||
|
WORKDIR /fineract
|
||||||
|
|
||||||
WORKDIR fineract
|
RUN ./gradlew --no-daemon -x rat -x test bootJar
|
||||||
RUN sed -i 's/localhost/fineractmysql/' ./fineract-provider/build.gradle
|
|
||||||
RUN sed -i 's/localhost/fineractmysql/' ./fineract-provider/src/main/resources/sql/migrations/list_db/V1__mifos-platform-shared-tenants.sql
|
|
||||||
RUN ./gradlew clean war
|
|
||||||
RUN mv build/libs/fineract-provider.war /opt/bitnami/tomcat/webapps
|
|
||||||
|
|
||||||
RUN keytool -genkey -keyalg RSA -alias tomcat -keystore /opt/bitnami/tomcat/tomcat.keystore -keypass xyz123 -storepass xyz123 -noprompt -dname "CN=Fineract, OU=Fineract, O=Fineract, L=Unknown, ST=Unknown, C=Unknown"
|
WORKDIR /fineract/target
|
||||||
COPY ./docker/server.xml /opt/bitnami/tomcat/conf
|
RUN jar -xf /fineract/build/libs/fineract-provider.jar
|
||||||
RUN chmod 664 /opt/bitnami/tomcat/conf/server.xml
|
|
||||||
WORKDIR /opt/bitnami/tomcat/lib
|
|
||||||
RUN wget http://central.maven.org/maven2/org/drizzle/jdbc/drizzle-jdbc/1.4/drizzle-jdbc-1.4.jar
|
|
||||||
|
|
||||||
|
# https://issues.apache.org/jira/browse/LEGAL-462
|
||||||
|
# https://issues.apache.org/jira/browse/FINERACT-762
|
||||||
|
# We include an alternative JDBC driver (which is faster, but not allowed to be default in Apache distribution)
|
||||||
|
# allowing implementations to switch the driver used by changing start-up parameters (for both tenants and each tenant DB)
|
||||||
|
# The commented out lines in the docker-compose.yml illustrate how to do this.
|
||||||
|
WORKDIR /fineract/target/BOOT-INF/lib
|
||||||
|
RUN wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.20/mysql-connector-java-8.0.20.jar
|
||||||
|
|
||||||
|
# =========================================
|
||||||
|
|
||||||
|
FROM gcr.io/distroless/java:11 as fineract
|
||||||
|
|
||||||
|
COPY --from=builder /fineract/target/BOOT-INF/lib /app/lib
|
||||||
|
COPY --from=builder /fineract/target/META-INF /app/META-INF
|
||||||
|
COPY --from=builder /fineract/target/BOOT-INF/classes /app
|
||||||
|
|
||||||
|
ENTRYPOINT ["java", "-cp", "app:app/lib/*", "org.apache.fineract.ServerApplication"]
|
||||||
|
|||||||
@@ -1,88 +1,244 @@
|
|||||||
Apache Fineract: A Platform for Microfinance [](https://travis-ci.org/apache/fineract)
|
Apache Fineract: A Platform for Microfinance [](https://travis-ci.org/apache/fineract) [](https://hub.docker.com/r/apache/fineract) [](https://hub.docker.com/r/apache/fineract/builds)
|
||||||
============
|
============
|
||||||
|
|
||||||
Fineract is a mature platform with open APIs that provides a reliable, robust, and affordable core banking solution for financial institutions offering services to the world’s 2 billion underbanked and unbanked.
|
Fineract is a mature platform with open APIs that provides a reliable, robust, and affordable core banking solution for financial institutions offering services to the world’s 2 billion underbanked and unbanked.
|
||||||
|
|
||||||
|
[Have a look at the FAQ on our Wiki at apache.org](https://cwiki.apache.org/confluence/display/FINERACT/FAQ) if this README does not answer what you are looking for. [Visit our JIRA Dashboard](https://issues.apache.org/jira/secure/Dashboard.jspa?selectPageId=12335824) to find issues to work on, see what others are working on, or open new issues.
|
||||||
|
|
||||||
|
[](https://gitpod.io/#https://github.com/apache/fineract)
|
||||||
|
to start contributing to this project in the online web-based IDE GitPod.io right away!
|
||||||
|
(You may initially have to press F1 to Find Command and run "Java: Start Language Server".)
|
||||||
|
It's of course also possible to contribute with a "traditional" local development environment (see below).
|
||||||
|
|
||||||
|
Community
|
||||||
|
=========
|
||||||
|
|
||||||
|
If you are interested in contributing to this project, but perhaps don't quite know how and where to get started, please [join our developer mailing list](http://fineract.apache.org/#contribute), listen into our conversations, chime into threads, and just send us a "Hello!" introduction email; we're a friendly bunch, and look forward to hearing from you.
|
||||||
|
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
============
|
============
|
||||||
* Java >= 1.8 (Oracle JVMs have been tested)
|
* Java >= 11 (OpenJDK JVM is tested by our CI on Travis)
|
||||||
* MySQL 5.5
|
* MySQL 5.7
|
||||||
|
|
||||||
You can run the required version of the database server in a container, instead of having to install it, like this:
|
You can run the required version of the database server in a container, instead of having to install it, like this:
|
||||||
|
|
||||||
docker run --name mysql-5.5 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mysql -d mysql:5.5
|
docker run --name mysql-5.7 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mysql -d mysql:5.7
|
||||||
|
|
||||||
and stop and destroy it like this:
|
and stop and destroy it like this:
|
||||||
|
|
||||||
docker rm -f mysql-5.5
|
docker rm -f mysql-5.7
|
||||||
|
|
||||||
Beware that this database container database keeps its state inside the container and not on the host filesystem. It is lost when you destroy (rm) this container. This is typically fine for development. See [Caveats: Where to Store Data on the database container documentation](https://hub.docker.com/_/mysql) re. how to make it persistant instead of ephemeral.
|
Beware that this database container database keeps its state inside the container and not on the host filesystem. It is lost when you destroy (rm) this container. This is typically fine for development. See [Caveats: Where to Store Data on the database container documentation](https://hub.docker.com/_/mysql) re. how to make it persistent instead of ephemeral.
|
||||||
|
|
||||||
Instructions to download gradle wrapper
|
Tomcat v9 is only required if you wish to deploy the Fineract WAR to a separate external servlet container. Note that you do not require to install Tomcat to develop Fineract, or to run it in production if you use the self-contained JAR, which transparently embeds a servlet container using Spring Boot. (Until FINERACT-730, Tomcat 7/8 were also supported, but now Tomcat 9 is required.)
|
||||||
|
|
||||||
|
|
||||||
|
Instructions how to run for local development
|
||||||
============
|
============
|
||||||
The file fineract-provider/gradle/wrapper/gradle-wrapper.jar binary is checked into this projects's Git source repository,
|
|
||||||
but won't exist in your copy of the Fineract codebase if you downloaded a released source archive from apache.org.
|
|
||||||
In that case, you need to downloaded it using the commands below:
|
|
||||||
|
|
||||||
wget --no-check-certificate -P fineract-provider/gradle/wrapper https://github.com/apache/fineract/raw/develop/fineract-provider/gradle/wrapper/gradle-wrapper.jar
|
Run the following commands:
|
||||||
|
1. `./gradlew createDB -PdbName=fineract_tenants`
|
||||||
|
1. `./gradlew createDB -PdbName=fineract_default`
|
||||||
|
1. `./gradlew bootRun`
|
||||||
|
|
||||||
|
|
||||||
|
Instructions to build the JAR file
|
||||||
|
============
|
||||||
|
1. Clone the repository or download and extract the archive file to your local directory.
|
||||||
|
2. Run `./gradlew clean bootJar` to build a modern cloud native fully self contained JAR file which will be created at `build/libs` directory.
|
||||||
|
3. Start it using `java -jar build/libs/fineract-provider.jar` (does not require external Tomcat)
|
||||||
|
|
||||||
|
|
||||||
|
Instructions to build a WAR file
|
||||||
|
============
|
||||||
|
1. Clone the repository or download and extract the archive file to your local directory.
|
||||||
|
2. Run `./gradlew clean bootWar` to build a traditional WAR file which will be created at `build/libs` directory.
|
||||||
|
3. Deploy this WAR to your Tomcat v9 Servlet Container.
|
||||||
|
|
||||||
|
We recommend using the JAR instead of the WAR file deployment, because it's much easier.
|
||||||
|
|
||||||
|
|
||||||
|
Instructions to execute Integration Tests
|
||||||
|
============
|
||||||
|
> Note that if this is the first time to access MySQL DB, then you may need to reset your password.
|
||||||
|
|
||||||
|
Run the following commands, very similarly to how [.travis.yml](.travis.yml) does:
|
||||||
|
1. `./gradlew createDB -PdbName=fineract_tenants`
|
||||||
|
1. `./gradlew createDB -PdbName=fineract_default`
|
||||||
|
1. `./gradlew clean integrationTest`
|
||||||
|
|
||||||
|
|
||||||
|
Instructions to run and debug in Eclipse IDE
|
||||||
|
============
|
||||||
|
|
||||||
|
It is possible to run Fineract in Eclipse IDE and also to debug Fineract using Eclipse's debugging facilities.
|
||||||
|
To do this, you need to create the Eclipse project files and import the project into an Eclipse workspace:
|
||||||
|
|
||||||
|
1. Create Eclipse project files into the Fineract project by running `./gradlew cleanEclipse eclipse`
|
||||||
|
2. Import the fineract-provider project into your Eclipse workspace (File->Import->General->Existing Projects into Workspace, choose root directory fineract/fineract-provider)
|
||||||
|
3. Do a clean build of the project in Eclipse (Project->Clean...)
|
||||||
|
3. Run / debug Fineract by right clicking on org.apache.fineract.ServerApplication class and choosing Run As / Debug As -> Java Application. All normal Eclipse debugging features (breakpoints, watchpoints etc) should work as expected.
|
||||||
|
|
||||||
|
If you change the project settings (dependencies etc) in Gradle, you should redo step 1 and refresh the project in Eclipse.
|
||||||
|
|
||||||
|
You can also use Eclipse Junit support to run tests in Eclipse (Run As->Junit Test)
|
||||||
|
|
||||||
|
Finally, modifying source code in Eclipse automatically triggers hot code replace to a running instance, allowing you to immediately test your changes
|
||||||
|
|
||||||
|
|
||||||
|
Instructions to run using Docker and docker-compose
|
||||||
|
===================================================
|
||||||
|
|
||||||
|
It is possible to do a 'one-touch' installation of Fineract using containers (AKA "Docker").
|
||||||
|
Fineract now packs the mifos community-app web UI in it's docker deploy.
|
||||||
|
You can now run and test fineract with a GUI directly from the combined docker builds.
|
||||||
|
This includes the database running in a container.
|
||||||
|
|
||||||
|
As Prerequisites, you must have `docker` and `docker-compose` installed on your machine; see
|
||||||
|
[Docker Install](https://docs.docker.com/install/) and
|
||||||
|
[Docker Compose Install](https://docs.docker.com/compose/install/).
|
||||||
|
|
||||||
|
Alternatively, you can also use [Podman](https://github.com/containers/libpod)
|
||||||
|
(e.g. via `dnf install podman-docker`), and [Podman Compose](https://github.com/containers/podman-compose/)
|
||||||
|
(e.g. via `pip3 install podman-compose`) instead of Docker.
|
||||||
|
|
||||||
|
Now to run a new Fineract instance you can simply:
|
||||||
|
|
||||||
|
1. `git clone https://github.com/apache/fineract.git ; cd fineract`
|
||||||
|
1. `docker-compose build`
|
||||||
|
1. `docker-compose up -d`
|
||||||
|
1. fineract (back-end) is running at https://localhost:8443/fineract-provider/
|
||||||
|
1. wait for https://localhost:8443/fineract-provider/actuator/health to return `{"status":"UP"}`
|
||||||
|
1. you must go to https://localhost:8443 and remember to accept the self-signed SSL certificate of the API once in your browser, otherwise you get a message that is rather misleading from the UI.
|
||||||
|
1. community-app (UI) is running at http://localhost:9090/?baseApiUrl=https://localhost:8443/fineract-provider&tenantIdentifier=default
|
||||||
|
1. login using default _username_ `mifos` and _password_ `password`
|
||||||
|
|
||||||
|
The [`docker-compose.yml`](docker-compose.yml) will build the `fineract` container from the source based on the [`Dockerfile`](Dockerfile). You could change that to use the pre-built container image instead of having to re-build it.
|
||||||
|
|
||||||
|
https://hub.docker.com/r/apache/fineract has a pre-built container image of this project, built continuously.
|
||||||
|
|
||||||
|
You must specify the MySQL tenants database JDBC URL by passing it to the `fineract` container via environment
|
||||||
|
variables; please consult the [`docker-compose.yml`](docker-compose.yml) for exact details how to specify those.
|
||||||
|
_(Note that in previous versions, the `mysqlserver` environment variable used at `docker build` time instead of at
|
||||||
|
`docker run` time did something similar; this has changed in [FINERACT-773](https://issues.apache.org/jira/browse/FINERACT-773)),
|
||||||
|
and the `mysqlserver` environment variable is now no longer supported.)_
|
||||||
|
|
||||||
|
|
||||||
|
Instructions to run on Kubernetes
|
||||||
|
=================================
|
||||||
|
|
||||||
|
General Clusters
|
||||||
|
----------------
|
||||||
|
|
||||||
|
You can also run Fineract using containers on a Kubernetes cluster.
|
||||||
|
Make sure you set up and connect to your Kubernetes cluster.
|
||||||
|
You can follow [this](https://cwiki.apache.org/confluence/display/FINERACT/Install+and+configure+kubectl+and+Google+Cloud+SDK+on+ubuntu+16.04) guide to set up a Kubernetes cluster on GKE. Make sure to replace `apache-fineract-cn` with `apache-fineract`
|
||||||
|
|
||||||
|
Now e.g. from your Google Cloud shell, run the following commands:
|
||||||
|
|
||||||
|
1. `git clone https://github.com/apache/fineract.git ; cd fineract/kubernetes`
|
||||||
|
1. `./kubectl-startup`
|
||||||
|
|
||||||
|
To shutdown and reset your Cluster, run:
|
||||||
|
|
||||||
|
./kubectl-shutdown
|
||||||
|
|
||||||
|
Using Minikube
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Alternatively, you can run fineract on a local kubernetes cluster using [minikube](https://minikube.sigs.k8s.io/docs/).
|
||||||
|
As Prerequisites, you must have `minikube` and `kubectl` installed on your machine; see
|
||||||
|
[Minikube & Kubectl install](https://kubernetes.io/docs/tasks/tools/install-minikube/).
|
||||||
|
|
||||||
|
Now to run a new Fineract instance on Minikube you can simply:
|
||||||
|
|
||||||
|
1. `git clone https://github.com/apache/fineract.git ; cd fineract/kubernetes`
|
||||||
|
1. `minikube start`
|
||||||
|
1. `./kubectl-startup.sh`
|
||||||
|
1. `minikube service fineract-server --url --https`
|
||||||
|
1. Fineract is now running at the printed URL (note HTTP), which you can check e.g. using:
|
||||||
|
|
||||||
|
http --verify=no --timeout 240 --check-status get $(minikube service fineract-server --url --https)/fineract-provider/actuator/health
|
||||||
|
|
||||||
|
To check the status of your containers on your local minikube Kubernetes cluster, run:
|
||||||
|
|
||||||
|
minikube dashboard
|
||||||
|
|
||||||
|
You can check Fineract logs using:
|
||||||
|
|
||||||
|
kubectl logs deployment/fineract-server
|
||||||
|
|
||||||
|
To shutdown and reset your cluster, run:
|
||||||
|
|
||||||
|
./kubectl-shutdown
|
||||||
|
|
||||||
|
We have [some open issues in JIRA with Kubernetes related enhancement ideas](https://jira.apache.org/jira/browse/FINERACT-783?jql=labels%20%3D%20kubernetes%20AND%20project%20%3D%20%22Apache%20Fineract%22%20) which you are welcome to contribute to.
|
||||||
|
|
||||||
|
|
||||||
|
Instructions to download Gradle wrapper
|
||||||
|
============
|
||||||
|
The file fineract-provider/gradle/wrapper/gradle-wrapper.jar binary is checked into this projects Git source repository,
|
||||||
|
but won't exist in your copy of the Fineract codebase if you downloaded a released source archive from apache.org.
|
||||||
|
In that case, you need to download it using the commands below:
|
||||||
|
|
||||||
|
wget --no-check-certificate -P fineract-provider/gradle/wrapper https://github.com/apache/fineract/raw/develop/fineract-provider/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
(or)
|
(or)
|
||||||
|
|
||||||
curl --insecure -L https://github.com/apache/fineract/raw/develop/fineract-provider/gradle/wrapper/gradle-wrapper.jar > fineract-provider/gradle/wrapper/gradle-wrapper.jar
|
curl --insecure -L https://github.com/apache/fineract/raw/develop/fineract-provider/gradle/wrapper/gradle-wrapper.jar > fineract-provider/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
Instructions to run Apache RAT (Release Audit Tool)
|
Instructions to run Apache RAT (Release Audit Tool)
|
||||||
============
|
============
|
||||||
1. Extract the archive file to your local directory.
|
1. Extract the archive file to your local directory.
|
||||||
2. Run `./gradlew rat`. A report will be generated under build/reports/rat/rat-report.txt
|
2. Run `./gradlew rat`. A report will be generated under build/reports/rat/rat-report.txt
|
||||||
|
|
||||||
Instructions to build a war file
|
|
||||||
|
Checkstyle and Spotless
|
||||||
============
|
============
|
||||||
1. Extract the archive file to your local directory.
|
|
||||||
2. Run `./gradlew clean war` or `./gradlew build` to build deployable war file which will be created at build/libs directory.
|
This project enforces its code conventions using [checkstyle.xml](fineract-provider/config/checkstyle/checkstyle.xml) through Checkstyle and [fineract-formatting-preferences.xml](config/fineract-formatting-preferences.xml) through Spotless. They are configured to run automatically during the normal Gradle build, and fail if there are any violations detected. You can run the following command to automatically fix spotless violations:
|
||||||
|
|
||||||
|
`./gradlew spotlessApply`
|
||||||
|
|
||||||
|
Since some checks are present in both Checkstyle and Spotless, the same command can help you fix some of the Checkstyle violations (but not all, other Checkstyle violations need to fixed manually).
|
||||||
|
|
||||||
|
You can also check for Spotless violations (only; but normally don't have to, because the regular build full already includes this anyway):
|
||||||
|
|
||||||
|
`./gradlew spotlessCheck`
|
||||||
|
|
||||||
|
We recommend that you configure your favourite Java IDE to match those conventions. For Eclipse, you can go to
|
||||||
|
Window > Java > Code Style and import our [config/fineractdev-formatter.xml](config/fineractdev-formatter.xml) under formatter section and [config/fineractdev-cleanup.xml](config/fineractdev-cleanup.xml) under Clean up section. The same fineractdev-formatter.xml configuration file (that can be used in Eclipse IDE) is also used by Spotless to both check for violations and autoformat code on the CLI.
|
||||||
|
You could also use Checkstyle directly in your IDE (but you don't neccesarily have to, it may just be more convenient for you). For Eclipse, use https://checkstyle.org/eclipse-cs/ and load our checkstyle.xml into it, for IntelliJ you can use [CheckStyle-IDEA](https://plugins.jetbrains.com/plugin/1065-checkstyle-idea).
|
||||||
|
|
||||||
|
|
||||||
Instructions to execute Integration tests
|
Code Coverage Reports
|
||||||
============
|
============
|
||||||
> Note that if this is the first time to access MySQL DB, then you may need to reset your password.
|
|
||||||
|
|
||||||
Run the following commands, very similarly to how [.travis.yml](.travis.yml) does:
|
The project uses Jacoco to measure unit tests code coverage, to generate a report run the following command:
|
||||||
1. `./gradlew createDB -PdbName=mifosplatform-tenants`
|
|
||||||
1. `./gradlew createDB -PdbName=mifostenant-default`
|
`./gradlew clean build jacocoTestReport`
|
||||||
1. `./gradlew clean integrationTest`
|
|
||||||
|
Generated reports can be found in build/code-coverage directory.
|
||||||
|
|
||||||
|
|
||||||
Instructions to run using Docker and docker-compose
|
Versions
|
||||||
===================================================
|
|
||||||
|
|
||||||
It is possible to do a 'one-touch' installation of Fineract using docker-compose
|
|
||||||
|
|
||||||
Prerequisites:
|
|
||||||
* docker and docker-compose installed on your machine
|
|
||||||
|
|
||||||
|
|
||||||
Installing a new Fineract instance:
|
|
||||||
|
|
||||||
* Clone the Fineract Github repository
|
|
||||||
* Run the following commands:
|
|
||||||
* docker-compose build
|
|
||||||
* docker-compose up -d
|
|
||||||
* Fineract will run at https://localhost:8443/fineract-provider
|
|
||||||
|
|
||||||
|
|
||||||
Version
|
|
||||||
============
|
============
|
||||||
|
|
||||||
The latest stable release can be viewed on the develop branch: [Latest Release on Develop](https://github.com/apache/fineract/tree/develop "Latest Release").
|
The latest stable release can be viewed on the develop branch: [Latest Release on Develop](https://github.com/apache/fineract/tree/develop "Latest Release").
|
||||||
|
|
||||||
The progress of this project can be viewed here: [View change log](https://github.com/apache/fineract/blob/develop/CHANGELOG.md "Latest release change log")
|
The progress of this project can be viewed here: [View change log](https://github.com/apache/fineract/blob/develop/CHANGELOG.md "Latest release change log")
|
||||||
|
|
||||||
|
|
||||||
License
|
License
|
||||||
============
|
============
|
||||||
|
|
||||||
This project is licensed under Apache License Version 2.0. See <https://github.com/apache/incubator-fineract/blob/develop/LICENSE.md> for referece.
|
This project is licensed under Apache License Version 2.0. See <https://github.com/apache/incubator-fineract/blob/develop/LICENSE.md> for reference.
|
||||||
|
|
||||||
The Connector/J JDBC Driver client library from MariaDB.org, which is licensed under the LGPL,
|
The Connector/J JDBC Driver client library from MariaDB.org, which is licensed under the LGPL,
|
||||||
is used in development when running integration tests that use the Flyway library. That JDBC
|
is used in development when running integration tests that use the Flyway library. That JDBC
|
||||||
driver is however not included in and distributed with the Fineract product, and is not
|
driver is however not included in and distributed with the Fineract product and is not
|
||||||
required to use the product.
|
required to use the product.
|
||||||
If you are developer and object to using the LGPL licensed Connector/J JDBC driver,
|
If you are developer and object to using the LGPL licensed Connector/J JDBC driver,
|
||||||
simply do not run the integration tests that use the Flyway library.
|
simply do not run the integration tests that use the Flyway library.
|
||||||
@@ -93,42 +249,107 @@ complies with the [Apache Software Foundation third-party license policy](https:
|
|||||||
Apache Fineract Platform API
|
Apache Fineract Platform API
|
||||||
============
|
============
|
||||||
|
|
||||||
The API for the Fineract-platform (project named 'Apache Fineract') is documented in the API-docs under <b><i>Full API Matrix</i></b> and can be viewed [here](https://demo.openmf.org/api-docs/apiLive.htm "API Documentation").
|
The API for the Fineract-platform (project named 'Apache Fineract') is documented in the API-docs under <b><i>Full API Matrix</i></b> and can be viewed [here](https://demo.fineract.dev/fineract-provider/api-docs/apiLive.htm "API Documentation").
|
||||||
|
|
||||||
|
|
||||||
|
API clients (Web UIs, Mobile, etc.)
|
||||||
|
============
|
||||||
|
|
||||||
|
* https://github.com/openMF/community-app/ is the "traditional" Reference Client App Web UI for the API offered by this project
|
||||||
|
* https://github.com/openMF/web-app is the next generation UI rewrite also using this project's API
|
||||||
|
* https://github.com/openMF/android-client is an Android Mobile App client for this project's API
|
||||||
|
* https://github.com/openMF has more related proejcts
|
||||||
|
|
||||||
|
|
||||||
Online Demos
|
Online Demos
|
||||||
============
|
============
|
||||||
|
|
||||||
* [Community App](https://demo.openmf.org "Reference Client App")
|
* [fineract.dev](https://www.fineract.dev) always runs the latest version of this code
|
||||||
> For this demo, a demo account is also provided for users to experience the functionality of this Community App. Users can use "mifos" for USERNAME and "password" for PASSWORD(without quotation marks).
|
* [demo.mifos.io](https://demo.mifos.io) A demo account is provided for users to experience the functionality of the Community App. Users can use "mifos" for USERNAME and "password" for PASSWORD (without quotation marks).
|
||||||
|
|
||||||
|
|
||||||
Developers
|
Developers
|
||||||
============
|
============
|
||||||
Please see <https://cwiki.apache.org/confluence/display/FINERACT/Contributor%27s+Zone> for the developers wiki page.
|
Please see <https://cwiki.apache.org/confluence/display/FINERACT/Contributor%27s+Zone> for the developers wiki page.
|
||||||
|
|
||||||
Please refer to <https://cwiki.apache.org/confluence/display/FINERACT/Fineract+101> for first time contribution for this project.
|
Please refer to <https://cwiki.apache.org/confluence/display/FINERACT/Fineract+101> for the first-time contribution to this project.
|
||||||
|
|
||||||
Please see <https://cwiki.apache.org/confluence/display/FINERACT/How-to+articles> for technical details to get started.
|
Please see <https://cwiki.apache.org/confluence/display/FINERACT/How-to+articles> for technical details to get started.
|
||||||
|
|
||||||
|
Please visit [our JIRA Dashboard](https://issues.apache.org/jira/secure/Dashboard.jspa?selectPageId=12335824) to find issues to work on, see what others are working on, or open new issues.
|
||||||
|
|
||||||
Roadmap
|
|
||||||
============
|
|
||||||
|
|
||||||
[Project Release Roadmap on JIRA (Detailed View)](https://issues.apache.org/jira/browse/FINERACT-268?jql=project%20%3D%20FINERACT "Project Release Roadmap on JIRA (Detailed View)")
|
|
||||||
|
|
||||||
Video Demonstration
|
Video Demonstration
|
||||||
============
|
============
|
||||||
|
|
||||||
Apache Fineract / Mifos X Demo (November 2016) - <https://www.youtube.com/watch?v=h61g9TptMBo>
|
Apache Fineract / Mifos X Demo (November 2016) - <https://www.youtube.com/watch?v=h61g9TptMBo>
|
||||||
|
|
||||||
|
|
||||||
Governance and Policies
|
Governance and Policies
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
[Becoming a Committer](https://cwiki.apache.org/confluence/display/FINERACT/Becoming+a+Committer)
|
[Becoming a Committer](https://cwiki.apache.org/confluence/display/FINERACT/Becoming+a+Committer)
|
||||||
documents the process through which you can become a committer in this project.
|
documents the process through which you can become a committer in this project.
|
||||||
|
|
||||||
|
|
||||||
|
Error Handling Guidelines
|
||||||
|
------------------
|
||||||
|
* When catching exceptions, either rethrow them, or log them. Either way, include the root cause by using `catch (SomeException e)` and then either `throw AnotherException("..details..", e)` or `LOG.error("...context...", e)`.
|
||||||
|
* Completely empty catch blocks are VERY suspicous! Are you sure that you want to just "swallow" an exception? Really, 100% totally absolutely sure?? ;-) Such "normal exceptions which just happen sometimes but are actually not really errors" are almost always a bad idea, can be a performance issue, and typically are an indication of another problem - e.g. the use of a wrong API which throws an Exception for an expected condition, when really you would want to use another API that instead returns something empty or optional.
|
||||||
|
* In tests, you'll typically never catch exceptions, but just propagate them, with `@Test void testXYZ() throws SomeException, AnotherException`..., so that the test fails if the exception happens. Unless you actually really want to test for the occurence of a problem - in that case, use [JUnit's Assert.assertThrows()](https://github.com/junit-team/junit4/wiki/Exception-testing) (but not `@Test(expected = SomeException.class)`).
|
||||||
|
* Never catch `NullPointerException` & Co.
|
||||||
|
|
||||||
|
Logging Guidelines
|
||||||
|
------------------
|
||||||
|
* We use [SLF4J](http://www.slf4j.org) as our logging API.
|
||||||
|
* Never, ever, use `System.out` and `System.err` or `printStackTrace()` anywhere, but always `LOG.info()` or `LOG.error()` instead.
|
||||||
|
* Use placeholder (`LOG.error("Could not... details: {}", something, exception)`) and never String concatenation (`LOG.error("Could not... details: " + something, exception)`)
|
||||||
|
* Which Log Level is appropriate?
|
||||||
|
* `LOG.error()` should be used to inform an "operator" running Fineract who supervises error logs of an unexpected condition. This includes technical problems with an external "environment" (e.g. can't reach a database), and situations which are likely bugs which need to be fixed in the code. They do NOT include e.g. validation errors for incoming API requests - that is signaled through the API response - and does (should) not be logged as an error. (Note that there is no _FATAL_ level in SLF4J; a "FATAL" event should just be logged as an _ERROR_.)
|
||||||
|
* `LOG.warn()` should be using sparingly. Make up your mind if it's an error (above) - or not!
|
||||||
|
* `LOG.info()` can be used notably for one-time actions taken during start-up. It should typically NOT be used to print out "regular" application usage information. The default logging configuration always outputs the application INFO logs, and in production under load, there's really no point to constantly spew out lots of information from frequently traversed paths in the code about what's going on. (Metrics are a better way.) `LOG.info()` *can* be used freely in tests though.
|
||||||
|
* `LOG.debug()` can be used anywhere in the code to log things that may be useful during investigations of specific problems. They are not shown in the default logging configuration, but can be enabled for troubleshooting. Developers should typically "turn down" most `LOG.info()` which they used while writing a new feature to "follow along what happens during local testing" to `LOG.debug()` for production before we merge their PRs.
|
||||||
|
* `LOG.trace()` is not used in Fineract.
|
||||||
|
|
||||||
|
Pull Requests
|
||||||
|
-------------
|
||||||
|
|
||||||
|
If your PR is failing to pass our CI build due to a test failure, then:
|
||||||
|
|
||||||
|
1. Understand if the failure is due to your PR or an unrelated unstable test.
|
||||||
|
1. If you suspect it is because of a "flaky" test, and not due to a change in your PR, then please do not simply wait for an active maintainer to come and help you, but instead be a proactive contributor to the project - see next steps. Do understand that we may not review PRs that are not green - it is the contributor's (that's you!) responsability to get a proposed PR to pass the build, not primarily the maintainers.
|
||||||
|
1. Search for the name of the failed test on https://issues.apache.org/jira/, e.g. for `AccountingScenarioIntegrationTest` you would find [FINERACT-899](https://issues.apache.org/jira/browse/FINERACT-899).
|
||||||
|
1. If you happen to read in such bugs that tests were just recently fixed, or ignored, then rebase your PR to pick up that change.
|
||||||
|
1. If you find previous comments "proving" that the same test has arbitrarily failed in at least 3 past PRs, then please do yourself raise a small separate new PR proposing to add an `@Disabled // TODO FINERACT-123` to the respective unstable test (e.g. [#774](https://github.com/apache/fineract/pull/774)) with the commit message mentioning said JIRA, as always. (Please do NOT just `@Disabled` any existing tests mixed in as part of your larger PR.)
|
||||||
|
1. If there is no existing JIRA for the test, then first please evaluate whether the failure couldn't be a (perhaps strange) impact of the change you are proposing after all. If it's not, then please raise a new JIRA to document the suspected Flaky Test, and link it to [FINERACT-850](https://issues.apache.org/jira/browse/FINERACT-850). This will allow the next person coming along hitting the same test failure to easily find it, and eventually propose to ignore the unstable test.
|
||||||
|
1. Then (only) Close and Reopen your PR, which will cause a new build, to see if it passes.
|
||||||
|
1. Of course, we very much appreciate you then jumping onto any such bugs and helping us figure out how to fix all ignored tests!
|
||||||
|
|
||||||
[Pull Request Size Limit](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit)
|
[Pull Request Size Limit](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit)
|
||||||
documents that we cannot accept huge "code dump" Pull Requests, with some related suggestions.
|
documents that we cannot accept huge "code dump" Pull Requests, with some related suggestions.
|
||||||
|
|
||||||
|
Guideline for new Feature commits involving Refactoring: If you are submitting PR for a new Feature,
|
||||||
|
and it involves refactoring, try to differentiate "new Feature code" with "Refactored" by placing
|
||||||
|
them in different commits. This helps review to review your code faster.
|
||||||
|
|
||||||
|
We have an automated Bot which marks pull requests as "stale" after a while, and ultimately automatically closes them.
|
||||||
|
|
||||||
|
Dependency Upgrades
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
This project uses a number of 3rd-party libraries, and this section provides some guidance for their updates. We have set-up [Renovate's bot](https://renovate.whitesourcesoftware.com) to automatically raise Pull Requests for our review when new dependencies are available [FINERACT-962](https://issues.apache.org/jira/browse/FINERACT-962).
|
||||||
|
|
||||||
|
Upgrades sometimes require package name changes. Changed code should ideally have test coverage.
|
||||||
|
|
||||||
|
Our `ClasspathHellDuplicatesCheckRuleTest` detects classes that appear in more than 1 JAR. If a version bump in [`build.gradle`](https://github.com/search?q=repo%3Aapache%2Ffineract+filename%3Abuild.gradle&type=Code&ref=advsearch&l=&l=) causes changes in transitives dependencies, then you may have to add related `exclude` to our [`dependencies.gradle`](https://github.com/apache/fineract/search?q=dependencies.gradle). Running `./gradlew dependencies` helps to understand what is required.
|
||||||
|
|
||||||
|
|
||||||
|
Releasing
|
||||||
|
---------
|
||||||
|
|
||||||
|
[How to Release Apache Fineract](https://cwiki.apache.org/confluence/x/DRwIB) documents the process how we make the source code that is available here in this Git repository into a binary release ZIP available on http://fineract.apache.org.
|
||||||
|
|
||||||
|
|
||||||
More Information
|
More Information
|
||||||
============
|
============
|
||||||
More details of the project can be found at <https://cwiki.apache.org/confluence/display/FINERACT>.
|
More details of the project can be found at <https://cwiki.apache.org/confluence/display/FINERACT>.
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<profiles version="2">
|
||||||
|
<profile kind="CleanUpProfile" name="fineractdevprofile" version="2">
|
||||||
|
<setting id="cleanup.use_autoboxing" value="false"/>
|
||||||
|
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/>
|
||||||
|
<setting id="cleanup.always_use_this_for_non_static_method_access" value="false"/>
|
||||||
|
<setting id="cleanup.organize_imports" value="true"/>
|
||||||
|
<setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/>
|
||||||
|
<setting id="cleanup.use_directly_map_method" value="false"/>
|
||||||
|
<setting id="cleanup.format_source_code_changes_only" value="false"/>
|
||||||
|
<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/>
|
||||||
|
<setting id="cleanup.add_generated_serial_version_id" value="false"/>
|
||||||
|
<setting id="cleanup.remove_redundant_semicolons" value="false"/>
|
||||||
|
<setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="true"/>
|
||||||
|
<setting id="cleanup.remove_redundant_type_arguments" value="false"/>
|
||||||
|
<setting id="cleanup.remove_unused_imports" value="true"/>
|
||||||
|
<setting id="cleanup.insert_inferred_type_arguments" value="false"/>
|
||||||
|
<setting id="cleanup.make_private_fields_final" value="true"/>
|
||||||
|
<setting id="cleanup.use_lambda" value="true"/>
|
||||||
|
<setting id="cleanup.simplify_lambda_expression_and_method_ref" value="false"/>
|
||||||
|
<setting id="cleanup.always_use_blocks" value="true"/>
|
||||||
|
<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="false"/>
|
||||||
|
<setting id="cleanup.sort_members_all" value="false"/>
|
||||||
|
<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/>
|
||||||
|
<setting id="cleanup.add_missing_annotations" value="true"/>
|
||||||
|
<setting id="cleanup.remove_unnecessary_array_creation" value="false"/>
|
||||||
|
<setting id="cleanup.always_use_this_for_non_static_field_access" value="true"/>
|
||||||
|
<setting id="cleanup.make_parameters_final" value="true"/>
|
||||||
|
<setting id="cleanup.sort_members" value="false"/>
|
||||||
|
<setting id="cleanup.remove_private_constructors" value="true"/>
|
||||||
|
<setting id="cleanup.always_use_parentheses_in_expressions" value="false"/>
|
||||||
|
<setting id="cleanup.remove_unused_local_variables" value="false"/>
|
||||||
|
<setting id="cleanup.convert_to_enhanced_for_loop" value="false"/>
|
||||||
|
<setting id="cleanup.remove_unused_private_fields" value="true"/>
|
||||||
|
<setting id="cleanup.remove_redundant_modifiers" value="false"/>
|
||||||
|
<setting id="cleanup.never_use_blocks" value="false"/>
|
||||||
|
<setting id="cleanup.number_suffix" value="false"/>
|
||||||
|
<setting id="cleanup.add_missing_deprecated_annotations" value="true"/>
|
||||||
|
<setting id="cleanup.use_this_for_non_static_field_access" value="true"/>
|
||||||
|
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
|
||||||
|
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
|
||||||
|
<setting id="cleanup.add_missing_nls_tags" value="false"/>
|
||||||
|
<setting id="cleanup.remove_unnecessary_casts" value="true"/>
|
||||||
|
<setting id="cleanup.use_unboxing" value="false"/>
|
||||||
|
<setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/>
|
||||||
|
<setting id="cleanup.format_source_code" value="true"/>
|
||||||
|
<setting id="cleanup.convert_functional_interfaces" value="false"/>
|
||||||
|
<setting id="cleanup.add_default_serial_version_id" value="true"/>
|
||||||
|
<setting id="cleanup.remove_unused_private_methods" value="true"/>
|
||||||
|
<setting id="cleanup.remove_trailing_whitespaces" value="true"/>
|
||||||
|
<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/>
|
||||||
|
<setting id="cleanup.add_serial_version_id" value="false"/>
|
||||||
|
<setting id="cleanup.use_this_for_non_static_method_access" value="true"/>
|
||||||
|
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="true"/>
|
||||||
|
<setting id="cleanup.use_anonymous_class_creation" value="false"/>
|
||||||
|
<setting id="cleanup.add_missing_override_annotations_interface_methods" value="true"/>
|
||||||
|
<setting id="cleanup.remove_unused_private_members" value="false"/>
|
||||||
|
<setting id="cleanup.make_local_variable_final" value="true"/>
|
||||||
|
<setting id="cleanup.add_missing_methods" value="true"/>
|
||||||
|
<setting id="cleanup.never_use_parentheses_in_expressions" value="true"/>
|
||||||
|
<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/>
|
||||||
|
<setting id="cleanup.push_down_negation" value="false"/>
|
||||||
|
<setting id="cleanup.use_parentheses_in_expressions" value="false"/>
|
||||||
|
<setting id="cleanup.add_missing_override_annotations" value="true"/>
|
||||||
|
<setting id="cleanup.use_blocks" value="true"/>
|
||||||
|
<setting id="cleanup.make_variable_declarations_final" value="true"/>
|
||||||
|
<setting id="cleanup.correct_indentation" value="true"/>
|
||||||
|
<setting id="cleanup.remove_unused_private_types" value="true"/>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,365 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<profiles version="18">
|
||||||
|
<profile kind="CodeFormatterProfile" name="fineractdevprojectformatter" version="18">
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="140"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
+36
-2
@@ -16,15 +16,22 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# NB: Travis CI (dist: bionic) supports up to v3.7
|
||||||
|
# (unless we'd install a more recent version in .travis.yml)
|
||||||
version: '3.7'
|
version: '3.7'
|
||||||
services:
|
services:
|
||||||
|
# Backend service
|
||||||
fineractmysql:
|
fineractmysql:
|
||||||
image: mysql:5.7
|
image: mysql:5.7
|
||||||
volumes:
|
volumes:
|
||||||
- ./fineract-db/docker:/docker-entrypoint-initdb.d
|
- ./fineract-db/docker:/docker-entrypoint-initdb.d:Z,ro
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: mysql
|
MYSQL_ROOT_PASSWORD: skdcnwauicn2ucnaecasdsajdnizucawencascdca
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "--password=skdcnwauicn2ucnaecasdsajdnizucawencascdca" ]
|
||||||
|
timeout: 10s
|
||||||
|
retries: 10
|
||||||
ports:
|
ports:
|
||||||
- "3306:3306"
|
- "3306:3306"
|
||||||
fineract-server:
|
fineract-server:
|
||||||
@@ -35,3 +42,30 @@ services:
|
|||||||
- 8443:8443
|
- 8443:8443
|
||||||
depends_on:
|
depends_on:
|
||||||
- fineractmysql
|
- fineractmysql
|
||||||
|
environment:
|
||||||
|
- DRIVERCLASS_NAME=org.drizzle.jdbc.DrizzleDriver
|
||||||
|
- PROTOCOL=jdbc
|
||||||
|
- SUB_PROTOCOL=mysql:thin
|
||||||
|
- fineract_tenants_driver=org.drizzle.jdbc.DrizzleDriver
|
||||||
|
- fineract_tenants_url=jdbc:mysql:thin://fineractmysql:3306/fineract_tenants
|
||||||
|
- fineract_tenants_uid=root
|
||||||
|
- fineract_tenants_pwd=skdcnwauicn2ucnaecasdsajdnizucawencascdca
|
||||||
|
- FINERACT_DEFAULT_TENANTDB_HOSTNAME=fineractmysql
|
||||||
|
- FINERACT_DEFAULT_TENANTDB_PORT=3306
|
||||||
|
- FINERACT_DEFAULT_TENANTDB_UID=root
|
||||||
|
- FINERACT_DEFAULT_TENANTDB_PWD=skdcnwauicn2ucnaecasdsajdnizucawencascdca
|
||||||
|
|
||||||
|
# Frontend service
|
||||||
|
community-app:
|
||||||
|
image: openmf/community-app:latest
|
||||||
|
container_name: mifos-ui
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 9090:80
|
||||||
|
|
||||||
|
|
||||||
|
# https://issues.apache.org/jira/browse/FINERACT-762
|
||||||
|
# To use an altnerative JDBC driver (which is faster, but not allowed to be default in Apache distribution)
|
||||||
|
# replace org.drizzle.jdbc.DrizzleDriver with com.mysql.jdbc.Driver in DRIVERCLASS_NAME and fineract_tenants_driver,
|
||||||
|
# and remove ":thin:" from SUB_PROTOCOL and fineract_tenants_url. Note that the mysql-connector-java-*.jar is already
|
||||||
|
# bundled in the container by the Dockerfile, but just not used by default.
|
||||||
|
|||||||
+4
-32
@@ -31,35 +31,6 @@
|
|||||||
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
|
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
|
||||||
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
|
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
|
||||||
|
|
||||||
<!-- Global JNDI resources
|
|
||||||
Documentation at /docs/jndi-resources-howto.html
|
|
||||||
-->
|
|
||||||
<GlobalNamingResources>
|
|
||||||
<!-- Editable user database that can also be used by
|
|
||||||
UserDatabaseRealm to authenticate users
|
|
||||||
-->
|
|
||||||
<Resource type="javax.sql.DataSource"
|
|
||||||
name="jdbc/mifosplatform-tenants"
|
|
||||||
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
|
|
||||||
driverClassName="org.drizzle.jdbc.DrizzleDriver"
|
|
||||||
url="jdbc:mysql:thin://fineractmysql:3306/mifosplatform-tenants"
|
|
||||||
username="root"
|
|
||||||
password="mysql"
|
|
||||||
initialSize="3"
|
|
||||||
maxActive="10"
|
|
||||||
maxIdle="6"
|
|
||||||
minIdle="3"
|
|
||||||
validationQuery="SELECT 1"
|
|
||||||
testOnBorrow="true"
|
|
||||||
testOnReturn="true"
|
|
||||||
testWhileIdle="true"
|
|
||||||
timeBetweenEvictionRunsMillis="30000"
|
|
||||||
minEvictableIdleTimeMillis="60000"
|
|
||||||
logAbandoned="true"
|
|
||||||
suspectTimeout="60"
|
|
||||||
/>
|
|
||||||
</GlobalNamingResources>
|
|
||||||
|
|
||||||
<!-- A "Service" is a collection of one or more "Connectors" that share
|
<!-- A "Service" is a collection of one or more "Connectors" that share
|
||||||
a single "Container" Note: A "Service" is not itself a "Container",
|
a single "Container" Note: A "Service" is not itself a "Container",
|
||||||
so you may not define subcomponents such as "Valves" at this level.
|
so you may not define subcomponents such as "Valves" at this level.
|
||||||
@@ -99,7 +70,7 @@
|
|||||||
Either JSSE or OpenSSL style configuration may be used regardless of
|
Either JSSE or OpenSSL style configuration may be used regardless of
|
||||||
the SSLImplementation selected. JSSE style configuration is used below.
|
the SSLImplementation selected. JSSE style configuration is used below.
|
||||||
-->
|
-->
|
||||||
<Connector protocol="org.apache.coyote.http11.Http11Protocol"
|
<Connector protocol="org.apache.coyote.http11.Http11NioProtocol"
|
||||||
port="8443" maxThreads="200" scheme="https"
|
port="8443" maxThreads="200" scheme="https"
|
||||||
secure="true" SSLEnabled="true"
|
secure="true" SSLEnabled="true"
|
||||||
keystoreFile="/opt/bitnami/tomcat/tomcat.keystore"
|
keystoreFile="/opt/bitnami/tomcat/tomcat.keystore"
|
||||||
@@ -137,8 +108,9 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- Define an AJP 1.3 Connector on port 8009 -->
|
<!-- Define an AJP 1.3 Connector on port 8009 -->
|
||||||
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
|
<!--
|
||||||
|
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" secret="xyz123" />
|
||||||
|
-->
|
||||||
|
|
||||||
<!-- An Engine represents the entry point (within Catalina) that processes
|
<!-- An Engine represents the entry point (within Catalina) that processes
|
||||||
every request. The Engine implementation for Tomcat stand alone
|
every request. The Engine implementation for Tomcat stand alone
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ pre .tex .formula {
|
|||||||
<ul>
|
<ul>
|
||||||
<li>2006: Project intiated by <a href="http://www.grameenfoundation.org/" target="_blank">Grameen Foundation</a></li>
|
<li>2006: Project intiated by <a href="http://www.grameenfoundation.org/" target="_blank">Grameen Foundation</a></li>
|
||||||
<li>Late 2011: Grameen Foundation handed over full responsibility to open source community.</li>
|
<li>Late 2011: Grameen Foundation handed over full responsibility to open source community.</li>
|
||||||
<li>2012: Mifos X platform started. Previous members of project come together under the name of Community for Open Source Microfinance (COSM / <a href="http://www.openmf.org" target="_blank">OpenMF</a>)</li>
|
<li>2012: Mifos X platform started. Previous members of project come together under the name of Community for Open Source Microfinance (COSM / <a href="http://www.mifos.org" target="_blank">OpenMF</a>)</li>
|
||||||
<li>2013: COSM / OpenMF officially rebranded to <strong>Mifos Initiative</strong> and receive US 501c3 status.</li>
|
<li>2013: COSM / OpenMF officially rebranded to <strong>Mifos Initiative</strong> and receive US 501c3 status.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
@@ -276,7 +276,7 @@ pre .tex .formula {
|
|||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2>Functional Overview</h2>
|
<h2>Functional Overview</h2>
|
||||||
<p>As ALL capabilities of the platform are exposed through an API, The API docs are the best place to view a detailed breakdown of what the platform does. See <a href="https://demo.openmf.org/api-docs/apiLive.htm" target="_blank">online API Documentation</a>.
|
<p>As ALL capabilities of the platform are exposed through an API, The API docs are the best place to view a detailed breakdown of what the platform does. See <a href="https://demo.fineract.dev/fineract-provider/api-docs/apiLive.htm" target="_blank">online API Documentation</a>.
|
||||||
</p>
|
</p>
|
||||||
<img src="diagrams/platform-categories.png"
|
<img src="diagrams/platform-categories.png"
|
||||||
alt="platform functionality view" />
|
alt="platform functionality view" />
|
||||||
@@ -378,7 +378,7 @@ pre .tex .formula {
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
See <a href="https://demo.openmf.org/api-docs/apiLive.htm" target="_blank">online API Documentation</a> for more detail.
|
See <a href="https://demo.fineract.dev/fineract-provider/api-docs/apiLive.htm" target="_blank">online API Documentation</a> for more detail.
|
||||||
</p>
|
</p>
|
||||||
<h3>Multi-tenanted</h3>
|
<h3>Multi-tenanted</h3>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
# create databases
|
# create databases
|
||||||
CREATE DATABASE IF NOT EXISTS `mifosplatform-tenants`;
|
CREATE DATABASE IF NOT EXISTS `fineract_tenants`;
|
||||||
CREATE DATABASE IF NOT EXISTS `mifostenant-default`;
|
CREATE DATABASE IF NOT EXISTS `fineract_default`;
|
||||||
|
|
||||||
# create root user and grant rights
|
# create root user and grant rights
|
||||||
GRANT ALL ON *.* TO 'root'@'%';
|
GRANT ALL ON *.* TO 'root'@'%';
|
||||||
@@ -19,14 +19,14 @@
|
|||||||
|
|
||||||
-- MySQL dump 10.13 Distrib 5.1.60, for Win32 (ia32)
|
-- MySQL dump 10.13 Distrib 5.1.60, for Win32 (ia32)
|
||||||
--
|
--
|
||||||
-- Host: localhost Database: mifosplatform-tenants
|
-- Host: localhost Database: fineract_tenants
|
||||||
-- ------------------------------------------------------
|
-- ------------------------------------------------------
|
||||||
-- Server version 5.1.60-community
|
-- Server version 5.1.60-community
|
||||||
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
/*!40101 SET NAMES utf8 */;
|
/*!40101 SET NAMES UTF8MB4 */;
|
||||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||||
@@ -40,24 +40,24 @@
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS `schema_version`;
|
DROP TABLE IF EXISTS `schema_version`;
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
/*!40101 SET character_set_client = UTF8MB4 */;
|
||||||
CREATE TABLE `schema_version` (
|
CREATE TABLE `schema_version` (
|
||||||
`version_rank` int(11) NOT NULL,
|
`version_rank` INT NOT NULL,
|
||||||
`installed_rank` int(11) NOT NULL,
|
`installed_rank` INT NOT NULL,
|
||||||
`version` varchar(50) NOT NULL,
|
`version` varchar(50) NOT NULL,
|
||||||
`description` varchar(200) NOT NULL,
|
`description` varchar(200) NOT NULL,
|
||||||
`type` varchar(20) NOT NULL,
|
`type` varchar(20) NOT NULL,
|
||||||
`script` varchar(1000) NOT NULL,
|
`script` varchar(1000) NOT NULL,
|
||||||
`checksum` int(11) DEFAULT NULL,
|
`checksum` INT DEFAULT NULL,
|
||||||
`installed_by` varchar(100) NOT NULL,
|
`installed_by` varchar(100) NOT NULL,
|
||||||
`installed_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`installed_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
`execution_time` int(11) NOT NULL,
|
`execution_time` INT NOT NULL,
|
||||||
`success` tinyint(1) NOT NULL,
|
`success` tinyint NOT NULL,
|
||||||
PRIMARY KEY (`version`),
|
PRIMARY KEY (`version`),
|
||||||
KEY `schema_version_vr_idx` (`version_rank`),
|
KEY `schema_version_vr_idx` (`version_rank`),
|
||||||
KEY `schema_version_ir_idx` (`installed_rank`),
|
KEY `schema_version_ir_idx` (`installed_rank`),
|
||||||
KEY `schema_version_s_idx` (`success`)
|
KEY `schema_version_s_idx` (`success`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@@ -77,14 +77,14 @@ UNLOCK TABLES;
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS `tenants`;
|
DROP TABLE IF EXISTS `tenants`;
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
/*!40101 SET character_set_client = UTF8MB4 */;
|
||||||
CREATE TABLE `tenants` (
|
CREATE TABLE `tenants` (
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
`identifier` varchar(100) NOT NULL,
|
`identifier` varchar(100) NOT NULL,
|
||||||
`name` varchar(100) NOT NULL,
|
`name` varchar(100) NOT NULL,
|
||||||
`schema_name` varchar(100) NOT NULL,
|
`schema_name` varchar(100) NOT NULL,
|
||||||
`timezone_id` varchar(100) NOT NULL,
|
`timezone_id` varchar(100) NOT NULL,
|
||||||
`country_id` int(11) DEFAULT NULL,
|
`country_id` INT DEFAULT NULL,
|
||||||
`joined_date` date DEFAULT NULL,
|
`joined_date` date DEFAULT NULL,
|
||||||
`created_date` datetime DEFAULT NULL,
|
`created_date` datetime DEFAULT NULL,
|
||||||
`lastmodified_date` datetime DEFAULT NULL,
|
`lastmodified_date` datetime DEFAULT NULL,
|
||||||
@@ -92,22 +92,22 @@ CREATE TABLE `tenants` (
|
|||||||
`schema_server_port` varchar(10) NOT NULL DEFAULT '3306',
|
`schema_server_port` varchar(10) NOT NULL DEFAULT '3306',
|
||||||
`schema_username` varchar(100) NOT NULL DEFAULT 'root',
|
`schema_username` varchar(100) NOT NULL DEFAULT 'root',
|
||||||
`schema_password` varchar(100) NOT NULL DEFAULT 'mysql',
|
`schema_password` varchar(100) NOT NULL DEFAULT 'mysql',
|
||||||
`auto_update` tinyint(1) NOT NULL DEFAULT '1',
|
`auto_update` tinyint NOT NULL DEFAULT '1',
|
||||||
`pool_initial_size` int(5) DEFAULT 5,
|
`pool_initial_size` INT DEFAULT 5,
|
||||||
`pool_validation_interval` int(11) DEFAULT 30000,
|
`pool_validation_interval` INT DEFAULT 30000,
|
||||||
`pool_remove_abandoned` tinyint(1) DEFAULT 1,
|
`pool_remove_abandoned` tinyint DEFAULT 1,
|
||||||
`pool_remove_abandoned_timeout` int(5) DEFAULT 60,
|
`pool_remove_abandoned_timeout` INT DEFAULT 60,
|
||||||
`pool_log_abandoned` tinyint(1) DEFAULT 1,
|
`pool_log_abandoned` tinyint DEFAULT 1,
|
||||||
`pool_abandon_when_percentage_full` int(5) DEFAULT 50,
|
`pool_abandon_when_percentage_full` INT DEFAULT 50,
|
||||||
`pool_test_on_borrow` tinyint(1) DEFAULT 1,
|
`pool_test_on_borrow` tinyint DEFAULT 1,
|
||||||
`pool_max_active` int(5) DEFAULT 40,
|
`pool_max_active` INT DEFAULT 40,
|
||||||
`pool_min_idle` int(5) DEFAULT 20,
|
`pool_min_idle` INT DEFAULT 20,
|
||||||
`pool_max_idle` int(5) DEFAULT 10,
|
`pool_max_idle` INT DEFAULT 10,
|
||||||
`pool_suspect_timeout` int(5) DEFAULT 60,
|
`pool_suspect_timeout` INT DEFAULT 60,
|
||||||
`pool_time_between_eviction_runs_millis` int(11) DEFAULT 34000,
|
`pool_time_between_eviction_runs_millis` INT DEFAULT 34000,
|
||||||
`pool_min_evictable_idle_time_millis` int(11) DEFAULT 60000,
|
`pool_min_evictable_idle_time_millis` INT DEFAULT 60000,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=UTF8MB4;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@@ -117,7 +117,7 @@ CREATE TABLE `tenants` (
|
|||||||
LOCK TABLES `tenants` WRITE;
|
LOCK TABLES `tenants` WRITE;
|
||||||
/*!40000 ALTER TABLE `tenants` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `tenants` DISABLE KEYS */;
|
||||||
INSERT INTO `tenants` VALUES
|
INSERT INTO `tenants` VALUES
|
||||||
(1,'default','default','mifostenant-default','Asia/Kolkata',NULL,NULL,NULL,NULL,'localhost','3306','root','mysql',1,5,30000,1,60,1,50,1,40,20,10,60,34000,60000);
|
(1,'default','default','fineract_default','Asia/Kolkata',NULL,NULL,NULL,NULL,'localhost','3306','root','mysql',1,5,30000,1,60,1,50,1,40,20,10,60,34000,60000);
|
||||||
/*!40000 ALTER TABLE `tenants` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `tenants` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
@@ -127,14 +127,14 @@ UNLOCK TABLES;
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS `timezones`;
|
DROP TABLE IF EXISTS `timezones`;
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
/*!40101 SET character_set_client = UTF8MB4 */;
|
||||||
CREATE TABLE `timezones` (
|
CREATE TABLE `timezones` (
|
||||||
`id` int(3) NOT NULL AUTO_INCREMENT,
|
`id` INT NOT NULL AUTO_INCREMENT,
|
||||||
`country_code` varchar(2) NOT NULL,
|
`country_code` varchar(2) NOT NULL,
|
||||||
`timezonename` varchar(100) NOT NULL,
|
`timezonename` varchar(100) NOT NULL,
|
||||||
`comments` varchar(150) DEFAULT NULL,
|
`comments` varchar(150) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=416 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=416 DEFAULT CHARSET=UTF8MB4;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -19,14 +19,14 @@
|
|||||||
|
|
||||||
-- MySQL dump 10.13 Distrib 5.1.60, for Win32 (ia32)
|
-- MySQL dump 10.13 Distrib 5.1.60, for Win32 (ia32)
|
||||||
--
|
--
|
||||||
-- Host: localhost Database: mifosplatform-tenants
|
-- Host: localhost Database: fineract_tenants
|
||||||
-- ------------------------------------------------------
|
-- ------------------------------------------------------
|
||||||
-- Server version 5.1.60-community
|
-- Server version 5.1.60-community
|
||||||
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
/*!40101 SET NAMES utf8 */;
|
/*!40101 SET NAMES UTF8MB4 */;
|
||||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||||
@@ -40,14 +40,14 @@
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS `tenants`;
|
DROP TABLE IF EXISTS `tenants`;
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
/*!40101 SET character_set_client = UTF8MB4 */;
|
||||||
CREATE TABLE `tenants` (
|
CREATE TABLE `tenants` (
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
`identifier` varchar(100) NOT NULL,
|
`identifier` varchar(100) NOT NULL,
|
||||||
`name` varchar(100) NOT NULL,
|
`name` varchar(100) NOT NULL,
|
||||||
`schema_name` varchar(100) NOT NULL,
|
`schema_name` varchar(100) NOT NULL,
|
||||||
`timezone_id` varchar(100) NOT NULL,
|
`timezone_id` varchar(100) NOT NULL,
|
||||||
`country_id` int(11) DEFAULT NULL,
|
`country_id` INT DEFAULT NULL,
|
||||||
`joined_date` date DEFAULT NULL,
|
`joined_date` date DEFAULT NULL,
|
||||||
`created_date` datetime DEFAULT NULL,
|
`created_date` datetime DEFAULT NULL,
|
||||||
`lastmodified_date` datetime DEFAULT NULL,
|
`lastmodified_date` datetime DEFAULT NULL,
|
||||||
@@ -55,9 +55,9 @@ CREATE TABLE `tenants` (
|
|||||||
`schema_server_port` varchar(10) NOT NULL DEFAULT '3306',
|
`schema_server_port` varchar(10) NOT NULL DEFAULT '3306',
|
||||||
`schema_username` varchar(100) NOT NULL DEFAULT 'root',
|
`schema_username` varchar(100) NOT NULL DEFAULT 'root',
|
||||||
`schema_password` varchar(100) NOT NULL DEFAULT 'mysql',
|
`schema_password` varchar(100) NOT NULL DEFAULT 'mysql',
|
||||||
`auto_update` tinyint(1) NOT NULL DEFAULT '1',
|
`auto_update` tinyint NOT NULL DEFAULT '1',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=UTF8MB4;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@@ -66,7 +66,7 @@ CREATE TABLE `tenants` (
|
|||||||
|
|
||||||
LOCK TABLES `tenants` WRITE;
|
LOCK TABLES `tenants` WRITE;
|
||||||
/*!40000 ALTER TABLE `tenants` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `tenants` DISABLE KEYS */;
|
||||||
INSERT INTO `tenants` VALUES (1,'default','Default Demo Tenant','mifostenant-default','Asia/Kolkata',NULL,NULL,NULL,NULL,'localhost','3306','root','mysql',1);
|
INSERT INTO `tenants` VALUES (1,'default','Default Demo Tenant','fineract_default','Asia/Kolkata',NULL,NULL,NULL,NULL,'localhost','3306','root','mysql',1);
|
||||||
/*!40000 ALTER TABLE `tenants` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `tenants` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
@@ -76,14 +76,14 @@ UNLOCK TABLES;
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS `timezones`;
|
DROP TABLE IF EXISTS `timezones`;
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
/*!40101 SET character_set_client = UTF8MB4 */;
|
||||||
CREATE TABLE `timezones` (
|
CREATE TABLE `timezones` (
|
||||||
`id` int(3) NOT NULL AUTO_INCREMENT,
|
`id` INT NOT NULL AUTO_INCREMENT,
|
||||||
`country_code` varchar(2) NOT NULL,
|
`country_code` varchar(2) NOT NULL,
|
||||||
`timezonename` varchar(100) NOT NULL,
|
`timezonename` varchar(100) NOT NULL,
|
||||||
`comments` varchar(150) DEFAULT NULL,
|
`comments` varchar(150) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=416 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=416 DEFAULT CHARSET=UTF8MB4;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -163,76 +163,76 @@ where mc.`code_name` = "YesNo";
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS `client additional data`;
|
DROP TABLE IF EXISTS `client additional data`;
|
||||||
CREATE TABLE `client additional data` (
|
CREATE TABLE `client additional data` (
|
||||||
`client_id` bigint(20) NOT NULL,
|
`client_id` BIGINT NOT NULL,
|
||||||
`Gender_cd` int(11) NOT NULL,
|
`Gender_cd` INT NOT NULL,
|
||||||
`Date of Birth` date NOT NULL,
|
`Date of Birth` date NOT NULL,
|
||||||
`Home address` text NOT NULL,
|
`Home address` text NOT NULL,
|
||||||
`Telephone number` varchar(20) NOT NULL,
|
`Telephone number` varchar(20) NOT NULL,
|
||||||
`Telephone number (2nd)` varchar(20) NOT NULL,
|
`Telephone number (2nd)` varchar(20) NOT NULL,
|
||||||
`Email address` varchar(50) NOT NULL,
|
`Email address` varchar(50) NOT NULL,
|
||||||
`EducationLevel_cd` int(11) NOT NULL,
|
`EducationLevel_cd` INT NOT NULL,
|
||||||
`MaritalStatus_cd` int(11) NOT NULL,
|
`MaritalStatus_cd` INT NOT NULL,
|
||||||
`Number of children` int(11) NOT NULL,
|
`Number of children` INT NOT NULL,
|
||||||
`Citizenship` varchar(50) NOT NULL,
|
`Citizenship` varchar(50) NOT NULL,
|
||||||
`PovertyStatus_cd` int(11) NOT NULL,
|
`PovertyStatus_cd` INT NOT NULL,
|
||||||
`YesNo_cd_Employed` int(11) NOT NULL,
|
`YesNo_cd_Employed` INT NOT NULL,
|
||||||
`FieldOfEmployment_cd_Field of employment` int(11) DEFAULT NULL,
|
`FieldOfEmployment_cd_Field of employment` INT DEFAULT NULL,
|
||||||
`Employer name` varchar(50) DEFAULT NULL,
|
`Employer name` varchar(50) DEFAULT NULL,
|
||||||
`Number of years` int(11) DEFAULT NULL,
|
`Number of years` INT DEFAULT NULL,
|
||||||
`Monthly salary` decimal(19,6) DEFAULT NULL,
|
`Monthly salary` decimal(19,6) DEFAULT NULL,
|
||||||
`YesNo_cd_Self employed` int(11) NOT NULL,
|
`YesNo_cd_Self employed` INT NOT NULL,
|
||||||
`FieldOfEmployment_cd_Field of self-employment` int(11) DEFAULT NULL,
|
`FieldOfEmployment_cd_Field of self-employment` INT DEFAULT NULL,
|
||||||
`Business address` text,
|
`Business address` text,
|
||||||
`Number of employees` int(11) DEFAULT NULL,
|
`Number of employees` INT DEFAULT NULL,
|
||||||
`Monthly salaries paid` decimal(19,6) DEFAULT NULL,
|
`Monthly salaries paid` decimal(19,6) DEFAULT NULL,
|
||||||
`Monthly net income of business activity` decimal(19,6) DEFAULT NULL,
|
`Monthly net income of business activity` decimal(19,6) DEFAULT NULL,
|
||||||
`Monthly rent` decimal(19,6) DEFAULT NULL,
|
`Monthly rent` decimal(19,6) DEFAULT NULL,
|
||||||
`Other income generating activities` varchar(100) DEFAULT NULL,
|
`Other income generating activities` varchar(100) DEFAULT NULL,
|
||||||
`YesNo_cd_Bookkeeping` int(11) DEFAULT NULL,
|
`YesNo_cd_Bookkeeping` INT DEFAULT NULL,
|
||||||
`YesNo_cd_Loans with other institutions` int(11) NOT NULL,
|
`YesNo_cd_Loans with other institutions` INT NOT NULL,
|
||||||
`From whom` varchar(100) DEFAULT NULL,
|
`From whom` varchar(100) DEFAULT NULL,
|
||||||
`Amount` decimal(19,6) DEFAULT NULL,
|
`Amount` decimal(19,6) DEFAULT NULL,
|
||||||
`Interest rate pa` decimal(19,6) DEFAULT NULL,
|
`Interest rate pa` decimal(19,6) DEFAULT NULL,
|
||||||
`Number of people depending on overal income` int(11) NOT NULL,
|
`Number of people depending on overal income` INT NOT NULL,
|
||||||
`YesNo_cd_Bank account` int(11) NOT NULL,
|
`YesNo_cd_Bank account` INT NOT NULL,
|
||||||
`YesNo_cd_Business plan provided` int(11) NOT NULL,
|
`YesNo_cd_Business plan provided` INT NOT NULL,
|
||||||
`YesNo_cd_Access to internet` int(11) DEFAULT NULL,
|
`YesNo_cd_Access to internet` INT DEFAULT NULL,
|
||||||
`Introduced by` varchar(100) DEFAULT NULL,
|
`Introduced by` varchar(100) DEFAULT NULL,
|
||||||
`Known to introducer since` varchar(100) NOT NULL,
|
`Known to introducer since` varchar(100) NOT NULL,
|
||||||
`Last visited by` varchar(100) DEFAULT NULL,
|
`Last visited by` varchar(100) DEFAULT NULL,
|
||||||
`Last visited on` date NOT NULL,
|
`Last visited on` date NOT NULL,
|
||||||
PRIMARY KEY (`client_id`),
|
PRIMARY KEY (`client_id`),
|
||||||
CONSTRAINT `FK_client_additional_data` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
|
CONSTRAINT `FK_client_additional_data` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `impact measurement`;
|
DROP TABLE IF EXISTS `impact measurement`;
|
||||||
CREATE TABLE `impact measurement` (
|
CREATE TABLE `impact measurement` (
|
||||||
`loan_id` bigint(20) NOT NULL,
|
`loan_id` BIGINT NOT NULL,
|
||||||
`YesNo_cd_RepaidOnSchedule` int(11) NOT NULL,
|
`YesNo_cd_RepaidOnSchedule` INT NOT NULL,
|
||||||
`ReasonNotRepaidOnSchedule` text DEFAULT NULL,
|
`ReasonNotRepaidOnSchedule` text DEFAULT NULL,
|
||||||
`How was Loan Amount Invested` text NOT NULL,
|
`How was Loan Amount Invested` text NOT NULL,
|
||||||
`Additional Income Generated` decimal(19,6) NOT NULL,
|
`Additional Income Generated` decimal(19,6) NOT NULL,
|
||||||
`Additional Income Used For` text NOT NULL,
|
`Additional Income Used For` text NOT NULL,
|
||||||
`YesNo_cd_NewJobsCreated` int(11) NOT NULL,
|
`YesNo_cd_NewJobsCreated` INT NOT NULL,
|
||||||
`Number of Jobs Created` bigint(20) DEFAULT NULL,
|
`Number of Jobs Created` BIGINT DEFAULT NULL,
|
||||||
PRIMARY KEY (`loan_id`),
|
PRIMARY KEY (`loan_id`),
|
||||||
CONSTRAINT `FK_impact measurement` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
|
CONSTRAINT `FK_impact measurement` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `loan additional data`;
|
DROP TABLE IF EXISTS `loan additional data`;
|
||||||
CREATE TABLE `loan additional data` (
|
CREATE TABLE `loan additional data` (
|
||||||
`loan_id` bigint(20) NOT NULL,
|
`loan_id` BIGINT NOT NULL,
|
||||||
`PurposeOfLoan_cd` int(11) NOT NULL,
|
`PurposeOfLoan_cd` INT NOT NULL,
|
||||||
`CollateralType_cd` int(11) NOT NULL,
|
`CollateralType_cd` INT NOT NULL,
|
||||||
`Collateral notes` text NOT NULL,
|
`Collateral notes` text NOT NULL,
|
||||||
`YesNo_cd_Guarantor` int(11) NOT NULL,
|
`YesNo_cd_Guarantor` INT NOT NULL,
|
||||||
`Guarantor name` varchar(100) DEFAULT NULL,
|
`Guarantor name` varchar(100) DEFAULT NULL,
|
||||||
`Guarantor relation` varchar(100) DEFAULT NULL,
|
`Guarantor relation` varchar(100) DEFAULT NULL,
|
||||||
`Guarantor address` varchar(100) DEFAULT NULL,
|
`Guarantor address` varchar(100) DEFAULT NULL,
|
||||||
`Guarantor telephone number` varchar(20) DEFAULT NULL,
|
`Guarantor telephone number` varchar(20) DEFAULT NULL,
|
||||||
PRIMARY KEY (`loan_id`),
|
PRIMARY KEY (`loan_id`),
|
||||||
CONSTRAINT `FK_loan_additional_data` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
|
CONSTRAINT `FK_loan_additional_data` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
-- datatables mapping
|
-- datatables mapping
|
||||||
INSERT INTO `x_registered_table`
|
INSERT INTO `x_registered_table`
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+13
-13
@@ -70,45 +70,45 @@ where mc.`code_name` = "Education";
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS `extra_client_details`;
|
DROP TABLE IF EXISTS `extra_client_details`;
|
||||||
CREATE TABLE `extra_client_details` (
|
CREATE TABLE `extra_client_details` (
|
||||||
`client_id` bigint(20) NOT NULL,
|
`client_id` BIGINT NOT NULL,
|
||||||
`Business Description` varchar(100) DEFAULT NULL,
|
`Business Description` varchar(100) DEFAULT NULL,
|
||||||
`Years in Business` int(11) DEFAULT NULL,
|
`Years in Business` INT DEFAULT NULL,
|
||||||
`Gender_cd` int(11) DEFAULT NULL,
|
`Gender_cd` INT DEFAULT NULL,
|
||||||
`Education_cv` varchar(60) DEFAULT NULL,
|
`Education_cv` varchar(60) DEFAULT NULL,
|
||||||
`Next Visit` date DEFAULT NULL,
|
`Next Visit` date DEFAULT NULL,
|
||||||
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
|
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
|
||||||
`Comment` text,
|
`Comment` text,
|
||||||
PRIMARY KEY (`client_id`),
|
PRIMARY KEY (`client_id`),
|
||||||
CONSTRAINT `FK_extra_client_details` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
|
CONSTRAINT `FK_extra_client_details` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `extra_family_details`;
|
DROP TABLE IF EXISTS `extra_family_details`;
|
||||||
CREATE TABLE `extra_family_details` (
|
CREATE TABLE `extra_family_details` (
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
`client_id` bigint(20) NOT NULL,
|
`client_id` BIGINT NOT NULL,
|
||||||
`Name` varchar(40) DEFAULT NULL,
|
`Name` varchar(40) DEFAULT NULL,
|
||||||
`Date of Birth` date DEFAULT NULL,
|
`Date of Birth` date DEFAULT NULL,
|
||||||
`Points Score` int(11) DEFAULT NULL,
|
`Points Score` INT DEFAULT NULL,
|
||||||
`Education_cd_Highest` int(11) DEFAULT NULL,
|
`Education_cd_Highest` INT DEFAULT NULL,
|
||||||
`Other Notes` text,
|
`Other Notes` text,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `FK_Extra Family Details Data_1` (`client_id`),
|
KEY `FK_Extra Family Details Data_1` (`client_id`),
|
||||||
CONSTRAINT `FK_family_details` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
|
CONSTRAINT `FK_family_details` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `extra_loan_details`;
|
DROP TABLE IF EXISTS `extra_loan_details`;
|
||||||
CREATE TABLE `extra_loan_details` (
|
CREATE TABLE `extra_loan_details` (
|
||||||
`loan_id` bigint(20) NOT NULL,
|
`loan_id` BIGINT NOT NULL,
|
||||||
`Business Description` varchar(100) DEFAULT NULL,
|
`Business Description` varchar(100) DEFAULT NULL,
|
||||||
`Years in Business` int(11) DEFAULT NULL,
|
`Years in Business` INT DEFAULT NULL,
|
||||||
`Gender_cd` int(11) DEFAULT NULL,
|
`Gender_cd` INT DEFAULT NULL,
|
||||||
`Education_cv` varchar(60) DEFAULT NULL,
|
`Education_cv` varchar(60) DEFAULT NULL,
|
||||||
`Next Visit` date DEFAULT NULL,
|
`Next Visit` date DEFAULT NULL,
|
||||||
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
|
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
|
||||||
`Comment` text,
|
`Comment` text,
|
||||||
PRIMARY KEY (`loan_id`),
|
PRIMARY KEY (`loan_id`),
|
||||||
CONSTRAINT `FK_extra_loan_details` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
|
CONSTRAINT `FK_extra_loan_details` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
-- datatables mapping
|
-- datatables mapping
|
||||||
INSERT INTO `x_registered_table`
|
INSERT INTO `x_registered_table`
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS `risk_analysis`;
|
DROP TABLE IF EXISTS `risk_analysis`;
|
||||||
CREATE TABLE `risk_analysis` (
|
CREATE TABLE `risk_analysis` (
|
||||||
`client_id` bigint(20) NOT NULL,
|
`client_id` BIGINT NOT NULL,
|
||||||
`proposed_loan_amount` decimal(19,6) DEFAULT NULL,
|
`proposed_loan_amount` decimal(19,6) DEFAULT NULL,
|
||||||
`assets_cash` decimal(19,6) DEFAULT NULL,
|
`assets_cash` decimal(19,6) DEFAULT NULL,
|
||||||
`assets_bank_accounts` decimal(19,6) DEFAULT NULL,
|
`assets_bank_accounts` decimal(19,6) DEFAULT NULL,
|
||||||
@@ -55,4 +55,4 @@ CREATE TABLE `risk_analysis` (
|
|||||||
`fi_repayment_capacity` decimal(19,6) DEFAULT NULL,
|
`fi_repayment_capacity` decimal(19,6) DEFAULT NULL,
|
||||||
PRIMARY KEY (`client_id`),
|
PRIMARY KEY (`client_id`),
|
||||||
CONSTRAINT `FK_risk_analysis_1` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
|
CONSTRAINT `FK_risk_analysis_1` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
File diff suppressed because one or more lines are too long
@@ -19,45 +19,45 @@
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS `latam_extra_client_details`;
|
DROP TABLE IF EXISTS `latam_extra_client_details`;
|
||||||
CREATE TABLE `latam_extra_client_details` (
|
CREATE TABLE `latam_extra_client_details` (
|
||||||
`client_id` bigint(20) NOT NULL,
|
`client_id` BIGINT NOT NULL,
|
||||||
`Business Description` varchar(100) DEFAULT NULL,
|
`Business Description` varchar(100) DEFAULT NULL,
|
||||||
`Years in Business` int(11) DEFAULT NULL,
|
`Years in Business` INT DEFAULT NULL,
|
||||||
`Gender_cd` int(11) DEFAULT NULL,
|
`Gender_cd` INT DEFAULT NULL,
|
||||||
`Education_cv` varchar(60) DEFAULT NULL,
|
`Education_cv` varchar(60) DEFAULT NULL,
|
||||||
`Next Visit` date DEFAULT NULL,
|
`Next Visit` date DEFAULT NULL,
|
||||||
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
|
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
|
||||||
`Comment` text,
|
`Comment` text,
|
||||||
PRIMARY KEY (`client_id`),
|
PRIMARY KEY (`client_id`),
|
||||||
CONSTRAINT `FK_latam_extra_client_details` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
|
CONSTRAINT `FK_latam_extra_client_details` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `latam_family_details`;
|
DROP TABLE IF EXISTS `latam_family_details`;
|
||||||
CREATE TABLE `latam_family_details` (
|
CREATE TABLE `latam_family_details` (
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
`client_id` bigint(20) NOT NULL,
|
`client_id` BIGINT NOT NULL,
|
||||||
`Name` varchar(40) DEFAULT NULL,
|
`Name` varchar(40) DEFAULT NULL,
|
||||||
`Date of Birth` date DEFAULT NULL,
|
`Date of Birth` date DEFAULT NULL,
|
||||||
`Points Score` int(11) DEFAULT NULL,
|
`Points Score` INT DEFAULT NULL,
|
||||||
`Education_cd_Highest` int(11) DEFAULT NULL,
|
`Education_cd_Highest` INT DEFAULT NULL,
|
||||||
`Other Notes` text,
|
`Other Notes` text,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `FK_Extra Family Details Data_1` (`client_id`),
|
KEY `FK_Extra Family Details Data_1` (`client_id`),
|
||||||
CONSTRAINT `FK_latam_family_details` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
|
CONSTRAINT `FK_latam_family_details` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `latam_extra_loan_details`;
|
DROP TABLE IF EXISTS `latam_extra_loan_details`;
|
||||||
CREATE TABLE `latam_extra_loan_details` (
|
CREATE TABLE `latam_extra_loan_details` (
|
||||||
`loan_id` bigint(20) NOT NULL,
|
`loan_id` BIGINT NOT NULL,
|
||||||
`Business Description` varchar(100) DEFAULT NULL,
|
`Business Description` varchar(100) DEFAULT NULL,
|
||||||
`Years in Business` int(11) DEFAULT NULL,
|
`Years in Business` INT DEFAULT NULL,
|
||||||
`Gender_cd` int(11) DEFAULT NULL,
|
`Gender_cd` INT DEFAULT NULL,
|
||||||
`Education_cv` varchar(60) DEFAULT NULL,
|
`Education_cv` varchar(60) DEFAULT NULL,
|
||||||
`Next Visit` date DEFAULT NULL,
|
`Next Visit` date DEFAULT NULL,
|
||||||
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
|
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
|
||||||
`Comment` text,
|
`Comment` text,
|
||||||
PRIMARY KEY (`loan_id`),
|
PRIMARY KEY (`loan_id`),
|
||||||
CONSTRAINT `FK_latam_extra_loan_details` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
|
CONSTRAINT `FK_latam_extra_loan_details` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `mifostenant-latam`.`m_code` (`code_name`, `is_system_defined`) VALUES ('Gender', 1);
|
INSERT INTO `mifostenant-latam`.`m_code` (`code_name`, `is_system_defined`) VALUES ('Gender', 1);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
|
||||||
|
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
|
||||||
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <resources> <item path="/fineract-provider/bin/main" type="2"/> </resources>}"/>
|
||||||
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/fineract-provider/gradlew}"/>
|
||||||
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,auto,"/>
|
||||||
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-x rat -x compileJava -x sql -x processResources -x generateGitProperties -Penv=eclipse enhance"/>
|
||||||
|
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
||||||
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/fineract-provider}"/>
|
||||||
|
</launchConfiguration>
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
bin
|
|
||||||
out/
|
|
||||||
build
|
|
||||||
repos
|
|
||||||
.classpath
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
.gradle
|
|
||||||
*.log
|
|
||||||
.idea
|
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
|
||||||
/gradle
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
Manifest-Version: 1.0
|
|
||||||
Class-Path:
|
|
||||||
|
|
||||||
+563
-382
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,271 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!--
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<!DOCTYPE module PUBLIC
|
||||||
|
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||||
|
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
||||||
|
<module name="Checker">
|
||||||
|
<property name="charset" value="UTF-8"/>
|
||||||
|
<property name="severity" value="error"/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
You can learn more about individual checkstyles at: https://checkstyle.sourceforge.io/
|
||||||
|
Checks related to LineLength and Indentation are only handled by Spotless
|
||||||
|
-->
|
||||||
|
|
||||||
|
<module name="FileTabCharacter">
|
||||||
|
<property name="eachLine" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpSingleline">
|
||||||
|
<property name="format" value="\s+$"/>
|
||||||
|
<property name="message" value="Line has trailing spaces."/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpMultiline">
|
||||||
|
<property name="format" value="(?s:\r\n.*)"/>
|
||||||
|
<property name="message" value="File has Windows (CR+LF) instead of UNIX (LF) end of line (EOL) delimiters."/>
|
||||||
|
</module>
|
||||||
|
<module name="SuppressWarningsFilter"/>
|
||||||
|
|
||||||
|
|
||||||
|
<module name="TreeWalker">
|
||||||
|
<module name="SeparatorWrap">
|
||||||
|
<property name="tokens" value="DOT"/>
|
||||||
|
<property name="option" value="nl"/>
|
||||||
|
</module>
|
||||||
|
<module name="SuppressWarningsHolder" />
|
||||||
|
<module name="RegexpSinglelineJava">
|
||||||
|
<property name="format" value="System\.(out)|(err)\.print(ln)?\("/>
|
||||||
|
<property name="message" value="Line contains console output."/>
|
||||||
|
<property name="ignoreComments" value="false" />
|
||||||
|
</module>
|
||||||
|
<module name="EqualsHashCode"/>
|
||||||
|
<module name="FinalClass"/>
|
||||||
|
<module name="SeparatorWrap">
|
||||||
|
<property name="tokens" value="COMMA"/>
|
||||||
|
<property name="option" value="EOL"/>
|
||||||
|
</module>
|
||||||
|
<module name="NoFinalizer"/>
|
||||||
|
<module name="FallThrough"/>
|
||||||
|
<module name="IllegalThrows" />
|
||||||
|
<module name="RedundantImport"/>
|
||||||
|
<module name="UnusedImports"/>
|
||||||
|
<module name="AvoidStarImport"/>
|
||||||
|
<module name="LeftCurly" />
|
||||||
|
<module name="AnnotationLocation">
|
||||||
|
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
|
||||||
|
</module>
|
||||||
|
<module name="CustomImportOrder">
|
||||||
|
<property name="thirdPartyPackageRegExp" value=".*"/>
|
||||||
|
<property name="sortImportsInGroupAlphabetically" value="true"/>
|
||||||
|
<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
|
||||||
|
</module>
|
||||||
|
<module name="OperatorWrap">
|
||||||
|
<property name="option" value="NL"/>
|
||||||
|
<property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/>
|
||||||
|
</module>
|
||||||
|
<module name="RightCurly">
|
||||||
|
<property name="option" value="ALONE_OR_SINGLELINE"/>
|
||||||
|
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, STATIC_INIT, INSTANCE_INIT"/>
|
||||||
|
</module>
|
||||||
|
<module name="com.github.sevntu.checkstyle.checks.coding.ForbidCertainImportsCheck">
|
||||||
|
<property name="packageNameRegexp" value=".*" />
|
||||||
|
<property name="forbiddenImportsRegexp" value="com.google.common.base.Charsets" />
|
||||||
|
<property name="forbiddenImportsExcludesRegexp" value="" />
|
||||||
|
<message key="forbid.certain.imports" value="Use ''java.nio.charset.StandardCharsets'' instead of ''{0}''" />
|
||||||
|
</module>
|
||||||
|
<module name="OneStatementPerLine"/>
|
||||||
|
<module name="EmptyStatement"/>
|
||||||
|
<module name="EmptyCatchBlock">
|
||||||
|
<property name="exceptionVariableName" value="expected|ignore"/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpSinglelineJava">
|
||||||
|
<property name="format" value="\.printStackTrace?\("/>
|
||||||
|
<property name="message" value="Line contains printStacktrace()."/>
|
||||||
|
<property name="ignoreComments" value="false" />
|
||||||
|
</module>
|
||||||
|
<module name="TypeName">
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Type name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="MethodTypeParameterName">
|
||||||
|
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Method type name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="EmptyLineSeparator">
|
||||||
|
<property name="allowNoEmptyLineBetweenFields" value="true"/>
|
||||||
|
<!-- No PACKAGE_DEF token, as we like our license header to be glue to "package" statement, to save 1 line screen space -->
|
||||||
|
<property name="tokens" value="IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF, STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
|
||||||
|
</module>
|
||||||
|
<module name="PackageName">
|
||||||
|
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9_]*)*$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Package name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="OuterTypeFilename"/>
|
||||||
|
<module name="AnnotationLocation">
|
||||||
|
<property name="tokens" value="VARIABLE_DEF"/>
|
||||||
|
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="AvoidEscapedUnicodeCharacters">
|
||||||
|
<property name="allowEscapesForControlCharacters" value="true"/>
|
||||||
|
<property name="allowByTailComment" value="true"/>
|
||||||
|
<property name="allowNonPrintableEscapes" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="EmptyBlock">
|
||||||
|
<property name="option" value="TEXT"/>
|
||||||
|
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
|
||||||
|
</module>
|
||||||
|
<module name="UpperEll"/>
|
||||||
|
<module name="NeedBraces"/>
|
||||||
|
<module name="MethodParamPad"/>
|
||||||
|
<module name="ArrayTypeStyle"/>
|
||||||
|
<module name="NoLineWrap"/>
|
||||||
|
<module name="IllegalTokenText">
|
||||||
|
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
|
||||||
|
<property name="format" value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
|
||||||
|
<property name="message" value="Avoid using corresponding octal or Unicode escape."/>
|
||||||
|
</module>
|
||||||
|
<module name="GenericWhitespace">
|
||||||
|
<message key="ws.followed"
|
||||||
|
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
|
||||||
|
<message key="ws.preceded"
|
||||||
|
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
|
||||||
|
<message key="ws.illegalFollow"
|
||||||
|
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
|
||||||
|
<message key="ws.notPreceded"
|
||||||
|
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
|
||||||
|
</module>
|
||||||
|
<module name="OneTopLevelClass"/>
|
||||||
|
<module name="MethodName">
|
||||||
|
<property name="format" value="^[a-z][a-zA-Z0-9_]*$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Method name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="WhitespaceAround">
|
||||||
|
<property name="allowEmptyConstructors" value="true"/>
|
||||||
|
<property name="allowEmptyMethods" value="true"/>
|
||||||
|
<property name="allowEmptyTypes" value="true"/>
|
||||||
|
<property name="allowEmptyLoops" value="true"/>
|
||||||
|
<message key="ws.notFollowed"
|
||||||
|
value="WhitespaceAround: ''{0}'' is not followed by whitespace."/>
|
||||||
|
<message key="ws.notPreceded"
|
||||||
|
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
|
||||||
|
</module>
|
||||||
|
<module name="ParenPad" />
|
||||||
|
<!-- TODO Enable many more checks (go about this one by one, step by step, raise separate PRs fixing and then enforcing):
|
||||||
|
|
||||||
|
<module name="HiddenField">
|
||||||
|
<property name="ignoreAbstractMethods" value="true" />
|
||||||
|
<property name="ignoreConstructorParameter" value="true" />
|
||||||
|
<property name="ignoreSetter" value="true" />
|
||||||
|
<property name="setterCanReturnItsClass" value="true" />
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<module name="HideUtilityClassConstructor"/>
|
||||||
|
|
||||||
|
< ! - - TODO Checks for Exception Handling Anti-Patterns - - >
|
||||||
|
<module name="IllegalCatch"/>
|
||||||
|
|
||||||
|
<module name="MutableException"/>
|
||||||
|
<module name="com.github.sevntu.checkstyle.checks.coding.AvoidHidingCauseExceptionCheck" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<module name="MultipleVariableDeclarations"/>
|
||||||
|
|
||||||
|
<module name="MissingSwitchDefault"/>
|
||||||
|
|
||||||
|
|
||||||
|
<module name="ModifierOrder"/>
|
||||||
|
<module name="RedundantModifier"/>
|
||||||
|
|
||||||
|
<module name="MemberName">
|
||||||
|
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Member name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="ParameterName">
|
||||||
|
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="LocalVariableName">
|
||||||
|
<property name="tokens" value="VARIABLE_DEF"/>
|
||||||
|
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
|
||||||
|
<property name="allowOneCharVarInForLoop" value="true"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="ClassTypeParameterName">
|
||||||
|
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Class type name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<module name="ConstantName" />
|
||||||
|
|
||||||
|
|
||||||
|
<module name="AbbreviationAsWordInName">
|
||||||
|
<property name="ignoreFinal" value="false"/>
|
||||||
|
<property name="allowedAbbreviationLength" value="4"/>
|
||||||
|
</module>
|
||||||
|
<module name="OverloadMethodsDeclarationOrder"/>
|
||||||
|
<module name="VariableDeclarationUsageDistance"/>
|
||||||
|
|
||||||
|
|
||||||
|
<! - - Enable some JavaDoc validation (requires quite a lot of manual clean up work; not a top priority for initial Checkstyle adoption - ->
|
||||||
|
<module name="JavadocTagContinuationIndentation"/>
|
||||||
|
<module name="SummaryJavadocCheck">
|
||||||
|
<property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
|
||||||
|
</module>
|
||||||
|
<module name="JavadocStyle">
|
||||||
|
< ! - - Do NOT 'scope' this one; any JavaDoc (public/protected/private) IFF present, should be style checked. - - >
|
||||||
|
<property name="checkEmptyJavadoc" value="true" />
|
||||||
|
<property name="tokens" value="ANNOTATION_DEF, ANNOTATION_FIELD_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF, INTERFACE_DEF, METHOD_DEF, VARIABLE_DEF"/>
|
||||||
|
</module>
|
||||||
|
<module name="SingleLineJavadoc"/>
|
||||||
|
<module name="NonEmptyAtclauseDescription"/>
|
||||||
|
<module name="AtclauseOrder">
|
||||||
|
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
|
||||||
|
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
|
||||||
|
</module>
|
||||||
|
< ! - - TODO Enable proper JavaDoc paragraphs (requires removing /** from all license headers) - - >
|
||||||
|
<module name="JavadocParagraph">
|
||||||
|
<property name="allowNewlineParagraph" value="false"/>
|
||||||
|
</module>
|
||||||
|
-->
|
||||||
|
</module>
|
||||||
|
<!-- NB, PS: This entire custom Checkstyle configuration originally came from (EPL'd)
|
||||||
|
https://github.com/opendaylight/odlparent/blob/master/checkstyle/src/main/resources/odl_checks.xml
|
||||||
|
(for which it was first created by Michael Vorburger.ch while he worked on that community in 2016-2018).
|
||||||
|
Michael in Jan 2020 copy/pasted this into Apache Fineract (where he has been actively contributing since
|
||||||
|
ca. 2010 when it was still Mifos), where it was then independantly maintained by Apache contributors. -->
|
||||||
|
</module>
|
||||||
@@ -17,92 +17,118 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
dependencies {
|
dependencies {
|
||||||
def tomcatVersion = '7.0.54'
|
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
|
||||||
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
|
|
||||||
"org.apache.tomcat.embed:tomcat-embed-logging-log4j:${tomcatVersion}" // NOT tomcat-embed-logging-juli (http://stackoverflow.com/questions/23963049/classcircularityerror-java-util-logging-logrecord-running-gradle-webapp-with-ja)
|
|
||||||
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
|
|
||||||
exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
|
|
||||||
}
|
|
||||||
tomcat "org.apache.tomcat:tomcat-dbcp:${tomcatVersion}"
|
|
||||||
|
|
||||||
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat:${springBootVersion}")
|
spotbugsPlugins "jp.skypencil.findbugs.slf4j:bug-pattern:1.5.0@jar"
|
||||||
|
spotbugs 'com.github.spotbugs:spotbugs:4.0.4'
|
||||||
|
|
||||||
providedCompile(
|
// Never use "compile" scope, but make all dependencies either 'implementation', 'runtimeOnly' or 'testCompile'.
|
||||||
// [group: 'javax.servlet', name: 'servlet-api', version: '2.5'],
|
// Note that we never use 'api', because Fineract at least currently is a simple monolithic application ("WAR"), not a library.
|
||||||
)
|
// We also (normally should have) no need to ever use 'compileOnly'.
|
||||||
|
|
||||||
compile(
|
// implementation dependencies are directly used (compiled against) in src/main (and src/test)
|
||||||
// [group: 'ch.vorburger.mariaDB4j', name: 'mariaDB4j', version: '2.1.3'],
|
//
|
||||||
|
implementation(
|
||||||
|
//'ch.vorburger.mariaDB4j:mariaDB4j:2.4.0',
|
||||||
|
|
||||||
[group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBootVersion],
|
'org.springframework.boot:spring-boot-starter-web',
|
||||||
[group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: springBootVersion],
|
'org.springframework.boot:spring-boot-starter-security',
|
||||||
[group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: springBootVersion],
|
'org.springframework.boot:spring-boot-starter-cache',
|
||||||
//[group: 'org.eclipse.persistence', name: 'javax.persistence', version: '2.0.0'],
|
|
||||||
[group: 'org.springframework', name: 'spring-context-support', version: springVersion],
|
|
||||||
|
|
||||||
[group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: springOauthVersion],
|
'org.springframework:spring-jms',
|
||||||
|
'org.springframework:spring-context-support',
|
||||||
|
'org.springframework.security.oauth:spring-security-oauth2',
|
||||||
|
|
||||||
[group: 'org.apache.openjpa', name:'openjpa-all', version: openJPAVersion],
|
'com.sun.jersey:jersey-servlet',
|
||||||
//[group: 'javax.ws.rs', name: 'jsr311-api', version: '1.1.1'],
|
'com.sun.jersey:jersey-server',
|
||||||
[group: 'com.sun.jersey', name: 'jersey-core', version: jerseyVersion],
|
'com.sun.jersey:jersey-json',
|
||||||
[group: 'com.sun.jersey', name: 'jersey-servlet', version: jerseyVersion],
|
'com.sun.jersey.contribs:jersey-spring',
|
||||||
[group: 'com.sun.jersey', name: 'jersey-server', version: jerseyVersion],
|
'com.sun.jersey.contribs:jersey-multipart',
|
||||||
[group: 'com.sun.jersey', name: 'jersey-json', version: jerseyVersion],
|
|
||||||
[group: 'com.sun.jersey.contribs', name: 'jersey-spring', version: jerseyVersion],
|
|
||||||
[group: 'com.sun.jersey.contribs', name: 'jersey-multipart', version: jerseyVersion],
|
|
||||||
|
|
||||||
[group: 'com.squareup.retrofit', name: 'retrofit', version: '1.6.1'],
|
'joda-time:joda-time',
|
||||||
[group: 'com.squareup.okhttp', name: 'okhttp', version: '2.0.0'],
|
'com.google.code.gson:gson',
|
||||||
[group: 'com.squareup.okhttp', name: 'okhttp-urlconnection', version: '2.0.0'],
|
'com.sun.jersey:jersey-core',
|
||||||
|
'com.squareup.retrofit:retrofit',
|
||||||
|
'jakarta.jms:jakarta.jms-api',
|
||||||
|
'jakarta.management.j2ee:jakarta.management.j2ee-api',
|
||||||
|
|
||||||
|
'com.squareup.okhttp:okhttp',
|
||||||
|
'com.squareup.okhttp:okhttp-urlconnection',
|
||||||
|
|
||||||
[group: 'com.google.code.gson', name: 'gson', version: '2.2.4'],
|
'org.apache.commons:commons-email',
|
||||||
[group: 'com.google.guava', name: 'guava', version: '15.0'],
|
'org.apache.commons:commons-lang3',
|
||||||
|
'commons-io:commons-io',
|
||||||
|
'org.apache.poi:poi',
|
||||||
|
'org.apache.poi:poi-ooxml',
|
||||||
|
'org.apache.poi:poi-ooxml-schemas',
|
||||||
|
'org.apache.tika:tika-core',
|
||||||
|
|
||||||
[group: 'joda-time', name: 'joda-time', version: '2.4'],
|
'org.drizzle.jdbc:drizzle-jdbc',
|
||||||
//[group: 'net.sourceforge.javacsv', name: 'javacsv', version: '2.0'],
|
'org.flywaydb:flyway-core',
|
||||||
[group: 'org.apache.commons', name: 'commons-email', version: '1.3.3'],
|
|
||||||
[group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'],
|
|
||||||
|
|
||||||
// no slf4j & logback here (anymore), as spring-boot-starter-logging already brings this now, better assembled (log4j-over-slf4j was originally forgotten here)
|
'com.github.librepdf:openpdf',
|
||||||
|
'com.github.spullara.mustache.java:compiler',
|
||||||
|
'com.jayway.jsonpath:json-path',
|
||||||
|
|
||||||
//[group: 'mysql', name: 'mysql-connector-java', version: '5.1.27'],
|
// JAX-B dependencies for JDK 9+
|
||||||
[group: 'org.drizzle.jdbc', name: 'drizzle-jdbc', version: '1.4'],
|
'jakarta.xml.bind:jakarta.xml.bind-api',
|
||||||
// [group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: tomcatVersion],
|
'org.dom4j:dom4j',
|
||||||
|
|
||||||
|
'javax.cache:cache-api',
|
||||||
|
|
||||||
[group: 'org.apache.poi',name: 'poi', version: '3.9'],
|
'com.github.spotbugs:spotbugs-annotations',
|
||||||
[group: 'org.apache.poi',name: 'poi-ooxml', version: '3.9'],
|
)
|
||||||
[group: 'org.apache.poi',name: 'poi-ooxml-schemas', version: '3.9'],
|
implementation ('io.swagger:swagger-jersey-jaxrs') {
|
||||||
|
exclude group: 'javax.validation'
|
||||||
|
}
|
||||||
|
implementation ('org.apache.activemq:activemq-broker') {
|
||||||
|
exclude group: 'org.apache.geronimo.specs'
|
||||||
|
}
|
||||||
|
implementation ('org.springframework.boot:spring-boot-starter-data-jpa') {
|
||||||
|
exclude group: 'org.hibernate'
|
||||||
|
}
|
||||||
|
implementation ('org.apache.openjpa:openjpa') {
|
||||||
|
exclude group: 'org.eclipse.persistence'
|
||||||
|
exclude group: 'org.apache.geronimo.specs'
|
||||||
|
}
|
||||||
|
implementation ('org.quartz-scheduler:quartz') {
|
||||||
|
exclude group: 'com.zaxxer', module: 'HikariCP-java7'
|
||||||
|
}
|
||||||
|
implementation ('com.amazonaws:aws-java-sdk-s3') {
|
||||||
|
exclude group: 'commons-logging'
|
||||||
|
}
|
||||||
|
implementation ('org.mnode.ical4j:ical4j') {
|
||||||
|
exclude group: 'commons-logging'
|
||||||
|
}
|
||||||
|
implementation ('org.ehcache:ehcache') {
|
||||||
|
exclude group: 'org.glassfish.jaxb', module: 'jaxb-runtime'
|
||||||
|
}
|
||||||
|
|
||||||
[group: 'com.lowagie', name: 'itext', version: '2.1.7'],
|
// runtimeOnly dependencies are things that Fineract code has no direct compile time dependency on, but which must be present at run-time
|
||||||
//[group: 'com.lowagie', name: 'itext-rtf', version: '2.1.7'],
|
runtimeOnly(
|
||||||
[group: 'org.mnode.ical4j', name: 'ical4j', version: '1.0.4'],
|
'org.apache.bval:org.apache.bval.bundle',
|
||||||
[group: 'com.googlecode.flyway', name: 'flyway-core', version: '2.1.1'],
|
'org.springframework.boot:spring-boot-starter-actuator',
|
||||||
[group: 'org.quartz-scheduler', name: 'quartz', version: '2.1.7'],
|
|
||||||
[group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.80'],
|
|
||||||
[group: 'net.sf.ehcache', name: 'ehcache', version: '2.7.2'],
|
|
||||||
[group: 'com.github.spullara.mustache.java', name: 'compiler', version: '0.8.12'],
|
|
||||||
[group: 'com.jayway.jsonpath', name: 'json-path', version: '0.9.1'],
|
|
||||||
[group: 'org.apache.tika', name: 'tika-core', version :'1.9'],
|
|
||||||
// Although fineract (at the time of writing) doesn't have any compile time dep. on this,
|
|
||||||
// it's useful to have this for the Spring Boot TestRestTemplate http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-rest-templates-test-utility
|
|
||||||
[group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.5'],
|
|
||||||
// Once we've switched to Java 8 this dep can be removed.
|
|
||||||
//[group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0']
|
|
||||||
|
|
||||||
[group: 'io.swagger', name: 'swagger-jersey-jaxrs', version: '1.5.15'],
|
// Although fineract (at the time of writing) doesn't have any compile time dep. on httpclient,
|
||||||
[group: 'org.springframework', name:'spring-jms'],
|
// it's useful to have this for the Spring Boot TestRestTemplate http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-rest-templates-test-utility
|
||||||
[group: 'org.apache.activemq', name: 'activemq-broker'],
|
'org.apache.httpcomponents:httpclient',
|
||||||
[group: 'javax.validation', name: 'validation-api', version: '2.0.0.Final']
|
|
||||||
)
|
)
|
||||||
|
|
||||||
testCompile 'junit:junit:4.11',
|
// testCompile dependencies are ONLY used in src/test and/or src/integrationTest, not src/main.
|
||||||
'junit:junit-dep:4.11',
|
// Do NOT repeat dependencies which are ALREADY in implementation or runtimeOnly!
|
||||||
'org.mockito:mockito-core:1.9.5',
|
//
|
||||||
'com.jayway.restassured:rest-assured:2.3.3',
|
testImplementation( 'org.mockito:mockito-core',
|
||||||
[group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: springBootVersion],
|
'org.mockito:mockito-junit-jupiter',
|
||||||
[group: 'com.mockrunner', name: 'mockrunner-jms', version: '1.0.6'],
|
'org.junit.platform:junit-platform-runner', // required to be able to run tests directly under Eclipse, see FINERACT-943 & FINERACT-1021
|
||||||
[group: 'com.mockrunner', name: 'mockrunner-jdbc', version: '1.0.6']
|
'io.github.classgraph:classgraph',
|
||||||
|
'org.awaitility:awaitility'
|
||||||
|
)
|
||||||
|
testImplementation ('io.rest-assured:rest-assured') {
|
||||||
|
exclude group: 'commons-logging'
|
||||||
|
exclude group: 'org.apache.sling'
|
||||||
|
}
|
||||||
|
testImplementation ('org.springframework.boot:spring-boot-starter-test') {
|
||||||
|
exclude group: 'com.jayway.jsonpath', module: 'json-path'
|
||||||
|
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,108 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
dependencies {
|
|
||||||
def tomcatVersion = '7.0.54'
|
|
||||||
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
|
|
||||||
"org.apache.tomcat.embed:tomcat-embed-logging-log4j:${tomcatVersion}" // NOT tomcat-embed-logging-juli (http://stackoverflow.com/questions/23963049/classcircularityerror-java-util-logging-logrecord-running-gradle-webapp-with-ja)
|
|
||||||
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
|
|
||||||
exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
|
|
||||||
}
|
|
||||||
tomcat "org.apache.tomcat:tomcat-dbcp:${tomcatVersion}"
|
|
||||||
|
|
||||||
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat:${springBootVersion}")
|
|
||||||
|
|
||||||
providedCompile(
|
|
||||||
// [group: 'javax.servlet', name: 'servlet-api', version: '2.5'],
|
|
||||||
)
|
|
||||||
|
|
||||||
compile(
|
|
||||||
[group: 'ch.vorburger.mariaDB4j', name: 'mariaDB4j', version: '2.1.3'],
|
|
||||||
|
|
||||||
[group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBootVersion],
|
|
||||||
[group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: springBootVersion],
|
|
||||||
[group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: springBootVersion],
|
|
||||||
//[group: 'org.eclipse.persistence', name: 'javax.persistence', version: '2.0.0'],
|
|
||||||
[group: 'org.springframework', name: 'spring-context-support', version: springVersion],
|
|
||||||
[group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: springOauthVersion],
|
|
||||||
|
|
||||||
[group: 'org.apache.openjpa', name:'openjpa-all', version:'2.4.1'],
|
|
||||||
[group: 'org.apache.openjpa', name:'openjpa-maven-plugin', version:'2.4.1'],
|
|
||||||
[group: 'javax.ws.rs', name: 'jsr311-api', version: '1.1.1'],
|
|
||||||
[group: 'com.sun.jersey', name: 'jersey-core', version: jerseyVersion],
|
|
||||||
[group: 'com.sun.jersey', name: 'jersey-servlet', version: jerseyVersion],
|
|
||||||
[group: 'com.sun.jersey', name: 'jersey-server', version: jerseyVersion],
|
|
||||||
[group: 'com.sun.jersey', name: 'jersey-json', version: jerseyVersion],
|
|
||||||
[group: 'com.sun.jersey.contribs', name: 'jersey-spring', version: jerseyVersion],
|
|
||||||
[group: 'com.sun.jersey.contribs', name: 'jersey-multipart', version: jerseyVersion],
|
|
||||||
|
|
||||||
[group: 'com.squareup.retrofit', name: 'retrofit', version: '1.6.1'],
|
|
||||||
[group: 'com.squareup.okhttp', name: 'okhttp', version: '2.0.0'],
|
|
||||||
[group: 'com.squareup.okhttp', name: 'okhttp-urlconnection', version: '2.0.0'],
|
|
||||||
|
|
||||||
|
|
||||||
[group: 'com.google.code.gson', name: 'gson', version: '2.2.4'],
|
|
||||||
[group: 'com.google.guava', name: 'guava', version: '15.0'],
|
|
||||||
|
|
||||||
[group: 'joda-time', name: 'joda-time', version: '2.4'],
|
|
||||||
//[group: 'net.sourceforge.javacsv', name: 'javacsv', version: '2.0'],
|
|
||||||
[group: 'org.apache.commons', name: 'commons-email', version: '1.3.3'],
|
|
||||||
[group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'],
|
|
||||||
|
|
||||||
// no slf4j & logback here (anymore), as spring-boot-starter-logging already brings this now, better assembled (log4j-over-slf4j was originally forgotten here)
|
|
||||||
|
|
||||||
//[group: 'mysql', name: 'mysql-connector-java', version: '5.1.27'],
|
|
||||||
[group: 'org.drizzle.jdbc', name: 'drizzle-jdbc', version: '1.3'],
|
|
||||||
[group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: tomcatVersion],
|
|
||||||
|
|
||||||
|
|
||||||
[group: 'org.apache.poi',name: 'poi', version: '3.9'],
|
|
||||||
[group: 'org.apache.poi',name: 'poi-ooxml', version: '3.9'],
|
|
||||||
[group: 'org.apache.poi',name: 'poi-ooxml-schemas', version: '3.9'],
|
|
||||||
|
|
||||||
[group: 'com.lowagie', name: 'itext', version: '2.1.7'],
|
|
||||||
[group: 'com.lowagie', name: 'itext-rtf', version: '2.1.7'],
|
|
||||||
[group: 'org.mnode.ical4j', name: 'ical4j', version: '1.0.4'],
|
|
||||||
[group: 'com.googlecode.flyway', name: 'flyway-core', version: '2.1.1'],
|
|
||||||
[group: 'org.quartz-scheduler', name: 'quartz', version: '2.1.7'],
|
|
||||||
[group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.80'],
|
|
||||||
[group: 'net.sf.ehcache', name: 'ehcache', version: '2.7.2'],
|
|
||||||
[group: 'com.github.spullara.mustache.java', name: 'compiler', version: '0.8.12'],
|
|
||||||
[group: 'com.jayway.jsonpath', name: 'json-path', version: '0.9.1'],
|
|
||||||
[group: 'org.apache.tika', name: 'tika-core', version :'1.9'],
|
|
||||||
// Although fineract (at the time of writing) doesn't have any compile time dep. on this,
|
|
||||||
// it's useful to have this for the Spring Boot TestRestTemplate http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-rest-templates-test-utility
|
|
||||||
[group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.5'],
|
|
||||||
// Once we've switched to Java 8 this dep can be removed.
|
|
||||||
//[group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0']
|
|
||||||
|
|
||||||
[group: 'io.swagger', name: 'swagger-jersey-jaxrs', version: '1.5.15'],
|
|
||||||
[group: 'org.springframework', name:'spring-jms'],
|
|
||||||
[group: 'org.apache.activemq', name: 'activemq-broker'],
|
|
||||||
[group: 'javax.validation', name: 'validation-api', version: '2.0.0.Final']
|
|
||||||
)
|
|
||||||
|
|
||||||
testCompile 'junit:junit:4.11',
|
|
||||||
'junit:junit-dep:4.11',
|
|
||||||
'org.mockito:mockito-core:1.9.5',
|
|
||||||
'com.jayway.restassured:rest-assured:2.3.3',
|
|
||||||
[group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: springBootVersion],
|
|
||||||
[group: 'com.mockrunner', name: 'mockrunner-jms', version: '1.0.6'],
|
|
||||||
[group: 'com.mockrunner', name: 'mockrunner-jdbc', version: '1.0.6']
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -18,5 +18,3 @@
|
|||||||
#
|
#
|
||||||
releaseVersion=1.0.0
|
releaseVersion=1.0.0
|
||||||
buildType=BUILD
|
buildType=BUILD
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -1,6 +1,5 @@
|
|||||||
#Fri Jan 29 13:04:36 IST 2016
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-bin.zip
|
|
||||||
|
|||||||
+185
@@ -0,0 +1,185 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed 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
|
||||||
|
#
|
||||||
|
# https://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.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=`expr $i + 1`
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
0) set -- ;;
|
||||||
|
1) set -- "$args0" ;;
|
||||||
|
2) set -- "$args0" "$args1" ;;
|
||||||
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+104
@@ -0,0 +1,104 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
@@ -18,3 +18,11 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
spring.profiles.default=basicauth
|
spring.profiles.default=basicauth
|
||||||
|
management.health.jms.enabled=false
|
||||||
|
|
||||||
|
# FINERACT-883
|
||||||
|
management.info.git.mode=FULL
|
||||||
|
|
||||||
|
# FINERACT-914
|
||||||
|
server.forward-headers-strategy=framework
|
||||||
|
spring.cache.jcache.config=classpath:/META-INF/spring/ehcache.xml
|
||||||
|
|||||||
@@ -19,3 +19,11 @@
|
|||||||
|
|
||||||
spring.profiles.default=basicauth
|
spring.profiles.default=basicauth
|
||||||
spring.profiles.active=basicauth,twofactor
|
spring.profiles.active=basicauth,twofactor
|
||||||
|
management.health.jms.enabled=false
|
||||||
|
|
||||||
|
# FINERACT-883
|
||||||
|
management.info.git.mode=FULL
|
||||||
|
|
||||||
|
# FINERACT-914
|
||||||
|
server.forward-headers-strategy=framework
|
||||||
|
spring.cache.jcache.config=classpath:/META-INF/spring/ehcache.xml
|
||||||
|
|||||||
@@ -19,3 +19,11 @@
|
|||||||
|
|
||||||
spring.profiles.default=basicauth
|
spring.profiles.default=basicauth
|
||||||
spring.profiles.active=oauth
|
spring.profiles.active=oauth
|
||||||
|
management.health.jms.enabled=false
|
||||||
|
|
||||||
|
# FINERACT-883
|
||||||
|
management.info.git.mode=FULL
|
||||||
|
|
||||||
|
# FINERACT-914
|
||||||
|
server.forward-headers-strategy=framework
|
||||||
|
spring.cache.jcache.config=classpath:/META-INF/spring/ehcache.xml
|
||||||
|
|||||||
@@ -19,3 +19,11 @@
|
|||||||
|
|
||||||
spring.profiles.default=basicauth
|
spring.profiles.default=basicauth
|
||||||
spring.profiles.active=oauth,twofactor
|
spring.profiles.active=oauth,twofactor
|
||||||
|
management.health.jms.enabled=false
|
||||||
|
|
||||||
|
# FINERACT-883
|
||||||
|
management.info.git.mode=FULL
|
||||||
|
|
||||||
|
# FINERACT-914
|
||||||
|
server.forward-headers-strategy=framework
|
||||||
|
spring.cache.jcache.config=classpath:/META-INF/spring/ehcache.xml
|
||||||
|
|||||||
+87
-87
@@ -18,10 +18,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.CenterDomain;
|
import org.apache.fineract.integrationtests.common.CenterDomain;
|
||||||
import org.apache.fineract.integrationtests.common.CenterHelper;
|
import org.apache.fineract.integrationtests.common.CenterHelper;
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
@@ -36,18 +40,15 @@ import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
|||||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||||
import org.apache.fineract.integrationtests.common.system.AccountNumberPreferencesHelper;
|
import org.apache.fineract.integrationtests.common.system.AccountNumberPreferencesHelper;
|
||||||
import org.apache.fineract.integrationtests.common.system.CodeHelper;
|
import org.apache.fineract.integrationtests.common.system.CodeHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
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 AccountNumberPreferencesTest {
|
public class AccountNumberPreferencesTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(AccountNumberPreferencesTest.class);
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private ResponseSpecification responseValidationError;
|
private ResponseSpecification responseValidationError;
|
||||||
@@ -87,7 +88,7 @@ public class AccountNumberPreferencesTest {
|
|||||||
private Integer centerId;
|
private Integer centerId;
|
||||||
private String groupAccountNo;
|
private String groupAccountNo;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -151,15 +152,15 @@ public class AccountNumberPreferencesTest {
|
|||||||
Integer id = (Integer) preferenceId.get("id");
|
Integer id = (Integer) preferenceId.get("id");
|
||||||
HashMap<String, Object> delResponse = this.accountNumberPreferencesHelper.deleteAccountNumberPreference(id, this.responseSpec,
|
HashMap<String, Object> delResponse = this.accountNumberPreferencesHelper.deleteAccountNumberPreference(id, this.responseSpec,
|
||||||
"");
|
"");
|
||||||
System.out.println("Successfully deleted account number preference (ID: " + delResponse.get("resourceId") + ")");
|
LOG.info("Successfully deleted account number preference (ID: {} )", delResponse.get("resourceId"));
|
||||||
}
|
}
|
||||||
/* Deletion of invalid account preference ID should fail */
|
/* Deletion of invalid account preference ID should fail */
|
||||||
System.out
|
LOG.info(
|
||||||
.println("---------------------------------DELETING ACCOUNT NUMBER PREFERENCE WITH INVALID ID------------------------------------------");
|
"---------------------------------DELETING ACCOUNT NUMBER PREFERENCE WITH INVALID ID------------------------------------------");
|
||||||
|
|
||||||
HashMap<String, Object> deletionError = this.accountNumberPreferencesHelper.deleteAccountNumberPreference(10,
|
HashMap<String, Object> deletionError = this.accountNumberPreferencesHelper.deleteAccountNumberPreference(10,
|
||||||
this.responseNotFoundError, "");
|
this.responseNotFoundError, "");
|
||||||
Assert.assertEquals("error.msg.resource.not.found", deletionError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
Assertions.assertEquals("error.msg.resource.not.found", deletionError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateDefaultAccountNumberGeneration() {
|
private void validateDefaultAccountNumberGeneration() {
|
||||||
@@ -180,25 +181,25 @@ public class AccountNumberPreferencesTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createAccountNumberPreference() {
|
private void createAccountNumberPreference() {
|
||||||
this.clientAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createClientAccountNumberPreference(
|
this.clientAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
|
||||||
this.responseSpec, "resourceId");
|
.createClientAccountNumberPreference(this.responseSpec, "resourceId");
|
||||||
System.out.println("Successfully created account number preferences for Client (ID: " + this.clientAccountNumberPreferenceId);
|
LOG.info("Successfully created account number preferences for Client (ID: {})", this.clientAccountNumberPreferenceId);
|
||||||
|
|
||||||
this.loanAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createLoanAccountNumberPreference(
|
this.loanAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
|
||||||
this.responseSpec, "resourceId");
|
.createLoanAccountNumberPreference(this.responseSpec, "resourceId");
|
||||||
System.out.println("Successfully created account number preferences for Loan (ID: " + this.loanAccountNumberPreferenceId);
|
LOG.info("Successfully created account number preferences for Loan (ID: {} )", this.loanAccountNumberPreferenceId);
|
||||||
|
|
||||||
this.savingsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createSavingsAccountNumberPreference(
|
this.savingsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
|
||||||
this.responseSpec, "resourceId");
|
.createSavingsAccountNumberPreference(this.responseSpec, "resourceId");
|
||||||
System.out.println("Successfully created account number preferences for Savings (ID: " + this.savingsAccountNumberPreferenceId);
|
LOG.info("Successfully created account number preferences for Savings (ID: {})", this.savingsAccountNumberPreferenceId);
|
||||||
|
|
||||||
this.groupsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createGroupsAccountNumberPreference(
|
this.groupsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
|
||||||
this.responseSpec, "resourceId");
|
.createGroupsAccountNumberPreference(this.responseSpec, "resourceId");
|
||||||
System.out.println("Successfully created account number preferences for Groups (ID: " + this.groupsAccountNumberPreferenceId);
|
LOG.info("Successfully created account number preferences for Groups (ID: {})", this.groupsAccountNumberPreferenceId);
|
||||||
|
|
||||||
this.centerAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createCenterAccountNumberPreference(
|
this.centerAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
|
||||||
this.responseSpec, "resourceId");
|
.createCenterAccountNumberPreference(this.responseSpec, "resourceId");
|
||||||
System.out.println("Successfully created account number preferences for Center (ID: " + this.centerAccountNumberPreferenceId);
|
LOG.info("Successfully created account number preferences for Center (ID: {})", this.centerAccountNumberPreferenceId);
|
||||||
|
|
||||||
this.accountNumberPreferencesHelper.verifyCreationOfAccountNumberPreferences(this.clientAccountNumberPreferenceId,
|
this.accountNumberPreferencesHelper.verifyCreationOfAccountNumberPreferences(this.clientAccountNumberPreferenceId,
|
||||||
this.loanAccountNumberPreferenceId, this.savingsAccountNumberPreferenceId, this.groupsAccountNumberPreferenceId,
|
this.loanAccountNumberPreferenceId, this.savingsAccountNumberPreferenceId, this.groupsAccountNumberPreferenceId,
|
||||||
@@ -211,13 +212,13 @@ public class AccountNumberPreferencesTest {
|
|||||||
|
|
||||||
private void createAccountNumberPreferenceDuplicateData(final String accountType, final String prefixType) {
|
private void createAccountNumberPreferenceDuplicateData(final String accountType, final String prefixType) {
|
||||||
/* Creating account Preference with duplicate data should fail */
|
/* Creating account Preference with duplicate data should fail */
|
||||||
System.out
|
LOG.info(
|
||||||
.println("---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH DUPLICATE DATA------------------------------------------");
|
"---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH DUPLICATE DATA------------------------------------------");
|
||||||
|
|
||||||
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper.createAccountNumberPreferenceWithInvalidData(
|
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper
|
||||||
this.responseForbiddenError, accountType, prefixType, "");
|
.createAccountNumberPreferenceWithInvalidData(this.responseForbiddenError, accountType, prefixType, "");
|
||||||
|
|
||||||
Assert.assertEquals("error.msg.account.number.format.duplicate.account.type",
|
Assertions.assertEquals("error.msg.account.number.format.duplicate.account.type",
|
||||||
creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -225,48 +226,48 @@ public class AccountNumberPreferencesTest {
|
|||||||
private void createAccountNumberPreferenceInvalidData(final String accountType, final String prefixType) {
|
private void createAccountNumberPreferenceInvalidData(final String accountType, final String prefixType) {
|
||||||
|
|
||||||
/* Creating account Preference with invalid data should fail */
|
/* Creating account Preference with invalid data should fail */
|
||||||
System.out
|
LOG.info(
|
||||||
.println("---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
|
"---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
|
||||||
|
|
||||||
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper.createAccountNumberPreferenceWithInvalidData(
|
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper
|
||||||
this.responseValidationError, accountType, prefixType, "");
|
.createAccountNumberPreferenceWithInvalidData(this.responseValidationError, accountType, prefixType, "");
|
||||||
|
|
||||||
if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals(
|
if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)
|
||||||
"validation.msg.accountNumberFormat.accountType.is.not.within.expected.range")) {
|
.equals("validation.msg.accountNumberFormat.accountType.is.not.within.expected.range")) {
|
||||||
Assert.assertEquals("validation.msg.accountNumberFormat.accountType.is.not.within.expected.range",
|
Assertions.assertEquals("validation.msg.accountNumberFormat.accountType.is.not.within.expected.range",
|
||||||
creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
} else if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals(
|
} else if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)
|
||||||
"validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations")) {
|
.equals("validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations")) {
|
||||||
Assert.assertEquals("validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations",
|
Assertions.assertEquals("validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations",
|
||||||
creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAccountNumberPreference() {
|
private void updateAccountNumberPreference() {
|
||||||
HashMap<String, Object> accountNumberPreferences = this.accountNumberPreferencesHelper.updateAccountNumberPreference(
|
HashMap<String, Object> accountNumberPreferences = this.accountNumberPreferencesHelper
|
||||||
this.clientAccountNumberPreferenceId, "101", this.responseSpec, "");
|
.updateAccountNumberPreference(this.clientAccountNumberPreferenceId, "101", this.responseSpec, "");
|
||||||
|
|
||||||
System.out.println("--------------------------UPDATION SUCCESSFUL FOR ACCOUNT NUMBER PREFERENCE ID "
|
LOG.info("--------------------------UPDATION SUCCESSFUL FOR ACCOUNT NUMBER PREFERENCE ID {}",
|
||||||
+ accountNumberPreferences.get("resourceId"));
|
accountNumberPreferences.get("resourceId"));
|
||||||
|
|
||||||
this.accountNumberPreferencesHelper.verifyUpdationOfAccountNumberPreferences((Integer) accountNumberPreferences.get("resourceId"),
|
this.accountNumberPreferencesHelper.verifyUpdationOfAccountNumberPreferences((Integer) accountNumberPreferences.get("resourceId"),
|
||||||
this.responseSpec, this.requestSpec);
|
this.responseSpec, this.requestSpec);
|
||||||
|
|
||||||
/* Update invalid account preference id should fail */
|
/* Update invalid account preference id should fail */
|
||||||
System.out
|
LOG.info(
|
||||||
.println("---------------------------------UPDATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
|
"---------------------------------UPDATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
|
||||||
|
|
||||||
/* Invalid Account Type */
|
/* Invalid Account Type */
|
||||||
HashMap<String, Object> updationError = this.accountNumberPreferencesHelper.updateAccountNumberPreference(9999, "101",
|
HashMap<String, Object> updationError = this.accountNumberPreferencesHelper.updateAccountNumberPreference(9999, "101",
|
||||||
this.responseNotFoundError, "");
|
this.responseNotFoundError, "");
|
||||||
if (updationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals("error.msg.resource.not.found")) {
|
if (updationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals("error.msg.resource.not.found")) {
|
||||||
Assert.assertEquals("error.msg.resource.not.found", updationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
Assertions.assertEquals("error.msg.resource.not.found", updationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
}
|
}
|
||||||
/* Invalid Prefix Type */
|
/* Invalid Prefix Type */
|
||||||
HashMap<String, Object> updationError1 = this.accountNumberPreferencesHelper.updateAccountNumberPreference(
|
HashMap<String, Object> updationError1 = this.accountNumberPreferencesHelper
|
||||||
this.clientAccountNumberPreferenceId, "103", this.responseValidationError, "");
|
.updateAccountNumberPreference(this.clientAccountNumberPreferenceId, "103", this.responseValidationError, "");
|
||||||
|
|
||||||
Assert.assertEquals("validation.msg.validation.errors.exist", updationError1.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
Assertions.assertEquals("validation.msg.validation.errors.exist", updationError1.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,8 +292,8 @@ public class AccountNumberPreferencesTest {
|
|||||||
this.groupAccountNo = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "accountNo");
|
this.groupAccountNo = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "accountNo");
|
||||||
|
|
||||||
if (isAccountPreferenceSetUp) {
|
if (isAccountPreferenceSetUp) {
|
||||||
String groupsPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
String groupsPrefixName = (String) this.accountNumberPreferencesHelper
|
||||||
this.groupsAccountNumberPreferenceId, "prefixType.value");
|
.getAccountNumberPreference(this.groupsAccountNumberPreferenceId, "prefixType.value");
|
||||||
|
|
||||||
if (groupsPrefixName.equals(this.officeName)) {
|
if (groupsPrefixName.equals(this.officeName)) {
|
||||||
|
|
||||||
@@ -312,12 +313,12 @@ public class AccountNumberPreferencesTest {
|
|||||||
String name = "CenterCreation" + new Timestamp(new java.util.Date().getTime());
|
String name = "CenterCreation" + new Timestamp(new java.util.Date().getTime());
|
||||||
this.centerId = CenterHelper.createCenter(name, officeId, requestSpec, responseSpec);
|
this.centerId = CenterHelper.createCenter(name, officeId, requestSpec, responseSpec);
|
||||||
CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec);
|
CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec);
|
||||||
Assert.assertNotNull(center);
|
Assertions.assertNotNull(center);
|
||||||
Assert.assertTrue(center.getName().equals(name));
|
Assertions.assertTrue(center.getName().equals(name));
|
||||||
|
|
||||||
if (isAccountPreferenceSetUp) {
|
if (isAccountPreferenceSetUp) {
|
||||||
String centerPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
String centerPrefixName = (String) this.accountNumberPreferencesHelper
|
||||||
this.centerAccountNumberPreferenceId, "prefixType.value");
|
.getAccountNumberPreference(this.centerAccountNumberPreferenceId, "prefixType.value");
|
||||||
final String CENTER_URL = "/fineract-provider/api/v1/centers/" + this.centerId + "?" + Utils.TENANT_IDENTIFIER;
|
final String CENTER_URL = "/fineract-provider/api/v1/centers/" + this.centerId + "?" + Utils.TENANT_IDENTIFIER;
|
||||||
|
|
||||||
if (centerPrefixName.equals(this.officeName)) {
|
if (centerPrefixName.equals(this.officeName)) {
|
||||||
@@ -329,10 +330,9 @@ public class AccountNumberPreferencesTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void createAndValidateClientWithoutAccountPreference() {
|
private void createAndValidateClientWithoutAccountPreference() {
|
||||||
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(this.clientId);
|
Assertions.assertNotNull(this.clientId);
|
||||||
String clientAccountNo = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "accountNo");
|
String clientAccountNo = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "accountNo");
|
||||||
validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, null);
|
validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, null);
|
||||||
}
|
}
|
||||||
@@ -340,8 +340,8 @@ public class AccountNumberPreferencesTest {
|
|||||||
private void createAndValidateClientBasedOnAccountPreference() {
|
private void createAndValidateClientBasedOnAccountPreference() {
|
||||||
final String codeName = "ClientType";
|
final String codeName = "ClientType";
|
||||||
String clientAccountNo = null;
|
String clientAccountNo = null;
|
||||||
String clientPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
String clientPrefixName = (String) this.accountNumberPreferencesHelper
|
||||||
this.clientAccountNumberPreferenceId, "prefixType.value");
|
.getAccountNumberPreference(this.clientAccountNumberPreferenceId, "prefixType.value");
|
||||||
if (clientPrefixName.equals(this.clientTypeName)) {
|
if (clientPrefixName.equals(this.clientTypeName)) {
|
||||||
|
|
||||||
/* Retrieve Code id for the Code "ClientType" */
|
/* Retrieve Code id for the Code "ClientType" */
|
||||||
@@ -359,14 +359,14 @@ public class AccountNumberPreferencesTest {
|
|||||||
this.clientId = ClientHelper.createClientForAccountPreference(this.requestSpec, this.responseSpec, this.clientCodeValueId,
|
this.clientId = ClientHelper.createClientForAccountPreference(this.requestSpec, this.responseSpec, this.clientCodeValueId,
|
||||||
"clientId");
|
"clientId");
|
||||||
|
|
||||||
Assert.assertNotNull(clientId);
|
Assertions.assertNotNull(clientId);
|
||||||
|
|
||||||
clientAccountNo = (String) ClientHelper.getClient(this.requestSpec, this.responseSpec, this.clientId.toString(), "accountNo");
|
clientAccountNo = (String) ClientHelper.getClient(this.requestSpec, this.responseSpec, this.clientId.toString(), "accountNo");
|
||||||
this.validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, this.clientCodeValueName);
|
this.validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, this.clientCodeValueName);
|
||||||
|
|
||||||
} else if (clientPrefixName.equals(this.officeName)) {
|
} else if (clientPrefixName.equals(this.officeName)) {
|
||||||
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientId);
|
Assertions.assertNotNull(clientId);
|
||||||
clientAccountNo = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "accountNo");
|
clientAccountNo = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "accountNo");
|
||||||
String officeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "officeName");
|
String officeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "officeName");
|
||||||
this.validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, officeName);
|
this.validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, officeName);
|
||||||
@@ -375,31 +375,31 @@ public class AccountNumberPreferencesTest {
|
|||||||
|
|
||||||
private void validateAccountNumberLengthAndStartsWithPrefix(final String accountNumber, String prefix) {
|
private void validateAccountNumberLengthAndStartsWithPrefix(final String accountNumber, String prefix) {
|
||||||
if (prefix != null) {
|
if (prefix != null) {
|
||||||
prefix = prefix.substring(0, Math.min(prefix.length(), 10));
|
prefix = prefix.substring(0, Math.min(prefix.length(), 10));
|
||||||
Assert.assertEquals(accountNumber.length(), prefix.length() + 9);
|
Assertions.assertEquals(accountNumber.length(), prefix.length() + 9);
|
||||||
Assert.assertTrue(accountNumber.startsWith(prefix));
|
Assertions.assertTrue(accountNumber.startsWith(prefix));
|
||||||
} else {
|
} else {
|
||||||
Assert.assertEquals(accountNumber.length(), 9);
|
Assertions.assertEquals(9, accountNumber.length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createLoanProduct() {
|
private void createLoanProduct() {
|
||||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
|
|
||||||
System.out.println("---------------------------------CREATING LOAN PRODUCT------------------------------------------");
|
LOG.info("---------------------------------CREATING LOAN PRODUCT------------------------------------------");
|
||||||
|
|
||||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(loanPrincipalAmount)
|
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(loanPrincipalAmount)
|
||||||
.withNumberOfRepayments(numberOfRepayments).withinterestRatePerPeriod(interestRatePerPeriod)
|
.withNumberOfRepayments(numberOfRepayments).withinterestRatePerPeriod(interestRatePerPeriod)
|
||||||
.withInterestRateFrequencyTypeAsYear().build(null);
|
.withInterestRateFrequencyTypeAsYear().build(null);
|
||||||
|
|
||||||
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
System.out.println("Successfully created loan product (ID: " + this.loanProductId + ")");
|
LOG.info("Successfully created loan product (ID: {} )", this.loanProductId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createAndValidateLoanEntity(Boolean isAccountPreferenceSetUp) {
|
private void createAndValidateLoanEntity(Boolean isAccountPreferenceSetUp) {
|
||||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
|
|
||||||
System.out.println("---------------------------------NEW LOAN APPLICATION------------------------------------------");
|
LOG.info("---------------------------------NEW LOAN APPLICATION------------------------------------------");
|
||||||
|
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
|
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
|
||||||
.withLoanTermFrequency(numberOfRepayments).withLoanTermFrequencyAsMonths().withNumberOfRepayments(numberOfRepayments)
|
.withLoanTermFrequency(numberOfRepayments).withLoanTermFrequencyAsMonths().withNumberOfRepayments(numberOfRepayments)
|
||||||
@@ -408,15 +408,15 @@ public class AccountNumberPreferencesTest {
|
|||||||
.withSubmittedOnDate(dateString).withExpectedDisbursementDate(dateString).withPrincipalGrace("2").withInterestGrace("2")
|
.withSubmittedOnDate(dateString).withExpectedDisbursementDate(dateString).withPrincipalGrace("2").withInterestGrace("2")
|
||||||
.build(this.clientId.toString(), this.loanProductId.toString(), null);
|
.build(this.clientId.toString(), this.loanProductId.toString(), null);
|
||||||
|
|
||||||
System.out.println("Loan Application :" + loanApplicationJSON);
|
LOG.info("Loan Application :{}", loanApplicationJSON);
|
||||||
|
|
||||||
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||||
String loanAccountNo = (String) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, this.loanId,
|
String loanAccountNo = (String) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, this.loanId,
|
||||||
"accountNo");
|
"accountNo");
|
||||||
|
|
||||||
if (isAccountPreferenceSetUp) {
|
if (isAccountPreferenceSetUp) {
|
||||||
String loanPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
String loanPrefixName = (String) this.accountNumberPreferencesHelper
|
||||||
this.loanAccountNumberPreferenceId, "prefixType.value");
|
.getAccountNumberPreference(this.loanAccountNumberPreferenceId, "prefixType.value");
|
||||||
if (loanPrefixName.equals(this.officeName)) {
|
if (loanPrefixName.equals(this.officeName)) {
|
||||||
String loanOfficeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "officeName");
|
String loanOfficeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "officeName");
|
||||||
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, loanOfficeName);
|
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, loanOfficeName);
|
||||||
@@ -425,17 +425,17 @@ public class AccountNumberPreferencesTest {
|
|||||||
this.loanProductId, "shortName");
|
this.loanProductId, "shortName");
|
||||||
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, loanShortName);
|
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, loanShortName);
|
||||||
}
|
}
|
||||||
System.out.println("SUCCESSFULLY CREATED LOAN APPLICATION BASED ON ACCOUNT PREFERENCES (ID: " + this.loanId + ")");
|
LOG.info("SUCCESSFULLY CREATED LOAN APPLICATION BASED ON ACCOUNT PREFERENCES (ID: {} )", this.loanId);
|
||||||
} else {
|
} else {
|
||||||
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, null);
|
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, null);
|
||||||
System.out.println("SUCCESSFULLY CREATED LOAN APPLICATION (ID: " + loanId + ")");
|
LOG.info("SUCCESSFULLY CREATED LOAN APPLICATION (ID: {} )", loanId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createSavingsProduct() {
|
private void createSavingsProduct() {
|
||||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
|
|
||||||
System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
||||||
|
|
||||||
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
|
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
|
||||||
|
|
||||||
@@ -452,7 +452,7 @@ public class AccountNumberPreferencesTest {
|
|||||||
.withMinRequiredBalance(minRequiredBalance).withEnforceMinRequiredBalance(enforceMinRequiredBalance)
|
.withMinRequiredBalance(minRequiredBalance).withEnforceMinRequiredBalance(enforceMinRequiredBalance)
|
||||||
.withMinimumOpenningBalance(this.MINIMUM_OPENING_BALANCE).build();
|
.withMinimumOpenningBalance(this.MINIMUM_OPENING_BALANCE).build();
|
||||||
this.savingsProductId = SavingsProductHelper.createSavingsProduct(savingsProductJSON, this.requestSpec, this.responseSpec);
|
this.savingsProductId = SavingsProductHelper.createSavingsProduct(savingsProductJSON, this.requestSpec, this.responseSpec);
|
||||||
System.out.println("Sucessfully created savings product (ID: " + this.savingsProductId + ")");
|
LOG.info("Sucessfully created savings product (ID: {} )", this.savingsProductId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,14 +461,14 @@ public class AccountNumberPreferencesTest {
|
|||||||
|
|
||||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
this.savingsId = this.savingsAccountHelper
|
this.savingsId = this.savingsAccountHelper.applyForSavingsApplication(this.clientId, this.savingsProductId,
|
||||||
.applyForSavingsApplication(this.clientId, this.savingsProductId, ACCOUNT_TYPE_INDIVIDUAL);
|
ACCOUNT_TYPE_INDIVIDUAL);
|
||||||
|
|
||||||
String savingsAccountNo = (String) this.savingsAccountHelper.getSavingsAccountDetail(this.savingsId, "accountNo");
|
String savingsAccountNo = (String) this.savingsAccountHelper.getSavingsAccountDetail(this.savingsId, "accountNo");
|
||||||
|
|
||||||
if (isAccountPreferenceSetUp) {
|
if (isAccountPreferenceSetUp) {
|
||||||
String savingsPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
String savingsPrefixName = (String) this.accountNumberPreferencesHelper
|
||||||
this.savingsAccountNumberPreferenceId, "prefixType.value");
|
.getAccountNumberPreference(this.savingsAccountNumberPreferenceId, "prefixType.value");
|
||||||
|
|
||||||
if (savingsPrefixName.equals(this.officeName)) {
|
if (savingsPrefixName.equals(this.officeName)) {
|
||||||
String savingsOfficeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(),
|
String savingsOfficeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(),
|
||||||
@@ -478,10 +478,10 @@ public class AccountNumberPreferencesTest {
|
|||||||
String loanShortName = (String) this.savingsAccountHelper.getSavingsAccountDetail(this.savingsId, "shortName");
|
String loanShortName = (String) this.savingsAccountHelper.getSavingsAccountDetail(this.savingsId, "shortName");
|
||||||
this.validateAccountNumberLengthAndStartsWithPrefix(savingsAccountNo, loanShortName);
|
this.validateAccountNumberLengthAndStartsWithPrefix(savingsAccountNo, loanShortName);
|
||||||
}
|
}
|
||||||
System.out.println("SUCCESSFULLY CREATED SAVINGS APPLICATION BASED ON ACCOUNT PREFERENCES (ID: " + this.loanId + ")");
|
LOG.info("SUCCESSFULLY CREATED SAVINGS APPLICATION BASED ON ACCOUNT PREFERENCES (ID: {} )", this.loanId);
|
||||||
} else {
|
} else {
|
||||||
this.validateAccountNumberLengthAndStartsWithPrefix(savingsAccountNo, null);
|
this.validateAccountNumberLengthAndStartsWithPrefix(savingsAccountNo, null);
|
||||||
System.out.println("SUCCESSFULLY CREATED SAVINGS APPLICATION (ID: " + this.savingsId + ")");
|
LOG.info("SUCCESSFULLY CREATED SAVINGS APPLICATION (ID:{} )", this.savingsId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-86
@@ -18,21 +18,25 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||||
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.accounting.Account;
|
import org.apache.fineract.integrationtests.common.accounting.Account;
|
||||||
|
import org.apache.fineract.integrationtests.common.accounting.Account.AccountType;
|
||||||
import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
|
import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
|
||||||
import org.apache.fineract.integrationtests.common.accounting.FinancialActivityAccountHelper;
|
import org.apache.fineract.integrationtests.common.accounting.FinancialActivityAccountHelper;
|
||||||
import org.apache.fineract.integrationtests.common.accounting.JournalEntry;
|
import org.apache.fineract.integrationtests.common.accounting.JournalEntry;
|
||||||
import org.apache.fineract.integrationtests.common.accounting.JournalEntryHelper;
|
import org.apache.fineract.integrationtests.common.accounting.JournalEntryHelper;
|
||||||
import org.apache.fineract.integrationtests.common.accounting.Account.AccountType;
|
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||||
@@ -41,16 +45,12 @@ import org.apache.fineract.integrationtests.common.savings.AccountTransferHelper
|
|||||||
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
||||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
|
||||||
import com.jayway.restassured.http.ContentType;
|
|
||||||
import com.jayway.restassured.specification.RequestSpecification;
|
|
||||||
import com.jayway.restassured.specification.ResponseSpecification;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JUnit Test Cases for Account Transfer for.
|
* JUnit Test Cases for Account Transfer for.
|
||||||
@@ -58,6 +58,7 @@ import com.jayway.restassured.specification.ResponseSpecification;
|
|||||||
@SuppressWarnings({ "rawtypes", "unused" })
|
@SuppressWarnings({ "rawtypes", "unused" })
|
||||||
public class AccountTransferTest {
|
public class AccountTransferTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(AccountTransferTest.class);
|
||||||
public static final String MINIMUM_OPENING_BALANCE = "30000.0";
|
public static final String MINIMUM_OPENING_BALANCE = "30000.0";
|
||||||
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
|
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
|
||||||
public static final String ACCOUNT_TRANSFER_AMOUNT = "15000.0";
|
public static final String ACCOUNT_TRANSFER_AMOUNT = "15000.0";
|
||||||
@@ -79,14 +80,14 @@ public class AccountTransferTest {
|
|||||||
private AccountHelper accountHelper;
|
private AccountHelper accountHelper;
|
||||||
private JournalEntryHelper journalEntryHelper;
|
private JournalEntryHelper journalEntryHelper;
|
||||||
|
|
||||||
Float TRANSFER_AMOUNT = new Float(ACCOUNT_TRANSFER_AMOUNT);
|
Float TRANSFER_AMOUNT = Float.valueOf(ACCOUNT_TRANSFER_AMOUNT);
|
||||||
Float TRANSFER_AMOUNT_ADJUST = new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
Float TRANSFER_AMOUNT_ADJUST = Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
||||||
|
|
||||||
private FinancialActivityAccountHelper financialActivityAccountHelper;
|
private FinancialActivityAccountHelper financialActivityAccountHelper;
|
||||||
private Integer financialActivityAccountId;
|
private Integer financialActivityAccountId;
|
||||||
private Account liabilityTransferAccount;
|
private Account liabilityTransferAccount;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -101,17 +102,17 @@ public class AccountTransferTest {
|
|||||||
/** Setup liability transfer account **/
|
/** Setup liability transfer account **/
|
||||||
/** Create a Liability and an Asset Transfer Account **/
|
/** Create a Liability and an Asset Transfer Account **/
|
||||||
liabilityTransferAccount = accountHelper.createLiabilityAccount();
|
liabilityTransferAccount = accountHelper.createLiabilityAccount();
|
||||||
Assert.assertNotNull(liabilityTransferAccount);
|
Assertions.assertNotNull(liabilityTransferAccount);
|
||||||
|
|
||||||
/*** Create A Financial Activity to Account Mapping **/
|
/*** Create A Financial Activity to Account Mapping **/
|
||||||
financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
|
financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
|
||||||
FinancialActivityAccountsTest.liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(),
|
FinancialActivityAccountsTest.LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityTransferAccount.getAccountID(),
|
||||||
responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
Assert.assertNotNull(financialActivityAccountId);
|
Assertions.assertNotNull(financialActivityAccountId);
|
||||||
} else {
|
} else {
|
||||||
for (HashMap financialActivity : financialActivities) {
|
for (HashMap financialActivity : financialActivities) {
|
||||||
HashMap financialActivityData = (HashMap) financialActivity.get("financialActivityData");
|
HashMap financialActivityData = (HashMap) financialActivity.get("financialActivityData");
|
||||||
if (financialActivityData.get("id").equals(FinancialActivityAccountsTest.liabilityTransferFinancialActivityId)) {
|
if (financialActivityData.get("id").equals(FinancialActivityAccountsTest.LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID)) {
|
||||||
HashMap glAccountData = (HashMap) financialActivity.get("glAccountData");
|
HashMap glAccountData = (HashMap) financialActivity.get("glAccountData");
|
||||||
liabilityTransferAccount = new Account((Integer) glAccountData.get("id"), AccountType.LIABILITY);
|
liabilityTransferAccount = new Account((Integer) glAccountData.get("id"), AccountType.LIABILITY);
|
||||||
financialActivityAccountId = (Integer) financialActivity.get("id");
|
financialActivityAccountId = (Integer) financialActivity.get("id");
|
||||||
@@ -124,12 +125,12 @@ public class AccountTransferTest {
|
|||||||
/**
|
/**
|
||||||
* Delete the Liability transfer account
|
* Delete the Liability transfer account
|
||||||
*/
|
*/
|
||||||
@After
|
@AfterEach
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper.deleteFinancialActivityAccount(
|
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper
|
||||||
financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
.deleteFinancialActivityAccount(financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
Assert.assertNotNull(deletedFinancialActivityAccountId);
|
Assertions.assertNotNull(deletedFinancialActivityAccountId);
|
||||||
Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
|
Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -144,20 +145,20 @@ public class AccountTransferTest {
|
|||||||
|
|
||||||
OfficeHelper officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec);
|
OfficeHelper officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec);
|
||||||
Integer toOfficeId = officeHelper.createOffice("01 January 2011");
|
Integer toOfficeId = officeHelper.createOffice("01 January 2011");
|
||||||
Assert.assertNotNull(toOfficeId);
|
Assertions.assertNotNull(toOfficeId);
|
||||||
|
|
||||||
// Creating Savings Account to which fund to be Transferred
|
// Creating Savings Account to which fund to be Transferred
|
||||||
final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
||||||
String.valueOf(toOfficeId));
|
String.valueOf(toOfficeId));
|
||||||
Assert.assertNotNull(toClientID);
|
Assertions.assertNotNull(toClientID);
|
||||||
|
|
||||||
final Integer toSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, assetAccount,
|
final Integer toSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, assetAccount,
|
||||||
incomeAccount, expenseAccount, liabilityAccount);
|
incomeAccount, expenseAccount, liabilityAccount);
|
||||||
Assert.assertNotNull(toSavingsProductID);
|
Assertions.assertNotNull(toSavingsProductID);
|
||||||
|
|
||||||
final Integer toSavingsID = this.savingsAccountHelper.applyForSavingsApplication(toClientID, toSavingsProductID,
|
final Integer toSavingsID = this.savingsAccountHelper.applyForSavingsApplication(toClientID, toSavingsProductID,
|
||||||
ACCOUNT_TYPE_INDIVIDUAL);
|
ACCOUNT_TYPE_INDIVIDUAL);
|
||||||
Assert.assertNotNull(toSavingsProductID);
|
Assertions.assertNotNull(toSavingsProductID);
|
||||||
|
|
||||||
HashMap toSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, toSavingsID);
|
HashMap toSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, toSavingsID);
|
||||||
SavingsStatusChecker.verifySavingsIsPending(toSavingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsPending(toSavingsStatusHashMap);
|
||||||
@@ -171,20 +172,20 @@ public class AccountTransferTest {
|
|||||||
final HashMap toSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
final HashMap toSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
||||||
|
|
||||||
Integer fromOfficeId = officeHelper.createOffice("01 January 2011");
|
Integer fromOfficeId = officeHelper.createOffice("01 January 2011");
|
||||||
Assert.assertNotNull(fromOfficeId);
|
Assertions.assertNotNull(fromOfficeId);
|
||||||
|
|
||||||
// Creating Savings Account from which the Fund has to be Transferred
|
// Creating Savings Account from which the Fund has to be Transferred
|
||||||
final Integer fromClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
final Integer fromClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
||||||
String.valueOf(fromOfficeId));
|
String.valueOf(fromOfficeId));
|
||||||
Assert.assertNotNull(fromClientID);
|
Assertions.assertNotNull(fromClientID);
|
||||||
|
|
||||||
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
||||||
Assert.assertNotNull(fromSavingsProductID);
|
Assertions.assertNotNull(fromSavingsProductID);
|
||||||
|
|
||||||
final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientID, fromSavingsProductID,
|
final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientID, fromSavingsProductID,
|
||||||
ACCOUNT_TYPE_INDIVIDUAL);
|
ACCOUNT_TYPE_INDIVIDUAL);
|
||||||
Assert.assertNotNull(fromSavingsID);
|
Assertions.assertNotNull(fromSavingsID);
|
||||||
|
|
||||||
HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID);
|
HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID);
|
||||||
SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap);
|
||||||
@@ -197,26 +198,26 @@ public class AccountTransferTest {
|
|||||||
|
|
||||||
final HashMap fromSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
final HashMap fromSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||||
|
|
||||||
Float fromSavingsBalance = new Float(MINIMUM_OPENING_BALANCE);
|
Float fromSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||||
Float toSavingsBalance = new Float(MINIMUM_OPENING_BALANCE);
|
Float toSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||||
|
|
||||||
this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, fromClientID, toSavingsID, FROM_SAVINGS_ACCOUNT_TYPE,
|
this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, fromClientID, toSavingsID, FROM_SAVINGS_ACCOUNT_TYPE,
|
||||||
TO_SAVINGS_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT);
|
TO_SAVINGS_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT);
|
||||||
|
|
||||||
fromSavingsBalance -= new Float(ACCOUNT_TRANSFER_AMOUNT);
|
fromSavingsBalance -= Float.valueOf(ACCOUNT_TRANSFER_AMOUNT);
|
||||||
toSavingsBalance += new Float(ACCOUNT_TRANSFER_AMOUNT);
|
toSavingsBalance += Float.valueOf(ACCOUNT_TRANSFER_AMOUNT);
|
||||||
|
|
||||||
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||||
assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance,
|
assertEquals(fromSavingsBalance, fromSavingsSummaryAfter.get("accountBalance"),
|
||||||
fromSavingsSummaryAfter.get("accountBalance"));
|
"Verifying From Savings Account Balance after Account Transfer");
|
||||||
|
|
||||||
HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
||||||
assertEquals("Verifying To Savings Account Balance after Account Transfer", toSavingsBalance,
|
assertEquals(toSavingsBalance, toSavingsSummaryAfter.get("accountBalance"),
|
||||||
toSavingsSummaryAfter.get("accountBalance"));
|
"Verifying To Savings Account Balance after Account Transfer");
|
||||||
final JournalEntry[] office1LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT),
|
final JournalEntry[] office1LiabilityEntries = {
|
||||||
JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT), JournalEntry.TransactionType.CREDIT) };
|
||||||
final JournalEntry[] office2LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT),
|
final JournalEntry[] office2LiabilityEntries = {
|
||||||
JournalEntry.TransactionType.DEBIT) };
|
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT), JournalEntry.TransactionType.DEBIT) };
|
||||||
|
|
||||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
|
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
|
||||||
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
|
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
|
||||||
@@ -243,21 +244,21 @@ public class AccountTransferTest {
|
|||||||
|
|
||||||
OfficeHelper officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec);
|
OfficeHelper officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec);
|
||||||
Integer toOfficeId = officeHelper.createOffice("01 January 2011");
|
Integer toOfficeId = officeHelper.createOffice("01 January 2011");
|
||||||
Assert.assertNotNull(toOfficeId);
|
Assertions.assertNotNull(toOfficeId);
|
||||||
|
|
||||||
// Creating Loan Account to which fund to be Transferred
|
// Creating Loan Account to which fund to be Transferred
|
||||||
final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
||||||
String.valueOf(toOfficeId));
|
String.valueOf(toOfficeId));
|
||||||
Assert.assertNotNull(toClientID);
|
Assertions.assertNotNull(toClientID);
|
||||||
|
|
||||||
Account toTransferAccount = accountHelper.createLiabilityAccount();
|
Account toTransferAccount = accountHelper.createLiabilityAccount();
|
||||||
Assert.assertNotNull(toTransferAccount);
|
Assertions.assertNotNull(toTransferAccount);
|
||||||
|
|
||||||
final Integer toLoanProductID = createLoanProduct(loanAssetAccount, loanIncomeAccount, loanExpenseAccount, overpaymentAccount);
|
final Integer toLoanProductID = createLoanProduct(loanAssetAccount, loanIncomeAccount, loanExpenseAccount, overpaymentAccount);
|
||||||
Assert.assertNotNull(toLoanProductID);
|
Assertions.assertNotNull(toLoanProductID);
|
||||||
|
|
||||||
final Integer toLoanID = applyForLoanApplication(toClientID, toLoanProductID);
|
final Integer toLoanID = applyForLoanApplication(toClientID, toLoanProductID);
|
||||||
Assert.assertNotNull(toLoanID);
|
Assertions.assertNotNull(toLoanID);
|
||||||
|
|
||||||
HashMap toLoanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, toLoanID);
|
HashMap toLoanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, toLoanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(toLoanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(toLoanStatusHashMap);
|
||||||
@@ -269,20 +270,20 @@ public class AccountTransferTest {
|
|||||||
LoanStatusChecker.verifyLoanIsActive(toLoanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(toLoanStatusHashMap);
|
||||||
|
|
||||||
Integer fromOfficeId = officeHelper.createOffice("01 January 2011");
|
Integer fromOfficeId = officeHelper.createOffice("01 January 2011");
|
||||||
Assert.assertNotNull(fromOfficeId);
|
Assertions.assertNotNull(fromOfficeId);
|
||||||
|
|
||||||
// Creating Savings Account from which the Fund has to be Transferred
|
// Creating Savings Account from which the Fund has to be Transferred
|
||||||
final Integer fromClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
final Integer fromClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
||||||
String.valueOf(fromOfficeId));
|
String.valueOf(fromOfficeId));
|
||||||
Assert.assertNotNull(fromClientID);
|
Assertions.assertNotNull(fromClientID);
|
||||||
|
|
||||||
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
||||||
Assert.assertNotNull(fromSavingsProductID);
|
Assertions.assertNotNull(fromSavingsProductID);
|
||||||
|
|
||||||
final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientID, fromSavingsProductID,
|
final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientID, fromSavingsProductID,
|
||||||
ACCOUNT_TYPE_INDIVIDUAL);
|
ACCOUNT_TYPE_INDIVIDUAL);
|
||||||
Assert.assertNotNull(fromSavingsID);
|
Assertions.assertNotNull(fromSavingsID);
|
||||||
|
|
||||||
HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID);
|
HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID);
|
||||||
SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap);
|
||||||
@@ -295,7 +296,7 @@ public class AccountTransferTest {
|
|||||||
|
|
||||||
final HashMap fromSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
final HashMap fromSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||||
|
|
||||||
Float fromSavingsBalance = new Float(MINIMUM_OPENING_BALANCE);
|
Float fromSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||||
|
|
||||||
this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, toClientID, toLoanID, FROM_SAVINGS_ACCOUNT_TYPE,
|
this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, toClientID, toLoanID, FROM_SAVINGS_ACCOUNT_TYPE,
|
||||||
TO_LOAN_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
TO_LOAN_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
||||||
@@ -303,17 +304,17 @@ public class AccountTransferTest {
|
|||||||
fromSavingsBalance -= TRANSFER_AMOUNT_ADJUST;
|
fromSavingsBalance -= TRANSFER_AMOUNT_ADJUST;
|
||||||
|
|
||||||
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||||
assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance,
|
assertEquals(fromSavingsBalance, fromSavingsSummaryAfter.get("accountBalance"),
|
||||||
fromSavingsSummaryAfter.get("accountBalance"));
|
"Verifying From Savings Account Balance after Account Transfer");
|
||||||
|
|
||||||
HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, toLoanID);
|
HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, toLoanID);
|
||||||
assertEquals("Verifying To Loan Repayment Amount after Account Transfer", TRANSFER_AMOUNT_ADJUST,
|
assertEquals(TRANSFER_AMOUNT_ADJUST, toLoanSummaryAfter.get("totalRepayment"),
|
||||||
toLoanSummaryAfter.get("totalRepayment"));
|
"Verifying To Loan Repayment Amount after Account Transfer");
|
||||||
|
|
||||||
final JournalEntry[] office1LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
|
final JournalEntry[] office1LiabilityEntries = {
|
||||||
JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.CREDIT) };
|
||||||
final JournalEntry[] office2LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
|
final JournalEntry[] office2LiabilityEntries = {
|
||||||
JournalEntry.TransactionType.DEBIT) };
|
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.DEBIT) };
|
||||||
|
|
||||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
|
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
|
||||||
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
|
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
|
||||||
@@ -339,20 +340,20 @@ public class AccountTransferTest {
|
|||||||
|
|
||||||
OfficeHelper officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec);
|
OfficeHelper officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec);
|
||||||
Integer toOfficeId = officeHelper.createOffice("01 January 2011");
|
Integer toOfficeId = officeHelper.createOffice("01 January 2011");
|
||||||
Assert.assertNotNull(toOfficeId);
|
Assertions.assertNotNull(toOfficeId);
|
||||||
|
|
||||||
// Creating Loan Account to which fund to be Transferred
|
// Creating Loan Account to which fund to be Transferred
|
||||||
final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
||||||
String.valueOf(toOfficeId));
|
String.valueOf(toOfficeId));
|
||||||
Assert.assertNotNull(toClientID);
|
Assertions.assertNotNull(toClientID);
|
||||||
|
|
||||||
final Integer toSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, assetAccount,
|
final Integer toSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, assetAccount,
|
||||||
incomeAccount, expenseAccount, liabilityAccount);
|
incomeAccount, expenseAccount, liabilityAccount);
|
||||||
Assert.assertNotNull(toSavingsProductID);
|
Assertions.assertNotNull(toSavingsProductID);
|
||||||
|
|
||||||
final Integer toSavingsID = this.savingsAccountHelper.applyForSavingsApplication(toClientID, toSavingsProductID,
|
final Integer toSavingsID = this.savingsAccountHelper.applyForSavingsApplication(toClientID, toSavingsProductID,
|
||||||
ACCOUNT_TYPE_INDIVIDUAL);
|
ACCOUNT_TYPE_INDIVIDUAL);
|
||||||
Assert.assertNotNull(toSavingsID);
|
Assertions.assertNotNull(toSavingsID);
|
||||||
|
|
||||||
HashMap toSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, toSavingsID);
|
HashMap toSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, toSavingsID);
|
||||||
SavingsStatusChecker.verifySavingsIsPending(toSavingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsPending(toSavingsStatusHashMap);
|
||||||
@@ -364,18 +365,18 @@ public class AccountTransferTest {
|
|||||||
SavingsStatusChecker.verifySavingsIsActive(toSavingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsActive(toSavingsStatusHashMap);
|
||||||
|
|
||||||
Integer fromOfficeId = officeHelper.createOffice("01 January 2011");
|
Integer fromOfficeId = officeHelper.createOffice("01 January 2011");
|
||||||
Assert.assertNotNull(fromOfficeId);
|
Assertions.assertNotNull(fromOfficeId);
|
||||||
|
|
||||||
// Creating Savings Account from which the Fund has to be Transferred
|
// Creating Savings Account from which the Fund has to be Transferred
|
||||||
final Integer fromClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
final Integer fromClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
||||||
String.valueOf(fromOfficeId));
|
String.valueOf(fromOfficeId));
|
||||||
Assert.assertNotNull(fromClientID);
|
Assertions.assertNotNull(fromClientID);
|
||||||
|
|
||||||
final Integer loanProductID = createLoanProduct(loanAssetAccount, loanIncomeAccount, loanExpenseAccount, overpaymentAccount);
|
final Integer loanProductID = createLoanProduct(loanAssetAccount, loanIncomeAccount, loanExpenseAccount, overpaymentAccount);
|
||||||
Assert.assertNotNull(loanProductID);
|
Assertions.assertNotNull(loanProductID);
|
||||||
|
|
||||||
final Integer loanID = applyForLoanApplication(fromClientID, loanProductID);
|
final Integer loanID = applyForLoanApplication(fromClientID, loanProductID);
|
||||||
Assert.assertNotNull(loanID);
|
Assertions.assertNotNull(loanID);
|
||||||
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
@@ -388,11 +389,11 @@ public class AccountTransferTest {
|
|||||||
|
|
||||||
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
||||||
Assert.assertNotNull(fromSavingsProductID);
|
Assertions.assertNotNull(fromSavingsProductID);
|
||||||
|
|
||||||
final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientID, fromSavingsProductID,
|
final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientID, fromSavingsProductID,
|
||||||
ACCOUNT_TYPE_INDIVIDUAL);
|
ACCOUNT_TYPE_INDIVIDUAL);
|
||||||
Assert.assertNotNull(fromSavingsID);
|
Assertions.assertNotNull(fromSavingsID);
|
||||||
|
|
||||||
HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID);
|
HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID);
|
||||||
SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap);
|
||||||
@@ -405,7 +406,7 @@ public class AccountTransferTest {
|
|||||||
|
|
||||||
final HashMap toSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
final HashMap toSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
||||||
|
|
||||||
Float fromSavingsBalance = new Float(MINIMUM_OPENING_BALANCE);
|
Float fromSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||||
|
|
||||||
this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, fromClientID, loanID, FROM_SAVINGS_ACCOUNT_TYPE,
|
this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, fromClientID, loanID, FROM_SAVINGS_ACCOUNT_TYPE,
|
||||||
TO_LOAN_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT);
|
TO_LOAN_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT);
|
||||||
@@ -415,10 +416,10 @@ public class AccountTransferTest {
|
|||||||
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||||
|
|
||||||
// Verifying fromSavings Account Balance after Account Transfer
|
// Verifying fromSavings Account Balance after Account Transfer
|
||||||
assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance,
|
assertEquals(fromSavingsBalance, fromSavingsSummaryAfter.get("accountBalance"),
|
||||||
fromSavingsSummaryAfter.get("accountBalance"));
|
"Verifying From Savings Account Balance after Account Transfer");
|
||||||
|
|
||||||
Float toSavingsBalance = new Float(MINIMUM_OPENING_BALANCE);
|
Float toSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||||
|
|
||||||
this.accountTransferHelper.accountTransfer(fromClientID, loanID, toClientID, toSavingsID, FROM_LOAN_ACCOUNT_TYPE,
|
this.accountTransferHelper.accountTransfer(fromClientID, loanID, toClientID, toSavingsID, FROM_LOAN_ACCOUNT_TYPE,
|
||||||
TO_SAVINGS_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
TO_SAVINGS_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
||||||
@@ -428,13 +429,13 @@ public class AccountTransferTest {
|
|||||||
HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
||||||
|
|
||||||
// Verifying toSavings Account Balance after Account Transfer
|
// Verifying toSavings Account Balance after Account Transfer
|
||||||
assertEquals("Verifying From Savings Account Balance after Account Transfer", toSavingsBalance,
|
assertEquals(toSavingsBalance, toSavingsSummaryAfter.get("accountBalance"),
|
||||||
toSavingsSummaryAfter.get("accountBalance"));
|
"Verifying From Savings Account Balance after Account Transfer");
|
||||||
|
|
||||||
final JournalEntry[] office1LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
|
final JournalEntry[] office1LiabilityEntries = {
|
||||||
JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.CREDIT) };
|
||||||
final JournalEntry[] office2LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
|
final JournalEntry[] office2LiabilityEntries = {
|
||||||
JournalEntry.TransactionType.DEBIT) };
|
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.DEBIT) };
|
||||||
|
|
||||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
|
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
|
||||||
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
|
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
|
||||||
@@ -445,7 +446,7 @@ public class AccountTransferTest {
|
|||||||
|
|
||||||
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||||
final String minOpenningBalance, final Account... accounts) {
|
final String minOpenningBalance, final Account... accounts) {
|
||||||
System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
||||||
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
|
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
|
||||||
final String savingsProductJSON = savingsProductHelper //
|
final String savingsProductJSON = savingsProductHelper //
|
||||||
.withInterestCompoundingPeriodTypeAsDaily() //
|
.withInterestCompoundingPeriodTypeAsDaily() //
|
||||||
@@ -456,7 +457,7 @@ public class AccountTransferTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Integer createLoanProduct(final Account... accounts) {
|
private Integer createLoanProduct(final Account... accounts) {
|
||||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||||
final String loanProductJSON = new LoanProductTestBuilder() //
|
final String loanProductJSON = new LoanProductTestBuilder() //
|
||||||
.withPrincipal("8,000.00") //
|
.withPrincipal("8,000.00") //
|
||||||
.withNumberOfRepayments("4") //
|
.withNumberOfRepayments("4") //
|
||||||
@@ -472,7 +473,7 @@ public class AccountTransferTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID) {
|
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID) {
|
||||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||||
.withPrincipal("8,000.00") //
|
.withPrincipal("8,000.00") //
|
||||||
.withLoanTermFrequency("4") //
|
.withLoanTermFrequency("4") //
|
||||||
|
|||||||
+195
-221
@@ -18,8 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
@@ -30,7 +35,6 @@ import java.util.Calendar;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||||
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
||||||
@@ -56,19 +60,17 @@ import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
|||||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||||
import org.joda.time.Days;
|
import org.joda.time.Days;
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
@SuppressWarnings({ "unchecked" })
|
||||||
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({ "unused", "rawtypes", "unchecked", "static-access" })
|
|
||||||
public class AccountingScenarioIntegrationTest {
|
public class AccountingScenarioIntegrationTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(AccountingScenarioIntegrationTest.class);
|
||||||
private static RequestSpecification requestSpec;
|
private static RequestSpecification requestSpec;
|
||||||
private static ResponseSpecification responseSpec;
|
private static ResponseSpecification responseSpec;
|
||||||
|
|
||||||
@@ -89,13 +91,14 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
public static final String WITHDRAWAL_AMOUNT = "3000";
|
public static final String WITHDRAWAL_AMOUNT = "3000";
|
||||||
public static final String WITHDRAWAL_AMOUNT_ADJUSTED = "2000";
|
public static final String WITHDRAWAL_AMOUNT_ADJUSTED = "2000";
|
||||||
|
|
||||||
Float SP_BALANCE = new Float(MINIMUM_OPENING_BALANCE);
|
Float SP_BALANCE = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||||
Float SP_DEPOSIT_AMOUNT = new Float(DEPOSIT_AMOUNT);
|
Float SP_DEPOSIT_AMOUNT = Float.valueOf(DEPOSIT_AMOUNT);
|
||||||
Float SP_WITHDRAWAL_AMOUNT = new Float(WITHDRAWAL_AMOUNT);
|
Float SP_WITHDRAWAL_AMOUNT = Float.valueOf(WITHDRAWAL_AMOUNT);
|
||||||
Float SP_WITHDRAWAL_AMOUNT_ADJUSTED = new Float(WITHDRAWAL_AMOUNT_ADJUSTED);
|
Float SP_WITHDRAWAL_AMOUNT_ADJUSTED = Float.valueOf(WITHDRAWAL_AMOUNT_ADJUSTED);
|
||||||
|
|
||||||
private final String REPAYMENT_DATE[] = { "", "04 May 2011", "04 July 2011", "04 September 2011", "04 November 2011", "04 January 2012" };
|
private final String[] REPAYMENT_DATE = { "", "04 May 2011", "04 July 2011", "04 September 2011", "04 November 2011",
|
||||||
private final Float REPAYMENT_AMOUNT[] = { .0f, 2200.0f, 3000.0f, 900.0f, 2000.0f, 2500.0f };
|
"04 January 2012" };
|
||||||
|
private final Float[] REPAYMENT_AMOUNT = { .0f, 2200.0f, 3000.0f, 900.0f, 2000.0f, 2500.0f };
|
||||||
|
|
||||||
private final Float AMOUNT_TO_BE_WAIVE = 400.0f;
|
private final Float AMOUNT_TO_BE_WAIVE = 400.0f;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
@@ -109,18 +112,18 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
private SchedulerJobHelper schedulerJobHelper;
|
private SchedulerJobHelper schedulerJobHelper;
|
||||||
private PeriodicAccrualAccountingHelper periodicAccrualAccountingHelper;
|
private PeriodicAccrualAccountingHelper periodicAccrualAccountingHelper;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
|
|
||||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
this.loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
|
||||||
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
|
this.accountHelper = new AccountHelper(requestSpec, responseSpec);
|
||||||
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
|
this.journalEntryHelper = new JournalEntryHelper(requestSpec, responseSpec);
|
||||||
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
|
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||||
this.periodicAccrualAccountingHelper = new PeriodicAccrualAccountingHelper(this.requestSpec, this.responseSpec);
|
this.periodicAccrualAccountingHelper = new PeriodicAccrualAccountingHelper(requestSpec, responseSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -133,10 +136,10 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final Integer loanProductID = createLoanProductWithUpfrontAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
final Integer loanProductID = createLoanProductWithUpfrontAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||||
overpaymentAccount);
|
overpaymentAccount);
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
|
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||||
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||||
@@ -147,19 +150,19 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
// CHECK ACCOUNT ENTRIES
|
// CHECK ACCOUNT ENTRIES
|
||||||
System.out.println("Entries ......");
|
LOG.info("Entries ......");
|
||||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||||
final float TOTAL_INTEREST = 1000.0f;
|
final float TOTAL_INTEREST = 1000.0f;
|
||||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(TOTAL_INTEREST, JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(TOTAL_INTEREST, JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||||
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
|
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
||||||
System.out.println("CHECKING INCOME: ******************************************");
|
LOG.info("CHECKING INCOME: ******************************************");
|
||||||
final JournalEntry incomeJournalEntry = new JournalEntry(TOTAL_INTEREST, JournalEntry.TransactionType.CREDIT);
|
final JournalEntry incomeJournalEntry = new JournalEntry(TOTAL_INTEREST, JournalEntry.TransactionType.CREDIT);
|
||||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.EXPECTED_DISBURSAL_DATE, incomeJournalEntry);
|
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.EXPECTED_DISBURSAL_DATE, incomeJournalEntry);
|
||||||
|
|
||||||
// MAKE 1
|
// MAKE 1
|
||||||
System.out.println("Repayment 1 ......");
|
LOG.info("Repayment 1 ......");
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], this.REPAYMENT_AMOUNT[1], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], this.REPAYMENT_AMOUNT[1], loanID);
|
||||||
final float FIRST_INTEREST = 200.0f;
|
final float FIRST_INTEREST = 200.0f;
|
||||||
final float FIRST_PRINCIPAL = 2000.0f;
|
final float FIRST_PRINCIPAL = 2000.0f;
|
||||||
@@ -168,10 +171,10 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(FIRST_INTEREST + FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(FIRST_INTEREST + FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
|
||||||
System.out.println("Repayment 1 Done......");
|
LOG.info("Repayment 1 Done......");
|
||||||
|
|
||||||
// REPAYMENT 2
|
// REPAYMENT 2
|
||||||
System.out.println("Repayment 2 ......");
|
LOG.info("Repayment 2 ......");
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
|
||||||
final float SECOND_AND_THIRD_INTEREST = 400.0f;
|
final float SECOND_AND_THIRD_INTEREST = 400.0f;
|
||||||
final float SECOND_PRINCIPAL = this.REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
|
final float SECOND_PRINCIPAL = this.REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
|
||||||
@@ -180,10 +183,10 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(SECOND_AND_THIRD_INTEREST + SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(SECOND_AND_THIRD_INTEREST + SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
|
||||||
System.out.println("Repayment 2 Done ......");
|
LOG.info("Repayment 2 Done ......");
|
||||||
|
|
||||||
// WAIVE INTEREST
|
// WAIVE INTEREST
|
||||||
System.out.println("Waive Interest ......");
|
LOG.info("Waive Interest ......");
|
||||||
this.loanTransactionHelper.waiveInterest(this.REPAYMENT_DATE[4], this.AMOUNT_TO_BE_WAIVE.toString(), loanID);
|
this.loanTransactionHelper.waiveInterest(this.REPAYMENT_DATE[4], this.AMOUNT_TO_BE_WAIVE.toString(), loanID);
|
||||||
|
|
||||||
final JournalEntry waivedEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.CREDIT);
|
final JournalEntry waivedEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.CREDIT);
|
||||||
@@ -191,41 +194,41 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
|
|
||||||
final JournalEntry expenseJournalEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.DEBIT);
|
final JournalEntry expenseJournalEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.DEBIT);
|
||||||
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, this.REPAYMENT_DATE[4], expenseJournalEntry);
|
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, this.REPAYMENT_DATE[4], expenseJournalEntry);
|
||||||
System.out.println("Waive Interest Done......");
|
LOG.info("Waive Interest Done......");
|
||||||
|
|
||||||
// REPAYMENT 3
|
// REPAYMENT 3
|
||||||
System.out.println("Repayment 3 ......");
|
LOG.info("Repayment 3 ......");
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
|
||||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||||
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
||||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
|
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
|
||||||
System.out.println("Repayment 3 Done ......");
|
LOG.info("Repayment 3 Done ......");
|
||||||
|
|
||||||
// REPAYMENT 4
|
// REPAYMENT 4
|
||||||
System.out.println("Repayment 4 ......");
|
LOG.info("Repayment 4 ......");
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
|
||||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
|
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
|
||||||
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
|
||||||
System.out.println("Repayment 4 Done ......");
|
LOG.info("Repayment 4 Done ......");
|
||||||
|
|
||||||
// Repayment 5
|
// Repayment 5
|
||||||
System.out.println("Repayment 5 ......");
|
LOG.info("Repayment 5 ......");
|
||||||
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
||||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
|
||||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
|
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
|
||||||
System.out.println("Repayment 5 Done ......");
|
LOG.info("Repayment 5 Done ......");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer createLoanProductWithUpfrontAccrualAccountingEnabled(final Account... accounts) {
|
private Integer createLoanProductWithUpfrontAccrualAccountingEnabled(final Account... accounts) {
|
||||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
||||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||||
@@ -235,7 +238,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID) {
|
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID) {
|
||||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString())
|
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString())
|
||||||
.withLoanTermFrequency(this.LOAN_TERM_FREQUENCY).withLoanTermFrequencyAsMonths().withNumberOfRepayments(this.LP_REPAYMENTS)
|
.withLoanTermFrequency(this.LOAN_TERM_FREQUENCY).withLoanTermFrequencyAsMonths().withNumberOfRepayments(this.LP_REPAYMENTS)
|
||||||
.withRepaymentEveryAfter(this.LP_REPAYMENT_PERIOD).withRepaymentFrequencyTypeAsMonths()
|
.withRepaymentEveryAfter(this.LP_REPAYMENT_PERIOD).withRepaymentFrequencyTypeAsMonths()
|
||||||
@@ -248,7 +251,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkAccountingWithSavingsFlow() {
|
public void checkAccountingWithSavingsFlow() {
|
||||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||||
|
|
||||||
final Account assetAccount = this.accountHelper.createAssetAccount();
|
final Account assetAccount = this.accountHelper.createAssetAccount();
|
||||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||||
@@ -258,10 +261,10 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final Integer savingsProductID = createSavingsProduct(MINIMUM_OPENING_BALANCE, assetAccount, incomeAccount, expenseAccount,
|
final Integer savingsProductID = createSavingsProduct(MINIMUM_OPENING_BALANCE, assetAccount, incomeAccount, expenseAccount,
|
||||||
liabilityAccount);
|
liabilityAccount);
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
|
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||||
final Integer savingsID = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
|
final Integer savingsID = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
|
||||||
|
|
||||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsID);
|
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(requestSpec, responseSpec, savingsID);
|
||||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||||
|
|
||||||
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsID);
|
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsID);
|
||||||
@@ -274,21 +277,21 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.DEBIT) };
|
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.DEBIT) };
|
||||||
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.CREDIT) };
|
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.CREDIT) };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountInitialEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountInitialEntry);
|
||||||
this.journalEntryHelper
|
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
||||||
.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE, liablilityAccountInitialEntry);
|
liablilityAccountInitialEntry);
|
||||||
|
|
||||||
// First Transaction-Deposit
|
// First Transaction-Deposit
|
||||||
this.savingsAccountHelper.depositToSavingsAccount(savingsID, DEPOSIT_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE,
|
this.savingsAccountHelper.depositToSavingsAccount(savingsID, DEPOSIT_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE,
|
||||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
Float balance = SP_BALANCE + SP_DEPOSIT_AMOUNT;
|
Float balance = SP_BALANCE + SP_DEPOSIT_AMOUNT;
|
||||||
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsID);
|
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsID);
|
||||||
assertEquals("Verifying Balance after Deposit", balance, summary.get("accountBalance"));
|
assertEquals(balance, summary.get("accountBalance"), "Verifying Balance after Deposit");
|
||||||
|
|
||||||
System.out.println("----------------------Verifying Journal Entry after the Transaction Deposit----------------------------");
|
LOG.info("----------------------Verifying Journal Entry after the Transaction Deposit----------------------------");
|
||||||
final JournalEntry[] assetAccountFirstTransactionEntry = { new JournalEntry(this.SP_DEPOSIT_AMOUNT,
|
final JournalEntry[] assetAccountFirstTransactionEntry = {
|
||||||
JournalEntry.TransactionType.DEBIT) };
|
new JournalEntry(this.SP_DEPOSIT_AMOUNT, JournalEntry.TransactionType.DEBIT) };
|
||||||
final JournalEntry[] liabililityAccountFirstTransactionEntry = { new JournalEntry(this.SP_DEPOSIT_AMOUNT,
|
final JournalEntry[] liabililityAccountFirstTransactionEntry = {
|
||||||
JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(this.SP_DEPOSIT_AMOUNT, JournalEntry.TransactionType.CREDIT) };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountFirstTransactionEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountFirstTransactionEntry);
|
||||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
||||||
liabililityAccountFirstTransactionEntry);
|
liabililityAccountFirstTransactionEntry);
|
||||||
@@ -298,40 +301,39 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
balance -= SP_WITHDRAWAL_AMOUNT;
|
balance -= SP_WITHDRAWAL_AMOUNT;
|
||||||
summary = this.savingsAccountHelper.getSavingsSummary(savingsID);
|
summary = this.savingsAccountHelper.getSavingsSummary(savingsID);
|
||||||
assertEquals("Verifying Balance after Withdrawal", balance, summary.get("accountBalance"));
|
assertEquals(balance, summary.get("accountBalance"), "Verifying Balance after Withdrawal");
|
||||||
|
|
||||||
System.out.println("-------------------Verifying Journal Entry after the Transaction Withdrawal----------------------");
|
LOG.info("-------------------Verifying Journal Entry after the Transaction Withdrawal----------------------");
|
||||||
final JournalEntry[] assetAccountSecondTransactionEntry = { new JournalEntry(this.SP_WITHDRAWAL_AMOUNT,
|
final JournalEntry[] assetAccountSecondTransactionEntry = {
|
||||||
JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT, JournalEntry.TransactionType.CREDIT) };
|
||||||
final JournalEntry[] liabililityAccountSecondTransactionEntry = { new JournalEntry(this.SP_WITHDRAWAL_AMOUNT,
|
final JournalEntry[] liabililityAccountSecondTransactionEntry = {
|
||||||
JournalEntry.TransactionType.DEBIT) };
|
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT, JournalEntry.TransactionType.DEBIT) };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountSecondTransactionEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountSecondTransactionEntry);
|
||||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
||||||
liabililityAccountSecondTransactionEntry);
|
liabililityAccountSecondTransactionEntry);
|
||||||
|
|
||||||
// Third Transaction-Add Charges for Withdrawal Fee
|
// Third Transaction-Add Charges for Withdrawal Fee
|
||||||
final Integer withdrawalChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
final Integer withdrawalChargeId = ChargesHelper.createCharges(requestSpec, responseSpec,
|
||||||
ChargesHelper.getSavingsWithdrawalFeeJSON());
|
ChargesHelper.getSavingsWithdrawalFeeJSON());
|
||||||
Assert.assertNotNull(withdrawalChargeId);
|
Assertions.assertNotNull(withdrawalChargeId);
|
||||||
|
|
||||||
this.savingsAccountHelper.addChargesForSavings(savingsID, withdrawalChargeId, false);
|
this.savingsAccountHelper.addChargesForSavings(savingsID, withdrawalChargeId, false);
|
||||||
ArrayList<HashMap> chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsID);
|
ArrayList<HashMap> chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsID);
|
||||||
Assert.assertEquals(1, chargesPendingState.size());
|
Assertions.assertEquals(1, chargesPendingState.size());
|
||||||
HashMap savingsChargeForPay = chargesPendingState.get(0);
|
HashMap savingsChargeForPay = chargesPendingState.get(0);
|
||||||
HashMap paidCharge = this.savingsAccountHelper.getSavingsCharge(savingsID, (Integer) savingsChargeForPay.get("id"));
|
HashMap paidCharge = this.savingsAccountHelper.getSavingsCharge(savingsID, (Integer) savingsChargeForPay.get("id"));
|
||||||
Float chargeAmount = (Float) paidCharge.get("amount");
|
Float chargeAmount = (Float) paidCharge.get("amount");
|
||||||
|
|
||||||
// Withdrawal after adding Charge of type Withdrawal Fee
|
// Withdrawal after adding Charge of type Withdrawal Fee
|
||||||
this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsID, WITHDRAWAL_AMOUNT_ADJUSTED,
|
this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsID, WITHDRAWAL_AMOUNT_ADJUSTED, SavingsAccountHelper.TRANSACTION_DATE,
|
||||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
summary = this.savingsAccountHelper.getSavingsSummary(savingsID);
|
summary = this.savingsAccountHelper.getSavingsSummary(savingsID);
|
||||||
balance = balance - SP_WITHDRAWAL_AMOUNT_ADJUSTED - chargeAmount;
|
balance = balance - SP_WITHDRAWAL_AMOUNT_ADJUSTED - chargeAmount;
|
||||||
|
|
||||||
final JournalEntry[] liabililityAccountThirdTransactionEntry = {
|
final JournalEntry[] liabililityAccountThirdTransactionEntry = { new JournalEntry(chargeAmount, JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(chargeAmount, JournalEntry.TransactionType.DEBIT),
|
|
||||||
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT_ADJUSTED, JournalEntry.TransactionType.DEBIT) };
|
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT_ADJUSTED, JournalEntry.TransactionType.DEBIT) };
|
||||||
final JournalEntry[] assetAccountThirdTransactionEntry = { new JournalEntry(this.SP_WITHDRAWAL_AMOUNT_ADJUSTED,
|
final JournalEntry[] assetAccountThirdTransactionEntry = {
|
||||||
JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT_ADJUSTED, JournalEntry.TransactionType.CREDIT) };
|
||||||
final JournalEntry[] incomeAccountThirdTransactionEntry = { new JournalEntry(chargeAmount, JournalEntry.TransactionType.CREDIT) };
|
final JournalEntry[] incomeAccountThirdTransactionEntry = { new JournalEntry(chargeAmount, JournalEntry.TransactionType.CREDIT) };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountThirdTransactionEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountThirdTransactionEntry);
|
||||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
||||||
@@ -339,15 +341,15 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.TRANSACTION_DATE, incomeAccountThirdTransactionEntry);
|
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.TRANSACTION_DATE, incomeAccountThirdTransactionEntry);
|
||||||
|
|
||||||
// Verifying Balance after applying Charge for Withdrawal Fee
|
// Verifying Balance after applying Charge for Withdrawal Fee
|
||||||
assertEquals("Verifying Balance", balance, summary.get("accountBalance"));
|
assertEquals(balance, summary.get("accountBalance"), "Verifying Balance");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFixedDepositAccountingFlow() {
|
public void testFixedDepositAccountingFlow() {
|
||||||
this.fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
|
this.fixedDepositProductHelper = new FixedDepositProductHelper(requestSpec, responseSpec);
|
||||||
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
|
this.accountHelper = new AccountHelper(requestSpec, responseSpec);
|
||||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||||
this.fixedDepositAccountHelper = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec);
|
this.fixedDepositAccountHelper = new FixedDepositAccountHelper(requestSpec, responseSpec);
|
||||||
|
|
||||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||||
DateFormat currentDateFormat = new SimpleDateFormat("dd");
|
DateFormat currentDateFormat = new SimpleDateFormat("dd");
|
||||||
@@ -364,7 +366,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final String APPROVED_ON_DATE = dateFormat.format(todaysDate.getTime());
|
final String APPROVED_ON_DATE = dateFormat.format(todaysDate.getTime());
|
||||||
final String ACTIVATION_DATE = dateFormat.format(todaysDate.getTime());
|
final String ACTIVATION_DATE = dateFormat.format(todaysDate.getTime());
|
||||||
|
|
||||||
Integer currentDate = new Integer(currentDateFormat.format(todaysDate.getTime()));
|
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
|
||||||
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
|
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
|
||||||
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1;
|
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1;
|
||||||
todaysDate.add(Calendar.DATE, numberOfDaysLeft);
|
todaysDate.add(Calendar.DATE, numberOfDaysLeft);
|
||||||
@@ -375,19 +377,19 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
||||||
final Account liabilityAccount = this.accountHelper.createLiabilityAccount();
|
final Account liabilityAccount = this.accountHelper.createLiabilityAccount();
|
||||||
|
|
||||||
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
Integer clientId = ClientHelper.createClient(requestSpec, responseSpec);
|
||||||
Assert.assertNotNull(clientId);
|
Assertions.assertNotNull(clientId);
|
||||||
|
|
||||||
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, assetAccount, incomeAccount, expenseAccount,
|
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, assetAccount, incomeAccount, expenseAccount,
|
||||||
liabilityAccount);
|
liabilityAccount);
|
||||||
Assert.assertNotNull(fixedDepositProductId);
|
Assertions.assertNotNull(fixedDepositProductId);
|
||||||
|
|
||||||
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM,
|
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM,
|
||||||
VALID_TO, SUBMITTED_ON_DATE, FixedDepositTest.WHOLE_TERM);
|
VALID_TO, SUBMITTED_ON_DATE, FixedDepositTest.WHOLE_TERM);
|
||||||
Assert.assertNotNull(fixedDepositAccountId);
|
Assertions.assertNotNull(fixedDepositAccountId);
|
||||||
|
|
||||||
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
|
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(requestSpec,
|
||||||
this.responseSpec, fixedDepositAccountId.toString());
|
responseSpec, fixedDepositAccountId.toString());
|
||||||
FixedDepositAccountStatusChecker.verifyFixedDepositIsPending(fixedDepositAccountStatusHashMap);
|
FixedDepositAccountStatusChecker.verifyFixedDepositIsPending(fixedDepositAccountStatusHashMap);
|
||||||
|
|
||||||
fixedDepositAccountStatusHashMap = this.fixedDepositAccountHelper.approveFixedDeposit(fixedDepositAccountId, APPROVED_ON_DATE);
|
fixedDepositAccountStatusHashMap = this.fixedDepositAccountHelper.approveFixedDeposit(fixedDepositAccountId, APPROVED_ON_DATE);
|
||||||
@@ -407,7 +409,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, ACTIVATION_DATE, liablilityAccountInitialEntry);
|
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, ACTIVATION_DATE, liablilityAccountInitialEntry);
|
||||||
|
|
||||||
Integer transactionIdForPostInterest = this.fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId);
|
Integer transactionIdForPostInterest = this.fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId);
|
||||||
Assert.assertNotNull(transactionIdForPostInterest);
|
Assertions.assertNotNull(transactionIdForPostInterest);
|
||||||
|
|
||||||
accountSummary = this.fixedDepositAccountHelper.getFixedDepositSummary(fixedDepositAccountId);
|
accountSummary = this.fixedDepositAccountHelper.getFixedDepositSummary(fixedDepositAccountId);
|
||||||
Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted");
|
Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted");
|
||||||
@@ -422,9 +424,9 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRecurringDepositAccountingFlow() {
|
public void testRecurringDepositAccountingFlow() {
|
||||||
this.recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec);
|
this.recurringDepositProductHelper = new RecurringDepositProductHelper(requestSpec, responseSpec);
|
||||||
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
|
this.accountHelper = new AccountHelper(requestSpec, responseSpec);
|
||||||
this.recurringDepositAccountHelper = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec);
|
this.recurringDepositAccountHelper = new RecurringDepositAccountHelper(requestSpec, responseSpec);
|
||||||
|
|
||||||
final Account assetAccount = this.accountHelper.createAssetAccount();
|
final Account assetAccount = this.accountHelper.createAssetAccount();
|
||||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||||
@@ -447,25 +449,25 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final String ACTIVATION_DATE = dateFormat.format(todaysDate.getTime());
|
final String ACTIVATION_DATE = dateFormat.format(todaysDate.getTime());
|
||||||
final String EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(todaysDate.getTime());
|
final String EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(todaysDate.getTime());
|
||||||
|
|
||||||
Integer currentDate = new Integer(currentDateFormat.format(todaysDate.getTime()));
|
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
|
||||||
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
|
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
|
||||||
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1;
|
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1;
|
||||||
todaysDate.add(Calendar.DATE, numberOfDaysLeft);
|
todaysDate.add(Calendar.DATE, numberOfDaysLeft);
|
||||||
final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime());
|
final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime());
|
||||||
|
|
||||||
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
Integer clientId = ClientHelper.createClient(requestSpec, responseSpec);
|
||||||
Assert.assertNotNull(clientId);
|
Assertions.assertNotNull(clientId);
|
||||||
|
|
||||||
Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, assetAccount, liabilityAccount,
|
Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, assetAccount, liabilityAccount,
|
||||||
incomeAccount, expenseAccount);
|
incomeAccount, expenseAccount);
|
||||||
Assert.assertNotNull(recurringDepositProductId);
|
Assertions.assertNotNull(recurringDepositProductId);
|
||||||
|
|
||||||
Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(),
|
Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(),
|
||||||
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, RecurringDepositTest.WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
|
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, RecurringDepositTest.WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
|
||||||
Assert.assertNotNull(recurringDepositAccountId);
|
Assertions.assertNotNull(recurringDepositAccountId);
|
||||||
|
|
||||||
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
|
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(requestSpec,
|
||||||
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
|
responseSpec, recurringDepositAccountId.toString());
|
||||||
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
|
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
|
||||||
|
|
||||||
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
|
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
|
||||||
@@ -476,13 +478,13 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
ACTIVATION_DATE);
|
ACTIVATION_DATE);
|
||||||
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsActive(recurringDepositAccountStatusHashMap);
|
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsActive(recurringDepositAccountStatusHashMap);
|
||||||
|
|
||||||
HashMap recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
|
HashMap recurringDepositAccountData = RecurringDepositAccountHelper.getRecurringDepositAccountById(requestSpec, responseSpec,
|
||||||
this.responseSpec, recurringDepositAccountId);
|
recurringDepositAccountId);
|
||||||
Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount");
|
Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount");
|
||||||
|
|
||||||
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
|
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
|
||||||
depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE);
|
depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE);
|
||||||
Assert.assertNotNull(depositTransactionId);
|
Assertions.assertNotNull(depositTransactionId);
|
||||||
|
|
||||||
// Checking initial Journal entries after Activation.
|
// Checking initial Journal entries after Activation.
|
||||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) };
|
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) };
|
||||||
@@ -493,7 +495,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
|
|
||||||
Integer interestPostingTransactionId = this.recurringDepositAccountHelper
|
Integer interestPostingTransactionId = this.recurringDepositAccountHelper
|
||||||
.postInterestForRecurringDeposit(recurringDepositAccountId);
|
.postInterestForRecurringDeposit(recurringDepositAccountId);
|
||||||
Assert.assertNotNull(interestPostingTransactionId);
|
Assertions.assertNotNull(interestPostingTransactionId);
|
||||||
|
|
||||||
HashMap accountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId);
|
HashMap accountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId);
|
||||||
Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted");
|
Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted");
|
||||||
@@ -507,7 +509,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Integer createSavingsProduct(final String minOpenningBalance, final Account... accounts) {
|
public static Integer createSavingsProduct(final String minOpenningBalance, final Account... accounts) {
|
||||||
System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
||||||
final String savingsProductJSON = new SavingsProductHelper().withInterestCompoundingPeriodTypeAsDaily() //
|
final String savingsProductJSON = new SavingsProductHelper().withInterestCompoundingPeriodTypeAsDaily() //
|
||||||
.withInterestPostingPeriodTypeAsQuarterly() //
|
.withInterestPostingPeriodTypeAsQuarterly() //
|
||||||
.withInterestCalculationPeriodTypeAsDailyBalance() //
|
.withInterestCalculationPeriodTypeAsDailyBalance() //
|
||||||
@@ -516,8 +518,8 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Integer createFixedDepositProduct(final String validFrom, final String validTo, Account... accounts) {
|
private Integer createFixedDepositProduct(final String validFrom, final String validTo, Account... accounts) {
|
||||||
System.out.println("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
|
||||||
FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
|
FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(requestSpec, responseSpec);
|
||||||
final String fixedDepositProductJSON = fixedDepositProductHelper //
|
final String fixedDepositProductJSON = fixedDepositProductHelper //
|
||||||
.withPeriodRangeChart()//
|
.withPeriodRangeChart()//
|
||||||
.withAccountingRuleAsCashBased(accounts).build(validFrom, validTo);
|
.withAccountingRuleAsCashBased(accounts).build(validFrom, validTo);
|
||||||
@@ -526,16 +528,15 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
|
|
||||||
private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String validFrom,
|
private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String validFrom,
|
||||||
final String validTo, final String submittedOnDate, final String penalInterestType) {
|
final String validTo, final String submittedOnDate, final String penalInterestType) {
|
||||||
System.out.println("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
|
LOG.info("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
|
||||||
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec) //
|
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(requestSpec, responseSpec) //
|
||||||
.withSubmittedOnDate(submittedOnDate).build(clientID, productID, penalInterestType);
|
.withSubmittedOnDate(submittedOnDate).build(clientID, productID, penalInterestType);
|
||||||
return this.fixedDepositAccountHelper
|
return FixedDepositAccountHelper.applyFixedDepositApplication(fixedDepositApplicationJSON, requestSpec, responseSpec);
|
||||||
.applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec, this.responseSpec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer createRecurringDepositProduct(final String validFrom, final String validTo, Account... accounts) {
|
private Integer createRecurringDepositProduct(final String validFrom, final String validTo, Account... accounts) {
|
||||||
System.out.println("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------");
|
||||||
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec);
|
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(requestSpec, responseSpec);
|
||||||
final String recurringDepositProductJSON = recurringDepositProductHelper //
|
final String recurringDepositProductJSON = recurringDepositProductHelper //
|
||||||
.withPeriodRangeChart()//
|
.withPeriodRangeChart()//
|
||||||
.withAccountingRuleAsCashBased(accounts).build(validFrom, validTo);
|
.withAccountingRuleAsCashBased(accounts).build(validFrom, validTo);
|
||||||
@@ -544,17 +545,16 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
|
|
||||||
private Integer applyForRecurringDepositApplication(final String clientID, final String productID, final String validFrom,
|
private Integer applyForRecurringDepositApplication(final String clientID, final String productID, final String validFrom,
|
||||||
final String validTo, final String submittedOnDate, final String penalInterestType, final String expectedFirstDepositOnDate) {
|
final String validTo, final String submittedOnDate, final String penalInterestType, final String expectedFirstDepositOnDate) {
|
||||||
System.out.println("--------------------------------APPLYING FOR RECURRING DEPOSIT ACCOUNT --------------------------------");
|
LOG.info("--------------------------------APPLYING FOR RECURRING DEPOSIT ACCOUNT --------------------------------");
|
||||||
final String recurringDepositApplicationJSON = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec)
|
final String recurringDepositApplicationJSON = new RecurringDepositAccountHelper(requestSpec, responseSpec)
|
||||||
//
|
//
|
||||||
.withSubmittedOnDate(submittedOnDate).withExpectedFirstDepositOnDate(expectedFirstDepositOnDate)
|
.withSubmittedOnDate(submittedOnDate).withExpectedFirstDepositOnDate(expectedFirstDepositOnDate)
|
||||||
.build(clientID, productID, penalInterestType);
|
.build(clientID, productID, penalInterestType);
|
||||||
return this.recurringDepositAccountHelper.applyRecurringDepositApplication(recurringDepositApplicationJSON, this.requestSpec,
|
return RecurringDepositAccountHelper.applyRecurringDepositApplication(recurringDepositApplicationJSON, requestSpec, responseSpec);
|
||||||
this.responseSpec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkPeriodicAccrualAccountingFlow() {
|
public void checkPeriodicAccrualAccountingFlow() throws InterruptedException, ParseException {
|
||||||
final Account assetAccount = this.accountHelper.createAssetAccount();
|
final Account assetAccount = this.accountHelper.createAssetAccount();
|
||||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||||
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
||||||
@@ -563,10 +563,10 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||||
overpaymentAccount);
|
overpaymentAccount);
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
|
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||||
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||||
@@ -577,7 +577,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
// CHECK ACCOUNT ENTRIES
|
// CHECK ACCOUNT ENTRIES
|
||||||
System.out.println("Entries ......");
|
LOG.info("Entries ......");
|
||||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||||
final float TOTAL_INTEREST = 1000.0f;
|
final float TOTAL_INTEREST = 1000.0f;
|
||||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||||
@@ -585,14 +585,11 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
||||||
|
|
||||||
final String jobName = "Add Accrual Transactions";
|
final String jobName = "Add Accrual Transactions";
|
||||||
try {
|
|
||||||
this.schedulerJobHelper.executeJob(jobName);
|
this.schedulerJobHelper.executeAndAwaitJob(jobName);
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
// MAKE 1
|
// MAKE 1
|
||||||
System.out.println("Repayment 1 ......");
|
LOG.info("Repayment 1 ......");
|
||||||
final float FIRST_INTEREST = 200.0f;
|
final float FIRST_INTEREST = 200.0f;
|
||||||
final float FIRST_PRINCIPAL = 2000.0f;
|
final float FIRST_PRINCIPAL = 2000.0f;
|
||||||
final float FEE_PORTION = 0.0f;
|
final float FEE_PORTION = 0.0f;
|
||||||
@@ -605,10 +602,10 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(FIRST_INTEREST + FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(FIRST_INTEREST + FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
|
||||||
System.out.println("Repayment 1 Done......");
|
LOG.info("Repayment 1 Done......");
|
||||||
|
|
||||||
// REPAYMENT 2
|
// REPAYMENT 2
|
||||||
System.out.println("Repayment 2 ......");
|
LOG.info("Repayment 2 ......");
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
|
||||||
final float SECOND_AND_THIRD_INTEREST = 400.0f;
|
final float SECOND_AND_THIRD_INTEREST = 400.0f;
|
||||||
final float SECOND_PRINCIPAL = this.REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
|
final float SECOND_PRINCIPAL = this.REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
|
||||||
@@ -621,10 +618,10 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(SECOND_AND_THIRD_INTEREST + SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(SECOND_AND_THIRD_INTEREST + SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
|
||||||
System.out.println("Repayment 2 Done ......");
|
LOG.info("Repayment 2 Done ......");
|
||||||
|
|
||||||
// WAIVE INTEREST
|
// WAIVE INTEREST
|
||||||
System.out.println("Waive Interest ......");
|
LOG.info("Waive Interest ......");
|
||||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[4]), FIRST_INTEREST,
|
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[4]), FIRST_INTEREST,
|
||||||
FEE_PORTION, PENALTY_PORTION, loanID);
|
FEE_PORTION, PENALTY_PORTION, loanID);
|
||||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[5]), FIRST_INTEREST,
|
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[5]), FIRST_INTEREST,
|
||||||
@@ -636,41 +633,41 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
|
|
||||||
final JournalEntry expenseJournalEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.DEBIT);
|
final JournalEntry expenseJournalEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.DEBIT);
|
||||||
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, this.REPAYMENT_DATE[4], expenseJournalEntry);
|
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, this.REPAYMENT_DATE[4], expenseJournalEntry);
|
||||||
System.out.println("Waive Interest Done......");
|
LOG.info("Waive Interest Done......");
|
||||||
|
|
||||||
// REPAYMENT 3
|
// REPAYMENT 3
|
||||||
System.out.println("Repayment 3 ......");
|
LOG.info("Repayment 3 ......");
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
|
||||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||||
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
||||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
|
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
|
||||||
System.out.println("Repayment 3 Done ......");
|
LOG.info("Repayment 3 Done ......");
|
||||||
|
|
||||||
// REPAYMENT 4
|
// REPAYMENT 4
|
||||||
System.out.println("Repayment 4 ......");
|
LOG.info("Repayment 4 ......");
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
|
||||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
|
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
|
||||||
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
|
||||||
System.out.println("Repayment 4 Done ......");
|
LOG.info("Repayment 4 Done ......");
|
||||||
|
|
||||||
// Repayment 5
|
// Repayment 5
|
||||||
System.out.println("Repayment 5 ......");
|
LOG.info("Repayment 5 ......");
|
||||||
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
||||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
|
||||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
|
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
|
||||||
System.out.println("Repayment 5 Done ......");
|
LOG.info("Repayment 5 Done ......");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkPeriodicAccrualAccountingFlow_OVER_PAYMENT() {
|
public void checkPeriodicAccrualAccountingFlow_OVER_PAYMENT() throws InterruptedException, ParseException {
|
||||||
final Account assetAccount = this.accountHelper.createAssetAccount();
|
final Account assetAccount = this.accountHelper.createAssetAccount();
|
||||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||||
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
||||||
@@ -679,10 +676,10 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||||
overpaymentAccount);
|
overpaymentAccount);
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
|
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||||
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||||
@@ -693,7 +690,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
// CHECK ACCOUNT ENTRIES
|
// CHECK ACCOUNT ENTRIES
|
||||||
System.out.println("Entries ......");
|
LOG.info("Entries ......");
|
||||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||||
final float TOTAL_INTEREST = 1000.0f;
|
final float TOTAL_INTEREST = 1000.0f;
|
||||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||||
@@ -701,14 +698,11 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
||||||
|
|
||||||
final String jobName = "Add Accrual Transactions";
|
final String jobName = "Add Accrual Transactions";
|
||||||
try {
|
|
||||||
this.schedulerJobHelper.executeJob(jobName);
|
this.schedulerJobHelper.executeAndAwaitJob(jobName);
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
// MAKE 1
|
// MAKE 1
|
||||||
System.out.println("Repayment 1 ......");
|
LOG.info("Repayment 1 ......");
|
||||||
final float FIRST_INTEREST = 200.0f;
|
final float FIRST_INTEREST = 200.0f;
|
||||||
final float FIRST_PRINCIPAL = 2000.0f;
|
final float FIRST_PRINCIPAL = 2000.0f;
|
||||||
final float FEE_PORTION = 0.0f;
|
final float FEE_PORTION = 0.0f;
|
||||||
@@ -721,14 +715,14 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final JournalEntry[] assetAccountEntry = { new JournalEntry(15000f, JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountEntry = { new JournalEntry(15000f, JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(11000f, JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(11000f, JournalEntry.TransactionType.CREDIT) };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountEntry);
|
||||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, this.REPAYMENT_DATE[1], new JournalEntry(4000f,
|
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, this.REPAYMENT_DATE[1],
|
||||||
JournalEntry.TransactionType.CREDIT));
|
new JournalEntry(4000f, JournalEntry.TransactionType.CREDIT));
|
||||||
System.out.println("Repayment Done......");
|
LOG.info("Repayment Done......");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkPeriodicAccrualAccountingTillCurrentDateFlow() {
|
public void checkPeriodicAccrualAccountingTillCurrentDateFlow() throws InterruptedException, ParseException {
|
||||||
final Account assetAccount = this.accountHelper.createAssetAccount();
|
final Account assetAccount = this.accountHelper.createAssetAccount();
|
||||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||||
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
||||||
@@ -737,17 +731,17 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||||
overpaymentAccount);
|
overpaymentAccount);
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
|
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||||
|
|
||||||
final float FEE_PORTION = 50.0f;
|
final float FEE_PORTION = 50.0f;
|
||||||
final float PENALTY_PORTION = 100.0f;
|
final float PENALTY_PORTION = 100.0f;
|
||||||
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
|
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
|
||||||
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(FEE_PORTION), false));
|
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(FEE_PORTION), false));
|
||||||
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
|
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
|
||||||
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
|
.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
|
||||||
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||||
@@ -772,16 +766,14 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
|
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
this.loanTransactionHelper.addChargesForLoan(
|
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
|
||||||
loanID,
|
String.valueOf(flatSpecifiedDueDate), dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
|
||||||
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDate),
|
|
||||||
dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
|
|
||||||
todayDate.add(Calendar.DATE, 1);
|
todayDate.add(Calendar.DATE, 1);
|
||||||
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
|
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
|
||||||
String.valueOf(flat), dateFormat.format(todayDate.getTime()), String.valueOf(FEE_PORTION)));
|
String.valueOf(flat), dateFormat.format(todayDate.getTime()), String.valueOf(FEE_PORTION)));
|
||||||
|
|
||||||
// CHECK ACCOUNT ENTRIES
|
// CHECK ACCOUNT ENTRIES
|
||||||
System.out.println("Entries ......");
|
LOG.info("Entries ......");
|
||||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||||
final float TOTAL_INTEREST = 1000.0f;
|
final float TOTAL_INTEREST = 1000.0f;
|
||||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||||
@@ -789,14 +781,10 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, LOAN_DISBURSEMENT_DATE, assetAccountInitialEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, LOAN_DISBURSEMENT_DATE, assetAccountInitialEntry);
|
||||||
|
|
||||||
final String jobName = "Add Periodic Accrual Transactions";
|
final String jobName = "Add Periodic Accrual Transactions";
|
||||||
try {
|
|
||||||
this.schedulerJobHelper.executeJob(jobName);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
|
this.schedulerJobHelper.executeAndAwaitJob(jobName);
|
||||||
loanID);
|
|
||||||
|
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, responseSpec, loanID);
|
||||||
// MAKE 1
|
// MAKE 1
|
||||||
List fromDateList = (List) loanSchedule.get(1).get("fromDate");
|
List fromDateList = (List) loanSchedule.get(1).get("fromDate");
|
||||||
LocalDate fromDateLocal = LocalDate.now();
|
LocalDate fromDateLocal = LocalDate.now();
|
||||||
@@ -815,7 +803,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue");
|
float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue");
|
||||||
DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US));
|
DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US));
|
||||||
float INTEREST_4_DAYS = totalInterest / totalDaysInPeriod * 4;
|
float INTEREST_4_DAYS = totalInterest / totalDaysInPeriod * 4;
|
||||||
INTEREST_4_DAYS = new Float(numberFormat.format(INTEREST_4_DAYS));
|
INTEREST_4_DAYS = Float.valueOf(numberFormat.format(INTEREST_4_DAYS));
|
||||||
|
|
||||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(currentDate), INTEREST_4_DAYS, FEE_PORTION,
|
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(currentDate), INTEREST_4_DAYS, FEE_PORTION,
|
||||||
PENALTY_PORTION, loanID);
|
PENALTY_PORTION, loanID);
|
||||||
@@ -823,7 +811,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkPeriodicAccrualAccountingAPIFlow() {
|
public void checkPeriodicAccrualAccountingAPIFlow() throws ParseException {
|
||||||
final Account assetAccount = this.accountHelper.createAssetAccount();
|
final Account assetAccount = this.accountHelper.createAssetAccount();
|
||||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||||
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
||||||
@@ -832,7 +820,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||||
overpaymentAccount);
|
overpaymentAccount);
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
|
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||||
|
|
||||||
final float FEE_PORTION = 50.0f;
|
final float FEE_PORTION = 50.0f;
|
||||||
@@ -842,15 +830,15 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
|
|
||||||
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
|
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
|
||||||
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(FEE_PORTION), false));
|
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(FEE_PORTION), false));
|
||||||
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
|
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
|
||||||
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
|
.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
|
||||||
|
|
||||||
Integer flatNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
|
Integer flatNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
|
||||||
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(NEXT_FEE_PORTION), false));
|
.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(NEXT_FEE_PORTION), false));
|
||||||
Integer flatSpecifiedDueDateNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
|
Integer flatSpecifiedDueDateNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
|
||||||
.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(NEXT_PENALTY_PORTION), true));
|
.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(NEXT_PENALTY_PORTION), true));
|
||||||
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||||
@@ -875,32 +863,23 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
|
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
this.loanTransactionHelper.addChargesForLoan(
|
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
|
||||||
loanID,
|
String.valueOf(flatSpecifiedDueDate), dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
|
||||||
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDate),
|
|
||||||
dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
|
|
||||||
todayDate.add(Calendar.DATE, 1);
|
todayDate.add(Calendar.DATE, 1);
|
||||||
String runOndate = dateFormat.format(todayDate.getTime());
|
String runOndate = dateFormat.format(todayDate.getTime());
|
||||||
|
|
||||||
this.loanTransactionHelper
|
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper
|
||||||
.addChargesForLoan(
|
.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flat), runOndate, String.valueOf(FEE_PORTION)));
|
||||||
loanID,
|
|
||||||
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flat), runOndate,
|
|
||||||
String.valueOf(FEE_PORTION)));
|
|
||||||
|
|
||||||
todayDate.add(Calendar.DATE, 1);
|
todayDate.add(Calendar.DATE, 1);
|
||||||
this.loanTransactionHelper.addChargesForLoan(
|
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
|
||||||
loanID,
|
String.valueOf(flatSpecifiedDueDateNext), dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_PENALTY_PORTION)));
|
||||||
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDateNext),
|
|
||||||
dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_PENALTY_PORTION)));
|
|
||||||
|
|
||||||
this.loanTransactionHelper.addChargesForLoan(
|
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
|
||||||
loanID,
|
String.valueOf(flatNext), dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_FEE_PORTION)));
|
||||||
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatNext),
|
|
||||||
dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_FEE_PORTION)));
|
|
||||||
|
|
||||||
// CHECK ACCOUNT ENTRIES
|
// CHECK ACCOUNT ENTRIES
|
||||||
System.out.println("Entries ......");
|
LOG.info("Entries ......");
|
||||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||||
final float TOTAL_INTEREST = 1000.0f;
|
final float TOTAL_INTEREST = 1000.0f;
|
||||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||||
@@ -909,8 +888,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
|
|
||||||
this.periodicAccrualAccountingHelper.runPeriodicAccrualAccounting(runOndate);
|
this.periodicAccrualAccountingHelper.runPeriodicAccrualAccounting(runOndate);
|
||||||
|
|
||||||
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
|
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, responseSpec, loanID);
|
||||||
loanID);
|
|
||||||
// MAKE 1
|
// MAKE 1
|
||||||
List fromDateList = (List) loanSchedule.get(1).get("fromDate");
|
List fromDateList = (List) loanSchedule.get(1).get("fromDate");
|
||||||
LocalDate fromDateLocal = LocalDate.now();
|
LocalDate fromDateLocal = LocalDate.now();
|
||||||
@@ -929,7 +907,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue");
|
float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue");
|
||||||
DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US));
|
DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US));
|
||||||
float INTEREST_3_DAYS = totalInterest / totalDaysInPeriod * 3;
|
float INTEREST_3_DAYS = totalInterest / totalDaysInPeriod * 3;
|
||||||
INTEREST_3_DAYS = new Float(numberFormat.format(INTEREST_3_DAYS));
|
INTEREST_3_DAYS = Float.valueOf(numberFormat.format(INTEREST_3_DAYS));
|
||||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(runOndate), INTEREST_3_DAYS, FEE_PORTION,
|
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(runOndate), INTEREST_3_DAYS, FEE_PORTION,
|
||||||
PENALTY_PORTION, loanID);
|
PENALTY_PORTION, loanID);
|
||||||
|
|
||||||
@@ -937,14 +915,14 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
|
|
||||||
this.periodicAccrualAccountingHelper.runPeriodicAccrualAccounting(runOndate);
|
this.periodicAccrualAccountingHelper.runPeriodicAccrualAccounting(runOndate);
|
||||||
float interestPerDay = (totalInterest / totalDaysInPeriod * 4) - INTEREST_3_DAYS;
|
float interestPerDay = (totalInterest / totalDaysInPeriod * 4) - INTEREST_3_DAYS;
|
||||||
interestPerDay = new Float(numberFormat.format(interestPerDay));
|
interestPerDay = Float.valueOf(numberFormat.format(interestPerDay));
|
||||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(runOndate), interestPerDay, NEXT_FEE_PORTION,
|
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(runOndate), interestPerDay, NEXT_FEE_PORTION,
|
||||||
NEXT_PENALTY_PORTION, loanID);
|
NEXT_PENALTY_PORTION, loanID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer createLoanProductWithPeriodicAccrualAccountingEnabled(final Account... accounts) {
|
private Integer createLoanProductWithPeriodicAccrualAccountingEnabled(final Account... accounts) {
|
||||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
||||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||||
@@ -963,10 +941,10 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final Integer loanProductID = createLoanProductWithCashBasedAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
final Integer loanProductID = createLoanProductWithCashBasedAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||||
overpaymentAccount);
|
overpaymentAccount);
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
|
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||||
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||||
@@ -977,7 +955,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
// CHECK ACCOUNT ENTRIES
|
// CHECK ACCOUNT ENTRIES
|
||||||
System.out.println("Entries ......");
|
LOG.info("Entries ......");
|
||||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||||
final float TOTAL_INTEREST = 1000.0f;
|
final float TOTAL_INTEREST = 1000.0f;
|
||||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||||
@@ -985,7 +963,7 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
||||||
|
|
||||||
// MAKE 1
|
// MAKE 1
|
||||||
System.out.println("Repayment 1 ......");
|
LOG.info("Repayment 1 ......");
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], this.REPAYMENT_AMOUNT[1], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], this.REPAYMENT_AMOUNT[1], loanID);
|
||||||
final float FIRST_INTEREST = 200.0f;
|
final float FIRST_INTEREST = 200.0f;
|
||||||
final float FIRST_PRINCIPAL = 2000.0f;
|
final float FIRST_PRINCIPAL = 2000.0f;
|
||||||
@@ -994,13 +972,13 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
|
||||||
System.out.println("CHECKING INCOME: ******************************************");
|
LOG.info("CHECKING INCOME: ******************************************");
|
||||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[1], new JournalEntry(FIRST_INTEREST,
|
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[1],
|
||||||
JournalEntry.TransactionType.CREDIT));
|
new JournalEntry(FIRST_INTEREST, JournalEntry.TransactionType.CREDIT));
|
||||||
System.out.println("Repayment 1 Done......");
|
LOG.info("Repayment 1 Done......");
|
||||||
|
|
||||||
// REPAYMENT 2
|
// REPAYMENT 2
|
||||||
System.out.println("Repayment 2 ......");
|
LOG.info("Repayment 2 ......");
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
|
||||||
final float SECOND_AND_THIRD_INTEREST = 400.0f;
|
final float SECOND_AND_THIRD_INTEREST = 400.0f;
|
||||||
final float SECOND_PRINCIPAL = this.REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
|
final float SECOND_PRINCIPAL = this.REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
|
||||||
@@ -1009,13 +987,13 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT), };
|
new JournalEntry(SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT), };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
|
||||||
System.out.println("CHECKING INCOME: ******************************************");
|
LOG.info("CHECKING INCOME: ******************************************");
|
||||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[2], new JournalEntry(
|
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[2],
|
||||||
SECOND_AND_THIRD_INTEREST, JournalEntry.TransactionType.CREDIT));
|
new JournalEntry(SECOND_AND_THIRD_INTEREST, JournalEntry.TransactionType.CREDIT));
|
||||||
System.out.println("Repayment 2 Done ......");
|
LOG.info("Repayment 2 Done ......");
|
||||||
|
|
||||||
// WAIVE INTEREST
|
// WAIVE INTEREST
|
||||||
System.out.println("Waive Interest ......");
|
LOG.info("Waive Interest ......");
|
||||||
Integer transactionId = this.loanTransactionHelper.waiveInterestAndReturnTransactionId(this.REPAYMENT_DATE[4],
|
Integer transactionId = this.loanTransactionHelper.waiveInterestAndReturnTransactionId(this.REPAYMENT_DATE[4],
|
||||||
this.AMOUNT_TO_BE_WAIVE.toString(), loanID);
|
this.AMOUNT_TO_BE_WAIVE.toString(), loanID);
|
||||||
// waive of fees and interest are not considered in cash based
|
// waive of fees and interest are not considered in cash based
|
||||||
@@ -1023,38 +1001,38 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
this.journalEntryHelper.ensureNoAccountingTransactionsWithTransactionId("L" + transactionId);
|
this.journalEntryHelper.ensureNoAccountingTransactionsWithTransactionId("L" + transactionId);
|
||||||
|
|
||||||
// REPAYMENT 3
|
// REPAYMENT 3
|
||||||
System.out.println("Repayment 3 ......");
|
LOG.info("Repayment 3 ......");
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
|
||||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||||
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
||||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
|
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
|
||||||
System.out.println("Repayment 3 Done ......");
|
LOG.info("Repayment 3 Done ......");
|
||||||
|
|
||||||
// REPAYMENT 4
|
// REPAYMENT 4
|
||||||
System.out.println("Repayment 4 ......");
|
LOG.info("Repayment 4 ......");
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
|
||||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
|
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
|
||||||
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
|
||||||
System.out.println("Repayment 4 Done ......");
|
LOG.info("Repayment 4 Done ......");
|
||||||
|
|
||||||
// Repayment 5
|
// Repayment 5
|
||||||
System.out.println("Repayment 5 ......");
|
LOG.info("Repayment 5 ......");
|
||||||
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
||||||
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
||||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
|
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
|
||||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
|
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
|
||||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
|
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
|
||||||
System.out.println("Repayment 5 Done ......");
|
LOG.info("Repayment 5 Done ......");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer createLoanProductWithCashBasedAccountingEnabled(final Account... accounts) {
|
private Integer createLoanProductWithCashBasedAccountingEnabled(final Account... accounts) {
|
||||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
||||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||||
@@ -1062,14 +1040,10 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LocalDate getDateAsLocalDate(String dateAsString) {
|
private LocalDate getDateAsLocalDate(String dateAsString) throws ParseException {
|
||||||
LocalDate date = null;
|
DateFormat df = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||||
try {
|
LocalDate date = new LocalDate(df.parse(dateAsString));
|
||||||
DateFormat df = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
|
||||||
date = new LocalDate(df.parse(dateAsString));
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* 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.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
import io.restassured.RestAssured;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.response.Response;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class ActuatorIntegrationTest {
|
||||||
|
|
||||||
|
private final static String INFO_URL = "/fineract-provider/actuator/info";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testActuatorGitBuildInfo() {
|
||||||
|
Response response = RestAssured.given().headers("Content-Type", ContentType.JSON, "Accept", ContentType.JSON).when().get(INFO_URL)
|
||||||
|
.then().contentType(ContentType.JSON).extract().response();
|
||||||
|
|
||||||
|
Map<String, String> gitBuildInfo = response.jsonPath().getMap("git");
|
||||||
|
|
||||||
|
assertTrue(gitBuildInfo.containsKey("branch"));
|
||||||
|
assertTrue(gitBuildInfo.containsKey("remote"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
* 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 io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class ApiDocsTest {
|
||||||
|
|
||||||
|
private ResponseSpecification responseSpec;
|
||||||
|
private RequestSpecification requestSpec;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
public void setup() {
|
||||||
|
Utils.initializeRESTAssured();
|
||||||
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
|
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testApiDocsAccess() {
|
||||||
|
Utils.performServerGet(requestSpec, responseSpec, "/fineract-provider/api-docs/apiLive.htm", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+41
-48
@@ -18,12 +18,16 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import org.apache.fineract.batch.domain.BatchRequest;
|
import org.apache.fineract.batch.domain.BatchRequest;
|
||||||
import org.apache.fineract.batch.domain.BatchResponse;
|
import org.apache.fineract.batch.domain.BatchResponse;
|
||||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||||
@@ -32,17 +36,9 @@ import org.apache.fineract.integrationtests.common.Utils;
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
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 class for
|
* Test class for
|
||||||
@@ -60,17 +56,13 @@ public class BatchApiTest {
|
|||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
|
|
||||||
public BatchApiTest() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the essential settings for the TEST like contentType,
|
* Sets up the essential settings for the TEST like contentType,
|
||||||
* expectedStatusCode. It uses the '@Before' annotation provided by jUnit.
|
* expectedStatusCode. It uses the '@BeforeEach' annotation provided by
|
||||||
|
* jUnit.
|
||||||
*/
|
*/
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
|
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||||
@@ -96,7 +88,7 @@ public class BatchApiTest {
|
|||||||
|
|
||||||
// Verify that only 501 is returned as the status code
|
// Verify that only 501 is returned as the status code
|
||||||
for (BatchResponse resp : response) {
|
for (BatchResponse resp : response) {
|
||||||
Assert.assertEquals("Verify Status code 501", (long) 501, (long) resp.getStatusCode());
|
Assertions.assertEquals((long) 501, (long) resp.getStatusCode(), "Verify Status code 501");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +108,7 @@ public class BatchApiTest {
|
|||||||
|
|
||||||
// Verify that a 200 response is returned as the status code
|
// Verify that a 200 response is returned as the status code
|
||||||
for (BatchResponse resp : response) {
|
for (BatchResponse resp : response) {
|
||||||
Assert.assertEquals("Verify Status code 200", (long) 200, (long) resp.getStatusCode());
|
Assertions.assertEquals((long) 200, (long) resp.getStatusCode(), "Verify Status code 200");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,8 +151,8 @@ public class BatchApiTest {
|
|||||||
BatchHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, "TestExtId12");
|
BatchHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, "TestExtId12");
|
||||||
|
|
||||||
// Asserts that all the transactions have been successfully rolled back
|
// Asserts that all the transactions have been successfully rolled back
|
||||||
Assert.assertEquals(response.size(), 1);
|
Assertions.assertEquals(1, response.size());
|
||||||
Assert.assertEquals("Verify Status code 400", (long) 400, (long) response.get(0).getStatusCode());
|
Assertions.assertEquals((long) 400, (long) response.get(0).getStatusCode(), "Verify Status code 400");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -193,8 +185,8 @@ public class BatchApiTest {
|
|||||||
final JsonObject changes = new FromJsonHelper().parse(response.get(1).getBody()).getAsJsonObject().get("changes").getAsJsonObject();
|
final JsonObject changes = new FromJsonHelper().parse(response.get(1).getBody()).getAsJsonObject().get("changes").getAsJsonObject();
|
||||||
|
|
||||||
// Asserts the client information is successfully updated
|
// Asserts the client information is successfully updated
|
||||||
Assert.assertEquals("Verify Firstname", "TestFirstName", changes.get("firstname").getAsString());
|
Assertions.assertEquals("TestFirstName", changes.get("firstname").getAsString());
|
||||||
Assert.assertEquals("Verify Lastname", "TestLastName", changes.get("lastname").getAsString());
|
Assertions.assertEquals("TestLastName", changes.get("lastname").getAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -244,7 +236,7 @@ public class BatchApiTest {
|
|||||||
// Get the clientId parameter from createClient Response
|
// Get the clientId parameter from createClient Response
|
||||||
final JsonElement clientId = new FromJsonHelper().parse(response.get(0).getBody()).getAsJsonObject().get("clientId");
|
final JsonElement clientId = new FromJsonHelper().parse(response.get(0).getBody()).getAsJsonObject().get("clientId");
|
||||||
|
|
||||||
Assert.assertEquals("Verify Status Code 200" + clientId.getAsString(), 200L, (long) response.get(1).getStatusCode());
|
Assertions.assertEquals(200L, (long) response.get(1).getStatusCode(), "Verify Status Code 200" + clientId.getAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -286,7 +278,7 @@ public class BatchApiTest {
|
|||||||
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
||||||
jsonifiedRequest);
|
jsonifiedRequest);
|
||||||
|
|
||||||
Assert.assertEquals("Verify Status Code 200", 200L, (long) response.get(1).getStatusCode());
|
Assertions.assertEquals(200L, (long) response.get(1).getStatusCode(), "Verify Status Code 200");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -338,14 +330,14 @@ public class BatchApiTest {
|
|||||||
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
||||||
jsonifiedRequest);
|
jsonifiedRequest);
|
||||||
|
|
||||||
Assert.assertEquals("Verify Status Code 200 for Create Loan Charge", 200L, (long) response.get(3).getStatusCode());
|
Assertions.assertEquals(200L, (long) response.get(3).getStatusCode(), "Verify Status Code 200 for Create Loan Charge");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that batch repayment for loans is happening properly.
|
* Tests that batch repayment for loans is happening properly. Collected
|
||||||
* Collected properly 200(OK) status was returned for successful responses.
|
* properly 200(OK) status was returned for successful responses. It first
|
||||||
* It first creates a new loan and then makes two repayments for it
|
* creates a new loan and then makes two repayments for it and then verifies
|
||||||
* and then verifies that 200(OK) is returned for the repayment requests.
|
* that 200(OK) is returned for the repayment requests.
|
||||||
*
|
*
|
||||||
* @see org.apache.fineract.batch.command.internal.RepayLoanCommandStrategy
|
* @see org.apache.fineract.batch.command.internal.RepayLoanCommandStrategy
|
||||||
*/
|
*/
|
||||||
@@ -401,8 +393,8 @@ public class BatchApiTest {
|
|||||||
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
||||||
jsonifiedRequest);
|
jsonifiedRequest);
|
||||||
|
|
||||||
Assert.assertEquals("Verify Status Code 200 for Repayment", 200L, (long) response.get(5).getStatusCode());
|
Assertions.assertEquals(200L, (long) response.get(5).getStatusCode(), "Verify Status Code 200 for Repayment");
|
||||||
Assert.assertEquals("Verify Status Code 200 for Repayment", 200L, (long) response.get(6).getStatusCode());
|
Assertions.assertEquals(200L, (long) response.get(6).getStatusCode(), "Verify Status Code 200 for Repayment");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,8 +423,8 @@ public class BatchApiTest {
|
|||||||
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
||||||
jsonifiedRequest);
|
jsonifiedRequest);
|
||||||
|
|
||||||
Assert.assertEquals("Verify Status Code 200 for Create Client", 200L, (long) response.get(0).getStatusCode());
|
Assertions.assertEquals(200L, (long) response.get(0).getStatusCode(), "Verify Status Code 200 for Create Client");
|
||||||
Assert.assertEquals("Verify Status Code 200 for Activate Client", 200L, (long) response.get(1).getStatusCode());
|
Assertions.assertEquals(200L, (long) response.get(1).getStatusCode(), "Verify Status Code 200 for Activate Client");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -486,19 +478,20 @@ public class BatchApiTest {
|
|||||||
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
||||||
jsonifiedRequest);
|
jsonifiedRequest);
|
||||||
|
|
||||||
Assert.assertEquals("Verify Status Code 200 for Approve Loan", 200L, (long) response.get(3).getStatusCode());
|
Assertions.assertEquals(200L, (long) response.get(3).getStatusCode(), "Verify Status Code 200 for Approve Loan");
|
||||||
Assert.assertEquals("Verify Status Code 200 for Disburse Loan", 200L, (long) response.get(4).getStatusCode());
|
Assertions.assertEquals(200L, (long) response.get(4).getStatusCode(), "Verify Status Code 200 for Disburse Loan");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for the successful create client, apply loan,approval and disbursal of a loan using
|
* Test for the successful create client, apply loan,approval and disbursal
|
||||||
* Batch API with enclosingTransaction. A '200' status code is expected on successful activation.
|
* of a loan using Batch API with enclosingTransaction. A '200' status code
|
||||||
|
* is expected on successful activation.
|
||||||
*
|
*
|
||||||
* @see org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy
|
* @see org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy
|
||||||
* @see org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy
|
* @see org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void shouldReturnOkStatusOnSuccessfulLoanApprovalAndDisburseWithTransaction(){
|
public void shouldReturnOkStatusOnSuccessfulLoanApprovalAndDisburseWithTransaction() {
|
||||||
final String loanProductJSON = new LoanProductTestBuilder() //
|
final String loanProductJSON = new LoanProductTestBuilder() //
|
||||||
.withPrincipal("10000000.00") //
|
.withPrincipal("10000000.00") //
|
||||||
.withNumberOfRepayments("24") //
|
.withNumberOfRepayments("24") //
|
||||||
@@ -524,16 +517,16 @@ public class BatchApiTest {
|
|||||||
// Create a disburseLoan Request
|
// Create a disburseLoan Request
|
||||||
final BatchRequest br4 = BatchHelper.disburseLoanRequest(4744L, 4743L);
|
final BatchRequest br4 = BatchHelper.disburseLoanRequest(4744L, 4743L);
|
||||||
|
|
||||||
final List<BatchRequest> batchRequests = Arrays.asList(br1,br2,br3,br4);
|
final List<BatchRequest> batchRequests = Arrays.asList(br1, br2, br3, br4);
|
||||||
|
|
||||||
final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
|
final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
|
||||||
|
|
||||||
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithEnclosingTransaction(this.requestSpec, this.responseSpec,
|
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithEnclosingTransaction(this.requestSpec, this.responseSpec,
|
||||||
jsonifiedRequest);
|
jsonifiedRequest);
|
||||||
|
|
||||||
Assert.assertEquals("Verify Status Code 200 for create client", 200L, (long) response.get(0).getStatusCode());
|
Assertions.assertEquals(200L, (long) response.get(0).getStatusCode(), "Verify Status Code 200 for create client");
|
||||||
Assert.assertEquals("Verify Status Code 200 for apply Loan", 200L, (long) response.get(1).getStatusCode());
|
Assertions.assertEquals(200L, (long) response.get(1).getStatusCode(), "Verify Status Code 200 for apply Loan");
|
||||||
Assert.assertEquals("Verify Status Code 200 for approve Loan", 200L, (long) response.get(2).getStatusCode());
|
Assertions.assertEquals(200L, (long) response.get(2).getStatusCode(), "Verify Status Code 200 for approve Loan");
|
||||||
Assert.assertEquals("Verify Status Code 200 for disburse Loan", 200L, (long) response.get(3).getStatusCode());
|
Assertions.assertEquals(200L, (long) response.get(3).getStatusCode(), "Verify Status Code 200 for disburse Loan");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+16
-14
@@ -18,9 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.fineract.batch.domain.BatchRequest;
|
import org.apache.fineract.batch.domain.BatchRequest;
|
||||||
import org.apache.fineract.batch.domain.BatchResponse;
|
import org.apache.fineract.batch.domain.BatchResponse;
|
||||||
import org.apache.fineract.integrationtests.common.BatchHelper;
|
import org.apache.fineract.integrationtests.common.BatchHelper;
|
||||||
@@ -29,15 +33,11 @@ import org.apache.fineract.integrationtests.common.GroupHelper;
|
|||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
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 class for testing the integration of Batch API with custom batch
|
* Test class for testing the integration of Batch API with custom batch
|
||||||
@@ -48,6 +48,7 @@ import com.jayway.restassured.specification.ResponseSpecification;
|
|||||||
*/
|
*/
|
||||||
public class BatchRequestsIntegrationTest {
|
public class BatchRequestsIntegrationTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(BatchRequestsIntegrationTest.class);
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
|
|
||||||
@@ -57,9 +58,10 @@ public class BatchRequestsIntegrationTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the essential settings for the TEST like contentType,
|
* Sets up the essential settings for the TEST like contentType,
|
||||||
* expectedStatusCode. It uses the '@Before' annotation provided by jUnit.
|
* expectedStatusCode. It uses the '@BeforeEach' annotation provided by
|
||||||
|
* jUnit.
|
||||||
*/
|
*/
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
|
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
@@ -90,7 +92,7 @@ public class BatchRequestsIntegrationTest {
|
|||||||
for (Integer i = 0; i < clientsCount; i++) {
|
for (Integer i = 0; i < clientsCount; i++) {
|
||||||
clientIDs[i] = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
clientIDs[i] = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientIDs[i].toString());
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientIDs[i].toString());
|
||||||
System.out.println("client " + clientIDs[i] + " has been added to the group " + groupID);
|
LOG.info("client {} has been added to the group {}", clientIDs[i], groupID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a random count of number of new loan products to be created
|
// Generate a random count of number of new loan products to be created
|
||||||
@@ -134,7 +136,7 @@ public class BatchRequestsIntegrationTest {
|
|||||||
|
|
||||||
// Verify that each loan has been applied successfully
|
// Verify that each loan has been applied successfully
|
||||||
for (BatchResponse res : response) {
|
for (BatchResponse res : response) {
|
||||||
Assert.assertEquals("Verify Status Code 200", 200L, (long) res.getStatusCode());
|
Assertions.assertEquals(200L, (long) res.getStatusCode(), "Verify Status Code 200");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+76
-78
@@ -18,35 +18,36 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.CenterDomain;
|
import org.apache.fineract.integrationtests.common.CenterDomain;
|
||||||
import org.apache.fineract.integrationtests.common.CenterHelper;
|
import org.apache.fineract.integrationtests.common.CenterHelper;
|
||||||
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.google.gson.Gson;
|
import org.slf4j.LoggerFactory;
|
||||||
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 CenterIntegrationTest {
|
public class CenterIntegrationTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(CenterIntegrationTest.class);
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -62,20 +63,20 @@ public class CenterIntegrationTest {
|
|||||||
int resourceId = CenterHelper.createCenter(name, officeId, requestSpec, responseSpec);
|
int resourceId = CenterHelper.createCenter(name, officeId, requestSpec, responseSpec);
|
||||||
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
|
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
|
||||||
|
|
||||||
Assert.assertNotNull(center);
|
Assertions.assertNotNull(center);
|
||||||
Assert.assertTrue(center.getName().equals(name));
|
Assertions.assertTrue(center.getName().equals(name));
|
||||||
Assert.assertTrue(center.getOfficeId() == officeId);
|
Assertions.assertTrue(center.getOfficeId() == officeId);
|
||||||
Assert.assertTrue(center.isActive() == false);
|
Assertions.assertTrue(center.isActive() == false);
|
||||||
|
|
||||||
// Test retrieval by listing all centers
|
// Test retrieval by listing all centers
|
||||||
int id = CenterHelper.listCenters(requestSpec, responseSpec).get(0).getId();
|
int id = CenterHelper.listCenters(requestSpec, responseSpec).get(0).getId();
|
||||||
Assert.assertTrue(id > 0);
|
Assertions.assertTrue(id > 0);
|
||||||
|
|
||||||
CenterDomain retrievedCenter = CenterHelper.retrieveByID(id, requestSpec, responseSpec);
|
CenterDomain retrievedCenter = CenterHelper.retrieveByID(id, requestSpec, responseSpec);
|
||||||
Assert.assertNotNull(retrievedCenter);
|
Assertions.assertNotNull(retrievedCenter);
|
||||||
Assert.assertNotNull(retrievedCenter.getName());
|
Assertions.assertNotNull(retrievedCenter.getName());
|
||||||
Assert.assertNotNull(retrievedCenter.getHierarchy());
|
Assertions.assertNotNull(retrievedCenter.getHierarchy());
|
||||||
Assert.assertNotNull(retrievedCenter.getOfficeName());
|
Assertions.assertNotNull(retrievedCenter.getOfficeName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,13 +91,13 @@ public class CenterIntegrationTest {
|
|||||||
int resourceId = CenterHelper.createCenter(name, officeId, externalId, staffId, groupMembers, requestSpec, responseSpec);
|
int resourceId = CenterHelper.createCenter(name, officeId, externalId, staffId, groupMembers, requestSpec, responseSpec);
|
||||||
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
|
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
|
||||||
|
|
||||||
Assert.assertNotNull(center);
|
Assertions.assertNotNull(center);
|
||||||
Assert.assertTrue(center.getName().equals(name));
|
Assertions.assertTrue(center.getName().equals(name));
|
||||||
Assert.assertTrue(center.getOfficeId() == officeId);
|
Assertions.assertTrue(center.getOfficeId() == officeId);
|
||||||
Assert.assertTrue(center.getExternalId().equals(externalId));
|
Assertions.assertTrue(center.getExternalId().equals(externalId));
|
||||||
Assert.assertTrue(center.getStaffId() == staffId);
|
Assertions.assertTrue(center.getStaffId() == staffId);
|
||||||
Assert.assertTrue(center.isActive() == false);
|
Assertions.assertTrue(center.isActive() == false);
|
||||||
Assert.assertArrayEquals(center.getGroupMembers(), groupMembers);
|
Assertions.assertArrayEquals(center.getGroupMembers(), groupMembers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -104,10 +105,10 @@ public class CenterIntegrationTest {
|
|||||||
ArrayList<CenterDomain> paginatedList = CenterHelper.paginatedListCenters(requestSpec, responseSpec);
|
ArrayList<CenterDomain> paginatedList = CenterHelper.paginatedListCenters(requestSpec, responseSpec);
|
||||||
ArrayList<CenterDomain> list = CenterHelper.listCenters(requestSpec, responseSpec);
|
ArrayList<CenterDomain> list = CenterHelper.listCenters(requestSpec, responseSpec);
|
||||||
|
|
||||||
Assert.assertNotNull(paginatedList);
|
Assertions.assertNotNull(paginatedList);
|
||||||
Assert.assertNotNull(list);
|
Assertions.assertNotNull(list);
|
||||||
Assert.assertTrue(Arrays.equals(paginatedList.toArray(new CenterDomain[paginatedList.size()]),
|
Assertions.assertTrue(
|
||||||
list.toArray(new CenterDomain[list.size()])));
|
Arrays.equals(paginatedList.toArray(new CenterDomain[paginatedList.size()]), list.toArray(new CenterDomain[list.size()])));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -116,7 +117,7 @@ public class CenterIntegrationTest {
|
|||||||
int id = arr.get(arr.size() - 1).getId() + 1;
|
int id = arr.get(arr.size() - 1).getId() + 1;
|
||||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
||||||
CenterDomain center = CenterHelper.retrieveByID(id, requestSpec, responseSpec);
|
CenterDomain center = CenterHelper.retrieveByID(id, requestSpec, responseSpec);
|
||||||
Assert.assertNotNull(center);
|
Assertions.assertNotNull(center);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
@@ -137,7 +138,7 @@ public class CenterIntegrationTest {
|
|||||||
int[] associateResponse = CenterHelper.associateGroups(resourceId, associateGroupMembers, requestSpec, responseSpec);
|
int[] associateResponse = CenterHelper.associateGroups(resourceId, associateGroupMembers, requestSpec, responseSpec);
|
||||||
Arrays.sort(associateResponse);
|
Arrays.sort(associateResponse);
|
||||||
Arrays.sort(associateGroupMembers);
|
Arrays.sort(associateGroupMembers);
|
||||||
Assert.assertArrayEquals(associateResponse, associateGroupMembers);
|
Assertions.assertArrayEquals(associateResponse, associateGroupMembers);
|
||||||
|
|
||||||
int[] newGroupMembers = new int[5];
|
int[] newGroupMembers = new int[5];
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
@@ -153,17 +154,17 @@ public class CenterIntegrationTest {
|
|||||||
request.put("externalId", newExternalId);
|
request.put("externalId", newExternalId);
|
||||||
request.put("staffId", newStaffId);
|
request.put("staffId", newStaffId);
|
||||||
HashMap response = CenterHelper.updateCenter(resourceId, request, requestSpec, responseSpec);
|
HashMap response = CenterHelper.updateCenter(resourceId, request, requestSpec, responseSpec);
|
||||||
Assert.assertNotNull(response);
|
Assertions.assertNotNull(response);
|
||||||
Assert.assertEquals(newName, response.get("name"));
|
Assertions.assertEquals(newName, response.get("name"));
|
||||||
Assert.assertEquals(newExternalId, response.get("externalId"));
|
Assertions.assertEquals(newExternalId, response.get("externalId"));
|
||||||
Assert.assertEquals(newStaffId, response.get("staffId"));
|
Assertions.assertEquals(Integer.valueOf(newStaffId), Integer.valueOf(response.get("staffId").toString()));
|
||||||
|
|
||||||
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
|
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
|
||||||
Assert.assertNotNull(center);
|
Assertions.assertNotNull(center);
|
||||||
Assert.assertEquals(newName, center.getName());
|
Assertions.assertEquals(newName, center.getName());
|
||||||
Assert.assertEquals(newExternalId, center.getExternalId());
|
Assertions.assertEquals(newExternalId, center.getExternalId());
|
||||||
Assert.assertEquals((Integer)newStaffId, center.getStaffId());
|
Assertions.assertEquals((Integer) newStaffId, center.getStaffId());
|
||||||
Assert.assertArrayEquals(newGroupMembers, center.getGroupMembers());
|
Assertions.assertArrayEquals(newGroupMembers, center.getGroupMembers());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -175,7 +176,7 @@ public class CenterIntegrationTest {
|
|||||||
CenterHelper.deleteCenter(resourceId, requestSpec, responseSpec);
|
CenterHelper.deleteCenter(resourceId, requestSpec, responseSpec);
|
||||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
||||||
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
|
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
|
||||||
Assert.assertNotNull(center);
|
Assertions.assertNotNull(center);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int[] generateGroupMembers(int size, int officeId) {
|
private int[] generateGroupMembers(int size, int officeId) {
|
||||||
@@ -190,8 +191,8 @@ public class CenterIntegrationTest {
|
|||||||
map.put("active", "true");
|
map.put("active", "true");
|
||||||
map.put("activationDate", "04 March 2011");
|
map.put("activationDate", "04 March 2011");
|
||||||
|
|
||||||
groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec, "/fineract-provider/api/v1/groups?"
|
groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec,
|
||||||
+ Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId");
|
"/fineract-provider/api/v1/groups?" + Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId");
|
||||||
}
|
}
|
||||||
return groupMembers;
|
return groupMembers;
|
||||||
}
|
}
|
||||||
@@ -200,64 +201,61 @@ public class CenterIntegrationTest {
|
|||||||
public void testStaffAssignmentDuringCenterCreation() {
|
public void testStaffAssignmentDuringCenterCreation() {
|
||||||
|
|
||||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||||
System.out.println("--------------creating first staff with id-------------" + staffId);
|
LOG.info("--------------creating first staff with id------------- {}", staffId);
|
||||||
Assert.assertNotNull(staffId);
|
Assertions.assertNotNull(staffId);
|
||||||
|
|
||||||
final int centerWithStaffId = CenterHelper.createCenterWithStaffId(this.requestSpec, this.responseSpec, staffId);
|
final int centerWithStaffId = CenterHelper.createCenterWithStaffId(this.requestSpec, this.responseSpec, staffId);
|
||||||
final CenterDomain center = CenterHelper.retrieveByID(centerWithStaffId, requestSpec, responseSpec);
|
final CenterDomain center = CenterHelper.retrieveByID(centerWithStaffId, requestSpec, responseSpec);
|
||||||
Assert.assertNotNull(center);
|
Assertions.assertNotNull(center);
|
||||||
Assert.assertTrue(center.getId() == centerWithStaffId);
|
Assertions.assertTrue(center.getId() == centerWithStaffId);
|
||||||
Assert.assertTrue(center.getStaffId().intValue() == staffId);
|
Assertions.assertTrue(center.getStaffId().intValue() == staffId);
|
||||||
Assert.assertTrue(center.isActive() == true);
|
Assertions.assertTrue(center.isActive() == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAssignStaffToCenter() {
|
public void testAssignStaffToCenter() {
|
||||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||||
System.out.println("--------------creating first staff with id-------------" + staffId);
|
LOG.info("--------------creating first staff with id------------- {}", staffId);
|
||||||
Assert.assertNotNull(staffId);
|
Assertions.assertNotNull(staffId);
|
||||||
|
|
||||||
final Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec);
|
final Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec);
|
||||||
CenterHelper.verifyCenterCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
|
CenterHelper.verifyCenterCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
|
||||||
|
|
||||||
final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec,
|
final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec, this.responseSpec,
|
||||||
this.responseSpec, groupID.toString(),
|
groupID.toString(), staffId.longValue());
|
||||||
staffId.longValue());
|
assertEquals(assignStaffToCenterResponseMap.get("staffId"), staffId, "Verify assigned staff id is the same as id sent");
|
||||||
assertEquals("Verify assigned staff id is the same as id sent", assignStaffToCenterResponseMap.get("staffId"), staffId);
|
|
||||||
|
|
||||||
final CenterDomain center = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
|
final CenterDomain center = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
|
||||||
Assert.assertNotNull(center);
|
Assertions.assertNotNull(center);
|
||||||
Assert.assertTrue(center.getId().intValue() == groupID);
|
Assertions.assertTrue(center.getId().intValue() == groupID);
|
||||||
Assert.assertTrue(center.getStaffId().intValue() == staffId);
|
Assertions.assertTrue(center.getStaffId().intValue() == staffId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnassignStaffToCenter() {
|
public void testUnassignStaffToCenter() {
|
||||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||||
System.out.println("--------------creating first staff with id-------------" + staffId);
|
LOG.info("--------------creating first staff with id------------- {}", staffId);
|
||||||
Assert.assertNotNull(staffId);
|
Assertions.assertNotNull(staffId);
|
||||||
|
|
||||||
final Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec);
|
final Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec);
|
||||||
CenterHelper.verifyCenterCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
|
CenterHelper.verifyCenterCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
|
||||||
|
|
||||||
final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec,
|
final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec, this.responseSpec,
|
||||||
this.responseSpec, groupID.toString(),
|
groupID.toString(), staffId.longValue());
|
||||||
staffId.longValue());
|
assertEquals(assignStaffToCenterResponseMap.get("staffId"), staffId, "Verify assigned staff id is the same as id sent");
|
||||||
assertEquals("Verify assigned staff id is the same as id sent", assignStaffToCenterResponseMap.get("staffId"), staffId);
|
|
||||||
final CenterDomain centerWithStaffAssigned = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
|
final CenterDomain centerWithStaffAssigned = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
|
||||||
Assert.assertNotNull(centerWithStaffAssigned);
|
Assertions.assertNotNull(centerWithStaffAssigned);
|
||||||
Assert.assertTrue(centerWithStaffAssigned.getId().intValue() == groupID);
|
Assertions.assertTrue(centerWithStaffAssigned.getId().intValue() == groupID);
|
||||||
Assert.assertTrue(centerWithStaffAssigned.getStaffId().intValue() == staffId);
|
Assertions.assertTrue(centerWithStaffAssigned.getStaffId().intValue() == staffId);
|
||||||
|
|
||||||
final HashMap unassignStaffToCenterResponseMap = (HashMap) CenterHelper.unassignStaff(this.requestSpec,
|
final HashMap unassignStaffToCenterResponseMap = (HashMap) CenterHelper.unassignStaff(this.requestSpec, this.responseSpec,
|
||||||
this.responseSpec, groupID.toString(),
|
groupID.toString(), staffId.longValue());
|
||||||
staffId.longValue());
|
assertEquals(unassignStaffToCenterResponseMap.get("staffId"), null, "Verify staffId is null after unassigning ");
|
||||||
assertEquals("Verify staffId is null after unassigning ", unassignStaffToCenterResponseMap.get("staffId"), null);
|
|
||||||
final CenterDomain centerWithStaffUnssigned = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
|
final CenterDomain centerWithStaffUnssigned = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
|
||||||
Assert.assertNotNull(centerWithStaffUnssigned);
|
Assertions.assertNotNull(centerWithStaffUnssigned);
|
||||||
Assert.assertTrue(centerWithStaffUnssigned.getId().intValue() == groupID);
|
Assertions.assertTrue(centerWithStaffUnssigned.getId().intValue() == groupID);
|
||||||
Assert.assertTrue(centerWithStaffUnssigned.getStaffId() == null);
|
Assertions.assertTrue(centerWithStaffUnssigned.getStaffId() == null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+56
-58
@@ -18,20 +18,18 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
|
import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.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" })
|
@SuppressWarnings({ "rawtypes" })
|
||||||
public class ChargesTest {
|
public class ChargesTest {
|
||||||
@@ -39,7 +37,7 @@ public class ChargesTest {
|
|||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -52,19 +50,19 @@ public class ChargesTest {
|
|||||||
|
|
||||||
// Retrieving all Charges
|
// Retrieving all Charges
|
||||||
ArrayList<HashMap> allChargesData = ChargesHelper.getCharges(this.requestSpec, this.responseSpec);
|
ArrayList<HashMap> allChargesData = ChargesHelper.getCharges(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(allChargesData);
|
Assertions.assertNotNull(allChargesData);
|
||||||
|
|
||||||
// Testing Creation, Updation and Deletion of Disbursement Charge
|
// Testing Creation, Updation and Deletion of Disbursement Charge
|
||||||
final Integer disbursementChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
final Integer disbursementChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||||
ChargesHelper.getLoanDisbursementJSON());
|
ChargesHelper.getLoanDisbursementJSON());
|
||||||
Assert.assertNotNull(disbursementChargeId);
|
Assertions.assertNotNull(disbursementChargeId);
|
||||||
|
|
||||||
// Updating Charge Amount
|
// Updating Charge Amount
|
||||||
HashMap changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, disbursementChargeId,
|
HashMap changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, disbursementChargeId,
|
||||||
ChargesHelper.getModifyChargeJSON());
|
ChargesHelper.getModifyChargeJSON());
|
||||||
|
|
||||||
HashMap chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId);
|
HashMap chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId);
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount"));
|
Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, disbursementChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, disbursementChargeId,
|
||||||
ChargesHelper.getModifyChargeAsPecentageAmountJSON());
|
ChargesHelper.getModifyChargeAsPecentageAmountJSON());
|
||||||
@@ -72,10 +70,10 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId);
|
||||||
|
|
||||||
HashMap chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargePaymentMode");
|
HashMap chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargePaymentMode");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargePaymentMode"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargePaymentMode"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, disbursementChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, disbursementChargeId,
|
||||||
ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON());
|
ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON());
|
||||||
@@ -83,7 +81,7 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId);
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, disbursementChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, disbursementChargeId,
|
||||||
ChargesHelper.getModifyChargeAsPercentageInterestJSON());
|
ChargesHelper.getModifyChargeAsPercentageInterestJSON());
|
||||||
@@ -91,22 +89,22 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId);
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
Integer chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, disbursementChargeId);
|
Integer chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, disbursementChargeId);
|
||||||
Assert.assertEquals("Verifying Charge ID after deletion", disbursementChargeId, chargeIdAfterDeletion);
|
Assertions.assertEquals(disbursementChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion");
|
||||||
|
|
||||||
// Testing Creation, Updation and Deletion of Specified due date Charge
|
// Testing Creation, Updation and Deletion of Specified due date Charge
|
||||||
final Integer specifiedDueDateChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
final Integer specifiedDueDateChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||||
ChargesHelper.getLoanSpecifiedDueDateJSON());
|
ChargesHelper.getLoanSpecifiedDueDateJSON());
|
||||||
Assert.assertNotNull(specifiedDueDateChargeId);
|
Assertions.assertNotNull(specifiedDueDateChargeId);
|
||||||
|
|
||||||
// Updating Charge Amount
|
// Updating Charge Amount
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId,
|
||||||
ChargesHelper.getModifyChargeJSON());
|
ChargesHelper.getModifyChargeJSON());
|
||||||
|
|
||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount"));
|
Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId,
|
||||||
ChargesHelper.getModifyChargeAsPecentageAmountJSON());
|
ChargesHelper.getModifyChargeAsPecentageAmountJSON());
|
||||||
@@ -114,10 +112,10 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargePaymentMode");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargePaymentMode");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargePaymentMode"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargePaymentMode"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId,
|
||||||
ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON());
|
ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON());
|
||||||
@@ -125,7 +123,7 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId,
|
||||||
ChargesHelper.getModifyChargeAsPercentageInterestJSON());
|
ChargesHelper.getModifyChargeAsPercentageInterestJSON());
|
||||||
@@ -133,10 +131,10 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, specifiedDueDateChargeId);
|
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, specifiedDueDateChargeId);
|
||||||
Assert.assertEquals("Verifying Charge ID after deletion", specifiedDueDateChargeId, chargeIdAfterDeletion);
|
Assertions.assertEquals(specifiedDueDateChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion");
|
||||||
|
|
||||||
// Testing Creation, Updation and Deletion of Installment Fee Charge
|
// Testing Creation, Updation and Deletion of Installment Fee Charge
|
||||||
final Integer installmentFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
final Integer installmentFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||||
@@ -147,7 +145,7 @@ public class ChargesTest {
|
|||||||
ChargesHelper.getModifyChargeJSON());
|
ChargesHelper.getModifyChargeJSON());
|
||||||
|
|
||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId);
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount"));
|
Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, installmentFeeChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, installmentFeeChargeId,
|
||||||
ChargesHelper.getModifyChargeAsPecentageAmountJSON());
|
ChargesHelper.getModifyChargeAsPecentageAmountJSON());
|
||||||
@@ -155,10 +153,10 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId);
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargePaymentMode");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargePaymentMode");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargePaymentMode"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargePaymentMode"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, installmentFeeChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, installmentFeeChargeId,
|
||||||
ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON());
|
ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON());
|
||||||
@@ -166,7 +164,7 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId);
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, installmentFeeChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, installmentFeeChargeId,
|
||||||
ChargesHelper.getModifyChargeAsPercentageInterestJSON());
|
ChargesHelper.getModifyChargeAsPercentageInterestJSON());
|
||||||
@@ -174,22 +172,22 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId);
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, installmentFeeChargeId);
|
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, installmentFeeChargeId);
|
||||||
Assert.assertEquals("Verifying Charge ID after deletion", installmentFeeChargeId, chargeIdAfterDeletion);
|
Assertions.assertEquals(installmentFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion");
|
||||||
|
|
||||||
// Testing Creation, Updation and Deletion of Overdue Installment Fee
|
// Testing Creation, Updation and Deletion of Overdue Installment Fee
|
||||||
// Charge
|
// Charge
|
||||||
final Integer overdueFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
final Integer overdueFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||||
ChargesHelper.getLoanOverdueFeeJSON());
|
ChargesHelper.getLoanOverdueFeeJSON());
|
||||||
Assert.assertNotNull(overdueFeeChargeId);
|
Assertions.assertNotNull(overdueFeeChargeId);
|
||||||
|
|
||||||
// Updating Charge Amount
|
// Updating Charge Amount
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId, ChargesHelper.getModifyChargeJSON());
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId, ChargesHelper.getModifyChargeJSON());
|
||||||
|
|
||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount"));
|
Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId,
|
||||||
ChargesHelper.getModifyChargeAsPecentageAmountJSON());
|
ChargesHelper.getModifyChargeAsPecentageAmountJSON());
|
||||||
@@ -197,10 +195,10 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargePaymentMode");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargePaymentMode");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargePaymentMode"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargePaymentMode"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId,
|
||||||
ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON());
|
ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON());
|
||||||
@@ -208,7 +206,7 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId,
|
||||||
ChargesHelper.getModifyChargeAsPercentageInterestJSON());
|
ChargesHelper.getModifyChargeAsPercentageInterestJSON());
|
||||||
@@ -216,7 +214,7 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId,
|
||||||
ChargesHelper.getModifyChargeFeeFrequencyAsYearsJSON());
|
ChargesHelper.getModifyChargeFeeFrequencyAsYearsJSON());
|
||||||
@@ -224,10 +222,10 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
||||||
|
|
||||||
chargeChangedData = (HashMap) chargeDataAfterChanges.get("feeFrequency");
|
chargeChangedData = (HashMap) chargeDataAfterChanges.get("feeFrequency");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("feeFrequency"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("feeFrequency"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, overdueFeeChargeId);
|
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, overdueFeeChargeId);
|
||||||
Assert.assertEquals("Verifying Charge ID after deletion", overdueFeeChargeId, chargeIdAfterDeletion);
|
Assertions.assertEquals(overdueFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -236,37 +234,37 @@ public class ChargesTest {
|
|||||||
// Testing Creation, Updation and Deletion of Specified due date Charge
|
// Testing Creation, Updation and Deletion of Specified due date Charge
|
||||||
final Integer specifiedDueDateChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
final Integer specifiedDueDateChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||||
ChargesHelper.getSavingsSpecifiedDueDateJSON());
|
ChargesHelper.getSavingsSpecifiedDueDateJSON());
|
||||||
Assert.assertNotNull(specifiedDueDateChargeId);
|
Assertions.assertNotNull(specifiedDueDateChargeId);
|
||||||
|
|
||||||
// Updating Charge Amount
|
// Updating Charge Amount
|
||||||
HashMap changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId,
|
HashMap changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId,
|
||||||
ChargesHelper.getModifyChargeJSON());
|
ChargesHelper.getModifyChargeJSON());
|
||||||
|
|
||||||
HashMap chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
HashMap chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount"));
|
Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
Integer chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, specifiedDueDateChargeId);
|
Integer chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, specifiedDueDateChargeId);
|
||||||
Assert.assertEquals("Verifying Charge ID after deletion", specifiedDueDateChargeId, chargeIdAfterDeletion);
|
Assertions.assertEquals(specifiedDueDateChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion");
|
||||||
|
|
||||||
// Testing Creation, Updation and Deletion of Savings Activation Charge
|
// Testing Creation, Updation and Deletion of Savings Activation Charge
|
||||||
final Integer savingsActivationChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
final Integer savingsActivationChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||||
ChargesHelper.getSavingsActivationFeeJSON());
|
ChargesHelper.getSavingsActivationFeeJSON());
|
||||||
Assert.assertNotNull(savingsActivationChargeId);
|
Assertions.assertNotNull(savingsActivationChargeId);
|
||||||
|
|
||||||
// Updating Charge Amount
|
// Updating Charge Amount
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, savingsActivationChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, savingsActivationChargeId,
|
||||||
ChargesHelper.getModifyChargeJSON());
|
ChargesHelper.getModifyChargeJSON());
|
||||||
|
|
||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, savingsActivationChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, savingsActivationChargeId);
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount"));
|
Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, savingsActivationChargeId);
|
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, savingsActivationChargeId);
|
||||||
Assert.assertEquals("Verifying Charge ID after deletion", savingsActivationChargeId, chargeIdAfterDeletion);
|
Assertions.assertEquals(savingsActivationChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion");
|
||||||
|
|
||||||
// Testing Creation, Updation and Deletion of Charge for Withdrawal Fee
|
// Testing Creation, Updation and Deletion of Charge for Withdrawal Fee
|
||||||
final Integer withdrawalFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
final Integer withdrawalFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||||
ChargesHelper.getSavingsWithdrawalFeeJSON());
|
ChargesHelper.getSavingsWithdrawalFeeJSON());
|
||||||
Assert.assertNotNull(withdrawalFeeChargeId);
|
Assertions.assertNotNull(withdrawalFeeChargeId);
|
||||||
|
|
||||||
// Updating Charge-Calculation-Type to Withdrawal-Fee
|
// Updating Charge-Calculation-Type to Withdrawal-Fee
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, withdrawalFeeChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, withdrawalFeeChargeId,
|
||||||
@@ -275,52 +273,52 @@ public class ChargesTest {
|
|||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, withdrawalFeeChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, withdrawalFeeChargeId);
|
||||||
|
|
||||||
HashMap chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
HashMap chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType");
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType"));
|
Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, withdrawalFeeChargeId);
|
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, withdrawalFeeChargeId);
|
||||||
Assert.assertEquals("Verifying Charge ID after deletion", withdrawalFeeChargeId, chargeIdAfterDeletion);
|
Assertions.assertEquals(withdrawalFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion");
|
||||||
|
|
||||||
// Testing Creation, Updation and Deletion of Charge for Annual Fee
|
// Testing Creation, Updation and Deletion of Charge for Annual Fee
|
||||||
final Integer annualFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
final Integer annualFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||||
ChargesHelper.getSavingsAnnualFeeJSON());
|
ChargesHelper.getSavingsAnnualFeeJSON());
|
||||||
Assert.assertNotNull(annualFeeChargeId);
|
Assertions.assertNotNull(annualFeeChargeId);
|
||||||
|
|
||||||
// Updating Charge Amount
|
// Updating Charge Amount
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, annualFeeChargeId, ChargesHelper.getModifyChargeJSON());
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, annualFeeChargeId, ChargesHelper.getModifyChargeJSON());
|
||||||
|
|
||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, annualFeeChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, annualFeeChargeId);
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount"));
|
Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, annualFeeChargeId);
|
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, annualFeeChargeId);
|
||||||
Assert.assertEquals("Verifying Charge ID after deletion", annualFeeChargeId, chargeIdAfterDeletion);
|
Assertions.assertEquals(annualFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion");
|
||||||
|
|
||||||
// Testing Creation, Updation and Deletion of Charge for Monthly Fee
|
// Testing Creation, Updation and Deletion of Charge for Monthly Fee
|
||||||
final Integer monthlyFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
final Integer monthlyFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||||
ChargesHelper.getSavingsMonthlyFeeJSON());
|
ChargesHelper.getSavingsMonthlyFeeJSON());
|
||||||
Assert.assertNotNull(monthlyFeeChargeId);
|
Assertions.assertNotNull(monthlyFeeChargeId);
|
||||||
|
|
||||||
// Updating Charge Amount
|
// Updating Charge Amount
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, monthlyFeeChargeId, ChargesHelper.getModifyChargeJSON());
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, monthlyFeeChargeId, ChargesHelper.getModifyChargeJSON());
|
||||||
|
|
||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, monthlyFeeChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, monthlyFeeChargeId);
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount"));
|
Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, monthlyFeeChargeId);
|
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, monthlyFeeChargeId);
|
||||||
Assert.assertEquals("Verifying Charge ID after deletion", monthlyFeeChargeId, chargeIdAfterDeletion);
|
Assertions.assertEquals(monthlyFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion");
|
||||||
|
|
||||||
// Testing Creation, Updation and Deletion of Charge for Overdraft Fee
|
// Testing Creation, Updation and Deletion of Charge for Overdraft Fee
|
||||||
final Integer overdraftFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
final Integer overdraftFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||||
ChargesHelper.getSavingsOverdraftFeeJSON());
|
ChargesHelper.getSavingsOverdraftFeeJSON());
|
||||||
Assert.assertNotNull(overdraftFeeChargeId);
|
Assertions.assertNotNull(overdraftFeeChargeId);
|
||||||
|
|
||||||
// Updating Charge Amount
|
// Updating Charge Amount
|
||||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdraftFeeChargeId,
|
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdraftFeeChargeId,
|
||||||
ChargesHelper.getModifyChargeJSON());
|
ChargesHelper.getModifyChargeJSON());
|
||||||
|
|
||||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdraftFeeChargeId);
|
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdraftFeeChargeId);
|
||||||
Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount"));
|
Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification");
|
||||||
|
|
||||||
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, overdraftFeeChargeId);
|
chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, overdraftFeeChargeId);
|
||||||
Assert.assertEquals("Verifying Charge ID after deletion", overdraftFeeChargeId, chargeIdAfterDeletion);
|
Assertions.assertEquals(overdraftFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+738
-738
File diff suppressed because it is too large
Load Diff
Executable → Regular
+841
-928
File diff suppressed because it is too large
Load Diff
+21
-17
@@ -18,44 +18,48 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class ClientStatusChecker {
|
public class ClientStatusChecker {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(ClientStatusChecker.class);
|
||||||
|
|
||||||
public static void verifyClientIsActive(final HashMap<String, Object> clientStatusHashMap) {
|
public static void verifyClientIsActive(final HashMap<String, Object> clientStatusHashMap) {
|
||||||
assertEquals((int) clientStatusHashMap.get("id"), 300);
|
assertEquals(300, (int) clientStatusHashMap.get("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyClientClosed(final HashMap<String, Object> clientStatusHashMap) {
|
public static void verifyClientClosed(final HashMap<String, Object> clientStatusHashMap) {
|
||||||
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS CLOSED ------------------------------------");
|
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS CLOSED ------------------------------------");
|
||||||
assertEquals((int) clientStatusHashMap.get("id"), 600);
|
assertEquals(600, (int) clientStatusHashMap.get("id"));
|
||||||
System.out.println("Client Status:" + clientStatusHashMap + "\n");
|
LOG.info("Client Status: {} \n", clientStatusHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyClientPending(final HashMap<String, Object> clientStatusHashMap) {
|
public static void verifyClientPending(final HashMap<String, Object> clientStatusHashMap) {
|
||||||
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS PENDING ------------------------------------");
|
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS PENDING ------------------------------------");
|
||||||
assertEquals((int) clientStatusHashMap.get("id"), 100);
|
assertEquals(100, (int) clientStatusHashMap.get("id"));
|
||||||
System.out.println("Client Status:" + clientStatusHashMap + "\n");
|
LOG.info("Client Status: {} \n", clientStatusHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyClientRejected(final HashMap<String, Object> clientStatusHashMap) {
|
public static void verifyClientRejected(final HashMap<String, Object> clientStatusHashMap) {
|
||||||
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS REJECTED ------------------------------------");
|
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS REJECTED ------------------------------------");
|
||||||
assertEquals((int) clientStatusHashMap.get("id"), 700);
|
assertEquals(700, (int) clientStatusHashMap.get("id"));
|
||||||
System.out.println("Client Status:" + clientStatusHashMap + "\n");
|
LOG.info("Client Status: {} \n", clientStatusHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyClientActiavted(final HashMap<String, Object> clientStatusHashMap) {
|
public static void verifyClientActiavted(final HashMap<String, Object> clientStatusHashMap) {
|
||||||
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS ACTIVATED ------------------------------------");
|
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS ACTIVATED ------------------------------------");
|
||||||
assertEquals((int) clientStatusHashMap.get("id"), 300);
|
assertEquals(300, (int) clientStatusHashMap.get("id"));
|
||||||
System.out.println("Client Status:" + clientStatusHashMap + "\n");
|
LOG.info("Client Status: {} \n", clientStatusHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyClientWithdrawn(final HashMap<String, Object> clientStatusHashMap) {
|
public static void verifyClientWithdrawn(final HashMap<String, Object> clientStatusHashMap) {
|
||||||
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS WITHDRAWN ------------------------------------");
|
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS WITHDRAWN ------------------------------------");
|
||||||
assertEquals((int) clientStatusHashMap.get("id"), 800);
|
assertEquals(800, (int) clientStatusHashMap.get("id"));
|
||||||
System.out.println("Client Status:" + clientStatusHashMap + "\n");
|
LOG.info("Client Status: {} \n", clientStatusHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-16
@@ -18,19 +18,17 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.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 ClientTest {
|
public class ClientTest {
|
||||||
|
|
||||||
@@ -38,7 +36,7 @@ public class ClientTest {
|
|||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private ClientHelper clientHelper;
|
private ClientHelper clientHelper;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -51,7 +49,7 @@ public class ClientTest {
|
|||||||
public void testClientStatus() {
|
public void testClientStatus() {
|
||||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientId);
|
Assertions.assertNotNull(clientId);
|
||||||
|
|
||||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
ClientStatusChecker.verifyClientIsActive(status);
|
ClientStatusChecker.verifyClientIsActive(status);
|
||||||
@@ -82,9 +80,9 @@ public class ClientTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testClientAsPersonStatus() {
|
public void testClientAsPersonStatus() {
|
||||||
|
|
||||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
final Integer clientId = ClientHelper.createClientAsPerson(this.requestSpec, this.responseSpec);
|
final Integer clientId = ClientHelper.createClientAsPerson(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientId);
|
Assertions.assertNotNull(clientId);
|
||||||
|
|
||||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
ClientStatusChecker.verifyClientIsActive(status);
|
ClientStatusChecker.verifyClientIsActive(status);
|
||||||
@@ -115,9 +113,9 @@ public class ClientTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testClientAsEntityStatus() {
|
public void testClientAsEntityStatus() {
|
||||||
|
|
||||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
final Integer clientId = ClientHelper.createClientAsEntity(this.requestSpec, this.responseSpec);
|
final Integer clientId = ClientHelper.createClientAsEntity(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientId);
|
Assertions.assertNotNull(clientId);
|
||||||
|
|
||||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
ClientStatusChecker.verifyClientIsActive(status);
|
ClientStatusChecker.verifyClientIsActive(status);
|
||||||
|
|||||||
+260
-285
@@ -18,336 +18,311 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.apache.fineract.portfolio.client.api.ClientApiConstants;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.apache.fineract.portfolio.client.domain.Client;
|
|
||||||
import org.apache.fineract.portfolio.client.exception.InvalidClientStateTransitionException;
|
|
||||||
import org.apache.fineract.useradministration.domain.AppUser;
|
|
||||||
import org.joda.time.LocalDate;
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
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({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public class ClientUndoRejectAndWithdrawalIntegrationTest {
|
public class ClientUndoRejectAndWithdrawalIntegrationTest {
|
||||||
|
|
||||||
private static final String CREATE_CLIENT_URL = "/fineract-provider/api/v1/clients?" + Utils.TENANT_IDENTIFIER;
|
private static final String CREATE_CLIENT_URL = "/fineract-provider/api/v1/clients?" + Utils.TENANT_IDENTIFIER;
|
||||||
public static final String DATE_FORMAT = "dd MMMM yyyy";
|
public static final String DATE_FORMAT = "dd MMMM yyyy";
|
||||||
private final String submittedOnDate = "submittedOnDate";
|
private final String submittedOnDate = "submittedOnDate";
|
||||||
private final String officeId = "officeId";
|
private final String officeId = "officeId";
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private ClientHelper clientHelper;
|
private ClientHelper clientHelper;
|
||||||
|
|
||||||
@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.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
@BeforeEach
|
||||||
}
|
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
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
public void clientUndoRejectIntegrationTest() {
|
}
|
||||||
|
|
||||||
// CREATE CLIENT
|
|
||||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
|
||||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
|
||||||
Assert.assertNotNull(clientId);
|
|
||||||
|
|
||||||
// GET CLIENT STATUS
|
|
||||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
|
|
||||||
String.valueOf(clientId));
|
|
||||||
|
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
|
||||||
|
|
||||||
status = this.clientHelper.rejectClient(clientId);
|
|
||||||
ClientStatusChecker.verifyClientRejected(status);
|
|
||||||
|
|
||||||
status = this.clientHelper.undoReject(clientId);
|
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testClientUndoRejectWithDateBeforeRejectDate() {
|
|
||||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
|
||||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
|
||||||
|
|
||||||
// CREATE CLIENT
|
@Test
|
||||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
public void clientUndoRejectIntegrationTest() {
|
||||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
|
||||||
Assert.assertNotNull(clientId);
|
|
||||||
|
|
||||||
// GET CLIENT STATUS
|
// CREATE CLIENT
|
||||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
String.valueOf(clientId));
|
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||||
|
Assertions.assertNotNull(clientId);
|
||||||
|
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
// GET CLIENT STATUS
|
||||||
|
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
|
|
||||||
status = this.clientHelper.rejectClient(clientId);
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
ClientStatusChecker.verifyClientRejected(status);
|
|
||||||
|
|
||||||
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoRejectedclient(clientId,
|
status = this.clientHelper.rejectClient(clientId);
|
||||||
CommonConstants.RESPONSE_ERROR, ClientHelper.CREATED_DATE);
|
ClientStatusChecker.verifyClientRejected(status);
|
||||||
assertEquals("error.msg.client.reopened.date.cannot.before.client.rejected.date",
|
|
||||||
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
|
||||||
|
|
||||||
status = this.clientHelper.undoReject(clientId);
|
status = this.clientHelper.undoReject(clientId);
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
}
|
||||||
@Test
|
|
||||||
public void testClientUndoRejectWithoutReject() {
|
|
||||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
|
||||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
|
||||||
|
|
||||||
// CREATE CLIENT
|
@Test
|
||||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
public void testClientUndoRejectWithDateBeforeRejectDate() {
|
||||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||||
Assert.assertNotNull(clientId);
|
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||||
|
|
||||||
// GET CLIENT STATUS
|
// CREATE CLIENT
|
||||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
String.valueOf(clientId));
|
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
Assertions.assertNotNull(clientId);
|
||||||
|
|
||||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
// GET CLIENT STATUS
|
||||||
Calendar todaysDate = Calendar.getInstance();
|
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
final String undoRejectDate = dateFormat.format(todaysDate.getTime());
|
|
||||||
|
|
||||||
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoRejectedclient(clientId,
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
CommonConstants.RESPONSE_ERROR, undoRejectDate);
|
|
||||||
assertEquals("error.msg.client.undorejection.on.nonrejected.account",
|
|
||||||
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
|
||||||
|
|
||||||
status = this.clientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
status = this.clientHelper.rejectClient(clientId);
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
ClientStatusChecker.verifyClientRejected(status);
|
||||||
|
|
||||||
}
|
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoRejectedclient(clientId,
|
||||||
|
CommonConstants.RESPONSE_ERROR, ClientHelper.CREATED_DATE);
|
||||||
|
assertEquals("error.msg.client.reopened.date.cannot.before.client.rejected.date",
|
||||||
|
clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
@Test
|
status = this.clientHelper.undoReject(clientId);
|
||||||
public void testClientUndoRejectWithFutureDate() {
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
|
}
|
||||||
|
|
||||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
@Test
|
||||||
|
public void testClientUndoRejectWithoutReject() {
|
||||||
|
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||||
|
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||||
|
|
||||||
// CREATE CLIENT
|
// CREATE CLIENT
|
||||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientId);
|
Assertions.assertNotNull(clientId);
|
||||||
|
|
||||||
// GET CLIENT STATUS
|
// GET CLIENT STATUS
|
||||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
|
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
String.valueOf(clientId));
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
|
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||||
|
Date todaysDate = Utils.getLocalDateOfTenant().toDate();
|
||||||
|
final String undoRejectDate = dateFormat.format(todaysDate);
|
||||||
|
|
||||||
status = this.clientHelper.rejectClient(clientId);
|
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoRejectedclient(clientId,
|
||||||
ClientStatusChecker.verifyClientRejected(status);
|
CommonConstants.RESPONSE_ERROR, undoRejectDate);
|
||||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
assertEquals("error.msg.client.undorejection.on.nonrejected.account",
|
||||||
Calendar todaysDate = Calendar.getInstance();
|
clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
todaysDate.add(Calendar.DATE, 1);
|
|
||||||
final String undoRejectDate = dateFormat.format(todaysDate.getTime());
|
|
||||||
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoWithdrawclient(clientId,
|
|
||||||
CommonConstants.RESPONSE_ERROR, undoRejectDate);
|
|
||||||
assertEquals("validation.msg.client.reopenedDate.is.greater.than.date",
|
|
||||||
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
|
||||||
|
|
||||||
status = this.clientHelper.undoReject(clientId);
|
status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void clientUndoWithDrawnIntegrationTest() {
|
public void testClientUndoRejectWithFutureDate() {
|
||||||
|
|
||||||
// CREATE CLIENT
|
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
|
||||||
Assert.assertNotNull(clientId);
|
|
||||||
|
|
||||||
// GET CLIENT STATUS
|
// CREATE CLIENT
|
||||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
String.valueOf(clientId));
|
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||||
|
Assertions.assertNotNull(clientId);
|
||||||
|
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
// GET CLIENT STATUS
|
||||||
|
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
|
|
||||||
status = this.clientHelper.withdrawClient(clientId);
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
ClientStatusChecker.verifyClientWithdrawn(status);
|
|
||||||
|
|
||||||
status = this.clientHelper.undoWithdrawn(clientId);
|
status = this.clientHelper.rejectClient(clientId);
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
ClientStatusChecker.verifyClientRejected(status);
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||||
|
Date tomorrowsDate = Utils.getLocalDateOfTenant().plusDays(1).toDate();
|
||||||
|
final String undoRejectDate = dateFormat.format(tomorrowsDate);
|
||||||
|
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
|
||||||
|
CommonConstants.RESPONSE_ERROR, undoRejectDate);
|
||||||
|
assertEquals("validation.msg.client.reopenedDate.is.greater.than.date",
|
||||||
|
clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
}
|
status = this.clientHelper.undoReject(clientId);
|
||||||
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
|
|
||||||
@Test
|
}
|
||||||
public void testClientUndoWithDrawnWithDateBeforeWithdrawal() {
|
|
||||||
|
|
||||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
@Test
|
||||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
public void clientUndoWithDrawnIntegrationTest() {
|
||||||
|
|
||||||
// CREATE CLIENT
|
// CREATE CLIENT
|
||||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientId);
|
Assertions.assertNotNull(clientId);
|
||||||
|
|
||||||
// GET CLIENT STATUS
|
// GET CLIENT STATUS
|
||||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
|
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
String.valueOf(clientId));
|
|
||||||
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
|
||||||
|
status = this.clientHelper.withdrawClient(clientId);
|
||||||
status = this.clientHelper.withdrawClient(clientId);
|
ClientStatusChecker.verifyClientWithdrawn(status);
|
||||||
ClientStatusChecker.verifyClientWithdrawn(status);
|
|
||||||
|
status = this.clientHelper.undoWithdrawn(clientId);
|
||||||
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoWithdrawclient(clientId,
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
CommonConstants.RESPONSE_ERROR, ClientHelper.CREATED_DATE);
|
|
||||||
assertEquals("error.msg.client.reopened.date.cannot.before.client.withdrawal.date",
|
}
|
||||||
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
|
||||||
|
@Test
|
||||||
status = this.clientHelper.undoWithdrawn(clientId);
|
public void testClientUndoWithDrawnWithDateBeforeWithdrawal() {
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
|
||||||
|
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||||
}
|
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
// CREATE CLIENT
|
||||||
@Test
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
public void testClientUndoWithDrawnWithoutWithdrawal() {
|
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
Assertions.assertNotNull(clientId);
|
||||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
|
||||||
// CREATE CLIENT
|
// GET CLIENT STATUS
|
||||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
|
||||||
Assert.assertNotNull(clientId);
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
|
|
||||||
// GET CLIENT STATUS
|
status = this.clientHelper.withdrawClient(clientId);
|
||||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
|
ClientStatusChecker.verifyClientWithdrawn(status);
|
||||||
String.valueOf(clientId));
|
|
||||||
|
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
|
||||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
CommonConstants.RESPONSE_ERROR, ClientHelper.CREATED_DATE);
|
||||||
Calendar todaysDate = Calendar.getInstance();
|
assertEquals("error.msg.client.reopened.date.cannot.before.client.withdrawal.date",
|
||||||
final String undoWithdrawDate = dateFormat.format(todaysDate.getTime());
|
clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoWithdrawclient(clientId,
|
status = this.clientHelper.undoWithdrawn(clientId);
|
||||||
CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
assertEquals("error.msg.client.undoWithdrawal.on.nonwithdrawal.account",
|
|
||||||
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
}
|
||||||
|
|
||||||
status = this.clientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
@Test
|
||||||
|
public void testClientUndoWithDrawnWithoutWithdrawal() {
|
||||||
}
|
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||||
|
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||||
@Test
|
// CREATE CLIENT
|
||||||
public void testClientUndoWithDrawnWithFutureDate() {
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
|
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
Assertions.assertNotNull(clientId);
|
||||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
|
||||||
|
// GET CLIENT STATUS
|
||||||
// CREATE CLIENT
|
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
|
||||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||||
Assert.assertNotNull(clientId);
|
Date todaysDate = Utils.getLocalDateOfTenant().toDate();
|
||||||
|
final String undoWithdrawDate = dateFormat.format(todaysDate);
|
||||||
// GET CLIENT STATUS
|
|
||||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
|
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
|
||||||
String.valueOf(clientId));
|
CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
|
||||||
|
assertEquals("error.msg.client.undoWithdrawal.on.nonwithdrawal.account",
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
status = this.clientHelper.withdrawClient(clientId);
|
status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
ClientStatusChecker.verifyClientWithdrawn(status);
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
|
||||||
Calendar todaysDate = Calendar.getInstance();
|
}
|
||||||
todaysDate.add(Calendar.DATE, 1);
|
|
||||||
final String undoWithdrawDate = dateFormat.format(todaysDate.getTime());
|
@Test
|
||||||
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoWithdrawclient(clientId,
|
public void testClientUndoWithDrawnWithFutureDate() {
|
||||||
CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
|
|
||||||
assertEquals("validation.msg.client.reopenedDate.is.greater.than.date",
|
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||||
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||||
|
|
||||||
status = this.clientHelper.undoWithdrawn(clientId);
|
// CREATE CLIENT
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
|
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||||
}
|
Assertions.assertNotNull(clientId);
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
// GET CLIENT STATUS
|
||||||
@Test
|
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
public void testValidateReopenedDate() {
|
|
||||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
|
||||||
|
status = this.clientHelper.withdrawClient(clientId);
|
||||||
// CREATE CLIENT
|
ClientStatusChecker.verifyClientWithdrawn(status);
|
||||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
Date tomorrowsDate = Utils.getLocalDateOfTenant().plusDays(1).toDate();
|
||||||
Assert.assertNotNull(clientId);
|
final String undoWithdrawDate = dateFormat.format(tomorrowsDate);
|
||||||
// GET CLIENT STATUS
|
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
|
||||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
|
CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
|
||||||
String.valueOf(clientId));
|
assertEquals("validation.msg.client.reopenedDate.is.greater.than.date",
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
status = this.clientHelper.withdrawClient(clientId);
|
status = this.clientHelper.undoWithdrawn(clientId);
|
||||||
ClientStatusChecker.verifyClientWithdrawn(status);
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
status = this.clientHelper.undoWithdrawn(clientId);
|
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
}
|
||||||
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.activateClient(clientId,
|
|
||||||
CommonConstants.RESPONSE_ERROR);
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
assertEquals("error.msg.clients.submittedOnDate.after.reopened.date",
|
@Test
|
||||||
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
public void testValidateReopenedDate() {
|
||||||
|
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||||
}
|
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||||
|
|
||||||
@Test
|
// CREATE CLIENT
|
||||||
public void testReopenedDate() {
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
Assertions.assertNotNull(clientId);
|
||||||
|
// GET CLIENT STATUS
|
||||||
// CREATE CLIENT
|
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
|
||||||
Assert.assertNotNull(clientId);
|
status = this.clientHelper.withdrawClient(clientId);
|
||||||
// GET CLIENT STATUS
|
ClientStatusChecker.verifyClientWithdrawn(status);
|
||||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
|
status = this.clientHelper.undoWithdrawn(clientId);
|
||||||
String.valueOf(clientId));
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.activateClient(clientId, CommonConstants.RESPONSE_ERROR);
|
||||||
|
assertEquals("error.msg.clients.submittedOnDate.after.reopened.date",
|
||||||
status = this.clientHelper.withdrawClient(clientId);
|
clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
ClientStatusChecker.verifyClientWithdrawn(status);
|
|
||||||
status = this.clientHelper.undoWithdrawn(clientId);
|
}
|
||||||
ClientStatusChecker.verifyClientPending(status);
|
|
||||||
status = this.clientHelper.activateClientWithDiffDateOption(clientId, ClientHelper.CREATED_DATE_PLUS_TWO);
|
@Test
|
||||||
|
public void testReopenedDate() {
|
||||||
}
|
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||||
|
// final ClientHelper validationErrorHelper = new
|
||||||
private static String randomIDGenerator(final String prefix, final int lenOfRandomSuffix) {
|
// ClientHelper(this.requestSpec, errorResponse);
|
||||||
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
|
||||||
}
|
// CREATE CLIENT
|
||||||
|
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||||
|
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||||
|
Assertions.assertNotNull(clientId);
|
||||||
|
// GET CLIENT STATUS
|
||||||
|
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||||
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
|
|
||||||
|
status = this.clientHelper.withdrawClient(clientId);
|
||||||
|
ClientStatusChecker.verifyClientWithdrawn(status);
|
||||||
|
status = this.clientHelper.undoWithdrawn(clientId);
|
||||||
|
ClientStatusChecker.verifyClientPending(status);
|
||||||
|
status = this.clientHelper.activateClientWithDiffDateOption(clientId, ClientHelper.CREATED_DATE_PLUS_TWO);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String randomIDGenerator(final String prefix, final int lenOfRandomSuffix) {
|
||||||
|
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Executable → Regular
+20
-19
@@ -18,30 +18,31 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.accounting.Account;
|
import org.apache.fineract.integrationtests.common.accounting.Account;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
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 ConcurrencyIntegrationTest {
|
public class ConcurrencyIntegrationTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(ConcurrencyIntegrationTest.class);
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
@@ -50,7 +51,7 @@ public class ConcurrencyIntegrationTest {
|
|||||||
|
|
||||||
final int MYTHREADS = 30;
|
final int MYTHREADS = 30;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -75,7 +76,7 @@ public class ConcurrencyIntegrationTest {
|
|||||||
date.set(2011, 9, 20);
|
date.set(2011, 9, 20);
|
||||||
Float repaymentAmount = 100.0f;
|
Float repaymentAmount = 100.0f;
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
System.out.println("Starting concurrent transaction number " + i);
|
LOG.info("Starting concurrent transaction number {}", i);
|
||||||
date.add(Calendar.DAY_OF_MONTH, 1);
|
date.add(Calendar.DAY_OF_MONTH, 1);
|
||||||
repaymentAmount = repaymentAmount + 100;
|
repaymentAmount = repaymentAmount + 100;
|
||||||
Runnable worker = new LoanRepaymentExecutor(loanTransactionHelper, loanID, repaymentAmount, date);
|
Runnable worker = new LoanRepaymentExecutor(loanTransactionHelper, loanID, repaymentAmount, date);
|
||||||
@@ -87,12 +88,12 @@ public class ConcurrencyIntegrationTest {
|
|||||||
while (!executor.isTerminated()) {
|
while (!executor.isTerminated()) {
|
||||||
|
|
||||||
}
|
}
|
||||||
System.out.println("\nFinished all threads");
|
LOG.info("\nFinished all threads");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer createLoanProduct(final boolean multiDisburseLoan, final String accountingRule, final Account... accounts) {
|
private Integer createLoanProduct(final boolean multiDisburseLoan, final String accountingRule, final Account... accounts) {
|
||||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||||
LoanProductTestBuilder builder = new LoanProductTestBuilder() //
|
LoanProductTestBuilder builder = new LoanProductTestBuilder() //
|
||||||
.withPrincipal("12,000.00") //
|
.withPrincipal("12,000.00") //
|
||||||
.withNumberOfRepayments("4") //
|
.withNumberOfRepayments("4") //
|
||||||
@@ -113,7 +114,7 @@ public class ConcurrencyIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, String principal) {
|
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, String principal) {
|
||||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||||
.withPrincipal(principal) //
|
.withPrincipal(principal) //
|
||||||
.withLoanTermFrequency("4") //
|
.withLoanTermFrequency("4") //
|
||||||
@@ -152,13 +153,13 @@ public class ConcurrencyIntegrationTest {
|
|||||||
try {
|
try {
|
||||||
this.loanTransactionHelper.makeRepayment(repaymentDate, repaymentAmount, loanId);
|
this.loanTransactionHelper.makeRepayment(repaymentDate, repaymentAmount, loanId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Found an exception" + e.getMessage());
|
LOG.info("Found an exception {}", e.getMessage());
|
||||||
System.out.println("Details of failed concurrent transaction (date, amount, loanId) are " + repaymentDate + ","
|
LOG.info("Details of failed concurrent transaction (date, amount, loanId) are {},{},{}", repaymentDate, repaymentAmount,
|
||||||
+ repaymentAmount + "," + loanId);
|
loanId);
|
||||||
throw (e);
|
throw (e);
|
||||||
}
|
}
|
||||||
System.out.println("Details of passed concurrent transaction, details (date, amount, loanId) are " + repaymentDate + ","
|
LOG.info("Details of passed concurrent transaction, details (date, amount, loanId) are {},{},{}", repaymentDate,
|
||||||
+ repaymentAmount + "," + loanId);
|
repaymentAmount, loanId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+19
-22
@@ -18,21 +18,19 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.CurrenciesHelper;
|
import org.apache.fineract.integrationtests.common.CurrenciesHelper;
|
||||||
import org.apache.fineract.integrationtests.common.CurrencyDomain;
|
import org.apache.fineract.integrationtests.common.CurrencyDomain;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.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({ "unused", "rawtypes" })
|
@SuppressWarnings({ "unused", "rawtypes" })
|
||||||
public class CurrenciesTest {
|
public class CurrenciesTest {
|
||||||
@@ -40,7 +38,7 @@ public class CurrenciesTest {
|
|||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -54,13 +52,13 @@ public class CurrenciesTest {
|
|||||||
CurrencyDomain currency = CurrenciesHelper.getCurrencybyCode(requestSpec, responseSpec, "USD");
|
CurrencyDomain currency = CurrenciesHelper.getCurrencybyCode(requestSpec, responseSpec, "USD");
|
||||||
CurrencyDomain usd = CurrencyDomain.create("USD", "US Dollar", 2, "$", "currency.USD", "US Dollar ($)").build();
|
CurrencyDomain usd = CurrencyDomain.create("USD", "US Dollar", 2, "$", "currency.USD", "US Dollar ($)").build();
|
||||||
|
|
||||||
Assert.assertTrue(currency.getDecimalPlaces() >= 0);
|
Assertions.assertTrue(currency.getDecimalPlaces() >= 0);
|
||||||
Assert.assertNotNull(currency.getName());
|
Assertions.assertNotNull(currency.getName());
|
||||||
Assert.assertNotNull(currency.getDisplaySymbol());
|
Assertions.assertNotNull(currency.getDisplaySymbol());
|
||||||
Assert.assertNotNull(currency.getDisplayLabel());
|
Assertions.assertNotNull(currency.getDisplayLabel());
|
||||||
Assert.assertNotNull(currency.getNameCode());
|
Assertions.assertNotNull(currency.getNameCode());
|
||||||
|
|
||||||
Assert.assertEquals(usd, currency);
|
Assertions.assertEquals(usd, currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -75,12 +73,11 @@ public class CurrenciesTest {
|
|||||||
currenciestoUpdate.add("USD");
|
currenciestoUpdate.add("USD");
|
||||||
currenciestoUpdate.add("INR");
|
currenciestoUpdate.add("INR");
|
||||||
|
|
||||||
|
|
||||||
ArrayList<String> currenciesOutput = CurrenciesHelper.updateSelectedCurrencies(this.requestSpec, this.responseSpec,
|
ArrayList<String> currenciesOutput = CurrenciesHelper.updateSelectedCurrencies(this.requestSpec, this.responseSpec,
|
||||||
currenciestoUpdate);
|
currenciestoUpdate);
|
||||||
Assert.assertNotNull(currenciesOutput);
|
Assertions.assertNotNull(currenciesOutput);
|
||||||
|
|
||||||
Assert.assertEquals("Verifying Do Outputed Currencies Match after Updation", currenciestoUpdate, currenciesOutput);
|
Assertions.assertEquals(currenciestoUpdate, currenciesOutput, "Verifying Do Outputed Currencies Match after Updation");
|
||||||
|
|
||||||
// Test that output matches updation
|
// Test that output matches updation
|
||||||
ArrayList<CurrencyDomain> currenciesBeforeUpdate = new ArrayList<CurrencyDomain>();
|
ArrayList<CurrencyDomain> currenciesBeforeUpdate = new ArrayList<CurrencyDomain>();
|
||||||
@@ -90,8 +87,8 @@ public class CurrenciesTest {
|
|||||||
Collections.sort(currenciesBeforeUpdate);
|
Collections.sort(currenciesBeforeUpdate);
|
||||||
|
|
||||||
ArrayList<CurrencyDomain> currenciesAfterUpdate = CurrenciesHelper.getSelectedCurrencies(requestSpec, responseSpec);
|
ArrayList<CurrencyDomain> currenciesAfterUpdate = CurrenciesHelper.getSelectedCurrencies(requestSpec, responseSpec);
|
||||||
Assert.assertNotNull(currenciesAfterUpdate);
|
Assertions.assertNotNull(currenciesAfterUpdate);
|
||||||
|
|
||||||
Assert.assertEquals("Verifying Do Selected Currencies Match after Updation", currenciesBeforeUpdate, currenciesAfterUpdate);
|
Assertions.assertEquals(currenciesBeforeUpdate, currenciesAfterUpdate, "Verifying Do Selected Currencies Match after Updation");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+7
-9
@@ -18,15 +18,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
||||||
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 CurrencyIntegrationTest {
|
public class CurrencyIntegrationTest {
|
||||||
|
|
||||||
@@ -34,8 +33,7 @@ public class CurrencyIntegrationTest {
|
|||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private SavingsAccountHelper savingsAccountHelper;
|
private SavingsAccountHelper savingsAccountHelper;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
@Before
|
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
|
|||||||
+81
-45
@@ -18,34 +18,39 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
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.*;
|
import org.apache.fineract.integrationtests.common.GroupHelper;
|
||||||
import org.apache.fineract.integrationtests.common.loans.*;
|
import org.apache.fineract.integrationtests.common.LoanRescheduleRequestHelper;
|
||||||
import org.junit.Assert;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.junit.Before;
|
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||||
import org.junit.Ignore;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.junit.Test;
|
import org.apache.fineract.integrationtests.common.loans.LoanRescheduleRequestTestBuilder;
|
||||||
|
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import com.jayway.restassured.http.ContentType;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import com.jayway.restassured.specification.RequestSpecification;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import com.jayway.restassured.specification.ResponseSpecification;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests loan schedule change based on group meeting changes and loan
|
* Tests loan schedule change based on group meeting changes and loan
|
||||||
* rescheduling
|
* rescheduling
|
||||||
**/
|
**/
|
||||||
@SuppressWarnings({ "rawtypes" })
|
@SuppressWarnings({ "rawtypes" })
|
||||||
@Ignore
|
@Disabled
|
||||||
public class DisbursalAndRepaymentScheduleTest {
|
public class DisbursalAndRepaymentScheduleTest {
|
||||||
|
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
@@ -66,14 +71,16 @@ public class DisbursalAndRepaymentScheduleTest {
|
|||||||
|
|
||||||
private final SimpleDateFormat dateFormatterStandard = new SimpleDateFormat("dd MMMM yyyy");
|
private final SimpleDateFormat dateFormatterStandard = new SimpleDateFormat("dd MMMM yyyy");
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRescheduleJLGLoanSynk() {
|
public void testRescheduleJLGLoanSynk() {
|
||||||
System.out.println("---------------------------------STARTING RESCHEDULE JLG LOAN TEST ------------------------------------------");
|
// system.out.println("---------------------------------STARTING
|
||||||
|
// RESCHEDULE JLG
|
||||||
|
// LOAN TEST ------------------------------------------");
|
||||||
|
|
||||||
Calendar meetingCalendar = Calendar.getInstance();
|
Calendar meetingCalendar = Calendar.getInstance();
|
||||||
meetingCalendar.setFirstDayOfWeek(Calendar.MONDAY);
|
meetingCalendar.setFirstDayOfWeek(Calendar.MONDAY);
|
||||||
@@ -122,7 +129,9 @@ public class DisbursalAndRepaymentScheduleTest {
|
|||||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
this.loanRescheduleRequestHelper = new LoanRescheduleRequestHelper(this.requestSpec, this.responseSpec);
|
this.loanRescheduleRequestHelper = new LoanRescheduleRequestHelper(this.requestSpec, this.responseSpec);
|
||||||
System.out.println("---------------------------------CREATING ENTITIES AND JLG LOAN ------------------------------------------");
|
// system.out.println("---------------------------------CREATING
|
||||||
|
// ENTITIES AND
|
||||||
|
// JLG LOAN ------------------------------------------");
|
||||||
// create all required entities
|
// create all required entities
|
||||||
this.createRequiredEntitiesForJLGLoanSync(groupMeetingDate);
|
this.createRequiredEntitiesForJLGLoanSync(groupMeetingDate);
|
||||||
|
|
||||||
@@ -137,7 +146,7 @@ public class DisbursalAndRepaymentScheduleTest {
|
|||||||
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||||
|
|
||||||
// Test for loan account is created
|
// Test for loan account is created
|
||||||
Assert.assertNotNull(this.loanId);
|
Assertions.assertNotNull(this.loanId);
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
||||||
|
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
@@ -152,25 +161,33 @@ public class DisbursalAndRepaymentScheduleTest {
|
|||||||
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("---------------------------------CHANGING GROUP MEETING DATE ------------------------------------------");
|
// system.out.println("---------------------------------CHANGING GROUP
|
||||||
|
// MEETING
|
||||||
|
// DATE ------------------------------------------");
|
||||||
CalendarHelper.updateMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, this.groupCalendarId.toString(),
|
CalendarHelper.updateMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, this.groupCalendarId.toString(),
|
||||||
groupMeetingNewStartDate, "2", "2", "2"); // New meeting dates
|
groupMeetingNewStartDate, "2", "2", "2"); // New
|
||||||
// will be the tuesday
|
// meeting
|
||||||
|
// dates
|
||||||
|
// will be
|
||||||
|
// the
|
||||||
|
// tuesday
|
||||||
// after the
|
// after the
|
||||||
// coming
|
// coming
|
||||||
// monday
|
// monday
|
||||||
|
|
||||||
ArrayList loanRepaymnetSchedule = this.loanTransactionHelper
|
ArrayList loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec,
|
||||||
.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, this.loanId);
|
this.loanId);
|
||||||
|
|
||||||
ArrayList dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
|
ArrayList dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
|
||||||
Calendar dueDateCalendar = Calendar.getInstance();
|
Calendar dueDateCalendar = Calendar.getInstance();
|
||||||
dueDateCalendar.setFirstDayOfWeek(Calendar.MONDAY);
|
dueDateCalendar.setFirstDayOfWeek(Calendar.MONDAY);
|
||||||
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
|
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
|
||||||
(Integer) dueDateLoanSchedule.get(2));
|
(Integer) dueDateLoanSchedule.get(2));
|
||||||
assertEquals("AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY", 3, dueDateCalendar.get(Calendar.DAY_OF_WEEK));
|
assertEquals(3, dueDateCalendar.get(Calendar.DAY_OF_WEEK), "AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY");
|
||||||
|
|
||||||
System.out.println("---------------------------------CREATING LOAN RESCHEDULE REQUEST------------------------------------------");
|
// system.out.println("---------------------------------CREATING LOAN
|
||||||
|
// RESCHEDULE
|
||||||
|
// REQUEST------------------------------------------");
|
||||||
|
|
||||||
String requestJSON = new LoanRescheduleRequestTestBuilder().updateGraceOnInterest("2").updateGraceOnPrincipal("2")
|
String requestJSON = new LoanRescheduleRequestTestBuilder().updateGraceOnInterest("2").updateGraceOnPrincipal("2")
|
||||||
.updateNewInterestRate(rescheduleInterestRate).updateRescheduleFromDate(rescheduleDate)
|
.updateNewInterestRate(rescheduleInterestRate).updateRescheduleFromDate(rescheduleDate)
|
||||||
@@ -183,12 +200,16 @@ public class DisbursalAndRepaymentScheduleTest {
|
|||||||
dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
|
dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
|
||||||
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
|
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
|
||||||
(Integer) dueDateLoanSchedule.get(2));
|
(Integer) dueDateLoanSchedule.get(2));
|
||||||
assertEquals("AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER LOAN RESCHEDULE REQUEST WAS SENT", 3,
|
assertEquals(3, dueDateCalendar.get(Calendar.DAY_OF_WEEK),
|
||||||
dueDateCalendar.get(Calendar.DAY_OF_WEEK));
|
"AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER LOAN RESCHEDULE REQUEST WAS SENT");
|
||||||
|
|
||||||
System.out.println("Successfully created loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
|
// system.out.println("Successfully created loan reschedule request (ID:
|
||||||
|
// " +
|
||||||
|
// this.loanRescheduleRequestId + ")");
|
||||||
|
|
||||||
System.out.println("-----------------------------APPROVING LOAN RESCHEDULE REQUEST--------------------------");
|
// system.out.println("-----------------------------APPROVING LOAN
|
||||||
|
// RESCHEDULE
|
||||||
|
// REQUEST--------------------------");
|
||||||
|
|
||||||
requestJSON = new LoanRescheduleRequestTestBuilder().updateSubmittedOnDate(rescheduleSubmittedDate)
|
requestJSON = new LoanRescheduleRequestTestBuilder().updateSubmittedOnDate(rescheduleSubmittedDate)
|
||||||
.getApproveLoanRescheduleRequestJSON();
|
.getApproveLoanRescheduleRequestJSON();
|
||||||
@@ -202,18 +223,25 @@ public class DisbursalAndRepaymentScheduleTest {
|
|||||||
dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
|
dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
|
||||||
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
|
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
|
||||||
(Integer) dueDateLoanSchedule.get(2));
|
(Integer) dueDateLoanSchedule.get(2));
|
||||||
assertEquals("AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER RESCHEDULE", 3,
|
assertEquals(3, dueDateCalendar.get(Calendar.DAY_OF_WEEK),
|
||||||
dueDateCalendar.get(Calendar.DAY_OF_WEEK));
|
"AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER RESCHEDULE");
|
||||||
System.out.println("Successfully changed group meeting date (CAELNDAR ID: " + this.groupCalendarId
|
// system.out.println("Successfully changed group meeting date (CAELNDAR
|
||||||
+ ") and rescheduled loan (RESCHEDULE ID: " + this.loanRescheduleRequestId + ")");
|
// ID: " +
|
||||||
|
// this.groupCalendarId
|
||||||
|
// + ") and rescheduled loan (RESCHEDULE ID: " +
|
||||||
|
// this.loanRescheduleRequestId +
|
||||||
|
// ")");
|
||||||
|
|
||||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
|
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testChangeGroupMeetingMaturedOnDate() {
|
public void testChangeGroupMeetingMaturedOnDate() {
|
||||||
System.out
|
// system.out
|
||||||
.println("---------------------------------STARTING GROUP LOAN MEETING CHANGE DATE EXPECTED MATURED CHANGE------------------------------------------");
|
// .println("---------------------------------STARTING GROUP LOAN
|
||||||
|
// MEETING CHANGE
|
||||||
|
// DATE EXPECTED MATURED
|
||||||
|
// CHANGE------------------------------------------");
|
||||||
|
|
||||||
Calendar meetingCalendar = Calendar.getInstance();
|
Calendar meetingCalendar = Calendar.getInstance();
|
||||||
meetingCalendar.setFirstDayOfWeek(Calendar.MONDAY);
|
meetingCalendar.setFirstDayOfWeek(Calendar.MONDAY);
|
||||||
@@ -257,7 +285,9 @@ public class DisbursalAndRepaymentScheduleTest {
|
|||||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
this.loanRescheduleRequestHelper = new LoanRescheduleRequestHelper(this.requestSpec, this.responseSpec);
|
this.loanRescheduleRequestHelper = new LoanRescheduleRequestHelper(this.requestSpec, this.responseSpec);
|
||||||
System.out.println("---------------------------------CREATING ENTITIES AND JLG LOAN ------------------------------------------");
|
// system.out.println("---------------------------------CREATING
|
||||||
|
// ENTITIES AND
|
||||||
|
// JLG LOAN ------------------------------------------");
|
||||||
// create all required entities
|
// create all required entities
|
||||||
this.createRequiredEntitiesForJLGLoanSync(groupMeetingDate);
|
this.createRequiredEntitiesForJLGLoanSync(groupMeetingDate);
|
||||||
|
|
||||||
@@ -272,7 +302,7 @@ public class DisbursalAndRepaymentScheduleTest {
|
|||||||
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||||
|
|
||||||
// Test for loan account is created
|
// Test for loan account is created
|
||||||
Assert.assertNotNull(this.loanId);
|
Assertions.assertNotNull(this.loanId);
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
||||||
|
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
@@ -287,10 +317,16 @@ public class DisbursalAndRepaymentScheduleTest {
|
|||||||
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("---------------------------------CHANGING GROUP MEETING DATE ------------------------------------------");
|
// system.out.println("---------------------------------CHANGING GROUP
|
||||||
|
// MEETING
|
||||||
|
// DATE ------------------------------------------");
|
||||||
CalendarHelper.updateMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, this.groupCalendarId.toString(),
|
CalendarHelper.updateMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, this.groupCalendarId.toString(),
|
||||||
groupMeetingNewStartDate, "2", "2", "2"); // New meeting dates
|
groupMeetingNewStartDate, "2", "2", "2"); // New
|
||||||
// will be the tuesday
|
// meeting
|
||||||
|
// dates
|
||||||
|
// will be
|
||||||
|
// the
|
||||||
|
// tuesday
|
||||||
// after the
|
// after the
|
||||||
// coming
|
// coming
|
||||||
// monday
|
// monday
|
||||||
@@ -303,8 +339,8 @@ public class DisbursalAndRepaymentScheduleTest {
|
|||||||
expectedMaturityCalendar.set((Integer) expectedMaturityDate.get(0), (Integer) expectedMaturityDate.get(1) - 1,
|
expectedMaturityCalendar.set((Integer) expectedMaturityDate.get(0), (Integer) expectedMaturityDate.get(1) - 1,
|
||||||
(Integer) expectedMaturityDate.get(2));
|
(Integer) expectedMaturityDate.get(2));
|
||||||
|
|
||||||
assertEquals("AFTER MEETING CHANGE DATE THE EXPECTED MATURITY SHOULD BE ON TUESDAY", 3,
|
assertEquals(3, expectedMaturityCalendar.get(Calendar.DAY_OF_WEEK),
|
||||||
expectedMaturityCalendar.get(Calendar.DAY_OF_WEEK));
|
"AFTER MEETING CHANGE DATE THE EXPECTED MATURITY SHOULD BE ON TUESDAY");
|
||||||
|
|
||||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
|
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-34
@@ -18,30 +18,30 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ExternalServicesConfigurationHelper;
|
import org.apache.fineract.integrationtests.common.ExternalServicesConfigurationHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
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", "static-access" })
|
|
||||||
public class ExternalServicesConfigurationTest {
|
public class ExternalServicesConfigurationTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(ExternalServicesConfigurationTest.class);
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private ExternalServicesConfigurationHelper externalServicesConfigurationHelper;
|
private ExternalServicesConfigurationHelper externalServicesConfigurationHelper;
|
||||||
private ResponseSpecification httpStatusForidden;
|
private ResponseSpecification httpStatusForidden;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -57,27 +57,27 @@ public class ExternalServicesConfigurationTest {
|
|||||||
|
|
||||||
// Checking for S3
|
// Checking for S3
|
||||||
String configName = "s3_access_key";
|
String configName = "s3_access_key";
|
||||||
ArrayList<HashMap> externalServicesConfig = this.externalServicesConfigurationHelper
|
ArrayList<HashMap> externalServicesConfig = ExternalServicesConfigurationHelper
|
||||||
.getExternalServicesConfigurationByServiceName(requestSpec, responseSpec, "S3");
|
.getExternalServicesConfigurationByServiceName(requestSpec, responseSpec, "S3");
|
||||||
Assert.assertNotNull(externalServicesConfig);
|
Assertions.assertNotNull(externalServicesConfig);
|
||||||
for (Integer configIndex = 0; configIndex < (externalServicesConfig.size()); configIndex++) {
|
for (Integer configIndex = 0; configIndex < externalServicesConfig.size(); configIndex++) {
|
||||||
String name = (String) externalServicesConfig.get(configIndex).get("name");
|
String name = (String) externalServicesConfig.get(configIndex).get("name");
|
||||||
String value = null;
|
String value = null;
|
||||||
if (name.equals(configName)) {
|
if (name.equals(configName)) {
|
||||||
value = (String) externalServicesConfig.get(configIndex).get("value");
|
value = (String) externalServicesConfig.get(configIndex).get("value");
|
||||||
if(value == null){
|
if (value == null) {
|
||||||
value = "testnull";
|
value = "testnull";
|
||||||
}
|
}
|
||||||
String newValue = "test";
|
String newValue = "test";
|
||||||
System.out.println(name + ":" + value);
|
LOG.info("{} : {}", name, value);
|
||||||
HashMap arrayListValue = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
HashMap arrayListValue = ExternalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
||||||
responseSpec, "S3", name, newValue);
|
responseSpec, "S3", name, newValue);
|
||||||
Assert.assertNotNull(arrayListValue.get("value"));
|
Assertions.assertNotNull(arrayListValue.get("value"));
|
||||||
Assert.assertEquals(arrayListValue.get("value"), newValue);
|
Assertions.assertEquals(arrayListValue.get("value"), newValue);
|
||||||
HashMap arrayListValue1 = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
HashMap arrayListValue1 = ExternalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
||||||
responseSpec, "S3", name, value);
|
responseSpec, "S3", name, value);
|
||||||
Assert.assertNotNull(arrayListValue1.get("value"));
|
Assertions.assertNotNull(arrayListValue1.get("value"));
|
||||||
Assert.assertEquals(arrayListValue1.get("value"), value);
|
Assertions.assertEquals(arrayListValue1.get("value"), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -85,27 +85,28 @@ public class ExternalServicesConfigurationTest {
|
|||||||
// Checking for SMTP:
|
// Checking for SMTP:
|
||||||
|
|
||||||
configName = "username";
|
configName = "username";
|
||||||
externalServicesConfig = this.externalServicesConfigurationHelper.getExternalServicesConfigurationByServiceName(requestSpec,
|
externalServicesConfig = ExternalServicesConfigurationHelper.getExternalServicesConfigurationByServiceName(requestSpec,
|
||||||
responseSpec, "SMTP");
|
responseSpec, "SMTP");
|
||||||
Assert.assertNotNull(externalServicesConfig);
|
Assertions.assertNotNull(externalServicesConfig);
|
||||||
for (Integer configIndex = 0; configIndex < (externalServicesConfig.size()); configIndex++) {
|
|
||||||
|
for (Integer configIndex = 0; configIndex < externalServicesConfig.size(); configIndex++) {
|
||||||
String name = (String) externalServicesConfig.get(configIndex).get("name");
|
String name = (String) externalServicesConfig.get(configIndex).get("name");
|
||||||
String value = null;
|
String value = null;
|
||||||
if (name.equals(configName)) {
|
if (name.equals(configName)) {
|
||||||
value = (String) externalServicesConfig.get(configIndex).get("value");
|
value = (String) externalServicesConfig.get(configIndex).get("value");
|
||||||
if(value == null){
|
if (value == null) {
|
||||||
value = "testnull";
|
value = "testnull";
|
||||||
}
|
}
|
||||||
String newValue = "test";
|
String newValue = "test";
|
||||||
System.out.println(name + ":" + value);
|
LOG.info("{} : {}", name, value);
|
||||||
HashMap arrayListValue = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
HashMap arrayListValue = ExternalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
||||||
responseSpec, "SMTP", name, newValue);
|
responseSpec, "SMTP", name, newValue);
|
||||||
Assert.assertNotNull(arrayListValue.get("value"));
|
Assertions.assertNotNull(arrayListValue.get("value"));
|
||||||
Assert.assertEquals(arrayListValue.get("value"), newValue);
|
Assertions.assertEquals(arrayListValue.get("value"), newValue);
|
||||||
HashMap arrayListValue1 = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
HashMap arrayListValue1 = ExternalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
||||||
responseSpec, "SMTP", name, value);
|
responseSpec, "SMTP", name, value);
|
||||||
Assert.assertNotNull(arrayListValue1.get("value"));
|
Assertions.assertNotNull(arrayListValue1.get("value"));
|
||||||
Assert.assertEquals(arrayListValue1.get("value"), value);
|
Assertions.assertEquals(arrayListValue1.get("value"), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Executable → Regular
+38
-39
@@ -18,12 +18,16 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
|
||||||
import org.apache.fineract.accounting.financialactivityaccount.exception.DuplicateFinancialActivityAccountFoundException;
|
import org.apache.fineract.accounting.financialactivityaccount.exception.DuplicateFinancialActivityAccountFoundException;
|
||||||
import org.apache.fineract.accounting.financialactivityaccount.exception.FinancialActivityAccountInvalidException;
|
import org.apache.fineract.accounting.financialactivityaccount.exception.FinancialActivityAccountInvalidException;
|
||||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||||
@@ -31,17 +35,10 @@ import org.apache.fineract.integrationtests.common.Utils;
|
|||||||
import org.apache.fineract.integrationtests.common.accounting.Account;
|
import org.apache.fineract.integrationtests.common.accounting.Account;
|
||||||
import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
|
import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
|
||||||
import org.apache.fineract.integrationtests.common.accounting.FinancialActivityAccountHelper;
|
import org.apache.fineract.integrationtests.common.accounting.FinancialActivityAccountHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.Test;
|
||||||
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")
|
@SuppressWarnings("rawtypes")
|
||||||
public class FinancialActivityAccountsTest {
|
public class FinancialActivityAccountsTest {
|
||||||
@@ -53,10 +50,10 @@ public class FinancialActivityAccountsTest {
|
|||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private AccountHelper accountHelper;
|
private AccountHelper accountHelper;
|
||||||
private FinancialActivityAccountHelper financialActivityAccountHelper;
|
private FinancialActivityAccountHelper financialActivityAccountHelper;
|
||||||
private final Integer assetTransferFinancialActivityId = FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue();
|
private final Integer assetTransferFinancialActivityId = FinancialActivity.ASSET_TRANSFER.getValue();
|
||||||
public static final Integer liabilityTransferFinancialActivityId = FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue();
|
public static final Integer LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID = FinancialActivity.LIABILITY_TRANSFER.getValue();
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -76,35 +73,36 @@ public class FinancialActivityAccountsTest {
|
|||||||
/** Create a Liability and an Asset Transfer Account **/
|
/** Create a Liability and an Asset Transfer Account **/
|
||||||
Account liabilityTransferAccount = accountHelper.createLiabilityAccount();
|
Account liabilityTransferAccount = accountHelper.createLiabilityAccount();
|
||||||
Account assetTransferAccount = accountHelper.createAssetAccount();
|
Account assetTransferAccount = accountHelper.createAssetAccount();
|
||||||
Assert.assertNotNull(assetTransferAccount);
|
Assertions.assertNotNull(assetTransferAccount);
|
||||||
Assert.assertNotNull(liabilityTransferAccount);
|
Assertions.assertNotNull(liabilityTransferAccount);
|
||||||
|
|
||||||
/*** Create A Financial Activity to Account Mapping **/
|
/*** Create A Financial Activity to Account Mapping **/
|
||||||
Integer financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
|
Integer financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
|
||||||
liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(), responseSpec,
|
LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityTransferAccount.getAccountID(), responseSpec,
|
||||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
Assert.assertNotNull(financialActivityAccountId);
|
Assertions.assertNotNull(financialActivityAccountId);
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Fetch Created Financial Activity to Account Mapping and validate
|
* Fetch Created Financial Activity to Account Mapping and validate
|
||||||
* created values
|
* created values
|
||||||
**/
|
**/
|
||||||
assertFinancialActivityAccountCreation(financialActivityAccountId, liabilityTransferFinancialActivityId, liabilityTransferAccount);
|
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID,
|
||||||
|
liabilityTransferAccount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update Existing Financial Activity to Account Mapping and assert
|
* Update Existing Financial Activity to Account Mapping and assert
|
||||||
* changes
|
* changes
|
||||||
**/
|
**/
|
||||||
Account newLiabilityTransferAccount = accountHelper.createLiabilityAccount();
|
Account newLiabilityTransferAccount = accountHelper.createLiabilityAccount();
|
||||||
Assert.assertNotNull(newLiabilityTransferAccount);
|
Assertions.assertNotNull(newLiabilityTransferAccount);
|
||||||
|
|
||||||
HashMap changes = (HashMap) financialActivityAccountHelper.updateFinancialActivityAccount(financialActivityAccountId,
|
HashMap changes = (HashMap) financialActivityAccountHelper.updateFinancialActivityAccount(financialActivityAccountId,
|
||||||
liabilityTransferFinancialActivityId, newLiabilityTransferAccount.getAccountID(), responseSpec,
|
LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, newLiabilityTransferAccount.getAccountID(), responseSpec,
|
||||||
CommonConstants.RESPONSE_CHANGES);
|
CommonConstants.RESPONSE_CHANGES);
|
||||||
Assert.assertEquals(newLiabilityTransferAccount.getAccountID(), changes.get("glAccountId"));
|
Assertions.assertEquals(newLiabilityTransferAccount.getAccountID(), changes.get("glAccountId"));
|
||||||
|
|
||||||
/** Validate update works correctly **/
|
/** Validate update works correctly **/
|
||||||
assertFinancialActivityAccountCreation(financialActivityAccountId, liabilityTransferFinancialActivityId,
|
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID,
|
||||||
newLiabilityTransferAccount);
|
newLiabilityTransferAccount);
|
||||||
|
|
||||||
/** Update with Invalid Financial Activity should fail **/
|
/** Update with Invalid Financial Activity should fail **/
|
||||||
@@ -116,7 +114,7 @@ public class FinancialActivityAccountsTest {
|
|||||||
|
|
||||||
/** Creating Duplicate Financial Activity should fail **/
|
/** Creating Duplicate Financial Activity should fail **/
|
||||||
List<HashMap> duplicateFinancialActivityAccountError = (List<HashMap>) financialActivityAccountHelper
|
List<HashMap> duplicateFinancialActivityAccountError = (List<HashMap>) financialActivityAccountHelper
|
||||||
.createFinancialActivityAccount(liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(),
|
.createFinancialActivityAccount(LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityTransferAccount.getAccountID(),
|
||||||
responseSpecForDomainRuleViolation, CommonConstants.RESPONSE_ERROR);
|
responseSpecForDomainRuleViolation, CommonConstants.RESPONSE_ERROR);
|
||||||
assertEquals(DuplicateFinancialActivityAccountFoundException.getErrorcode(),
|
assertEquals(DuplicateFinancialActivityAccountFoundException.getErrorcode(),
|
||||||
duplicateFinancialActivityAccountError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
duplicateFinancialActivityAccountError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
@@ -132,33 +130,34 @@ public class FinancialActivityAccountsTest {
|
|||||||
invalidFinancialActivityAccountError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
invalidFinancialActivityAccountError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
/** Should be able to delete a Financial Activity to Account Mapping **/
|
/** Should be able to delete a Financial Activity to Account Mapping **/
|
||||||
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper.deleteFinancialActivityAccount(
|
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper
|
||||||
financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
.deleteFinancialActivityAccount(financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
Assert.assertNotNull(deletedFinancialActivityAccountId);
|
Assertions.assertNotNull(deletedFinancialActivityAccountId);
|
||||||
Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
|
Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
|
||||||
|
|
||||||
/*** Trying to fetch a Deleted Account Mapping should give me a 404 **/
|
/*** Trying to fetch a Deleted Account Mapping should give me a 404 **/
|
||||||
financialActivityAccountHelper.getFinancialActivityAccount(deletedFinancialActivityAccountId, responseSpecForResourceNotFoundError);
|
financialActivityAccountHelper.getFinancialActivityAccount(deletedFinancialActivityAccountId, responseSpecForResourceNotFoundError);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertFinancialActivityAccountCreation(Integer financialActivityAccountId, Integer financialActivityId, Account glAccount) {
|
private void assertFinancialActivityAccountCreation(Integer financialActivityAccountId, Integer financialActivityId,
|
||||||
|
Account glAccount) {
|
||||||
HashMap mappingDetails = financialActivityAccountHelper.getFinancialActivityAccount(financialActivityAccountId, responseSpec);
|
HashMap mappingDetails = financialActivityAccountHelper.getFinancialActivityAccount(financialActivityAccountId, responseSpec);
|
||||||
Assert.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id"));
|
Assertions.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id"));
|
||||||
Assert.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id"));
|
Assertions.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the Financial activities
|
* Delete the Financial activities
|
||||||
*/
|
*/
|
||||||
@After
|
@AfterEach
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
|
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
|
||||||
for (HashMap financialActivity : financialActivities) {
|
for (HashMap financialActivity : financialActivities) {
|
||||||
Integer financialActivityAccountId = (Integer) financialActivity.get("id");
|
Integer financialActivityAccountId = (Integer) financialActivity.get("id");
|
||||||
Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper.deleteFinancialActivityAccount(
|
Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper
|
||||||
financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
.deleteFinancialActivityAccount(financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
Assert.assertNotNull(deletedFinancialActivityAccountId);
|
Assertions.assertNotNull(deletedFinancialActivityAccountId);
|
||||||
Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
|
Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+732
-594
File diff suppressed because it is too large
Load Diff
+36
-33
@@ -18,12 +18,16 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||||
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
|
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
|
||||||
@@ -31,20 +35,17 @@ import org.apache.fineract.integrationtests.common.Utils;
|
|||||||
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
||||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
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", "unused", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unused", "unchecked" })
|
||||||
public class FlexibleSavingsInterestPostingIntegrationTest {
|
public class FlexibleSavingsInterestPostingIntegrationTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(FlexibleSavingsInterestPostingIntegrationTest.class);
|
||||||
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
|
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
|
||||||
|
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
@@ -52,7 +53,7 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
|
|||||||
private SavingsProductHelper savingsProductHelper;
|
private SavingsProductHelper savingsProductHelper;
|
||||||
private SavingsAccountHelper savingsAccountHelper;
|
private SavingsAccountHelper savingsAccountHelper;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -67,15 +68,14 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
|
|||||||
// client activation, savings activation and 1st transaction date
|
// client activation, savings activation and 1st transaction date
|
||||||
final String startDate = "01 December 2013";
|
final String startDate = "01 December 2013";
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, startDate);
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, startDate);
|
||||||
Assert.assertNotNull(clientID);
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
// Configuring global config flags
|
// Configuring global config flags
|
||||||
configureInterestPosting(true, 4);
|
configureInterestPosting(true, 4);
|
||||||
|
|
||||||
final Integer savingsId = createSavingsAccount(clientID, startDate);
|
final Integer savingsId = createSavingsAccount(clientID, startDate);
|
||||||
|
|
||||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1000", startDate,
|
this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1000", startDate, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Perform Post interest transaction and verify the posted transaction
|
* Perform Post interest transaction and verify the posted transaction
|
||||||
@@ -85,22 +85,23 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
|
|||||||
HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
|
HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
|
||||||
ArrayList<HashMap<String, Object>> transactions = (ArrayList<HashMap<String, Object>>) accountDetails.get("transactions");
|
ArrayList<HashMap<String, Object>> transactions = (ArrayList<HashMap<String, Object>>) accountDetails.get("transactions");
|
||||||
HashMap<String, Object> interestPostingTransaction = transactions.get(transactions.size() - 2);
|
HashMap<String, Object> interestPostingTransaction = transactions.get(transactions.size() - 2);
|
||||||
for (Entry<String, Object> entry : interestPostingTransaction.entrySet())
|
for (Entry<String, Object> entry : interestPostingTransaction.entrySet()) {
|
||||||
System.out.println(entry.getKey() + "-" + entry.getValue().toString());
|
LOG.info("{} - {}", entry.getKey(), entry.getValue().toString());
|
||||||
|
}
|
||||||
// 1st Dec 13 to 31st March 14 - 365 days, daily compounding using daily
|
// 1st Dec 13 to 31st March 14 - 365 days, daily compounding using daily
|
||||||
// balance
|
// balance
|
||||||
// 33.7016 obtained from formula in excel provided by Subramanya
|
// 33.7016 obtained from formula in excel provided by Subramanya
|
||||||
assertEquals("Equality check for interest posted amount", "33.7016", interestPostingTransaction.get("amount").toString());
|
assertEquals("33.7016", interestPostingTransaction.get("amount").toString(), "Equality check for interest posted amount");
|
||||||
assertEquals("Date check for Interest Posting transaction", "[2014, 3, 31]", interestPostingTransaction.get("date").toString());
|
assertEquals("[2014, 3, 31]", interestPostingTransaction.get("date").toString(), "Date check for Interest Posting transaction");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer createSavingsAccount(final Integer clientID, final String startDate) {
|
private Integer createSavingsAccount(final Integer clientID, final String startDate) {
|
||||||
final Integer savingsProductID = createSavingsProduct();
|
final Integer savingsProductID = createSavingsProduct();
|
||||||
Assert.assertNotNull(savingsProductID);
|
Assertions.assertNotNull(savingsProductID);
|
||||||
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplicationOnDate(clientID, savingsProductID,
|
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplicationOnDate(clientID, savingsProductID,
|
||||||
ACCOUNT_TYPE_INDIVIDUAL, startDate);
|
ACCOUNT_TYPE_INDIVIDUAL, startDate);
|
||||||
Assert.assertNotNull(savingsId);
|
Assertions.assertNotNull(savingsId);
|
||||||
HashMap savingsStatusHashMap = this.savingsAccountHelper.approveSavingsOnDate(savingsId, startDate);
|
HashMap savingsStatusHashMap = this.savingsAccountHelper.approveSavingsOnDate(savingsId, startDate);
|
||||||
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
|
||||||
savingsStatusHashMap = this.savingsAccountHelper.activateSavingsAccount(savingsId, startDate);
|
savingsStatusHashMap = this.savingsAccountHelper.activateSavingsAccount(savingsId, startDate);
|
||||||
@@ -110,33 +111,34 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
|
|||||||
|
|
||||||
private void configureInterestPosting(final Boolean periodEndEnable, final Integer financialYearBeginningMonth) {
|
private void configureInterestPosting(final Boolean periodEndEnable, final Integer financialYearBeginningMonth) {
|
||||||
final ArrayList<HashMap> globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
final ArrayList<HashMap> globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(globalConfig);
|
Assertions.assertNotNull(globalConfig);
|
||||||
|
|
||||||
// Updating flag for interest posting at period end
|
// Updating flag for interest posting at period end
|
||||||
Integer periodEndConfigId = (Integer) globalConfig.get(10).get("id");
|
Integer periodEndConfigId = (Integer) globalConfig.get(10).get("id");
|
||||||
Assert.assertNotNull(periodEndConfigId);
|
Assertions.assertNotNull(periodEndConfigId);
|
||||||
|
|
||||||
HashMap periodEndConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
HashMap periodEndConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
||||||
periodEndConfigId.toString());
|
periodEndConfigId.toString());
|
||||||
Assert.assertNotNull(periodEndConfigData);
|
Assertions.assertNotNull(periodEndConfigData);
|
||||||
|
|
||||||
Boolean enabled = (Boolean) globalConfig.get(10).get("enabled");
|
Boolean enabled = (Boolean) globalConfig.get(10).get("enabled");
|
||||||
|
|
||||||
if (enabled != periodEndEnable)
|
if (!enabled.equals(periodEndEnable)) {
|
||||||
periodEndConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
periodEndConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||||
periodEndConfigId.toString(), periodEndEnable);
|
periodEndConfigId.toString(), periodEndEnable);
|
||||||
|
}
|
||||||
|
|
||||||
// Updating value for financial year beginning month
|
// Updating value for financial year beginning month
|
||||||
Integer financialYearBeginningConfigId = (Integer) globalConfig.get(11).get("id");
|
Integer financialYearBeginningConfigId = (Integer) globalConfig.get(11).get("id");
|
||||||
Assert.assertNotNull(financialYearBeginningConfigId);
|
Assertions.assertNotNull(financialYearBeginningConfigId);
|
||||||
|
|
||||||
HashMap financialYearBeginningConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec,
|
HashMap financialYearBeginningConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
||||||
this.responseSpec, financialYearBeginningConfigId.toString());
|
financialYearBeginningConfigId.toString());
|
||||||
Assert.assertNotNull(financialYearBeginningConfigData);
|
Assertions.assertNotNull(financialYearBeginningConfigData);
|
||||||
|
|
||||||
financialYearBeginningConfigId = GlobalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
financialYearBeginningConfigId = GlobalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||||
financialYearBeginningConfigId.toString(), financialYearBeginningMonth.toString());
|
financialYearBeginningConfigId.toString(), financialYearBeginningMonth.toString());
|
||||||
Assert.assertNotNull(financialYearBeginningConfigId);
|
Assertions.assertNotNull(financialYearBeginningConfigId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer createSavingsProduct() {
|
private Integer createSavingsProduct() {
|
||||||
@@ -146,9 +148,10 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset configuration fields
|
// Reset configuration fields
|
||||||
@After
|
@AfterEach
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
configureInterestPosting(false, 1);
|
GlobalConfigurationHelper.resetAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
|
GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+71
-126
@@ -18,25 +18,26 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||||
|
import static org.hamcrest.Matchers.hasItem;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.funds.FundsHelper;
|
import org.apache.fineract.integrationtests.common.funds.FundsHelper;
|
||||||
import org.apache.fineract.integrationtests.common.funds.FundsResourceHandler;
|
import org.apache.fineract.integrationtests.common.funds.FundsResourceHandler;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.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;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Funds Integration Test for checking Funds Application.
|
* Funds Integration Test for checking Funds Application.
|
||||||
@@ -46,7 +47,7 @@ public class FundsIntegrationTest {
|
|||||||
private ResponseSpecification statusOkResponseSpec;
|
private ResponseSpecification statusOkResponseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -56,121 +57,91 @@ public class FundsIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateFund() {
|
public void testCreateFund() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||||
Assert.assertNotNull(fundID);
|
Assertions.assertNotNull(fundID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateFundWithEmptyName() {
|
public void testCreateFundWithEmptyName() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(null).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(null)
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, responseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, responseSpec);
|
||||||
Assert.assertNull(fundID);
|
Assertions.assertNull(fundID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateFundWithEmptyExternalId() {
|
public void testCreateFundWithEmptyExternalId() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(null).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(null)
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||||
Assert.assertNotNull(fundID);
|
Assertions.assertNotNull(fundID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateFundWithDuplicateName() {
|
public void testCreateFundWithDuplicateName() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||||
Assert.assertNotNull(fundID);
|
Assertions.assertNotNull(fundID);
|
||||||
|
|
||||||
FundsHelper fh2 = FundsHelper
|
FundsHelper fh2 = FundsHelper.create(fh.getName()).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(fh.getName())
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
jsonData = fh2.toJSON();
|
jsonData = fh2.toJSON();
|
||||||
|
|
||||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
|
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||||
final Long fundID2 = createFund(jsonData, this.requestSpec, responseSpec);
|
final Long fundID2 = createFund(jsonData, this.requestSpec, responseSpec);
|
||||||
Assert.assertNull(fundID2);
|
Assertions.assertNull(fundID2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateFundWithDuplicateExternalId() {
|
public void testCreateFundWithDuplicateExternalId() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||||
Assert.assertNotNull(fundID);
|
Assertions.assertNotNull(fundID);
|
||||||
|
|
||||||
FundsHelper fh2 = FundsHelper
|
FundsHelper fh2 = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(fh.getExternalId()).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(fh.getExternalId())
|
|
||||||
.build();
|
|
||||||
jsonData = fh2.toJSON();
|
jsonData = fh2.toJSON();
|
||||||
|
|
||||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
|
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||||
final Long fundID2 = createFund(jsonData, this.requestSpec, responseSpec);
|
final Long fundID2 = createFund(jsonData, this.requestSpec, responseSpec);
|
||||||
Assert.assertNull(fundID2);
|
Assertions.assertNull(fundID2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateFundWithInvalidName() {
|
public void testCreateFundWithInvalidName() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 120)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(Utils.randomNameGenerator("", 120))
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, responseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, responseSpec);
|
||||||
Assert.assertNull(fundID);
|
Assertions.assertNull(fundID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateFundWithInvalidExternalId() {
|
public void testCreateFundWithInvalidExternalId() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 120)).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 120))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, responseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, responseSpec);
|
||||||
Assert.assertNull(fundID);
|
Assertions.assertNull(fundID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRetrieveFund() {
|
public void testRetrieveFund() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||||
Assert.assertNotNull(fundID);
|
Assertions.assertNotNull(fundID);
|
||||||
|
|
||||||
jsonData = FundsResourceHandler.retrieveFund(fundID, this.requestSpec, this.statusOkResponseSpec);
|
jsonData = FundsResourceHandler.retrieveFund(fundID, this.requestSpec, this.statusOkResponseSpec);
|
||||||
FundsHelper fh2 = FundsHelper.fromJSON(jsonData);
|
FundsHelper fh2 = FundsHelper.fromJSON(jsonData);
|
||||||
@@ -180,47 +151,41 @@ public class FundsIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRetrieveAllFunds() {
|
public void testRetrieveAllFunds() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||||
Assert.assertNotNull(fundID);
|
Assertions.assertNotNull(fundID);
|
||||||
|
|
||||||
List<FundsHelper> fhList = FundsResourceHandler.retrieveAllFunds(this.requestSpec, this.statusOkResponseSpec);
|
List<FundsHelper> fhList = FundsResourceHandler.retrieveAllFunds(this.requestSpec, this.statusOkResponseSpec);
|
||||||
|
|
||||||
Assert.assertNotNull(fhList);
|
Assertions.assertNotNull(fhList);
|
||||||
Assert.assertThat(fhList.size(), greaterThanOrEqualTo(1));
|
assertThat(fhList.size(), greaterThanOrEqualTo(1));
|
||||||
Assert.assertThat(fhList, hasItem(fh));
|
assertThat(fhList, hasItem(fh));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRetrieveUnknownFund() {
|
public void testRetrieveUnknownFund() {
|
||||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
||||||
String jsonData = FundsResourceHandler.retrieveFund(Long.MAX_VALUE, this.requestSpec, responseSpec);
|
String jsonData = FundsResourceHandler.retrieveFund(Long.MAX_VALUE, this.requestSpec, responseSpec);
|
||||||
HashMap<String, String> map = new Gson().fromJson(jsonData, HashMap.class);
|
HashMap<String, Object> map = new Gson().fromJson(jsonData, new TypeToken<HashMap<String, Object>>() {}.getType());
|
||||||
assertEquals(map.get("userMessageGlobalisationCode"), "error.msg.resource.not.found");
|
assertEquals("error.msg.resource.not.found", map.get("userMessageGlobalisationCode"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateFund() {
|
public void testUpdateFund() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||||
Assert.assertNotNull(fundID);
|
Assertions.assertNotNull(fundID);
|
||||||
|
|
||||||
String newName = Utils.randomNameGenerator("", 10);
|
String newName = Utils.randomNameGenerator("", 10);
|
||||||
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
||||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, this.statusOkResponseSpec);
|
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, this.statusOkResponseSpec);
|
||||||
|
|
||||||
Assert.assertEquals(newName, fh2.getName());
|
Assertions.assertEquals(newName, fh2.getName());
|
||||||
Assert.assertEquals(newExternalId, fh2.getExternalId());
|
Assertions.assertEquals(newExternalId, fh2.getExternalId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -228,120 +193,100 @@ public class FundsIntegrationTest {
|
|||||||
String newName = Utils.randomNameGenerator("", 10);
|
String newName = Utils.randomNameGenerator("", 10);
|
||||||
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
||||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
||||||
FundsHelper fh = FundsResourceHandler.updateFund(Long.MAX_VALUE, newName, newExternalId, this.requestSpec,
|
FundsHelper fh = FundsResourceHandler.updateFund(Long.MAX_VALUE, newName, newExternalId, this.requestSpec, responseSpec);
|
||||||
responseSpec);
|
Assertions.assertNull(fh);
|
||||||
Assert.assertNull(fh);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateFundWithInvalidNewName() {
|
public void testUpdateFundWithInvalidNewName() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||||
Assert.assertNotNull(fundID);
|
Assertions.assertNotNull(fundID);
|
||||||
|
|
||||||
String newName = Utils.randomNameGenerator("", 120);
|
String newName = Utils.randomNameGenerator("", 120);
|
||||||
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
||||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec,
|
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, responseSpec);
|
||||||
responseSpec);
|
|
||||||
|
|
||||||
Assert.assertNull(fh2);
|
Assertions.assertNull(fh2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateFundWithNewExternalId() {
|
public void testUpdateFundWithNewExternalId() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||||
Assert.assertNotNull(fundID);
|
Assertions.assertNotNull(fundID);
|
||||||
|
|
||||||
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
||||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, null, newExternalId, this.requestSpec, this.statusOkResponseSpec);
|
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, null, newExternalId, this.requestSpec, this.statusOkResponseSpec);
|
||||||
|
|
||||||
Assert.assertEquals(newExternalId, fh2.getExternalId());
|
Assertions.assertEquals(newExternalId, fh2.getExternalId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateFundWithInvalidNewExternalId() {
|
public void testUpdateFundWithInvalidNewExternalId() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||||
Assert.assertNotNull(fundID);
|
Assertions.assertNotNull(fundID);
|
||||||
|
|
||||||
String newName = Utils.randomNameGenerator("", 10);
|
String newName = Utils.randomNameGenerator("", 10);
|
||||||
String newExternalId = Utils.randomNameGenerator("fund-", 120);
|
String newExternalId = Utils.randomNameGenerator("fund-", 120);
|
||||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec,
|
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, responseSpec);
|
||||||
responseSpec);
|
|
||||||
|
|
||||||
Assert.assertNull(fh2);
|
Assertions.assertNull(fh2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateFundWithNewName() {
|
public void testUpdateFundWithNewName() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||||
Assert.assertNotNull(fundID);
|
Assertions.assertNotNull(fundID);
|
||||||
|
|
||||||
String newName = Utils.randomNameGenerator("", 10);
|
String newName = Utils.randomNameGenerator("", 10);
|
||||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, null, this.requestSpec, this.statusOkResponseSpec);
|
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, null, this.requestSpec, this.statusOkResponseSpec);
|
||||||
|
|
||||||
Assert.assertEquals(newName, fh2.getName());
|
Assertions.assertEquals(newName, fh2.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateFundWithEmptyParams() {
|
public void testUpdateFundWithEmptyParams() {
|
||||||
FundsHelper fh = FundsHelper
|
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||||
.create(Utils.randomNameGenerator("", 10))
|
|
||||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
|
||||||
.build();
|
|
||||||
String jsonData = fh.toJSON();
|
String jsonData = fh.toJSON();
|
||||||
|
|
||||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||||
Assert.assertNotNull(fundID);
|
Assertions.assertNotNull(fundID);
|
||||||
|
|
||||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, null, null, this.requestSpec, this.statusOkResponseSpec);
|
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, null, null, this.requestSpec, this.statusOkResponseSpec);
|
||||||
|
|
||||||
Assert.assertNull(fh2.getName());
|
Assertions.assertNull(fh2.getName());
|
||||||
Assert.assertNull(fh2.getExternalId());
|
Assertions.assertNull(fh2.getExternalId());
|
||||||
|
|
||||||
// assert that there was no change in
|
// assert that there was no change in
|
||||||
// the name and external ID of the fund
|
// the name and external ID of the fund
|
||||||
jsonData = FundsResourceHandler.retrieveFund(fundID, this.requestSpec, this.statusOkResponseSpec);
|
jsonData = FundsResourceHandler.retrieveFund(fundID, this.requestSpec, this.statusOkResponseSpec);
|
||||||
FundsHelper fh3 = new Gson().fromJson(jsonData, FundsHelper.class);
|
FundsHelper fh3 = new Gson().fromJson(jsonData, FundsHelper.class);
|
||||||
|
|
||||||
Assert.assertEquals(fh.getName(), fh3.getName());
|
Assertions.assertEquals(fh.getName(), fh3.getName());
|
||||||
Assert.assertEquals(fh.getExternalId(), fh3.getExternalId());
|
Assertions.assertEquals(fh.getExternalId(), fh3.getExternalId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Long createFund(final String fundJSON,
|
private Long createFund(final String fundJSON, final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
|
||||||
final RequestSpecification requestSpec,
|
|
||||||
final ResponseSpecification responseSpec) {
|
|
||||||
String fundId = String.valueOf(FundsResourceHandler.createFund(fundJSON, requestSpec, responseSpec));
|
String fundId = String.valueOf(FundsResourceHandler.createFund(fundJSON, requestSpec, responseSpec));
|
||||||
if (fundId.equals("null")) {
|
if (fundId.equals("null")) {
|
||||||
// Invalid JSON data parameters
|
// Invalid JSON data parameters
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Long(fundId);
|
return Long.valueOf(fundId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+29
-29
@@ -18,21 +18,19 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
|
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.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 GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest {
|
public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest {
|
||||||
|
|
||||||
@@ -40,7 +38,7 @@ public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest {
|
|||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private GlobalConfigurationHelper globalConfigurationHelper;
|
private GlobalConfigurationHelper globalConfigurationHelper;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -48,30 +46,32 @@ public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest {
|
|||||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"static-access", "rawtypes", "unchecked"})
|
@AfterEach
|
||||||
|
public void tearDown() {
|
||||||
|
GlobalConfigurationHelper.resetAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
|
GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "static-access", "rawtypes", "unchecked" })
|
||||||
@Test
|
@Test
|
||||||
public void testInterestChargedFromDateSameAsDisbursalDate(){
|
public void testInterestChargedFromDateSameAsDisbursalDate() {
|
||||||
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
// Retrieving All Global Configuration details
|
// Retrieving All Global Configuration details
|
||||||
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper
|
final ArrayList<HashMap> globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
Assertions.assertNotNull(globalConfig);
|
||||||
Assert.assertNotNull(globalConfig);
|
|
||||||
|
|
||||||
String configName = "interest-charged-from-date-same-as-disbursal-date";
|
String configName = "interest-charged-from-date-same-as-disbursal-date";
|
||||||
boolean newBooleanValue = true;
|
boolean newBooleanValue = true;
|
||||||
|
|
||||||
for (Integer configIndex = 0; configIndex < (globalConfig.size()); configIndex++) {
|
for (Integer configIndex = 0; configIndex < globalConfig.size(); configIndex++) {
|
||||||
if (globalConfig.get(configIndex).get("name")
|
if (globalConfig.get(configIndex).get("name").equals(configName)) {
|
||||||
.equals(configName)) {
|
String configId = globalConfig.get(configIndex).get("id").toString();
|
||||||
String configId = (globalConfig.get(configIndex).get("id"))
|
Integer updateConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec,
|
||||||
.toString();
|
this.responseSpec, configId.toString(), newBooleanValue);
|
||||||
Integer updateConfigId = this.globalConfigurationHelper
|
Assertions.assertNotNull(updateConfigId);
|
||||||
.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
break;
|
||||||
configId.toString(), newBooleanValue);;
|
}
|
||||||
Assert.assertNotNull(updateConfigId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+95
-103
@@ -18,23 +18,23 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||||
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
|
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
@SuppressWarnings({ "unchecked" })
|
||||||
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", "static-access" })
|
|
||||||
public class GlobalConfigurationTest {
|
public class GlobalConfigurationTest {
|
||||||
|
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
@@ -42,7 +42,7 @@ public class GlobalConfigurationTest {
|
|||||||
private GlobalConfigurationHelper globalConfigurationHelper;
|
private GlobalConfigurationHelper globalConfigurationHelper;
|
||||||
private ResponseSpecification httpStatusForidden;
|
private ResponseSpecification httpStatusForidden;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -51,37 +51,42 @@ public class GlobalConfigurationTest {
|
|||||||
this.httpStatusForidden = new ResponseSpecBuilder().expectStatusCode(403).build();
|
this.httpStatusForidden = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
public void tearDown() {
|
||||||
|
GlobalConfigurationHelper.resetAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
|
GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGlobalConfigurations() {
|
public void testGlobalConfigurations() {
|
||||||
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
// Retrieving All Global Configuration details
|
// Retrieving All Global Configuration details
|
||||||
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec,
|
final ArrayList<HashMap> globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
this.responseSpec);
|
Assertions.assertNotNull(globalConfig);
|
||||||
Assert.assertNotNull(globalConfig);
|
|
||||||
|
|
||||||
String configName = "penalty-wait-period";
|
String configName = "penalty-wait-period";
|
||||||
for (Integer configIndex = 0; configIndex < (globalConfig.size() - 1); configIndex++) {
|
for (Integer configIndex = 0; configIndex < globalConfig.size() - 1; configIndex++) {
|
||||||
if (globalConfig.get(configIndex).get("name").equals(configName)) {
|
if (globalConfig.get(configIndex).get("name").equals(configName)) {
|
||||||
Integer configId = (Integer) globalConfig.get(configIndex).get("id");
|
Integer configId = (Integer) globalConfig.get(configIndex).get("id");
|
||||||
Assert.assertNotNull(configId);
|
Assertions.assertNotNull(configId);
|
||||||
|
|
||||||
HashMap configDataBefore = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
HashMap configDataBefore = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
||||||
configId.toString());
|
configId.toString());
|
||||||
Assert.assertNotNull(configDataBefore);
|
Assertions.assertNotNull(configDataBefore);
|
||||||
|
|
||||||
Integer value = (Integer) configDataBefore.get("value") + 1;
|
Integer value = (Integer) configDataBefore.get("value") + 1;
|
||||||
|
|
||||||
// Updating Value for penalty-wait-period Global Configuration
|
// Updating Value for penalty-wait-period Global Configuration
|
||||||
configId = this.globalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
configId = GlobalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||||
configId.toString(), value.toString());
|
configId.toString(), value.toString());
|
||||||
Assert.assertNotNull(configId);
|
Assertions.assertNotNull(configId);
|
||||||
|
|
||||||
HashMap configDataAfter = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
HashMap configDataAfter = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
||||||
configId.toString());
|
configId.toString());
|
||||||
|
|
||||||
// Verifying Value for penalty-wait-period after Updation
|
// Verifying Value for penalty-wait-period after Updation
|
||||||
Assert.assertEquals("Verifying Global Config Value after Updation", value, configDataAfter.get("value"));
|
Assertions.assertEquals(value, configDataAfter.get("value"), "Verifying Global Config Value after Updation");
|
||||||
|
|
||||||
// Updating Enabled Flag for penalty-wait-period Global
|
// Updating Enabled Flag for penalty-wait-period Global
|
||||||
// Configuration
|
// Configuration
|
||||||
@@ -93,14 +98,14 @@ public class GlobalConfigurationTest {
|
|||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
configId = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
configId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||||
configId.toString(), enabled);
|
configId.toString(), enabled);
|
||||||
|
|
||||||
configDataAfter = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
configDataAfter = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
||||||
configId.toString());
|
configId.toString());
|
||||||
|
|
||||||
// Verifying Enabled Flag for penalty-wait-period after Updation
|
// Verifying Enabled Flag for penalty-wait-period after Updation
|
||||||
Assert.assertEquals("Verifying Enabled Flag Global Config after Updation", enabled, configDataAfter.get("enabled"));
|
Assertions.assertEquals(enabled, configDataAfter.get("enabled"), "Verifying Enabled Flag Global Config after Updation");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,15 +116,15 @@ public class GlobalConfigurationTest {
|
|||||||
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
// Retrieving Is Cache Enabled Global Configuration details
|
// Retrieving Is Cache Enabled Global Configuration details
|
||||||
ArrayList<HashMap> isCacheGlobalConfig = this.globalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec,
|
ArrayList<HashMap> isCacheGlobalConfig = GlobalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec,
|
||||||
this.responseSpec);
|
this.responseSpec);
|
||||||
Assert.assertNotNull(isCacheGlobalConfig);
|
Assertions.assertNotNull(isCacheGlobalConfig);
|
||||||
|
|
||||||
for (Integer cacheType = 0; cacheType <= ((isCacheGlobalConfig.size()) - 1); cacheType++) {
|
for (Integer cacheType = 0; cacheType <= isCacheGlobalConfig.size() - 1; cacheType++) {
|
||||||
|
|
||||||
// Retrieving Is Cache Enabled Global Configuration details
|
// Retrieving Is Cache Enabled Global Configuration details
|
||||||
isCacheGlobalConfig = this.globalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec, this.responseSpec);
|
isCacheGlobalConfig = GlobalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(isCacheGlobalConfig);
|
Assertions.assertNotNull(isCacheGlobalConfig);
|
||||||
|
|
||||||
HashMap cacheTypeAsHashMap = (HashMap) isCacheGlobalConfig.get(cacheType).get("cacheType");
|
HashMap cacheTypeAsHashMap = (HashMap) isCacheGlobalConfig.get(cacheType).get("cacheType");
|
||||||
Integer cacheTypeId = (Integer) cacheTypeAsHashMap.get("id");
|
Integer cacheTypeId = (Integer) cacheTypeAsHashMap.get("id");
|
||||||
@@ -132,90 +137,77 @@ public class GlobalConfigurationTest {
|
|||||||
cacheTypeId -= 1;
|
cacheTypeId -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap changes = this.globalConfigurationHelper.updateIsCacheEnabledForGlobalConfiguration(this.requestSpec,
|
HashMap changes = GlobalConfigurationHelper.updateIsCacheEnabledForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||||
this.responseSpec, cacheTypeId.toString());
|
cacheTypeId.toString());
|
||||||
Assert.assertEquals("Verifying Is Cache Enabled Global Config after Updation", cacheTypeId, changes.get("cacheType"));
|
Assertions.assertEquals(cacheTypeId, changes.get("cacheType"), "Verifying Is Cache Enabled Global Config after Updation");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGlobalConfigForcePasswordResetDays() {
|
public void testGlobalConfigForcePasswordResetDays() {
|
||||||
|
|
||||||
// Retrieving All Global Configuration details
|
// Retrieving All Global Configuration details
|
||||||
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper
|
final ArrayList<HashMap> globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
Assertions.assertNotNull(globalConfig);
|
||||||
Assert.assertNotNull(globalConfig);
|
|
||||||
|
|
||||||
String configName = "force-password-reset-days";
|
String configName = "force-password-reset-days";
|
||||||
String newValue = "0";
|
String newValue = "0";
|
||||||
String newBooleanValue = "true";
|
String newBooleanValue = "true";
|
||||||
|
|
||||||
for (Integer configIndex = 0; configIndex < (globalConfig.size() - 1); configIndex++) {
|
for (Integer configIndex = 0; configIndex < globalConfig.size() - 1; configIndex++) {
|
||||||
if (globalConfig.get(configIndex).get("name").equals(configName)) {
|
if (globalConfig.get(configIndex).get("name").equals(configName)) {
|
||||||
Integer configId = (Integer) globalConfig.get(configIndex).get(
|
Integer configId = (Integer) globalConfig.get(configIndex).get("id");
|
||||||
"id");
|
Assertions.assertNotNull(configId);
|
||||||
Assert.assertNotNull(configId);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update force-password-reset-days with value as 0 and Enable
|
* Update force-password-reset-days with value as 0 and Enable
|
||||||
* as true - failure case
|
* as true - failure case
|
||||||
*/
|
*/
|
||||||
ArrayList error = (ArrayList) this.globalConfigurationHelper
|
ArrayList error = (ArrayList) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(this.requestSpec,
|
||||||
.updatePasswordResetDaysForGlobalConfiguration(
|
this.httpStatusForidden, configId, newValue, newBooleanValue, CommonConstants.RESPONSE_ERROR);
|
||||||
this.requestSpec, this.httpStatusForidden,
|
HashMap hash = (HashMap) error.get(0);
|
||||||
configId, newValue, newBooleanValue,
|
|
||||||
CommonConstants.RESPONSE_ERROR);
|
|
||||||
HashMap hash = (HashMap) error.get(0);
|
|
||||||
|
|
||||||
Assert.assertEquals(
|
Assertions.assertEquals("error.msg.password.reset.days.value.must.be.greater.than.zero",
|
||||||
"Force Password Reset days value must be greater than zero.",
|
hash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE),
|
||||||
"error.msg.password.reset.days.value.must.be.greater.than.zero",
|
"Force Password Reset days value must be greater than zero.");
|
||||||
hash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update force-password-reset-days with value as 50 and Enable
|
* Update force-password-reset-days with value as 50 and Enable
|
||||||
* as true - success case
|
* as true - success case
|
||||||
*/
|
*/
|
||||||
final HashMap updateSuccess = (HashMap) this.globalConfigurationHelper
|
final HashMap updateSuccess = (HashMap) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(
|
||||||
.updatePasswordResetDaysForGlobalConfiguration(
|
this.requestSpec, this.responseSpec, configId, "50", newBooleanValue, "changes");
|
||||||
this.requestSpec, this.responseSpec, configId,
|
Assertions.assertNotNull(updateSuccess);
|
||||||
"50", newBooleanValue, "changes");
|
|
||||||
Assert.assertNotNull(updateSuccess);
|
|
||||||
|
|
||||||
/* Update with value as 0 and Enable as false - success case */
|
/* Update with value as 0 and Enable as false - success case */
|
||||||
final HashMap updateSuccess1 = (HashMap) this.globalConfigurationHelper
|
final HashMap updateSuccess1 = (HashMap) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(
|
||||||
.updatePasswordResetDaysForGlobalConfiguration(
|
this.requestSpec, this.responseSpec, configId, newValue, "false", "changes");
|
||||||
this.requestSpec, this.responseSpec, configId,
|
Assertions.assertNotNull(updateSuccess1);
|
||||||
newValue, "false", "changes");
|
|
||||||
Assert.assertNotNull(updateSuccess1);
|
|
||||||
|
|
||||||
/* Update without sending value and Enable as true - failure case*/
|
/*
|
||||||
ArrayList failure = (ArrayList) this.globalConfigurationHelper
|
* Update without sending value and Enable as true - failure
|
||||||
.updatePasswordResetDaysForGlobalConfiguration(
|
* case
|
||||||
this.requestSpec, this.httpStatusForidden, configId,
|
*/
|
||||||
null, newBooleanValue, CommonConstants.RESPONSE_ERROR);
|
ArrayList failure = (ArrayList) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(this.requestSpec,
|
||||||
HashMap failureHash = (HashMap) failure.get(0);
|
this.httpStatusForidden, configId, null, newBooleanValue, CommonConstants.RESPONSE_ERROR);
|
||||||
Assert.assertEquals(
|
HashMap failureHash = (HashMap) failure.get(0);
|
||||||
"Force Password Reset days value must be greater than zero.",
|
Assertions.assertEquals("error.msg.password.reset.days.value.must.be.greater.than.zero",
|
||||||
"error.msg.password.reset.days.value.must.be.greater.than.zero",
|
failureHash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE),
|
||||||
failureHash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
"Force Password Reset days value must be greater than zero.");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Update other global configuration property */
|
/* Update other global configuration property */
|
||||||
String otherConfigName = "maker-checker";
|
String otherConfigName = "maker-checker";
|
||||||
for (Integer configIndex = 0; configIndex < (globalConfig.size() - 1); configIndex++) {
|
for (Integer configIndex = 0; configIndex < globalConfig.size() - 1; configIndex++) {
|
||||||
if (globalConfig.get(configIndex).get("name")
|
if (globalConfig.get(configIndex).get("name").equals(otherConfigName)) {
|
||||||
.equals(otherConfigName)) {
|
String configId = globalConfig.get(configIndex).get("id").toString();
|
||||||
String configId = (globalConfig.get(configIndex).get("id"))
|
Integer updateConfigId = GlobalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||||
.toString();
|
configId, newValue);
|
||||||
Integer updateConfigId = this.globalConfigurationHelper
|
Assertions.assertNotNull(updateConfigId);
|
||||||
.updateValueForGlobalConfiguration(this.requestSpec,
|
break;
|
||||||
this.responseSpec, configId, newValue);
|
}
|
||||||
Assert.assertNotNull(updateConfigId);
|
}
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+166
-31
@@ -18,26 +18,31 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
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.GroupHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
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.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.jayway.restassured.http.ContentType;
|
|
||||||
import com.jayway.restassured.specification.RequestSpecification;
|
|
||||||
import com.jayway.restassured.specification.ResponseSpecification;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Group Loan Integration Test for checking Loan Application Repayment Schedule.
|
* Group Loan Integration Test for checking Loan Application Repayment Schedule.
|
||||||
@@ -48,8 +53,9 @@ public class GroupLoanIntegrationTest {
|
|||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(GroupLoanIntegrationTest.class);
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -70,11 +76,120 @@ public class GroupLoanIntegrationTest {
|
|||||||
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
|
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
|
||||||
loanID);
|
loanID);
|
||||||
verifyLoanRepaymentSchedule(loanSchedule);
|
verifyLoanRepaymentSchedule(loanSchedule);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void checkGlimAccountCommands() {
|
||||||
|
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||||
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
|
final Integer loanProductID = createLoanProduct();
|
||||||
|
|
||||||
|
HashMap<String, Integer> glim = applyForGlimApplication(clientID, groupID, loanProductID);
|
||||||
|
LOG.info("Glim Loan Application: {} ", glim);
|
||||||
|
|
||||||
|
final Integer glimId = glim.get("glimId");
|
||||||
|
LOG.info("GlimId : {} ", glimId);
|
||||||
|
|
||||||
|
final Integer loanId = glim.get("loanId");
|
||||||
|
LOG.info("LoanId : {} ", loanId);
|
||||||
|
|
||||||
|
List<Map<String, Object>> approvalFormData = new ArrayList<>();
|
||||||
|
approvalFormData.add(approvalFormData(loanId, "22 September 2011"));
|
||||||
|
|
||||||
|
HashMap loanStatusHashMap = this.loanTransactionHelper.approveGlimAccount(this.requestSpec, this.responseSpec, approvalFormData,
|
||||||
|
glimId);
|
||||||
|
LOG.info("glim approval loanSchedule: {} ", loanStatusHashMap);
|
||||||
|
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||||
|
|
||||||
|
loanStatusHashMap = this.loanTransactionHelper.disburseGlimAccount("25 September 2011", glimId);
|
||||||
|
LOG.info("glim disbursement loanSchedule: {} ", loanStatusHashMap);
|
||||||
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
|
loanStatusHashMap = this.loanTransactionHelper.undoDisburseGlimAccount(glimId);
|
||||||
|
LOG.info("glim undodisbursement loanSchedule: {} ", loanStatusHashMap);
|
||||||
|
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||||
|
|
||||||
|
loanStatusHashMap = this.loanTransactionHelper.undoApprovalGlimAccount(glimId);
|
||||||
|
LOG.info("glim undoApproval loanSchedule: {} ", loanStatusHashMap);
|
||||||
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
|
loanStatusHashMap = this.loanTransactionHelper.rejectGlimAccount("22 September 2011", glimId);
|
||||||
|
LOG.info("glim reject loanSchedule: {} ", loanStatusHashMap);
|
||||||
|
LoanStatusChecker.verifyLoanAccountRejected(loanStatusHashMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getGlimAccountByGroupId() {
|
||||||
|
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
final Integer loanProductID = createLoanProduct();
|
||||||
|
Assertions.assertNotNull(loanProductID);
|
||||||
|
|
||||||
|
HashMap<String, Integer> glim = applyForGlimApplication(clientID, groupID, loanProductID);
|
||||||
|
LOG.info("Glim Loan Application: {} ", glim);
|
||||||
|
|
||||||
|
final Integer glimId = glim.get("glimId");
|
||||||
|
LOG.info("GlimId: {} ", glimId);
|
||||||
|
|
||||||
|
final Integer loanId = glim.get("loanId");
|
||||||
|
LOG.info("LoanId: {} ", loanId);
|
||||||
|
|
||||||
|
final List<String> retrievedGlimId = GroupHelper.verifyRetrieveGlimAccountsByGroupId(this.requestSpec, this.responseSpec, groupID);
|
||||||
|
Assertions.assertNotNull(retrievedGlimId.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getGlimAccountByGlimId() {
|
||||||
|
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
final Integer loanProductID = createLoanProduct();
|
||||||
|
Assertions.assertNotNull(loanProductID);
|
||||||
|
|
||||||
|
HashMap<String, Integer> glim = applyForGlimApplication(clientID, groupID, loanProductID);
|
||||||
|
LOG.info("Glim Loan Application: {} ", glim);
|
||||||
|
|
||||||
|
final Integer glimId = glim.get("glimId");
|
||||||
|
LOG.info("GlimId: {} ", glimId);
|
||||||
|
|
||||||
|
final Integer loanId = glim.get("loanId");
|
||||||
|
LOG.info("LoanId: {} ", loanId);
|
||||||
|
|
||||||
|
final List<String> retrievedGlimAccountId = GroupHelper.verifyRetrieveGlimAccountsByGlimId(this.requestSpec, this.responseSpec,
|
||||||
|
glimId);
|
||||||
|
Assertions.assertNotNull(retrievedGlimAccountId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Object> approvalFormData(final Integer loanId, final String approvedOnDate) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("loanId", loanId);
|
||||||
|
map.put("approvedOnDate", approvedOnDate);
|
||||||
|
map.put("dateFormat", CommonConstants.DATE_FORMAT);
|
||||||
|
map.put("locale", "en");
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer createLoanProduct() {
|
private Integer createLoanProduct() {
|
||||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||||
final String loanProductJSON = new LoanProductTestBuilder() //
|
final String loanProductJSON = new LoanProductTestBuilder() //
|
||||||
.withPrincipal("12,000.00") //
|
.withPrincipal("12,000.00") //
|
||||||
.withNumberOfRepayments("4") //
|
.withNumberOfRepayments("4") //
|
||||||
@@ -89,7 +204,7 @@ public class GroupLoanIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Integer applyForLoanApplication(final Integer groupID, final Integer loanProductID) {
|
private Integer applyForLoanApplication(final Integer groupID, final Integer loanProductID) {
|
||||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||||
.withPrincipal("12,000.00") //
|
.withPrincipal("12,000.00") //
|
||||||
.withLoanTermFrequency("4") //
|
.withLoanTermFrequency("4") //
|
||||||
@@ -104,31 +219,51 @@ public class GroupLoanIntegrationTest {
|
|||||||
.withExpectedDisbursementDate("20 September 2011") //
|
.withExpectedDisbursementDate("20 September 2011") //
|
||||||
.withSubmittedOnDate("20 September 2011") //
|
.withSubmittedOnDate("20 September 2011") //
|
||||||
.withLoanType("group").build(groupID.toString(), loanProductID.toString(), null);
|
.withLoanType("group").build(groupID.toString(), loanProductID.toString(), null);
|
||||||
System.out.println(loanApplicationJSON);
|
LOG.info(loanApplicationJSON);
|
||||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HashMap<String, Integer> applyForGlimApplication(final Integer clientID, final Integer groupID, final Integer loanProductID) {
|
||||||
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
|
final String GlimApplicationJSON = new LoanApplicationTestBuilder() //
|
||||||
|
.withPrincipal("12,000.00") //
|
||||||
|
.withLoanTermFrequency("4") //
|
||||||
|
.withLoanTermFrequencyAsMonths() //
|
||||||
|
.withNumberOfRepayments("4") //
|
||||||
|
.withRepaymentEveryAfter("1") //
|
||||||
|
.withRepaymentFrequencyTypeAsMonths() //
|
||||||
|
.withInterestRatePerPeriod("2") //
|
||||||
|
.withAmortizationTypeAsEqualInstallments() //
|
||||||
|
.withInterestTypeAsDecliningBalance() //
|
||||||
|
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
|
||||||
|
.withExpectedDisbursementDate("20 September 2011") //
|
||||||
|
.withSubmittedOnDate("20 September 2011").withLoanType("glim").withtotalLoan("10000").withParentAccount("1")
|
||||||
|
.build(clientID.toString(), groupID.toString(), loanProductID.toString(), null);
|
||||||
|
LOG.info(GlimApplicationJSON);
|
||||||
|
return this.loanTransactionHelper.getGlimId(GlimApplicationJSON);
|
||||||
|
}
|
||||||
|
|
||||||
private void verifyLoanRepaymentSchedule(final ArrayList<HashMap> loanSchedule) {
|
private void verifyLoanRepaymentSchedule(final ArrayList<HashMap> loanSchedule) {
|
||||||
System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------");
|
LOG.info("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------");
|
||||||
|
|
||||||
assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 20)),
|
assertEquals(new ArrayList<>(Arrays.asList(2011, 10, 20)), loanSchedule.get(1).get("dueDate"),
|
||||||
loanSchedule.get(1).get("dueDate"));
|
"Checking for Due Date for 1st Month");
|
||||||
assertEquals("Checking for Principal Due for 1st Month", new Float("2911.49"), loanSchedule.get(1).get("principalOriginalDue"));
|
assertEquals(Float.valueOf("2911.49"), loanSchedule.get(1).get("principalOriginalDue"), "Checking for Principal Due for 1st Month");
|
||||||
assertEquals("Checking for Interest Due for 1st Month", new Float("240.00"), loanSchedule.get(1).get("interestOriginalDue"));
|
assertEquals(Float.valueOf("240.00"), loanSchedule.get(1).get("interestOriginalDue"), "Checking for Interest Due for 1st Month");
|
||||||
|
|
||||||
assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 20)),
|
assertEquals(new ArrayList<>(Arrays.asList(2011, 11, 20)), loanSchedule.get(2).get("dueDate"),
|
||||||
loanSchedule.get(2).get("dueDate"));
|
"Checking for Due Date for 2nd Month");
|
||||||
assertEquals("Checking for Principal Due for 2nd Month", new Float("2969.72"), loanSchedule.get(2).get("principalDue"));
|
assertEquals(Float.valueOf("2969.72"), loanSchedule.get(2).get("principalDue"), "Checking for Principal Due for 2nd Month");
|
||||||
assertEquals("Checking for Interest Due for 2nd Month", new Float("181.77"), loanSchedule.get(2).get("interestOriginalDue"));
|
assertEquals(Float.valueOf("181.77"), loanSchedule.get(2).get("interestOriginalDue"), "Checking for Interest Due for 2nd Month");
|
||||||
|
|
||||||
assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 20)),
|
assertEquals(new ArrayList<>(Arrays.asList(2011, 12, 20)), loanSchedule.get(3).get("dueDate"),
|
||||||
loanSchedule.get(3).get("dueDate"));
|
"Checking for Due Date for 3rd Month");
|
||||||
assertEquals("Checking for Principal Due for 3rd Month", new Float("3029.11"), loanSchedule.get(3).get("principalDue"));
|
assertEquals(Float.valueOf("3029.11"), loanSchedule.get(3).get("principalDue"), "Checking for Principal Due for 3rd Month");
|
||||||
assertEquals("Checking for Interest Due for 3rd Month", new Float("122.38"), loanSchedule.get(3).get("interestOriginalDue"));
|
assertEquals(Float.valueOf("122.38"), loanSchedule.get(3).get("interestOriginalDue"), "Checking for Interest Due for 3rd Month");
|
||||||
|
|
||||||
assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 20)),
|
assertEquals(new ArrayList<>(Arrays.asList(2012, 1, 20)), loanSchedule.get(4).get("dueDate"),
|
||||||
loanSchedule.get(4).get("dueDate"));
|
"Checking for Due Date for 4th Month");
|
||||||
assertEquals("Checking for Principal Due for 4th Month", new Float("3089.68"), loanSchedule.get(4).get("principalDue"));
|
assertEquals(Float.valueOf("3089.68"), loanSchedule.get(4).get("principalDue"), "Checking for Principal Due for 4th Month");
|
||||||
assertEquals("Checking for Interest Due for 4th Month", new Float("61.79"), loanSchedule.get(4).get("interestOriginalDue"));
|
assertEquals(Float.valueOf("61.79"), loanSchedule.get(4).get("interestOriginalDue"), "Checking for Interest Due for 4th Month");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+341
-85
@@ -18,8 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -28,25 +33,22 @@ import java.util.Calendar;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||||
import org.apache.fineract.integrationtests.common.GroupHelper;
|
import org.apache.fineract.integrationtests.common.GroupHelper;
|
||||||
|
import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
|
import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
|
||||||
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
||||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
|
||||||
import com.jayway.restassured.http.ContentType;
|
|
||||||
import com.jayway.restassured.specification.RequestSpecification;
|
|
||||||
import com.jayway.restassured.specification.ResponseSpecification;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Group Savings Integration Test for checking Savings Application.
|
* Group Savings Integration Test for checking Savings Application.
|
||||||
@@ -63,8 +65,9 @@ public class GroupSavingsIntegrationTest {
|
|||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private SavingsAccountHelper savingsAccountHelper;
|
private SavingsAccountHelper savingsAccountHelper;
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(GroupSavingsIntegrationTest.class);
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -77,26 +80,26 @@ public class GroupSavingsIntegrationTest {
|
|||||||
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientID);
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
final String minBalanceForInterestCalculation = null;
|
final String minBalanceForInterestCalculation = null;
|
||||||
final String minRequiredBalance = null;
|
final String minRequiredBalance = null;
|
||||||
final String enforceMinRequiredBalance = "false";
|
final String enforceMinRequiredBalance = "false";
|
||||||
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
||||||
Assert.assertNotNull(savingsProductID);
|
Assertions.assertNotNull(savingsProductID);
|
||||||
|
|
||||||
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
||||||
Assert.assertNotNull(savingsId);
|
Assertions.assertNotNull(savingsId);
|
||||||
|
|
||||||
HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(groupID, savingsProductID, savingsId, ACCOUNT_TYPE_GROUP);
|
HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(groupID, savingsProductID, savingsId, ACCOUNT_TYPE_GROUP);
|
||||||
Assert.assertTrue(modifications.containsKey("submittedOnDate"));
|
Assertions.assertTrue(modifications.containsKey("submittedOnDate"));
|
||||||
|
|
||||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
||||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||||
@@ -114,9 +117,10 @@ public class GroupSavingsIntegrationTest {
|
|||||||
|
|
||||||
this.savingsAccountHelper.postInterestForSavings(savingsId);
|
this.savingsAccountHelper.postInterestForSavings(savingsId);
|
||||||
summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||||
Assert.assertFalse(summaryBefore.equals(summary));
|
Assertions.assertFalse(summaryBefore.equals(summary));
|
||||||
|
|
||||||
final Object savingsInterest = this.savingsAccountHelper.getSavingsInterest(savingsId);
|
final Object savingsInterest = this.savingsAccountHelper.getSavingsInterest(savingsId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -127,23 +131,23 @@ public class GroupSavingsIntegrationTest {
|
|||||||
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse);
|
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse);
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientID);
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
final String minBalanceForInterestCalculation = null;
|
final String minBalanceForInterestCalculation = null;
|
||||||
final String minRequiredBalance = "1000.0";
|
final String minRequiredBalance = "1000.0";
|
||||||
final String enforceMinRequiredBalance = "true";
|
final String enforceMinRequiredBalance = "true";
|
||||||
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
||||||
Assert.assertNotNull(savingsProductID);
|
Assertions.assertNotNull(savingsProductID);
|
||||||
|
|
||||||
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
||||||
Assert.assertNotNull(savingsId);
|
Assertions.assertNotNull(savingsId);
|
||||||
|
|
||||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
||||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||||
@@ -158,14 +162,15 @@ public class GroupSavingsIntegrationTest {
|
|||||||
Calendar todaysDate = Calendar.getInstance();
|
Calendar todaysDate = Calendar.getInstance();
|
||||||
final String CLOSEDON_DATE = dateFormat.format(todaysDate.getTime());
|
final String CLOSEDON_DATE = dateFormat.format(todaysDate.getTime());
|
||||||
String withdrawBalance = "false";
|
String withdrawBalance = "false";
|
||||||
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.closeSavingsAccountAndGetBackRequiredField(
|
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper
|
||||||
savingsId, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
|
.closeSavingsAccountAndGetBackRequiredField(savingsId, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
|
||||||
assertEquals("validation.msg.savingsaccount.close.results.in.balance.not.zero",
|
assertEquals("validation.msg.savingsaccount.close.results.in.balance.not.zero",
|
||||||
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
withdrawBalance = "true";
|
withdrawBalance = "true";
|
||||||
savingsStatusHashMap = this.savingsAccountHelper.closeSavingsAccount(savingsId, withdrawBalance);
|
savingsStatusHashMap = this.savingsAccountHelper.closeSavingsAccount(savingsId, withdrawBalance);
|
||||||
SavingsStatusChecker.verifySavingsAccountIsClosed(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsAccountIsClosed(savingsStatusHashMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -177,23 +182,23 @@ public class GroupSavingsIntegrationTest {
|
|||||||
new ResponseSpecBuilder().build());
|
new ResponseSpecBuilder().build());
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientID);
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
final String minBalanceForInterestCalculation = null;
|
final String minBalanceForInterestCalculation = null;
|
||||||
final String minRequiredBalance = null;
|
final String minRequiredBalance = null;
|
||||||
final String enforceMinRequiredBalance = "false";
|
final String enforceMinRequiredBalance = "false";
|
||||||
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
||||||
Assert.assertNotNull(savingsProductID);
|
Assertions.assertNotNull(savingsProductID);
|
||||||
|
|
||||||
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
||||||
Assert.assertNotNull(savingsId);
|
Assertions.assertNotNull(savingsId);
|
||||||
|
|
||||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
||||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||||
@@ -216,6 +221,228 @@ public class GroupSavingsIntegrationTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// gsimcommands testing
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Test
|
||||||
|
public void testGsimSavingsAccount_REJECT_APPLICATION() {
|
||||||
|
|
||||||
|
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
|
SavingsAccountHelper savingsAccountHelperValidationError = new SavingsAccountHelper(this.requestSpec,
|
||||||
|
new ResponseSpecBuilder().build());
|
||||||
|
|
||||||
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
final String minBalanceForInterestCalculation = null;
|
||||||
|
final String minRequiredBalance = null;
|
||||||
|
final String enforceMinRequiredBalance = "false";
|
||||||
|
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
|
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
||||||
|
Assertions.assertNotNull(savingsProductID);
|
||||||
|
|
||||||
|
List<Map<String, Object>> clientArray = new ArrayList<>();
|
||||||
|
clientArray.add(clientArray(clientID, groupID, savingsProductID, "08 January 2013"));
|
||||||
|
|
||||||
|
final Integer gsimID = this.savingsAccountHelper.applyForGsimApplication(clientArray);
|
||||||
|
|
||||||
|
HashMap savingsStatusHashMap = this.savingsAccountHelper.approveGsimSavings(gsimID);
|
||||||
|
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
|
||||||
|
|
||||||
|
List<HashMap> error1 = savingsAccountHelperValidationError.rejectGsimApplicationWithErrorCode(gsimID,
|
||||||
|
SavingsAccountHelper.CREATED_DATE_PLUS_ONE);
|
||||||
|
assertEquals("validation.msg.savingsaccount.reject.not.in.submittedandpendingapproval.state",
|
||||||
|
error1.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
|
savingsStatusHashMap = this.savingsAccountHelper.undoApprovalGsimSavings(gsimID);
|
||||||
|
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||||
|
|
||||||
|
error1 = savingsAccountHelperValidationError.rejectGsimApplicationWithErrorCode(gsimID, SavingsAccountHelper.getFutureDate());
|
||||||
|
assertEquals("validation.msg.savingsaccount.reject.cannot.be.a.future.date",
|
||||||
|
error1.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
|
error1 = savingsAccountHelperValidationError.rejectGsimApplicationWithErrorCode(gsimID,
|
||||||
|
SavingsAccountHelper.CREATED_DATE_MINUS_ONE);
|
||||||
|
assertEquals("validation.msg.savingsaccount.reject.cannot.be.before.submittal.date",
|
||||||
|
error1.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
|
savingsStatusHashMap = this.savingsAccountHelper.rejectGsimApplication(gsimID);
|
||||||
|
SavingsStatusChecker.verifySavingsIsRejected(savingsStatusHashMap);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGsimSavingsAccount_DEPOSIT_APPLICATION() {
|
||||||
|
|
||||||
|
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
final String minBalanceForInterestCalculation = null;
|
||||||
|
final String minRequiredBalance = null;
|
||||||
|
final String enforceMinRequiredBalance = "false";
|
||||||
|
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
|
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
||||||
|
Assertions.assertNotNull(savingsProductID);
|
||||||
|
|
||||||
|
List<Map<String, Object>> clientArray = new ArrayList<>();
|
||||||
|
clientArray.add(clientArray(clientID, groupID, savingsProductID, "08 January 2013"));
|
||||||
|
LOG.info("client Array : {} ", clientArray);
|
||||||
|
|
||||||
|
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
||||||
|
Assertions.assertNotNull(savingsId);
|
||||||
|
|
||||||
|
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);
|
||||||
|
Assertions.assertNotNull(paymentTypeId);
|
||||||
|
|
||||||
|
List<Map<String, Object>> savingsArray = new ArrayList<>();
|
||||||
|
final Integer transactionAmount = 2500;
|
||||||
|
savingsArray.add(savingsArray(paymentTypeId, savingsId, transactionAmount, "10 March 2013"));
|
||||||
|
|
||||||
|
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
||||||
|
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||||
|
|
||||||
|
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
|
||||||
|
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
|
||||||
|
|
||||||
|
savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
|
||||||
|
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
||||||
|
|
||||||
|
final Integer depositId = this.savingsAccountHelper.depositGsimApplication(savingsId, savingsArray);
|
||||||
|
Assertions.assertNotNull(depositId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Test
|
||||||
|
public void testGsimSavingsAccount_CLOSE_APPLICATION() {
|
||||||
|
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||||
|
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||||
|
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse);
|
||||||
|
|
||||||
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
final String minBalanceForInterestCalculation = null;
|
||||||
|
final String minRequiredBalance = "1000.0";
|
||||||
|
final String enforceMinRequiredBalance = "true";
|
||||||
|
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
|
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
||||||
|
Assertions.assertNotNull(savingsProductID);
|
||||||
|
|
||||||
|
List<Map<String, Object>> clientArray = new ArrayList<>();
|
||||||
|
clientArray.add(clientArray(clientID, groupID, savingsProductID, "08 January 2013"));
|
||||||
|
|
||||||
|
final Integer gsimID = this.savingsAccountHelper.applyForGsimApplication(clientArray);
|
||||||
|
|
||||||
|
HashMap savingsStatusHashMap = this.savingsAccountHelper.approveGsimSavings(gsimID);
|
||||||
|
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
|
||||||
|
|
||||||
|
savingsStatusHashMap = this.savingsAccountHelper.activateGsimSavings(gsimID);
|
||||||
|
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
||||||
|
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||||
|
Calendar todaysDate = Calendar.getInstance();
|
||||||
|
final String CLOSEDON_DATE = dateFormat.format(todaysDate.getTime());
|
||||||
|
String withdrawBalance = "false";
|
||||||
|
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper
|
||||||
|
.closeGsimSavingsAccountAndGetBackRequiredField(gsimID, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
|
||||||
|
assertEquals("validation.msg.savingsaccount.close.results.in.balance.not.zero",
|
||||||
|
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
|
withdrawBalance = "true";
|
||||||
|
savingsStatusHashMap = this.savingsAccountHelper.closeGsimSavingsAccount(gsimID, withdrawBalance);
|
||||||
|
SavingsStatusChecker.verifySavingsAccountIsClosed(savingsStatusHashMap);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Test
|
||||||
|
public void testGsimSavingsAccount_UPDATE_APPLICATION() {
|
||||||
|
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||||
|
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||||
|
|
||||||
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
final String minBalanceForInterestCalculation = null;
|
||||||
|
final String minRequiredBalance = "1000.0";
|
||||||
|
final String enforceMinRequiredBalance = "true";
|
||||||
|
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
|
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
||||||
|
Assertions.assertNotNull(savingsProductID);
|
||||||
|
|
||||||
|
List<Map<String, Object>> clientArray = new ArrayList<>();
|
||||||
|
clientArray.add(clientArray(clientID, groupID, savingsProductID, "08 January 2013"));
|
||||||
|
|
||||||
|
final Integer gsimID = this.savingsAccountHelper.applyForGsimApplication(clientArray);
|
||||||
|
|
||||||
|
HashMap savingsStatusHashMap = this.savingsAccountHelper.updateGsimApplication(gsimID, clientID, groupID, savingsProductID);
|
||||||
|
LOG.info("savingsStatusHashMap: {} ", savingsStatusHashMap);
|
||||||
|
Assertions.assertTrue(savingsStatusHashMap.containsKey("savingsId"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getGsimAccount() {
|
||||||
|
|
||||||
|
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||||
|
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||||
|
|
||||||
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
|
final String minBalanceForInterestCalculation = null;
|
||||||
|
final String minRequiredBalance = "1000.0";
|
||||||
|
final String enforceMinRequiredBalance = "true";
|
||||||
|
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
|
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
||||||
|
Assertions.assertNotNull(savingsProductID);
|
||||||
|
|
||||||
|
List<Map<String, Object>> clientArray = new ArrayList<>();
|
||||||
|
clientArray.add(clientArray(clientID, groupID, savingsProductID, "08 January 2013"));
|
||||||
|
final Integer gsimID = this.savingsAccountHelper.applyForGsimApplication(clientArray);
|
||||||
|
|
||||||
|
final List<String> retrievedGsimId = GroupHelper.verifyRetrieveGsimAccounts(this.requestSpec, this.responseSpec, groupID);
|
||||||
|
Assertions.assertNotNull(retrievedGsimId.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Test
|
@Test
|
||||||
public void testSavingsAccount_REJECT_APPLICATION() {
|
public void testSavingsAccount_REJECT_APPLICATION() {
|
||||||
@@ -226,23 +453,23 @@ public class GroupSavingsIntegrationTest {
|
|||||||
new ResponseSpecBuilder().build());
|
new ResponseSpecBuilder().build());
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientID);
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
final String minBalanceForInterestCalculation = null;
|
final String minBalanceForInterestCalculation = null;
|
||||||
final String minRequiredBalance = null;
|
final String minRequiredBalance = null;
|
||||||
final String enforceMinRequiredBalance = "false";
|
final String enforceMinRequiredBalance = "false";
|
||||||
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
||||||
Assert.assertNotNull(savingsProductID);
|
Assertions.assertNotNull(savingsProductID);
|
||||||
|
|
||||||
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
||||||
Assert.assertNotNull(savingsId);
|
Assertions.assertNotNull(savingsId);
|
||||||
|
|
||||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
||||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||||
@@ -268,6 +495,7 @@ public class GroupSavingsIntegrationTest {
|
|||||||
|
|
||||||
savingsStatusHashMap = this.savingsAccountHelper.rejectApplication(savingsId);
|
savingsStatusHashMap = this.savingsAccountHelper.rejectApplication(savingsId);
|
||||||
SavingsStatusChecker.verifySavingsIsRejected(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsRejected(savingsStatusHashMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -276,23 +504,23 @@ public class GroupSavingsIntegrationTest {
|
|||||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientID);
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
final String minBalanceForInterestCalculation = null;
|
final String minBalanceForInterestCalculation = null;
|
||||||
final String minRequiredBalance = null;
|
final String minRequiredBalance = null;
|
||||||
final String enforceMinRequiredBalance = "false";
|
final String enforceMinRequiredBalance = "false";
|
||||||
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
||||||
Assert.assertNotNull(savingsProductID);
|
Assertions.assertNotNull(savingsProductID);
|
||||||
|
|
||||||
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
||||||
Assert.assertNotNull(savingsId);
|
Assertions.assertNotNull(savingsId);
|
||||||
|
|
||||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
||||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||||
@@ -310,23 +538,23 @@ public class GroupSavingsIntegrationTest {
|
|||||||
new ResponseSpecBuilder().build());
|
new ResponseSpecBuilder().build());
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientID);
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
final String minBalanceForInterestCalculation = null;
|
final String minBalanceForInterestCalculation = null;
|
||||||
final String minRequiredBalance = null;
|
final String minRequiredBalance = null;
|
||||||
final String enforceMinRequiredBalance = "false";
|
final String enforceMinRequiredBalance = "false";
|
||||||
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
||||||
Assert.assertNotNull(savingsProductID);
|
Assertions.assertNotNull(savingsProductID);
|
||||||
|
|
||||||
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
||||||
Assert.assertNotNull(savingsId);
|
Assertions.assertNotNull(savingsId);
|
||||||
|
|
||||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
||||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||||
@@ -348,40 +576,40 @@ public class GroupSavingsIntegrationTest {
|
|||||||
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
||||||
|
|
||||||
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||||
Float balance = new Float(MINIMUM_OPENING_BALANCE);
|
Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||||
assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
|
assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance");
|
||||||
|
|
||||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
|
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
|
||||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
|
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
|
||||||
balance += new Float(DEPOSIT_AMOUNT);
|
balance += Float.valueOf(DEPOSIT_AMOUNT);
|
||||||
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
|
assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), "Verifying Deposit Amount");
|
||||||
assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance"));
|
assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit");
|
||||||
|
|
||||||
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
|
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
|
||||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
|
HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
|
||||||
balance -= new Float(WITHDRAW_AMOUNT);
|
balance -= Float.valueOf(WITHDRAW_AMOUNT);
|
||||||
assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"));
|
assertEquals(Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"), "Verifying Withdrawal Amount");
|
||||||
assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance"));
|
assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal");
|
||||||
|
|
||||||
Integer newWithdrawTransactionId = this.savingsAccountHelper.updateSavingsAccountTransaction(savingsId, withdrawTransactionId,
|
Integer newWithdrawTransactionId = this.savingsAccountHelper.updateSavingsAccountTransaction(savingsId, withdrawTransactionId,
|
||||||
WITHDRAW_AMOUNT_ADJUSTED);
|
WITHDRAW_AMOUNT_ADJUSTED);
|
||||||
HashMap newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, newWithdrawTransactionId);
|
HashMap newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, newWithdrawTransactionId);
|
||||||
balance = balance + new Float(WITHDRAW_AMOUNT) - new Float(WITHDRAW_AMOUNT_ADJUSTED);
|
balance = balance + Float.valueOf(WITHDRAW_AMOUNT) - Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED);
|
||||||
assertEquals("Verifying adjusted Amount", new Float(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount"));
|
assertEquals(Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount"), "Verifying adjusted Amount");
|
||||||
assertEquals("Verifying Balance after adjust", balance, newWithdrawTransaction.get("runningBalance"));
|
assertEquals(balance, newWithdrawTransaction.get("runningBalance"), "Verifying Balance after adjust");
|
||||||
summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||||
assertEquals("Verifying Adjusted Balance", balance, summary.get("accountBalance"));
|
assertEquals(balance, summary.get("accountBalance"), "Verifying Adjusted Balance");
|
||||||
withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
|
withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
|
||||||
Assert.assertTrue((Boolean) withdrawTransaction.get("reversed"));
|
Assertions.assertTrue((Boolean) withdrawTransaction.get("reversed"));
|
||||||
|
|
||||||
this.savingsAccountHelper.undoSavingsAccountTransaction(savingsId, newWithdrawTransactionId);
|
this.savingsAccountHelper.undoSavingsAccountTransaction(savingsId, newWithdrawTransactionId);
|
||||||
newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
|
newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
|
||||||
Assert.assertTrue((Boolean) newWithdrawTransaction.get("reversed"));
|
Assertions.assertTrue((Boolean) newWithdrawTransaction.get("reversed"));
|
||||||
summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||||
balance += new Float(WITHDRAW_AMOUNT_ADJUSTED);
|
balance += Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED);
|
||||||
assertEquals("Verifying Balance After Undo Transaction", balance, summary.get("accountBalance"));
|
assertEquals(balance, summary.get("accountBalance"), "Verifying Balance After Undo Transaction");
|
||||||
|
|
||||||
error = (List) savingsAccountHelperValidationError.withdrawalFromSavingsAccount(savingsId, "5000",
|
error = (List) savingsAccountHelperValidationError.withdrawalFromSavingsAccount(savingsId, "5000",
|
||||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);
|
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);
|
||||||
@@ -414,44 +642,44 @@ public class GroupSavingsIntegrationTest {
|
|||||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(clientID);
|
Assertions.assertNotNull(clientID);
|
||||||
|
|
||||||
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
Assert.assertNotNull(groupID);
|
Assertions.assertNotNull(groupID);
|
||||||
|
|
||||||
final String minBalanceForInterestCalculation = null;
|
final String minBalanceForInterestCalculation = null;
|
||||||
final String minRequiredBalance = null;
|
final String minRequiredBalance = null;
|
||||||
final String enforceMinRequiredBalance = "false";
|
final String enforceMinRequiredBalance = "false";
|
||||||
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||||
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
|
||||||
Assert.assertNotNull(savingsProductID);
|
Assertions.assertNotNull(savingsProductID);
|
||||||
|
|
||||||
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
|
||||||
Assert.assertNotNull(savingsId);
|
Assertions.assertNotNull(savingsId);
|
||||||
|
|
||||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
||||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||||
|
|
||||||
final Integer withdrawalChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
final Integer withdrawalChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||||
ChargesHelper.getSavingsWithdrawalFeeJSON());
|
ChargesHelper.getSavingsWithdrawalFeeJSON());
|
||||||
Assert.assertNotNull(withdrawalChargeId);
|
Assertions.assertNotNull(withdrawalChargeId);
|
||||||
|
|
||||||
this.savingsAccountHelper.addChargesForSavings(savingsId, withdrawalChargeId, false);
|
this.savingsAccountHelper.addChargesForSavings(savingsId, withdrawalChargeId, false);
|
||||||
ArrayList<HashMap> chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
ArrayList<HashMap> chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
||||||
Assert.assertEquals(1, chargesPendingState.size());
|
Assertions.assertEquals(1, chargesPendingState.size());
|
||||||
|
|
||||||
Integer savingsChargeId = (Integer) chargesPendingState.get(0).get("id");
|
Integer savingsChargeId = (Integer) chargesPendingState.get(0).get("id");
|
||||||
HashMap chargeChanges = this.savingsAccountHelper.updateCharges(savingsChargeId, savingsId);
|
HashMap chargeChanges = this.savingsAccountHelper.updateCharges(savingsChargeId, savingsId);
|
||||||
Assert.assertTrue(chargeChanges.containsKey("amount"));
|
Assertions.assertTrue(chargeChanges.containsKey("amount"));
|
||||||
|
|
||||||
Integer deletedChargeId = this.savingsAccountHelper.deleteCharge(savingsChargeId, savingsId);
|
Integer deletedChargeId = this.savingsAccountHelper.deleteCharge(savingsChargeId, savingsId);
|
||||||
assertEquals(savingsChargeId, deletedChargeId);
|
assertEquals(savingsChargeId, deletedChargeId);
|
||||||
|
|
||||||
chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
||||||
Assert.assertTrue(chargesPendingState == null || chargesPendingState.size() == 0);
|
Assertions.assertTrue(chargesPendingState == null || chargesPendingState.size() == 0);
|
||||||
|
|
||||||
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
|
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
|
||||||
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
|
||||||
@@ -460,17 +688,17 @@ public class GroupSavingsIntegrationTest {
|
|||||||
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
||||||
|
|
||||||
final Integer chargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsAnnualFeeJSON());
|
final Integer chargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsAnnualFeeJSON());
|
||||||
Assert.assertNotNull(chargeId);
|
Assertions.assertNotNull(chargeId);
|
||||||
|
|
||||||
ArrayList<HashMap> charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
ArrayList<HashMap> charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
||||||
Assert.assertTrue(charges == null || charges.size() == 0);
|
Assertions.assertTrue(charges == null || charges.size() == 0);
|
||||||
|
|
||||||
this.savingsAccountHelper.addChargesForSavings(savingsId, chargeId, true);
|
this.savingsAccountHelper.addChargesForSavings(savingsId, chargeId, true);
|
||||||
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
||||||
Assert.assertEquals(1, charges.size());
|
Assertions.assertEquals(1, charges.size());
|
||||||
|
|
||||||
HashMap savingsChargeForPay = charges.get(0);
|
HashMap savingsChargeForPay = charges.get(0);
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.dateFormat, Locale.US);
|
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.DATE_FORMAT, Locale.US);
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
List dates = (List) savingsChargeForPay.get("dueDate");
|
List dates = (List) savingsChargeForPay.get("dueDate");
|
||||||
cal.set(Calendar.YEAR, (Integer) dates.get(0));
|
cal.set(Calendar.YEAR, (Integer) dates.get(0));
|
||||||
@@ -484,11 +712,11 @@ public class GroupSavingsIntegrationTest {
|
|||||||
|
|
||||||
final Integer monthlyFeechargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
final Integer monthlyFeechargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||||
ChargesHelper.getSavingsMonthlyFeeJSON());
|
ChargesHelper.getSavingsMonthlyFeeJSON());
|
||||||
Assert.assertNotNull(monthlyFeechargeId);
|
Assertions.assertNotNull(monthlyFeechargeId);
|
||||||
|
|
||||||
this.savingsAccountHelper.addChargesForSavings(savingsId, monthlyFeechargeId, true);
|
this.savingsAccountHelper.addChargesForSavings(savingsId, monthlyFeechargeId, true);
|
||||||
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
||||||
Assert.assertEquals(2, charges.size());
|
Assertions.assertEquals(2, charges.size());
|
||||||
|
|
||||||
HashMap savingsChargeForWaive = charges.get(1);
|
HashMap savingsChargeForWaive = charges.get(1);
|
||||||
this.savingsAccountHelper.waiveCharge((Integer) savingsChargeForWaive.get("id"), savingsId);
|
this.savingsAccountHelper.waiveCharge((Integer) savingsChargeForWaive.get("id"), savingsId);
|
||||||
@@ -501,12 +729,13 @@ public class GroupSavingsIntegrationTest {
|
|||||||
totalWaiveAmount = totalWaiveAmount.add(totalWaiveAmount);
|
totalWaiveAmount = totalWaiveAmount.add(totalWaiveAmount);
|
||||||
assertEquals(totalWaiveAmount.floatValue(), waiveCharge.get("amountWaived"));
|
assertEquals(totalWaiveAmount.floatValue(), waiveCharge.get("amountWaived"));
|
||||||
|
|
||||||
final Integer weeklyFeeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsWeeklyFeeJSON());
|
final Integer weeklyFeeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||||
Assert.assertNotNull(weeklyFeeId);
|
ChargesHelper.getSavingsWeeklyFeeJSON());
|
||||||
|
Assertions.assertNotNull(weeklyFeeId);
|
||||||
|
|
||||||
this.savingsAccountHelper.addChargesForSavings(savingsId, weeklyFeeId, true);
|
this.savingsAccountHelper.addChargesForSavings(savingsId, weeklyFeeId, true);
|
||||||
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
||||||
Assert.assertEquals(3, charges.size());
|
Assertions.assertEquals(3, charges.size());
|
||||||
|
|
||||||
savingsChargeForPay = charges.get(2);
|
savingsChargeForPay = charges.get(2);
|
||||||
cal = Calendar.getInstance();
|
cal = Calendar.getInstance();
|
||||||
@@ -518,7 +747,7 @@ public class GroupSavingsIntegrationTest {
|
|||||||
// Depositing huge amount as scheduler job deducts the fee amount
|
// Depositing huge amount as scheduler job deducts the fee amount
|
||||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "100000",
|
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "100000",
|
||||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
Assert.assertNotNull(depositTransactionId);
|
Assertions.assertNotNull(depositTransactionId);
|
||||||
|
|
||||||
this.savingsAccountHelper.payCharge((Integer) savingsChargeForPay.get("id"), savingsId,
|
this.savingsAccountHelper.payCharge((Integer) savingsChargeForPay.get("id"), savingsId,
|
||||||
((Float) savingsChargeForPay.get("amount")).toString(), sdf.format(cal.getTime()));
|
((Float) savingsChargeForPay.get("amount")).toString(), sdf.format(cal.getTime()));
|
||||||
@@ -529,16 +758,16 @@ public class GroupSavingsIntegrationTest {
|
|||||||
LocalDate expectedNextDueDate = new LocalDate((Integer) dates.get(0), (Integer) dates.get(1), (Integer) dates.get(2))
|
LocalDate expectedNextDueDate = new LocalDate((Integer) dates.get(0), (Integer) dates.get(1), (Integer) dates.get(2))
|
||||||
.plusWeeks((Integer) paidCharge.get("feeInterval"));
|
.plusWeeks((Integer) paidCharge.get("feeInterval"));
|
||||||
assertEquals(expectedNextDueDate, nextDueDate);
|
assertEquals(expectedNextDueDate, nextDueDate);
|
||||||
cal = Calendar.getInstance();
|
|
||||||
|
|
||||||
this.savingsAccountHelper.closeSavingsAccountAndGetBackRequiredField(savingsId, "true", null, sdf.format(cal.getTime()));
|
this.savingsAccountHelper.closeSavingsAccountAndGetBackRequiredField(savingsId, "true", null,
|
||||||
|
sdf.format(Utils.getLocalDateOfTenant().toDate()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
public static Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||||
final String minOpenningBalance, final String minBalanceForInterestCalculation, final String minRequiredBalance,
|
final String minOpenningBalance, final String minBalanceForInterestCalculation, final String minRequiredBalance,
|
||||||
final String enforceMinRequiredBalance) {
|
final String enforceMinRequiredBalance) {
|
||||||
System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
||||||
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
|
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
|
||||||
final String savingsProductJSON = savingsProductHelper //
|
final String savingsProductJSON = savingsProductHelper //
|
||||||
.withInterestCompoundingPeriodTypeAsDaily() //
|
.withInterestCompoundingPeriodTypeAsDaily() //
|
||||||
@@ -550,4 +779,31 @@ public class GroupSavingsIntegrationTest {
|
|||||||
.withMinimumOpenningBalance(minOpenningBalance).build();
|
.withMinimumOpenningBalance(minOpenningBalance).build();
|
||||||
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
|
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, Object> clientArray(final Integer clientId, final Integer groupId, final Integer productId,
|
||||||
|
final String submittedOnDate) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("clientId", clientId);
|
||||||
|
map.put("groupId", groupId);
|
||||||
|
map.put("productId", productId);
|
||||||
|
map.put("submittedOnDate", submittedOnDate);
|
||||||
|
map.put("dateFormat", CommonConstants.DATE_FORMAT);
|
||||||
|
map.put("locale", "en");
|
||||||
|
map.put("isParentAccount", "1");
|
||||||
|
map.put("isGSIM", "true");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Object> savingsArray(final Integer paymentId, final Integer savingsId, final Integer transactionAmount,
|
||||||
|
final String transactionDate) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("transactionDate", transactionDate);
|
||||||
|
map.put("dateFormat", CommonConstants.DATE_FORMAT);
|
||||||
|
map.put("locale", "en");
|
||||||
|
map.put("transactionAmount", transactionAmount);
|
||||||
|
map.put("paymentTypeId", paymentId);
|
||||||
|
map.put("childAccountId", savingsId);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Executable → Regular
+25
-24
@@ -18,11 +18,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.GroupHelper;
|
import org.apache.fineract.integrationtests.common.GroupHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
@@ -30,15 +34,11 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
|
||||||
import com.jayway.restassured.http.ContentType;
|
|
||||||
import com.jayway.restassured.specification.RequestSpecification;
|
|
||||||
import com.jayway.restassured.specification.ResponseSpecification;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Group Test for checking Group: Creation, Activation, Client Association,
|
* Group Test for checking Group: Creation, Activation, Client Association,
|
||||||
@@ -46,6 +46,7 @@ import com.jayway.restassured.specification.ResponseSpecification;
|
|||||||
*/
|
*/
|
||||||
public class GroupTest {
|
public class GroupTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(GroupTest.class);
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
@@ -54,7 +55,7 @@ public class GroupTest {
|
|||||||
private final String numberOfRepayments = "5";
|
private final String numberOfRepayments = "5";
|
||||||
private final String interestRatePerPeriod = "18";
|
private final String interestRatePerPeriod = "18";
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -109,22 +110,22 @@ public class GroupTest {
|
|||||||
|
|
||||||
// create staff
|
// create staff
|
||||||
Integer createStaffId1 = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
Integer createStaffId1 = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||||
System.out.println("--------------creating first staff with id-------------" + createStaffId1);
|
LOG.info("--------------creating first staff with id------------- {}", createStaffId1);
|
||||||
Assert.assertNotNull(createStaffId1);
|
Assertions.assertNotNull(createStaffId1);
|
||||||
|
|
||||||
Integer createStaffId2 = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
Integer createStaffId2 = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||||
System.out.println("--------------creating second staff with id-------------" + createStaffId2);
|
LOG.info("--------------creating second staff with id------------- {}", createStaffId2);
|
||||||
Assert.assertNotNull(createStaffId2);
|
Assertions.assertNotNull(createStaffId2);
|
||||||
|
|
||||||
// assign staff "createStaffId1" to group
|
// assign staff "createStaffId1" to group
|
||||||
HashMap assignStaffGroupId = (HashMap) GroupHelper.assignStaff(this.requestSpec, this.responseSpec, groupID.toString(),
|
HashMap assignStaffGroupId = (HashMap) GroupHelper.assignStaff(this.requestSpec, this.responseSpec, groupID.toString(),
|
||||||
createStaffId1.longValue());
|
createStaffId1.longValue());
|
||||||
assertEquals("Verify assigned staff id is the same as id sent", assignStaffGroupId.get("staffId"), createStaffId1);
|
assertEquals(assignStaffGroupId.get("staffId"), createStaffId1, "Verify assigned staff id is the same as id sent");
|
||||||
|
|
||||||
// assign staff "createStaffId2" to client
|
// assign staff "createStaffId2" to client
|
||||||
final HashMap assignStaffToClientChanges = (HashMap) ClientHelper.assignStaffToClient(this.requestSpec, this.responseSpec,
|
final HashMap assignStaffToClientChanges = (HashMap) ClientHelper.assignStaffToClient(this.requestSpec, this.responseSpec,
|
||||||
clientID.toString(), createStaffId2.toString());
|
clientID.toString(), createStaffId2.toString());
|
||||||
assertEquals("Verify assigned staff id is the same as id sent", assignStaffToClientChanges.get("staffId"), createStaffId2);
|
assertEquals(assignStaffToClientChanges.get("staffId"), createStaffId2, "Verify assigned staff id is the same as id sent");
|
||||||
|
|
||||||
final Integer loanProductId = this.createLoanProduct();
|
final Integer loanProductId = this.createLoanProduct();
|
||||||
|
|
||||||
@@ -139,13 +140,13 @@ public class GroupTest {
|
|||||||
|
|
||||||
// assert if client staff officer has change Note client was assigned
|
// assert if client staff officer has change Note client was assigned
|
||||||
// staff with createStaffId2
|
// staff with createStaffId2
|
||||||
assertNotEquals("Verify if client stuff has changed", assignStaffAndInheritStaffForClientAccounts.get("staffId"), createStaffId2);
|
assertNotEquals(assignStaffAndInheritStaffForClientAccounts.get("staffId"), createStaffId2, "Verify if client stuff has changed");
|
||||||
assertEquals("Verify if client inherited staff assigned above", assignStaffAndInheritStaffForClientAccounts.get("staffId"),
|
assertEquals(assignStaffAndInheritStaffForClientAccounts.get("staffId"), getClientStaffId,
|
||||||
getClientStaffId);
|
"Verify if client inherited staff assigned above");
|
||||||
|
|
||||||
// assert if clients loan officer has changed
|
// assert if clients loan officer has changed
|
||||||
final Integer loanOfficerId = this.loanTransactionHelper.getLoanOfficerId(loanId.toString());
|
final Integer loanOfficerId = this.loanTransactionHelper.getLoanOfficerId(loanId.toString());
|
||||||
assertEquals("Verify if client loan inherited staff", assignStaffAndInheritStaffForClientAccounts.get("staffId"), loanOfficerId);
|
assertEquals(assignStaffAndInheritStaffForClientAccounts.get("staffId"), loanOfficerId, "Verify if client loan inherited staff");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +158,7 @@ public class GroupTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, String principal) {
|
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, String principal) {
|
||||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||||
.withPrincipal(principal) //
|
.withPrincipal(principal) //
|
||||||
.withLoanTermFrequency("4") //
|
.withLoanTermFrequency("4") //
|
||||||
|
|||||||
+32
-30
@@ -18,36 +18,37 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
|
import io.restassured.RestAssured;
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.path.json.JsonPath;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.HookHelper;
|
import org.apache.fineract.integrationtests.common.HookHelper;
|
||||||
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.http.conn.HttpHostConnectException;
|
import org.apache.http.conn.HttpHostConnectException;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import com.jayway.restassured.RestAssured;
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
|
||||||
import com.jayway.restassured.http.ContentType;
|
|
||||||
import com.jayway.restassured.path.json.JsonPath;
|
|
||||||
import com.jayway.restassured.specification.RequestSpecification;
|
|
||||||
import com.jayway.restassured.specification.ResponseSpecification;
|
|
||||||
|
|
||||||
public class HookIntegrationTest {
|
public class HookIntegrationTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(HookIntegrationTest.class);
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
|
|
||||||
private HookHelper hookHelper;
|
private HookHelper hookHelper;
|
||||||
private OfficeHelper officeHelper;
|
private OfficeHelper officeHelper;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -62,7 +63,8 @@ public class HookIntegrationTest {
|
|||||||
// Subject to https://echo-webhook.herokuapp.com being up
|
// Subject to https://echo-webhook.herokuapp.com being up
|
||||||
// See
|
// See
|
||||||
// http://www.jamesward.com/2014/06/11/testing-webhooks-was-a-pain-so-i-fixed-the-glitch
|
// http://www.jamesward.com/2014/06/11/testing-webhooks-was-a-pain-so-i-fixed-the-glitch
|
||||||
final String payloadURL = "http://echo-webhook.herokuapp.com:80/Z7RXoCBdLSFMDrpn?";
|
final String uniqueId = UUID.randomUUID().toString();
|
||||||
|
final String payloadURL = "http://echo-webhook.herokuapp.com:80/" + uniqueId + "?";
|
||||||
this.hookHelper.createHook(payloadURL);
|
this.hookHelper.createHook(payloadURL);
|
||||||
final Integer createdOfficeID = this.officeHelper.createOffice("01 January 2012");
|
final Integer createdOfficeID = this.officeHelper.createOffice("01 January 2012");
|
||||||
try {
|
try {
|
||||||
@@ -76,9 +78,9 @@ public class HookIntegrationTest {
|
|||||||
try {
|
try {
|
||||||
final String json = RestAssured.get(payloadURL.replace("?", "")).asString();
|
final String json = RestAssured.get(payloadURL.replace("?", "")).asString();
|
||||||
final Integer notificationOfficeId = JsonPath.with(json).get("officeId");
|
final Integer notificationOfficeId = JsonPath.with(json).get("officeId");
|
||||||
Assert.assertEquals("Equality check for created officeId and hook received payload officeId", createdOfficeID,
|
Assertions.assertEquals(createdOfficeID, notificationOfficeId,
|
||||||
notificationOfficeId);
|
"Equality check for created officeId and hook received payload officeId");
|
||||||
System.out.println("Notification Office Id - " + notificationOfficeId);
|
LOG.info("Notification Office Id - {}", notificationOfficeId);
|
||||||
i = 6;
|
i = 6;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
TimeUnit.SECONDS.sleep(3);
|
TimeUnit.SECONDS.sleep(3);
|
||||||
@@ -96,20 +98,20 @@ public class HookIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createUpdateAndDeleteHook(){
|
public void createUpdateAndDeleteHook() {
|
||||||
final String payloadURL = "http://echo-webhook.herokuapp.com:80/Z7RXoCBdLSFMDrpn?";
|
final String payloadURL = "http://echo-webhook.herokuapp.com:80/Z7RXoCBdLSFMDrpn?";
|
||||||
final String updateURL = "http://localhost";
|
final String updateURL = "http://localhost";
|
||||||
|
|
||||||
Long hookId = this.hookHelper.createHook(payloadURL).longValue();
|
Long hookId = this.hookHelper.createHook(payloadURL).longValue();
|
||||||
Assert.assertNotNull(hookId);
|
Assertions.assertNotNull(hookId);
|
||||||
this.hookHelper.verifyHookCreatedOnServer(hookId);
|
this.hookHelper.verifyHookCreatedOnServer(hookId);
|
||||||
System.out.println("---------------------SUCCESSFULLY CREATED AND VERIFIED HOOK-------------------------"+hookId);
|
LOG.info("---------------------SUCCESSFULLY CREATED AND VERIFIED HOOK------------------------- {}", hookId);
|
||||||
this.hookHelper.updateHook(updateURL, hookId);
|
this.hookHelper.updateHook(updateURL, hookId);
|
||||||
this.hookHelper.verifyUpdateHook(updateURL, hookId);
|
this.hookHelper.verifyUpdateHook(updateURL, hookId);
|
||||||
System.out.println("---------------------SUCCESSFULLY UPDATED AND VERIFIED HOOK-------------------------"+hookId);
|
LOG.info("---------------------SUCCESSFULLY UPDATED AND VERIFIED HOOK------------------------- {}", hookId);
|
||||||
this.hookHelper.deleteHook(hookId);
|
this.hookHelper.deleteHook(hookId);
|
||||||
this.hookHelper.verifyDeleteHook(hookId);
|
this.hookHelper.verifyDeleteHook(hookId);
|
||||||
System.out.println("---------------------SUCCESSFULLY DELETED AND VERIFIED HOOK-------------------------"+hookId);
|
LOG.info("---------------------SUCCESSFULLY DELETED AND VERIFIED HOOK------------------------- {}", hookId);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-30
@@ -18,12 +18,16 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
@@ -31,25 +35,22 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
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")
|
@SuppressWarnings("rawtypes")
|
||||||
public class LoanApplicationApprovalTest {
|
public class LoanApplicationApprovalTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(LoanApplicationApprovalTest.class);
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private ResponseSpecification responseSpecForStatusCode403;
|
private ResponseSpecification responseSpecForStatusCode403;
|
||||||
private ResponseSpecification responseSpecForStatusCode400;
|
private ResponseSpecification responseSpecForStatusCode400;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -130,14 +131,13 @@ public class LoanApplicationApprovalTest {
|
|||||||
createTranches.add(createTrancheDetail("23 March 2014", "4000"));
|
createTranches.add(createTrancheDetail("23 March 2014", "4000"));
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||||
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
|
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
|
||||||
+ clientID);
|
|
||||||
|
|
||||||
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
|
final Integer loanProductID = this.loanTransactionHelper
|
||||||
.withInterestTypeAsDecliningBalance().withTranches(true).withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
|
.getLoanProductId(new LoanProductTestBuilder().withInterestTypeAsDecliningBalance().withTranches(true)
|
||||||
.build(null));
|
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).build(null));
|
||||||
System.out.println("----------------------------------LOAN PRODUCT CREATED WITH ID-------------------------------------------"
|
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
|
||||||
+ loanProductID);
|
loanProductID);
|
||||||
|
|
||||||
this.trancheLoansApprovedAmountLesserThanProposedAmount(clientID, loanProductID, createTranches);
|
this.trancheLoansApprovedAmountLesserThanProposedAmount(clientID, loanProductID, createTranches);
|
||||||
this.trancheLoansApprovalValidation(clientID, loanProductID, createTranches);
|
this.trancheLoansApprovalValidation(clientID, loanProductID, createTranches);
|
||||||
@@ -155,19 +155,17 @@ public class LoanApplicationApprovalTest {
|
|||||||
approveTranches.add(createTrancheDetail("23 March 2014", "1000"));
|
approveTranches.add(createTrancheDetail("23 March 2014", "1000"));
|
||||||
|
|
||||||
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
|
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
|
||||||
System.out.println("-----------------------------------LOAN CREATED WITH LOANID-------------------------------------------------"
|
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
|
||||||
+ loanID);
|
|
||||||
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
||||||
loanID, approveTranches);
|
loanID, approveTranches);
|
||||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||||
System.out
|
LOG.info("-----------------------------------MULTI DISBURSAL LOAN APPROVED SUCCESSFULLY---------------------------------------");
|
||||||
.println("-----------------------------------MULTI DISBURSAL LOAN APPROVED SUCCESSFULLY---------------------------------------");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,13 +200,12 @@ public class LoanApplicationApprovalTest {
|
|||||||
approveTranche4.add(createTrancheDetail("24 March 2014", "100"));
|
approveTranche4.add(createTrancheDetail("24 March 2014", "100"));
|
||||||
|
|
||||||
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
|
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
|
||||||
System.out.println("-----------------------------------LOAN CREATED WITH LOANID-------------------------------------------------"
|
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
|
||||||
+ loanID);
|
|
||||||
|
|
||||||
HashMap<String, Object> loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap<String, Object> loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode400);
|
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode400);
|
||||||
|
|
||||||
/* Tranches with same expected disbursement date */
|
/* Tranches with same expected disbursement date */
|
||||||
@@ -234,8 +231,8 @@ public class LoanApplicationApprovalTest {
|
|||||||
/* No. of tranches exceeds the max tranche count at product level */
|
/* No. of tranches exceeds the max tranche count at product level */
|
||||||
error = this.loanTransactionHelper.approveLoanForTranches(approveDate, expectedDisbursementDate, approvalAmount3, loanID,
|
error = this.loanTransactionHelper.approveLoanForTranches(approveDate, expectedDisbursementDate, approvalAmount3, loanID,
|
||||||
approveTranche3, CommonConstants.RESPONSE_ERROR);
|
approveTranche3, CommonConstants.RESPONSE_ERROR);
|
||||||
assertEquals("error.msg.disbursementData.exceeding.max.tranche.count", error.get(0)
|
assertEquals("error.msg.disbursementData.exceeding.max.tranche.count",
|
||||||
.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
|
||||||
/* If tranches are not specified for a multi-disburse loan */
|
/* If tranches are not specified for a multi-disburse loan */
|
||||||
/**
|
/**
|
||||||
@@ -258,9 +255,9 @@ public class LoanApplicationApprovalTest {
|
|||||||
|
|
||||||
public Integer applyForLoanApplicationWithTranches(final Integer clientID, final Integer loanProductID, String principal,
|
public Integer applyForLoanApplicationWithTranches(final Integer clientID, final Integer loanProductID, String principal,
|
||||||
List<HashMap> tranches) {
|
List<HashMap> tranches) {
|
||||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
||||||
//
|
//
|
||||||
.withPrincipal(principal)
|
.withPrincipal(principal)
|
||||||
//
|
//
|
||||||
.withLoanTermFrequency("5")
|
.withLoanTermFrequency("5")
|
||||||
|
|||||||
+27
-31
@@ -18,38 +18,36 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.LoanApplicationApprovalTest;
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
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")
|
@SuppressWarnings("rawtypes")
|
||||||
public class LoanApplicationUndoLastTrancheTest {
|
public class LoanApplicationUndoLastTrancheTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(LoanApplicationUndoLastTrancheTest.class);
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
private LoanApplicationApprovalTest loanApplicationApprovalTest;
|
private LoanApplicationApprovalTest loanApplicationApprovalTest;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -60,7 +58,7 @@ public class LoanApplicationUndoLastTrancheTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void LoanApplicationUndoLastTranche() {
|
public void loanApplicationUndoLastTranche() {
|
||||||
|
|
||||||
final String proposedAmount = "5000";
|
final String proposedAmount = "5000";
|
||||||
final String approvalAmount = "2000";
|
final String approvalAmount = "2000";
|
||||||
@@ -70,15 +68,14 @@ public class LoanApplicationUndoLastTrancheTest {
|
|||||||
|
|
||||||
// CREATE CLIENT
|
// CREATE CLIENT
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||||
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
|
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
|
||||||
+ clientID);
|
|
||||||
|
|
||||||
// CREATE LOAN MULTIDISBURSAL PRODUCT
|
// CREATE LOAN MULTIDISBURSAL PRODUCT
|
||||||
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
|
final Integer loanProductID = this.loanTransactionHelper
|
||||||
.withInterestTypeAsDecliningBalance().withTranches(true).withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
|
.getLoanProductId(new LoanProductTestBuilder().withInterestTypeAsDecliningBalance().withTranches(true)
|
||||||
.build(null));
|
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).build(null));
|
||||||
System.out.println("----------------------------------LOAN PRODUCT CREATED WITH ID-------------------------------------------"
|
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
|
||||||
+ loanProductID);
|
loanProductID);
|
||||||
|
|
||||||
// CREATE TRANCHES
|
// CREATE TRANCHES
|
||||||
List<HashMap> createTranches = new ArrayList<>();
|
List<HashMap> createTranches = new ArrayList<>();
|
||||||
@@ -92,14 +89,13 @@ public class LoanApplicationUndoLastTrancheTest {
|
|||||||
|
|
||||||
// APPLY FOR LOAN WITH TRANCHES
|
// APPLY FOR LOAN WITH TRANCHES
|
||||||
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
|
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
|
||||||
System.out.println("-----------------------------------LOAN CREATED WITH LOANID-------------------------------------------------"
|
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
|
||||||
+ loanID);
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||||
|
|
||||||
// VALIDATE THE LOAN STATUS
|
// VALIDATE THE LOAN STATUS
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
||||||
loanID, approveTranches);
|
loanID, approveTranches);
|
||||||
|
|
||||||
@@ -114,11 +110,11 @@ public class LoanApplicationUndoLastTrancheTest {
|
|||||||
// VALIDATE THE LOAN IS ACTIVE STATUS
|
// VALIDATE THE LOAN IS ACTIVE STATUS
|
||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("-------------Make repayment 1-----------");
|
LOG.info("-------------Make repayment 1-----------");
|
||||||
this.loanTransactionHelper.makeRepayment("01 April 2014", Float.valueOf("420"), loanID);
|
this.loanTransactionHelper.makeRepayment("01 April 2014", Float.valueOf("420"), loanID);
|
||||||
System.out.println("-------------Make repayment 2-----------");
|
LOG.info("-------------Make repayment 2-----------");
|
||||||
this.loanTransactionHelper.makeRepayment("01 May 2014", Float.valueOf("412"), loanID);
|
this.loanTransactionHelper.makeRepayment("01 May 2014", Float.valueOf("412"), loanID);
|
||||||
System.out.println("-------------Make repayment 3-----------");
|
LOG.info("-------------Make repayment 3-----------");
|
||||||
this.loanTransactionHelper.makeRepayment("01 June 2014", Float.valueOf("204"), loanID);
|
this.loanTransactionHelper.makeRepayment("01 June 2014", Float.valueOf("204"), loanID);
|
||||||
// DISBURSE A SECOND TRANCHE
|
// DISBURSE A SECOND TRANCHE
|
||||||
this.loanTransactionHelper.disburseLoan("23 June 2014", loanID);
|
this.loanTransactionHelper.disburseLoan("23 June 2014", loanID);
|
||||||
@@ -128,15 +124,15 @@ public class LoanApplicationUndoLastTrancheTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void validateDisbursedAmount(Float disbursedAmount) {
|
private void validateDisbursedAmount(Float disbursedAmount) {
|
||||||
Assert.assertEquals(Float.valueOf("1000.0"), disbursedAmount);
|
Assertions.assertEquals(Float.valueOf("1000.0"), disbursedAmount);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer applyForLoanApplicationWithTranches(final Integer clientID, final Integer loanProductID, String principal,
|
public Integer applyForLoanApplicationWithTranches(final Integer clientID, final Integer loanProductID, String principal,
|
||||||
List<HashMap> tranches) {
|
List<HashMap> tranches) {
|
||||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
||||||
//
|
//
|
||||||
.withPrincipal(principal)
|
.withPrincipal(principal)
|
||||||
//
|
//
|
||||||
.withLoanTermFrequency("5")
|
.withLoanTermFrequency("5")
|
||||||
|
|||||||
+29
-36
@@ -18,9 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
@@ -28,25 +32,22 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
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")
|
@SuppressWarnings("rawtypes")
|
||||||
public class LoanDisbursalDateValidationTest {
|
public class LoanDisbursalDateValidationTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(LoanDisbursalDateValidationTest.class);
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
private ResponseSpecification responseForbiddenError;
|
private ResponseSpecification responseForbiddenError;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -57,7 +58,7 @@ public class LoanDisbursalDateValidationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void LoanApplicationValidateDisbursalDate() {
|
public void loanApplicationValidateDisbursalDate() {
|
||||||
|
|
||||||
final String proposedAmount = "5000";
|
final String proposedAmount = "5000";
|
||||||
final String approveDate = "1 March 2014";
|
final String approveDate = "1 March 2014";
|
||||||
@@ -65,25 +66,23 @@ public class LoanDisbursalDateValidationTest {
|
|||||||
|
|
||||||
// CREATE CLIENT
|
// CREATE CLIENT
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||||
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
|
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
|
||||||
+ clientID);
|
|
||||||
|
|
||||||
// CREATE LOAN PRODUCT
|
// CREATE LOAN PRODUCT
|
||||||
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
|
final Integer loanProductID = this.loanTransactionHelper
|
||||||
.withSyncExpectedWithDisbursementDate(true).build(null));
|
.getLoanProductId(new LoanProductTestBuilder().withSyncExpectedWithDisbursementDate(true).build(null));
|
||||||
System.out.println("----------------------------------LOAN PRODUCT CREATED WITH ID-------------------------------------------"
|
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
|
||||||
+ loanProductID);
|
loanProductID);
|
||||||
|
|
||||||
// APPLY FOR LOAN
|
// APPLY FOR LOAN
|
||||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID, proposedAmount);
|
final Integer loanID = applyForLoanApplication(clientID, loanProductID, proposedAmount);
|
||||||
System.out.println("-----------------------------------LOAN CREATED WITH LOANID-------------------------------------------------"
|
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
|
||||||
+ loanID);
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||||
|
|
||||||
// VALIDATE THE LOAN STATUS
|
// VALIDATE THE LOAN STATUS
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(approveDate, loanID);
|
loanStatusHashMap = this.loanTransactionHelper.approveLoan(approveDate, loanID);
|
||||||
|
|
||||||
// VALIDATE THE LOAN IS APPROVED
|
// VALIDATE THE LOAN IS APPROVED
|
||||||
@@ -92,26 +91,20 @@ public class LoanDisbursalDateValidationTest {
|
|||||||
|
|
||||||
// DISBURSE A LOAN
|
// DISBURSE A LOAN
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<HashMap> disbursalError = (List<HashMap>) this.loanTransactionHelper.disburseLoan(disbursalDate, loanID, this.responseForbiddenError);
|
List<HashMap> disbursalError = (List<HashMap>) this.loanTransactionHelper.disburseLoan(disbursalDate, loanID,
|
||||||
|
this.responseForbiddenError);
|
||||||
|
|
||||||
Assert.assertEquals("error.msg.actual.disbursement.date.does.not.match.with.expected.disbursal.date",
|
Assertions.assertEquals(disbursalError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE),
|
||||||
disbursalError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
"error.msg.actual.disbursement.date.does.not.match.with.expected.disbursal.date");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, final String proposedAmount) {
|
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, final String proposedAmount) {
|
||||||
final String loanApplication = new LoanApplicationTestBuilder()
|
final String loanApplication = new LoanApplicationTestBuilder().withPrincipal(proposedAmount).withLoanTermFrequency("5")
|
||||||
.withPrincipal(proposedAmount).withLoanTermFrequency("5")
|
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("5").withRepaymentEveryAfter("1")
|
||||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("5")
|
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("2").withExpectedDisbursementDate("1 March 2014")
|
||||||
.withRepaymentEveryAfter("1")
|
.withSubmittedOnDate("26 February 2014").build(clientID.toString(), loanProductID.toString(), null);
|
||||||
.withRepaymentFrequencyTypeAsMonths()
|
|
||||||
.withInterestRatePerPeriod("2")
|
|
||||||
.withExpectedDisbursementDate("1 March 2014")
|
|
||||||
.withSubmittedOnDate("26 February 2014").
|
|
||||||
build(clientID.toString(), loanProductID.toString(), null);
|
|
||||||
return this.loanTransactionHelper.getLoanId(loanApplication);
|
return this.loanTransactionHelper.getLoanId(loanApplication);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+57
-67
@@ -18,16 +18,18 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
import java.math.MathContext;
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||||
@@ -35,18 +37,15 @@ import org.apache.fineract.integrationtests.common.loans.LoanDisbursementTestBui
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
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" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
public class LoanDisbursementDetailsIntegrationTest {
|
public class LoanDisbursementDetailsIntegrationTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(LoanDisbursementDetailsIntegrationTest.class);
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
@@ -57,7 +56,7 @@ public class LoanDisbursementDetailsIntegrationTest {
|
|||||||
final String proposedAmount = "5000";
|
final String proposedAmount = "5000";
|
||||||
final String approvalAmount = "5000";
|
final String approvalAmount = "5000";
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -77,40 +76,38 @@ public class LoanDisbursementDetailsIntegrationTest {
|
|||||||
createTranches.add(this.loanTransactionHelper.createTrancheDetail(id, "01 Sep 2015", "5000"));
|
createTranches.add(this.loanTransactionHelper.createTrancheDetail(id, "01 Sep 2015", "5000"));
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||||
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
|
LOG.info("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------{}", clientID);
|
||||||
+ clientID);
|
|
||||||
|
|
||||||
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
|
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
|
||||||
.withInterestTypeAsDecliningBalance().withMoratorium("", "").withAmortizationTypeAsEqualInstallments().withTranches(true)
|
.withInterestTypeAsDecliningBalance().withMoratorium("", "").withAmortizationTypeAsEqualInstallments().withTranches(true)
|
||||||
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).build(null));
|
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).build(null));
|
||||||
System.out.println("----------------------------------LOAN PRODUCT CREATED WITH ID-------------------------------------------"
|
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
|
||||||
+ loanProductID);
|
loanProductID);
|
||||||
|
|
||||||
final Integer loanIDWithEmi = applyForLoanApplicationWithEmiAmount(clientID, loanProductID, proposedAmount, createTranches,
|
final Integer loanIDWithEmi = applyForLoanApplicationWithEmiAmount(clientID, loanProductID, proposedAmount, createTranches,
|
||||||
installmentAmount);
|
installmentAmount);
|
||||||
|
|
||||||
System.out
|
LOG.info("-----------------------------------LOAN CREATED WITH EMI LOANID------------------------------------------------- {}",
|
||||||
.println("-----------------------------------LOAN CREATED WITH EMI LOANID-------------------------------------------------"
|
loanIDWithEmi);
|
||||||
+ loanIDWithEmi);
|
|
||||||
|
|
||||||
HashMap repaymentScheduleWithEmi = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec,
|
HashMap repaymentScheduleWithEmi = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec,
|
||||||
loanIDWithEmi, "repaymentSchedule");
|
loanIDWithEmi, "repaymentSchedule");
|
||||||
|
|
||||||
ArrayList<HashMap> periods = (ArrayList<HashMap>) repaymentScheduleWithEmi.get("periods");
|
ArrayList<HashMap> periods = (ArrayList<HashMap>) repaymentScheduleWithEmi.get("periods");
|
||||||
assertEquals(periods.size(), 15);
|
assertEquals(15, periods.size());
|
||||||
|
|
||||||
this.validateRepaymentScheduleWithEMI(periods);
|
this.validateRepaymentScheduleWithEMI(periods);
|
||||||
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanIDWithEmi);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanIDWithEmi);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount("01 June 2015", "01 June 2015", "10000", loanIDWithEmi,
|
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount("01 June 2015", "01 June 2015", "10000", loanIDWithEmi,
|
||||||
createTranches);
|
createTranches);
|
||||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||||
System.out
|
LOG.info(
|
||||||
.println("-----------------------------------MULTI DISBURSAL LOAN WITH EMI APPROVED SUCCESSFULLY---------------------------------------");
|
"-----------------------------------MULTI DISBURSAL LOAN WITH EMI APPROVED SUCCESSFULLY---------------------------------------");
|
||||||
|
|
||||||
final Integer loanIDWithoutEmi = applyForLoanApplicationWithEmiAmount(clientID, loanProductID, proposedAmount, createTranches,
|
final Integer loanIDWithoutEmi = applyForLoanApplicationWithEmiAmount(clientID, loanProductID, proposedAmount, createTranches,
|
||||||
withoutInstallmentAmount);
|
withoutInstallmentAmount);
|
||||||
@@ -119,11 +116,10 @@ public class LoanDisbursementDetailsIntegrationTest {
|
|||||||
loanIDWithoutEmi, "repaymentSchedule");
|
loanIDWithoutEmi, "repaymentSchedule");
|
||||||
|
|
||||||
ArrayList<HashMap> periods1 = (ArrayList<HashMap>) repaymentScheduleWithEmi.get("periods");
|
ArrayList<HashMap> periods1 = (ArrayList<HashMap>) repaymentScheduleWithEmi.get("periods");
|
||||||
assertEquals(periods1.size(), 15);
|
assertEquals(15, periods1.size());
|
||||||
|
|
||||||
System.out
|
LOG.info("-----------------------------------LOAN CREATED WITHOUT EMI LOANID------------------------------------------------- {}",
|
||||||
.println("-----------------------------------LOAN CREATED WITHOUT EMI LOANID-------------------------------------------------"
|
loanIDWithoutEmi);
|
||||||
+ loanIDWithoutEmi);
|
|
||||||
|
|
||||||
/* To be uncommented once issue MIFOSX-2006 is closed. */
|
/* To be uncommented once issue MIFOSX-2006 is closed. */
|
||||||
// this.validateRepaymentScheduleWithoutEMI(periods1);
|
// this.validateRepaymentScheduleWithoutEMI(periods1);
|
||||||
@@ -131,13 +127,13 @@ public class LoanDisbursementDetailsIntegrationTest {
|
|||||||
HashMap loanStatusMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanIDWithoutEmi);
|
HashMap loanStatusMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanIDWithoutEmi);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusMap);
|
||||||
|
|
||||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount("01 June 2015", "01 June 2015", "10000",
|
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount("01 June 2015", "01 June 2015", "10000",
|
||||||
loanIDWithoutEmi, createTranches);
|
loanIDWithoutEmi, createTranches);
|
||||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||||
System.out
|
LOG.info(
|
||||||
.println("-----------------------------------MULTI DISBURSAL LOAN WITHOUT EMI APPROVED SUCCESSFULLY---------------------------------------");
|
"-----------------------------------MULTI DISBURSAL LOAN WITHOUT EMI APPROVED SUCCESSFULLY---------------------------------------");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,21 +209,22 @@ public class LoanDisbursementDetailsIntegrationTest {
|
|||||||
|
|
||||||
assertEquals(period.get("dueDate").toString(), expectedRepaymentSchedule.getDueDate());
|
assertEquals(period.get("dueDate").toString(), expectedRepaymentSchedule.getDueDate());
|
||||||
assertEquals(period.get("principalLoanBalanceOutstanding"), expectedRepaymentSchedule.getPrincipalLoanBalanceOutstanding());
|
assertEquals(period.get("principalLoanBalanceOutstanding"), expectedRepaymentSchedule.getPrincipalLoanBalanceOutstanding());
|
||||||
System.out.println(period.get("totalOriginalDueForPeriod").toString());
|
LOG.info("{}", period.get("totalOriginalDueForPeriod").toString());
|
||||||
assertEquals(new Float(period.get("totalOriginalDueForPeriod").toString()), expectedRepaymentSchedule
|
assertEquals(Float.valueOf(period.get("totalOriginalDueForPeriod").toString()),
|
||||||
.getTotalOriginalDueForPeriod().floatValue(), 0.0f);
|
expectedRepaymentSchedule.getTotalOriginalDueForPeriod().floatValue(), 0.0f);
|
||||||
|
|
||||||
assertEquals(new Float(period.get("totalOutstandingForPeriod").toString()).floatValue(),
|
assertEquals(Float.valueOf(period.get("totalOutstandingForPeriod").toString()).floatValue(),
|
||||||
expectedRepaymentSchedule.getTotalOutstandingForPeriod(), 0.0f);
|
expectedRepaymentSchedule.getTotalOutstandingForPeriod(), 0.0f);
|
||||||
|
|
||||||
if (position != 0 && position != 3) {
|
if (position != 0 && position != 3) {
|
||||||
|
|
||||||
assertEquals(new Float(period.get("interestOutstanding").toString()).floatValue(),
|
assertEquals(Float.valueOf(period.get("interestOutstanding").toString()).floatValue(),
|
||||||
expectedRepaymentSchedule.getInterestOutstanding(), 0.0f);
|
expectedRepaymentSchedule.getInterestOutstanding(), 0.0f);
|
||||||
assertEquals(new Float(period.get("principalOutstanding").toString()).floatValue(),
|
assertEquals(Float.valueOf(period.get("principalOutstanding").toString()).floatValue(),
|
||||||
expectedRepaymentSchedule.getPrincipalOutstanding(), 0.0f);
|
expectedRepaymentSchedule.getPrincipalOutstanding(), 0.0f);
|
||||||
assertEquals(new Float(period.get("principalDue").toString()).floatValue(), expectedRepaymentSchedule.getPrincipalDue(), 0.0f);
|
assertEquals(Float.valueOf(period.get("principalDue").toString()).floatValue(), expectedRepaymentSchedule.getPrincipalDue(),
|
||||||
assertEquals(new Float(period.get("principalOriginalDue").toString()).floatValue(),
|
0.0f);
|
||||||
|
assertEquals(Float.valueOf(period.get("principalOriginalDue").toString()).floatValue(),
|
||||||
expectedRepaymentSchedule.getPrincipalOriginalDue(), 0.0f);
|
expectedRepaymentSchedule.getPrincipalOriginalDue(), 0.0f);
|
||||||
assertEquals(period.get("fromDate").toString(), expectedRepaymentSchedule.getFromDate());
|
assertEquals(period.get("fromDate").toString(), expectedRepaymentSchedule.getFromDate());
|
||||||
}
|
}
|
||||||
@@ -346,9 +343,9 @@ public class LoanDisbursementDetailsIntegrationTest {
|
|||||||
private Integer applyForLoanApplicationWithEmiAmount(final Integer clientID, final Integer loanProductID, final String proposedAmount,
|
private Integer applyForLoanApplicationWithEmiAmount(final Integer clientID, final Integer loanProductID, final String proposedAmount,
|
||||||
List<HashMap> tranches, final String installmentAmount) {
|
List<HashMap> tranches, final String installmentAmount) {
|
||||||
|
|
||||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
||||||
//
|
//
|
||||||
.withPrincipal(proposedAmount)
|
.withPrincipal(proposedAmount)
|
||||||
//
|
//
|
||||||
.withLoanTermFrequency("12")
|
.withLoanTermFrequency("12")
|
||||||
@@ -370,49 +367,46 @@ public class LoanDisbursementDetailsIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createApproveAndValidateMultiDisburseLoan() {
|
public void createApproveAndValidateMultiDisburseLoan() throws ParseException {
|
||||||
|
|
||||||
List<HashMap> createTranches = new ArrayList<>();
|
List<HashMap> createTranches = new ArrayList<>();
|
||||||
String id = null;
|
String id = null;
|
||||||
createTranches.add(this.loanTransactionHelper.createTrancheDetail(id, "01 March 2014", "1000"));
|
createTranches.add(this.loanTransactionHelper.createTrancheDetail(id, "01 March 2014", "1000"));
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||||
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
|
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
|
||||||
+ clientID);
|
|
||||||
|
|
||||||
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
|
final Integer loanProductID = this.loanTransactionHelper
|
||||||
.withInterestTypeAsDecliningBalance().withTranches(true).withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
|
.getLoanProductId(new LoanProductTestBuilder().withInterestTypeAsDecliningBalance().withTranches(true)
|
||||||
.build(null));
|
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).build(null));
|
||||||
System.out.println("----------------------------------LOAN PRODUCT CREATED WITH ID-------------------------------------------"
|
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
|
||||||
+ loanProductID);
|
loanProductID);
|
||||||
|
|
||||||
this.loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
|
this.loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
|
||||||
System.out.println("-----------------------------------LOAN CREATED WITH LOANID-------------------------------------------------"
|
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
|
||||||
+ loanID);
|
|
||||||
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
||||||
loanID, createTranches);
|
loanID, createTranches);
|
||||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||||
System.out
|
LOG.info("-----------------------------------MULTI DISBURSAL LOAN APPROVED SUCCESSFULLY---------------------------------------");
|
||||||
.println("-----------------------------------MULTI DISBURSAL LOAN APPROVED SUCCESSFULLY---------------------------------------");
|
|
||||||
ArrayList<HashMap> disbursementDetails = (ArrayList<HashMap>) this.loanTransactionHelper.getLoanDetail(this.requestSpec,
|
ArrayList<HashMap> disbursementDetails = (ArrayList<HashMap>) this.loanTransactionHelper.getLoanDetail(this.requestSpec,
|
||||||
this.responseSpec, this.loanID, "disbursementDetails");
|
this.responseSpec, this.loanID, "disbursementDetails");
|
||||||
this.disbursementId = (Integer) disbursementDetails.get(0).get("id");
|
this.disbursementId = (Integer) disbursementDetails.get(0).get("id");
|
||||||
this.editLoanDisbursementDetails();
|
this.editLoanDisbursementDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editLoanDisbursementDetails() {
|
private void editLoanDisbursementDetails() throws ParseException {
|
||||||
this.editDateAndPrincipalOfExistingTranche();
|
this.editDateAndPrincipalOfExistingTranche();
|
||||||
this.addNewDisbursementDetails();
|
this.addNewDisbursementDetails();
|
||||||
this.deleteDisbursmentDetails();
|
this.deleteDisbursmentDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addNewDisbursementDetails() {
|
private void addNewDisbursementDetails() throws ParseException {
|
||||||
List<HashMap> addTranches = new ArrayList<>();
|
List<HashMap> addTranches = new ArrayList<>();
|
||||||
ArrayList<HashMap> disbursementDetails = (ArrayList<HashMap>) this.loanTransactionHelper.getLoanDetail(this.requestSpec,
|
ArrayList<HashMap> disbursementDetails = (ArrayList<HashMap>) this.loanTransactionHelper.getLoanDetail(this.requestSpec,
|
||||||
this.responseSpec, this.loanID, "disbursementDetails");
|
this.responseSpec, this.loanID, "disbursementDetails");
|
||||||
@@ -430,7 +424,7 @@ public class LoanDisbursementDetailsIntegrationTest {
|
|||||||
addTranches, "");
|
addTranches, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteDisbursmentDetails() {
|
private void deleteDisbursmentDetails() throws ParseException {
|
||||||
List<HashMap> deleteTranches = new ArrayList<>();
|
List<HashMap> deleteTranches = new ArrayList<>();
|
||||||
ArrayList<HashMap> disbursementDetails = (ArrayList<HashMap>) this.loanTransactionHelper.getLoanDetail(this.requestSpec,
|
ArrayList<HashMap> disbursementDetails = (ArrayList<HashMap>) this.loanTransactionHelper.getLoanDetail(this.requestSpec,
|
||||||
this.responseSpec, this.loanID, "disbursementDetails");
|
this.responseSpec, this.loanID, "disbursementDetails");
|
||||||
@@ -447,7 +441,7 @@ public class LoanDisbursementDetailsIntegrationTest {
|
|||||||
deleteTranches, "");
|
deleteTranches, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editDateAndPrincipalOfExistingTranche() {
|
private void editDateAndPrincipalOfExistingTranche() throws ParseException {
|
||||||
String updatedExpectedDisbursementDate = "01 March 2014";
|
String updatedExpectedDisbursementDate = "01 March 2014";
|
||||||
String updatedPrincipal = "900";
|
String updatedPrincipal = "900";
|
||||||
/* Update */
|
/* Update */
|
||||||
@@ -463,24 +457,20 @@ public class LoanDisbursementDetailsIntegrationTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatExpectedDisbursementDate(String expectedDisbursementDate) {
|
private String formatExpectedDisbursementDate(String expectedDisbursementDate) throws ParseException {
|
||||||
|
|
||||||
SimpleDateFormat source = new SimpleDateFormat("[yyyy, MM, dd]");
|
SimpleDateFormat source = new SimpleDateFormat("[yyyy, MM, dd]");
|
||||||
SimpleDateFormat target = new SimpleDateFormat("dd MMMM yyyy");
|
SimpleDateFormat target = new SimpleDateFormat("dd MMMM yyyy");
|
||||||
String date = null;
|
String date = target.format(source.parse(expectedDisbursementDate));
|
||||||
try {
|
|
||||||
date = target.format(source.parse(expectedDisbursementDate));
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer applyForLoanApplicationWithTranches(final Integer clientID, final Integer loanProductID, String principal,
|
private Integer applyForLoanApplicationWithTranches(final Integer clientID, final Integer loanProductID, String principal,
|
||||||
List<HashMap> tranches) {
|
List<HashMap> tranches) {
|
||||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
||||||
//
|
//
|
||||||
.withPrincipal(principal)
|
.withPrincipal(principal)
|
||||||
//
|
//
|
||||||
.withLoanTermFrequency("5")
|
.withLoanTermFrequency("5")
|
||||||
|
|||||||
+41
-47
@@ -18,15 +18,19 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.accounting.Account;
|
import org.apache.fineract.integrationtests.common.accounting.Account;
|
||||||
@@ -34,25 +38,22 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
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")
|
@SuppressWarnings("rawtypes")
|
||||||
public class LoanRepaymentRescheduleAtDisbursementTest {
|
public class LoanRepaymentRescheduleAtDisbursementTest {
|
||||||
|
|
||||||
private ResponseSpecification responseSpec;
|
private final static Logger LOG = LoggerFactory.getLogger(LoanRepaymentRescheduleAtDisbursementTest.class);
|
||||||
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
private LoanApplicationApprovalTest loanApplicationApprovalTest;
|
private LoanApplicationApprovalTest loanApplicationApprovalTest;
|
||||||
private ResponseSpecification generalResponseSpec;
|
private ResponseSpecification generalResponseSpec;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -63,9 +64,9 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
|||||||
this.generalResponseSpec = new ResponseSpecBuilder().build();
|
this.generalResponseSpec = new ResponseSpecBuilder().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Test
|
@Test
|
||||||
public void testLoanRepaymentRescheduleAtDisbursement(){
|
public void testLoanRepaymentRescheduleAtDisbursement() {
|
||||||
|
|
||||||
final String approvalAmount = "10000";
|
final String approvalAmount = "10000";
|
||||||
final String approveDate = "01 March 2015";
|
final String approveDate = "01 March 2015";
|
||||||
@@ -74,9 +75,8 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
|||||||
final String adjustRepaymentDate = "16 March 2015";
|
final String adjustRepaymentDate = "16 March 2015";
|
||||||
|
|
||||||
// CREATE CLIENT
|
// CREATE CLIENT
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||||
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
|
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
|
||||||
+ clientID);
|
|
||||||
|
|
||||||
// CREATE LOAN MULTIDISBURSAL PRODUCT WITH INTEREST RECALCULATION
|
// CREATE LOAN MULTIDISBURSAL PRODUCT WITH INTEREST RECALCULATION
|
||||||
final Integer loanProductID = createLoanProductWithInterestRecalculation(LoanProductTestBuilder.RBI_INDIA_STRATEGY,
|
final Integer loanProductID = createLoanProductWithInterestRecalculation(LoanProductTestBuilder.RBI_INDIA_STRATEGY,
|
||||||
@@ -104,7 +104,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
|||||||
// VALIDATE THE LOAN STATUS
|
// VALIDATE THE LOAN STATUS
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
||||||
loanID, approveTranches);
|
loanID, approveTranches);
|
||||||
|
|
||||||
@@ -116,8 +116,9 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
|||||||
this.loanTransactionHelper.disburseLoanWithRepaymentReschedule(disbursementDate, loanID, adjustRepaymentDate);
|
this.loanTransactionHelper.disburseLoanWithRepaymentReschedule(disbursementDate, loanID, adjustRepaymentDate);
|
||||||
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||||
|
|
||||||
ArrayList<HashMap> loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, loanID);
|
ArrayList<HashMap> loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec,
|
||||||
HashMap firstInstallement = loanRepaymnetSchedule.get(1);
|
loanID);
|
||||||
|
HashMap firstInstallement = loanRepaymnetSchedule.get(1);
|
||||||
Map<String, Object> expectedvalues = new HashMap<>(3);
|
Map<String, Object> expectedvalues = new HashMap<>(3);
|
||||||
Calendar date = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
Calendar date = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
||||||
date.set(2015, Calendar.MARCH, 16);
|
date.set(2015, Calendar.MARCH, 16);
|
||||||
@@ -133,14 +134,14 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyLoanRepaymentSchedule(final HashMap firstInstallement, final Map<String, Object> expectedvalues) {
|
private void verifyLoanRepaymentSchedule(final HashMap firstInstallement, final Map<String, Object> expectedvalues) {
|
||||||
|
|
||||||
assertEquals(expectedvalues.get("dueDate"), firstInstallement.get("dueDate"));
|
assertEquals(expectedvalues.get("dueDate"), firstInstallement.get("dueDate"));
|
||||||
assertEquals(String.valueOf(expectedvalues.get("principalDue")), String.valueOf(firstInstallement.get("principalDue")));
|
assertEquals(String.valueOf(expectedvalues.get("principalDue")), String.valueOf(firstInstallement.get("principalDue")));
|
||||||
assertEquals(String.valueOf(expectedvalues.get("interestDue")), String.valueOf(firstInstallement.get("interestDue")));
|
assertEquals(String.valueOf(expectedvalues.get("interestDue")), String.valueOf(firstInstallement.get("interestDue")));
|
||||||
assertEquals(String.valueOf(expectedvalues.get("feeChargesDue")), String.valueOf(firstInstallement.get("feeChargesDue")));
|
assertEquals(String.valueOf(expectedvalues.get("feeChargesDue")), String.valueOf(firstInstallement.get("feeChargesDue")));
|
||||||
assertEquals(String.valueOf(expectedvalues.get("penaltyChargesDue")), String.valueOf(firstInstallement.get("penaltyChargesDue")));
|
assertEquals(String.valueOf(expectedvalues.get("penaltyChargesDue")), String.valueOf(firstInstallement.get("penaltyChargesDue")));
|
||||||
assertEquals(String.valueOf(expectedvalues.get("totalDueForPeriod")), String.valueOf(firstInstallement.get("totalDueForPeriod")));
|
assertEquals(String.valueOf(expectedvalues.get("totalDueForPeriod")), String.valueOf(firstInstallement.get("totalDueForPeriod")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,18 +170,11 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
|||||||
boolean isArrearsBasedOnOriginalSchedule, final Integer recalculationCompoundingFrequencyOnDayType,
|
boolean isArrearsBasedOnOriginalSchedule, final Integer recalculationCompoundingFrequencyOnDayType,
|
||||||
final Integer recalculationCompoundingFrequencyDayOfWeekType, final Integer recalculationRestFrequencyOnDayType,
|
final Integer recalculationCompoundingFrequencyDayOfWeekType, final Integer recalculationRestFrequencyOnDayType,
|
||||||
final Integer recalculationRestFrequencyDayOfWeekType) {
|
final Integer recalculationRestFrequencyDayOfWeekType) {
|
||||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||||
LoanProductTestBuilder builder = new LoanProductTestBuilder()
|
LoanProductTestBuilder builder = new LoanProductTestBuilder().withPrincipal("10000.00").withNumberOfRepayments("12")
|
||||||
.withPrincipal("10000.00")
|
.withRepaymentAfterEvery("2").withRepaymentTypeAsWeek().withinterestRatePerPeriod("2")
|
||||||
.withNumberOfRepayments("12")
|
.withInterestRateFrequencyTypeAsMonths().withTranches(true).withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
|
||||||
.withRepaymentAfterEvery("2")
|
.withRepaymentStrategy(repaymentStrategy).withInterestTypeAsDecliningBalance()
|
||||||
.withRepaymentTypeAsWeek()
|
|
||||||
.withinterestRatePerPeriod("2")
|
|
||||||
.withInterestRateFrequencyTypeAsMonths()
|
|
||||||
.withTranches(true)
|
|
||||||
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
|
|
||||||
.withRepaymentStrategy(repaymentStrategy)
|
|
||||||
.withInterestTypeAsDecliningBalance()
|
|
||||||
.withInterestRecalculationDetails(interestRecalculationCompoundingMethod, rescheduleStrategyMethod,
|
.withInterestRecalculationDetails(interestRecalculationCompoundingMethod, rescheduleStrategyMethod,
|
||||||
preCloseInterestCalculationStrategy)
|
preCloseInterestCalculationStrategy)
|
||||||
.withInterestRecalculationRestFrequencyDetails(recalculationRestFrequencyType, recalculationRestFrequencyInterval,
|
.withInterestRecalculationRestFrequencyDetails(recalculationRestFrequencyType, recalculationRestFrequencyInterval,
|
||||||
@@ -192,7 +186,9 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
|||||||
builder = builder.withAccountingRulePeriodicAccrual(accounts);
|
builder = builder.withAccountingRulePeriodicAccrual(accounts);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isArrearsBasedOnOriginalSchedule) builder = builder.withArrearsConfiguration();
|
if (isArrearsBasedOnOriginalSchedule) {
|
||||||
|
builder = builder.withArrearsConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
final String loanProductJSON = builder.build(chargeId);
|
final String loanProductJSON = builder.build(chargeId);
|
||||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
@@ -209,7 +205,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
|||||||
private Integer applyForLoanApplicationForInterestRecalculation(final Integer clientID, final Integer loanProductID,
|
private Integer applyForLoanApplicationForInterestRecalculation(final Integer clientID, final Integer loanProductID,
|
||||||
final String disbursementDate, final String repaymentStrategy, final List<HashMap> charges, final String graceOnInterestPayment,
|
final String disbursementDate, final String repaymentStrategy, final List<HashMap> charges, final String graceOnInterestPayment,
|
||||||
final String graceOnPrincipalPayment, List<HashMap> tranches) {
|
final String graceOnPrincipalPayment, List<HashMap> tranches) {
|
||||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||||
.withPrincipal("10000.00") //
|
.withPrincipal("10000.00") //
|
||||||
.withLoanTermFrequency("24") //
|
.withLoanTermFrequency("24") //
|
||||||
@@ -219,8 +215,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
|||||||
.withRepaymentFrequencyTypeAsWeeks() //
|
.withRepaymentFrequencyTypeAsWeeks() //
|
||||||
.withInterestRatePerPeriod("2") //
|
.withInterestRatePerPeriod("2") //
|
||||||
.withAmortizationTypeAsEqualInstallments() //
|
.withAmortizationTypeAsEqualInstallments() //
|
||||||
.withTranches(tranches)
|
.withTranches(tranches).withFixedEmiAmount("") //
|
||||||
.withFixedEmiAmount("") //
|
|
||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.withInterestCalculationPeriodTypeAsDays() //
|
.withInterestCalculationPeriodTypeAsDays() //
|
||||||
.withInterestCalculationPeriodTypeAsDays() //
|
.withInterestCalculationPeriodTypeAsDays() //
|
||||||
@@ -237,8 +232,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List getDateAsArray(Calendar date, int addvalue, int type) {
|
private List getDateAsArray(Calendar date, int addvalue, int type) {
|
||||||
date.add(type, addvalue);
|
date.add(type, addvalue);
|
||||||
return new ArrayList<>(Arrays.asList(date.get(Calendar.YEAR), date.get(Calendar.MONTH) + 1,
|
return new ArrayList<>(Arrays.asList(date.get(Calendar.YEAR), date.get(Calendar.MONTH) + 1, date.get(Calendar.DAY_OF_MONTH)));
|
||||||
date.get(Calendar.DAY_OF_MONTH)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+76
-86
@@ -18,11 +18,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.LoanRescheduleRequestHelper;
|
import org.apache.fineract.integrationtests.common.LoanRescheduleRequestHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
@@ -30,22 +34,20 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanRescheduleRequestTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanRescheduleRequestTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
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
|
* Test the creation, approval and rejection of a loan reschedule request
|
||||||
**/
|
**/
|
||||||
@SuppressWarnings({ "rawtypes" })
|
@SuppressWarnings({ "rawtypes" })
|
||||||
public class LoanRescheduleRequestTest {
|
public class LoanRescheduleRequestTest {
|
||||||
private ResponseSpecification responseSpec;
|
|
||||||
private ResponseSpecification generalResponseSpec;
|
private final static Logger LOG = LoggerFactory.getLogger(LoanRescheduleRequestTest.class);
|
||||||
|
private ResponseSpecification responseSpec;
|
||||||
|
private ResponseSpecification generalResponseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
private LoanRescheduleRequestHelper loanRescheduleRequestHelper;
|
private LoanRescheduleRequestHelper loanRescheduleRequestHelper;
|
||||||
@@ -53,14 +55,14 @@ public class LoanRescheduleRequestTest {
|
|||||||
private Integer loanProductId;
|
private Integer loanProductId;
|
||||||
private Integer loanId;
|
private Integer loanId;
|
||||||
private Integer loanRescheduleRequestId;
|
private Integer loanRescheduleRequestId;
|
||||||
private String loanPrincipalAmount = "100000.00";
|
private final String loanPrincipalAmount = "100000.00";
|
||||||
private String numberOfRepayments = "12";
|
private final String numberOfRepayments = "12";
|
||||||
private String interestRatePerPeriod = "18";
|
private final String interestRatePerPeriod = "18";
|
||||||
private String dateString = "4 September 2014";
|
private final String dateString = "4 September 2014";
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
@@ -77,16 +79,16 @@ public class LoanRescheduleRequestTest {
|
|||||||
* Creates the client, loan product, and loan entities
|
* Creates the client, loan product, and loan entities
|
||||||
**/
|
**/
|
||||||
private void createRequiredEntities() {
|
private void createRequiredEntities() {
|
||||||
this.createClientEntity();
|
this.createClientEntity();
|
||||||
this.createLoanProductEntity();
|
this.createLoanProductEntity();
|
||||||
this.createLoanEntity();
|
this.createLoanEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create a new client
|
* create a new client
|
||||||
**/
|
**/
|
||||||
private void createClientEntity() {
|
private void createClientEntity() {
|
||||||
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
|
|
||||||
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, this.clientId);
|
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, this.clientId);
|
||||||
}
|
}
|
||||||
@@ -95,48 +97,35 @@ public class LoanRescheduleRequestTest {
|
|||||||
* create a new loan product
|
* create a new loan product
|
||||||
**/
|
**/
|
||||||
private void createLoanProductEntity() {
|
private void createLoanProductEntity() {
|
||||||
System.out.println("---------------------------------CREATING LOAN PRODUCT------------------------------------------");
|
LOG.info("---------------------------------CREATING LOAN PRODUCT------------------------------------------");
|
||||||
|
|
||||||
final String loanProductJSON = new LoanProductTestBuilder()
|
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(loanPrincipalAmount)
|
||||||
.withPrincipal(loanPrincipalAmount)
|
.withNumberOfRepayments(numberOfRepayments).withinterestRatePerPeriod(interestRatePerPeriod)
|
||||||
.withNumberOfRepayments(numberOfRepayments)
|
.withInterestRateFrequencyTypeAsYear().build(null);
|
||||||
.withinterestRatePerPeriod(interestRatePerPeriod)
|
|
||||||
.withInterestRateFrequencyTypeAsYear()
|
|
||||||
.build(null);
|
|
||||||
|
|
||||||
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
System.out.println("Successfully created loan product (ID: " + this.loanProductId + ")");
|
LOG.info("Successfully created loan product (ID:{}) ", this.loanProductId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* submit a new loan application, approve and disburse the loan
|
* submit a new loan application, approve and disburse the loan
|
||||||
**/
|
**/
|
||||||
private void createLoanEntity() {
|
private void createLoanEntity() {
|
||||||
System.out.println("---------------------------------NEW LOAN APPLICATION------------------------------------------");
|
LOG.info("---------------------------------NEW LOAN APPLICATION------------------------------------------");
|
||||||
|
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
|
||||||
.withPrincipal(loanPrincipalAmount)
|
.withLoanTermFrequency(numberOfRepayments).withLoanTermFrequencyAsMonths().withNumberOfRepayments(numberOfRepayments)
|
||||||
.withLoanTermFrequency(numberOfRepayments)
|
.withRepaymentEveryAfter("1").withRepaymentFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments()
|
||||||
.withLoanTermFrequencyAsMonths()
|
.withInterestCalculationPeriodTypeAsDays().withInterestRatePerPeriod(interestRatePerPeriod).withLoanTermFrequencyAsMonths()
|
||||||
.withNumberOfRepayments(numberOfRepayments)
|
.withSubmittedOnDate(dateString).withExpectedDisbursementDate(dateString).withPrincipalGrace("2").withInterestGrace("2")
|
||||||
.withRepaymentEveryAfter("1")
|
.build(this.clientId.toString(), this.loanProductId.toString(), null);
|
||||||
.withRepaymentFrequencyTypeAsMonths()
|
|
||||||
.withAmortizationTypeAsEqualInstallments()
|
|
||||||
.withInterestCalculationPeriodTypeAsDays()
|
|
||||||
.withInterestRatePerPeriod(interestRatePerPeriod)
|
|
||||||
.withLoanTermFrequencyAsMonths()
|
|
||||||
.withSubmittedOnDate(dateString)
|
|
||||||
.withExpectedDisbursementDate(dateString)
|
|
||||||
.withPrincipalGrace("2")
|
|
||||||
.withInterestGrace("2")
|
|
||||||
.build(this.clientId.toString(), this.loanProductId.toString(), null);
|
|
||||||
|
|
||||||
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||||
|
|
||||||
System.out.println("Sucessfully created loan (ID: " + this.loanId + ")");
|
LOG.info("Sucessfully created loan (ID: {} )", this.loanId);
|
||||||
|
|
||||||
this.approveLoanApplication();
|
this.approveLoanApplication();
|
||||||
this.disburseLoan();
|
this.disburseLoan();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -144,10 +133,10 @@ public class LoanRescheduleRequestTest {
|
|||||||
**/
|
**/
|
||||||
private void approveLoanApplication() {
|
private void approveLoanApplication() {
|
||||||
|
|
||||||
if(this.loanId != null) {
|
if (this.loanId != null) {
|
||||||
this.loanTransactionHelper.approveLoan(this.dateString, this.loanId);
|
this.loanTransactionHelper.approveLoan(this.dateString, this.loanId);
|
||||||
System.out.println("Successfully approved loan (ID: " + this.loanId + ")");
|
LOG.info("Successfully approved loan (ID: {} )", this.loanId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -155,65 +144,66 @@ public class LoanRescheduleRequestTest {
|
|||||||
**/
|
**/
|
||||||
private void disburseLoan() {
|
private void disburseLoan() {
|
||||||
|
|
||||||
if(this.loanId != null) {
|
if (this.loanId != null) {
|
||||||
this.loanTransactionHelper.disburseLoan(this.dateString, this.loanId);
|
this.loanTransactionHelper.disburseLoan(this.dateString, this.loanId);
|
||||||
System.out.println("Successfully disbursed loan (ID: " + this.loanId + ")");
|
LOG.info("Successfully disbursed loan (ID: {} )", this.loanId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create new loan reschedule request
|
* create new loan reschedule request
|
||||||
**/
|
**/
|
||||||
private void createLoanRescheduleRequest() {
|
private void createLoanRescheduleRequest() {
|
||||||
System.out.println("---------------------------------CREATING LOAN RESCHEDULE REQUEST------------------------------------------");
|
LOG.info("---------------------------------CREATING LOAN RESCHEDULE REQUEST------------------------------------------");
|
||||||
|
|
||||||
final String requestJSON = new LoanRescheduleRequestTestBuilder().build(this.loanId.toString());
|
final String requestJSON = new LoanRescheduleRequestTestBuilder().build(this.loanId.toString());
|
||||||
|
|
||||||
this.loanRescheduleRequestId = this.loanRescheduleRequestHelper.createLoanRescheduleRequest(requestJSON);
|
this.loanRescheduleRequestId = this.loanRescheduleRequestHelper.createLoanRescheduleRequest(requestJSON);
|
||||||
this.loanRescheduleRequestHelper.verifyCreationOfLoanRescheduleRequest(this.loanRescheduleRequestId);
|
this.loanRescheduleRequestHelper.verifyCreationOfLoanRescheduleRequest(this.loanRescheduleRequestId);
|
||||||
|
|
||||||
System.out.println("Successfully created loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
|
LOG.info("Successfully created loan reschedule request (ID: {} )", this.loanRescheduleRequestId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateLoanRescheduleRequest() {
|
public void testCreateLoanRescheduleRequest() {
|
||||||
this.createLoanRescheduleRequest();
|
this.createLoanRescheduleRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRejectLoanRescheduleRequest() {
|
public void testRejectLoanRescheduleRequest() {
|
||||||
this.createLoanRescheduleRequest();
|
this.createLoanRescheduleRequest();
|
||||||
|
|
||||||
System.out.println("-----------------------------REJECTING LOAN RESCHEDULE REQUEST--------------------------");
|
LOG.info("-----------------------------REJECTING LOAN RESCHEDULE REQUEST--------------------------");
|
||||||
|
|
||||||
final String requestJSON = new LoanRescheduleRequestTestBuilder().getRejectLoanRescheduleRequestJSON();
|
final String requestJSON = new LoanRescheduleRequestTestBuilder().getRejectLoanRescheduleRequestJSON();
|
||||||
this.loanRescheduleRequestHelper.rejectLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
|
this.loanRescheduleRequestHelper.rejectLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
|
||||||
|
|
||||||
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
|
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
|
||||||
assertTrue((Boolean)response.get("rejected"));
|
assertTrue((Boolean) response.get("rejected"));
|
||||||
|
|
||||||
System.out.println("Successfully rejected loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
|
LOG.info("Successfully rejected loan reschedule request (ID: {} )", this.loanRescheduleRequestId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testApproveLoanRescheduleRequest() {
|
public void testApproveLoanRescheduleRequest() {
|
||||||
this.createLoanRescheduleRequest();
|
this.createLoanRescheduleRequest();
|
||||||
|
|
||||||
System.out.println("-----------------------------APPROVING LOAN RESCHEDULE REQUEST--------------------------");
|
LOG.info("-----------------------------APPROVING LOAN RESCHEDULE REQUEST--------------------------");
|
||||||
|
|
||||||
final String requestJSON = new LoanRescheduleRequestTestBuilder().getApproveLoanRescheduleRequestJSON();
|
final String requestJSON = new LoanRescheduleRequestTestBuilder().getApproveLoanRescheduleRequestJSON();
|
||||||
this.loanRescheduleRequestHelper.approveLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
|
this.loanRescheduleRequestHelper.approveLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
|
||||||
|
|
||||||
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
|
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
|
||||||
assertTrue((Boolean)response.get("approved"));
|
assertTrue((Boolean) response.get("approved"));
|
||||||
|
|
||||||
final Integer numberOfRepayments = (Integer) this.loanTransactionHelper.getLoanDetail(requestSpec, generalResponseSpec, loanId, "numberOfRepayments");
|
final Integer numberOfRepayments = (Integer) this.loanTransactionHelper.getLoanDetail(requestSpec, generalResponseSpec, loanId,
|
||||||
final HashMap loanSummary = this.loanTransactionHelper.getLoanSummary(requestSpec, generalResponseSpec, loanId);
|
"numberOfRepayments");
|
||||||
final Float totalExpectedRepayment = (Float) loanSummary.get("totalExpectedRepayment");
|
final HashMap loanSummary = this.loanTransactionHelper.getLoanSummary(requestSpec, generalResponseSpec, loanId);
|
||||||
|
final Float totalExpectedRepayment = (Float) loanSummary.get("totalExpectedRepayment");
|
||||||
|
|
||||||
assertEquals("NUMBER OF REPAYMENTS SHOULD BE 16, NOT 12", "12", numberOfRepayments.toString());
|
assertEquals(12, numberOfRepayments, "NUMBER OF REPAYMENTS is NOK");
|
||||||
assertEquals("TOTAL EXPECTED REPAYMENT MUST BE EQUAL TO 118000.0", "118000.0", totalExpectedRepayment.toString());
|
assertEquals(118000, totalExpectedRepayment, "TOTAL EXPECTED REPAYMENT is NOK");
|
||||||
|
|
||||||
System.out.println("Successfully approved loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
|
LOG.info("Successfully approved loan reschedule request (ID: {})", this.loanRescheduleRequestId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+55
-56
@@ -18,9 +18,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import com.google.gson.Gson;
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -29,14 +34,11 @@ import java.util.Arrays;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.apache.fineract.integrationtests.common.CalendarHelper;
|
import org.apache.fineract.integrationtests.common.CalendarHelper;
|
||||||
import org.apache.fineract.integrationtests.common.CenterDomain;
|
import org.apache.fineract.integrationtests.common.CenterDomain;
|
||||||
import org.apache.fineract.integrationtests.common.CenterHelper;
|
import org.apache.fineract.integrationtests.common.CenterHelper;
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
|
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
|
||||||
import org.apache.fineract.integrationtests.common.GroupHelper;
|
import org.apache.fineract.integrationtests.common.GroupHelper;
|
||||||
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
@@ -46,23 +48,22 @@ import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
import com.google.gson.Gson;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.junit.jupiter.api.Test;
|
||||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.http.ContentType;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.jayway.restassured.specification.RequestSpecification;
|
|
||||||
import com.jayway.restassured.specification.ResponseSpecification;
|
|
||||||
|
|
||||||
public class LoanReschedulingWithinCenterTest {
|
public class LoanReschedulingWithinCenterTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(LoanReschedulingWithinCenterTest.class);
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
private ResponseSpecification generalResponseSpec;
|
private ResponseSpecification generalResponseSpec;
|
||||||
private LoanApplicationApprovalTest loanApplicationApprovalTest;
|
private LoanApplicationApprovalTest loanApplicationApprovalTest;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -71,6 +72,8 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||||
this.loanApplicationApprovalTest = new LoanApplicationApprovalTest();
|
this.loanApplicationApprovalTest = new LoanApplicationApprovalTest();
|
||||||
this.generalResponseSpec = new ResponseSpecBuilder().build();
|
this.generalResponseSpec = new ResponseSpecBuilder().build();
|
||||||
|
|
||||||
|
GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
@@ -87,9 +90,9 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
responseSpec);
|
responseSpec);
|
||||||
CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec);
|
CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec);
|
||||||
Integer groupId = groupMembers[0];
|
Integer groupId = groupMembers[0];
|
||||||
Assert.assertNotNull(center);
|
Assertions.assertNotNull(center);
|
||||||
Assert.assertTrue(center.getStaffId() == staffId);
|
Assertions.assertTrue(center.getStaffId() == staffId);
|
||||||
Assert.assertTrue(center.isActive() == true);
|
Assertions.assertTrue(center.isActive() == true);
|
||||||
|
|
||||||
Integer calendarId = createCalendarMeeting(centerId);
|
Integer calendarId = createCalendarMeeting(centerId);
|
||||||
|
|
||||||
@@ -111,15 +114,14 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
|
LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
|
||||||
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
|
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
|
||||||
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0", recalculationRestFrequencyDate,
|
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0", recalculationRestFrequencyDate,
|
||||||
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan,
|
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan, null, null);
|
||||||
null, null);
|
|
||||||
|
|
||||||
// APPLY FOR TRANCHE LOAN WITH INTEREST RECALCULATION
|
// APPLY FOR TRANCHE LOAN WITH INTEREST RECALCULATION
|
||||||
final Integer loanId = applyForLoanApplicationForInterestRecalculation(clientId, groupId, calendarId, loanProductID, disbursalDate,
|
final Integer loanId = applyForLoanApplicationForInterestRecalculation(clientId, groupId, calendarId, loanProductID, disbursalDate,
|
||||||
recalculationRestFrequencyDate, LoanApplicationTestBuilder.RBI_INDIA_STRATEGY, new ArrayList<HashMap>(0), null);
|
recalculationRestFrequencyDate, LoanApplicationTestBuilder.RBI_INDIA_STRATEGY, new ArrayList<HashMap>(0), null);
|
||||||
|
|
||||||
// Test for loan account is created
|
// Test for loan account is created
|
||||||
Assert.assertNotNull(loanId);
|
Assertions.assertNotNull(loanId);
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanId);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanId);
|
||||||
|
|
||||||
// Test for loan account is created, can be approved
|
// Test for loan account is created, can be approved
|
||||||
@@ -132,7 +134,7 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanId);
|
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanId);
|
||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("---------------------------------CHANGING GROUP MEETING DATE ------------------------------------------");
|
LOG.info("---------------------------------CHANGING GROUP MEETING DATE ------------------------------------------");
|
||||||
Calendar todaysdate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
Calendar todaysdate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
||||||
todaysdate.add(Calendar.DAY_OF_MONTH, 14);
|
todaysdate.add(Calendar.DAY_OF_MONTH, 14);
|
||||||
String oldMeetingDate = dateFormat.format(todaysdate.getTime());
|
String oldMeetingDate = dateFormat.format(todaysdate.getTime());
|
||||||
@@ -148,8 +150,7 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
|
|
||||||
// VERIFY THE INTEREST
|
// VERIFY THE INTEREST
|
||||||
Float interestDue = (Float) ((HashMap) loanRepaymnetSchedule.get(2)).get("interestDue");
|
Float interestDue = (Float) ((HashMap) loanRepaymnetSchedule.get(2)).get("interestDue");
|
||||||
assertEquals(String.valueOf(interestDue), "90.82");
|
assertEquals("90.82", String.valueOf(interestDue));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void associateClientsToGroup(Integer groupId, Integer clientId) {
|
private void associateClientsToGroup(Integer groupId, Integer clientId) {
|
||||||
@@ -173,11 +174,15 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
final String startDate = dateFormat.format(today.getTime());
|
final String startDate = dateFormat.format(today.getTime());
|
||||||
final String frequency = "2"; // 2:Weekly
|
final String frequency = "2"; // 2:Weekly
|
||||||
final String interval = "2"; // Every one week
|
final String interval = "2"; // Every one week
|
||||||
final Integer repeatsOnDay = today.get(Calendar.DAY_OF_WEEK) - 1;
|
Integer repeatsOnDay = today.get(Calendar.DAY_OF_WEEK) - 1;
|
||||||
|
|
||||||
|
if (repeatsOnDay.intValue() == 0) {
|
||||||
|
repeatsOnDay = 7;
|
||||||
|
}
|
||||||
|
|
||||||
Integer calendarId = CalendarHelper.createMeetingForGroup(this.requestSpec, this.responseSpec, centerId, startDate, frequency,
|
Integer calendarId = CalendarHelper.createMeetingForGroup(this.requestSpec, this.responseSpec, centerId, startDate, frequency,
|
||||||
interval, repeatsOnDay.toString());
|
interval, repeatsOnDay.toString());
|
||||||
System.out.println("calendarId " + calendarId);
|
LOG.info("calendarId {}", calendarId);
|
||||||
return calendarId;
|
return calendarId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,9 +200,9 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
responseSpec);
|
responseSpec);
|
||||||
CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec);
|
CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec);
|
||||||
Integer groupId = groupMembers[0];
|
Integer groupId = groupMembers[0];
|
||||||
Assert.assertNotNull(center);
|
Assertions.assertNotNull(center);
|
||||||
Assert.assertTrue(center.getStaffId() == staffId);
|
Assertions.assertTrue(center.getStaffId() == staffId);
|
||||||
Assert.assertTrue(center.isActive() == true);
|
Assertions.assertTrue(center.isActive() == true);
|
||||||
|
|
||||||
Integer calendarId = createCalendarMeeting(centerId);
|
Integer calendarId = createCalendarMeeting(centerId);
|
||||||
|
|
||||||
@@ -223,12 +228,11 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
|
LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
|
||||||
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
|
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
|
||||||
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0", recalculationRestFrequencyDate,
|
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0", recalculationRestFrequencyDate,
|
||||||
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan,
|
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan, null, null);
|
||||||
null, null);
|
|
||||||
|
|
||||||
Calendar seondTrancheDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
Calendar seondTrancheDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
||||||
seondTrancheDate.add(Calendar.MONTH, 1);
|
seondTrancheDate.add(Calendar.MONTH, 1);
|
||||||
String secondDisbursement = dateFormat.format(seondTrancheDate.getTime()) ;
|
String secondDisbursement = dateFormat.format(seondTrancheDate.getTime());
|
||||||
|
|
||||||
// CREATE TRANCHES
|
// CREATE TRANCHES
|
||||||
List<HashMap> createTranches = new ArrayList<>();
|
List<HashMap> createTranches = new ArrayList<>();
|
||||||
@@ -249,7 +253,7 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
// VALIDATE THE LOAN STATUS
|
// VALIDATE THE LOAN STATUS
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
||||||
loanID, approveTranches);
|
loanID, approveTranches);
|
||||||
|
|
||||||
@@ -261,7 +265,7 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
this.loanTransactionHelper.disburseLoan(disbursementDate, loanID);
|
this.loanTransactionHelper.disburseLoan(disbursementDate, loanID);
|
||||||
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||||
|
|
||||||
System.out.println("---------------------------------CHANGING GROUP MEETING DATE ------------------------------------------");
|
LOG.info("---------------------------------CHANGING GROUP MEETING DATE ------------------------------------------");
|
||||||
Calendar todaysdate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
Calendar todaysdate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
||||||
todaysdate.add(Calendar.DAY_OF_MONTH, 14);
|
todaysdate.add(Calendar.DAY_OF_MONTH, 14);
|
||||||
String oldMeetingDate = dateFormat.format(todaysdate.getTime());
|
String oldMeetingDate = dateFormat.format(todaysdate.getTime());
|
||||||
@@ -277,15 +281,15 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
|
|
||||||
// VERIFY THE INTEREST
|
// VERIFY THE INTEREST
|
||||||
Float interestDue = (Float) ((HashMap) loanRepaymnetSchedule.get(2)).get("interestDue");
|
Float interestDue = (Float) ((HashMap) loanRepaymnetSchedule.get(2)).get("interestDue");
|
||||||
assertEquals(String.valueOf(interestDue), "41.05");
|
assertEquals("41.05", String.valueOf(interestDue));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer createLoanProductWithInterestRecalculation(final String repaymentStrategy,
|
private Integer createLoanProductWithInterestRecalculation(final String repaymentStrategy,
|
||||||
final String interestRecalculationCompoundingMethod, final String rescheduleStrategyMethod,
|
final String interestRecalculationCompoundingMethod, final String rescheduleStrategyMethod,
|
||||||
final String recalculationRestFrequencyType, final String recalculationRestFrequencyInterval,
|
final String recalculationRestFrequencyType, final String recalculationRestFrequencyInterval,
|
||||||
final String recalculationRestFrequencyDate, final String preCloseInterestCalculationStrategy, final Account[] accounts,
|
final String recalculationRestFrequencyDate, final String preCloseInterestCalculationStrategy, final Account[] accounts,
|
||||||
final boolean isMultiTrancheLoan, final Integer recalculationRestFrequencyOnDayType, final Integer recalculationRestFrequencyDayOfWeekType) {
|
final boolean isMultiTrancheLoan, final Integer recalculationRestFrequencyOnDayType,
|
||||||
|
final Integer recalculationRestFrequencyDayOfWeekType) {
|
||||||
final String recalculationCompoundingFrequencyType = null;
|
final String recalculationCompoundingFrequencyType = null;
|
||||||
final String recalculationCompoundingFrequencyInterval = null;
|
final String recalculationCompoundingFrequencyInterval = null;
|
||||||
final String recalculationCompoundingFrequencyDate = null;
|
final String recalculationCompoundingFrequencyDate = null;
|
||||||
@@ -295,8 +299,8 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
rescheduleStrategyMethod, recalculationRestFrequencyType, recalculationRestFrequencyInterval,
|
rescheduleStrategyMethod, recalculationRestFrequencyType, recalculationRestFrequencyInterval,
|
||||||
recalculationRestFrequencyDate, recalculationCompoundingFrequencyType, recalculationCompoundingFrequencyInterval,
|
recalculationRestFrequencyDate, recalculationCompoundingFrequencyType, recalculationCompoundingFrequencyInterval,
|
||||||
recalculationCompoundingFrequencyDate, preCloseInterestCalculationStrategy, accounts, null, false, isMultiTrancheLoan,
|
recalculationCompoundingFrequencyDate, preCloseInterestCalculationStrategy, accounts, null, false, isMultiTrancheLoan,
|
||||||
recalculationCompoundingFrequencyOnDayType, recalculationCompoundingFrequencyDayOfWeekType, recalculationRestFrequencyOnDayType,
|
recalculationCompoundingFrequencyOnDayType, recalculationCompoundingFrequencyDayOfWeekType,
|
||||||
recalculationRestFrequencyDayOfWeekType);
|
recalculationRestFrequencyOnDayType, recalculationRestFrequencyDayOfWeekType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer createLoanProductWithInterestRecalculation(final String repaymentStrategy,
|
private Integer createLoanProductWithInterestRecalculation(final String repaymentStrategy,
|
||||||
@@ -306,20 +310,13 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
final String recalculationCompoundingFrequencyInterval, final String recalculationCompoundingFrequencyDate,
|
final String recalculationCompoundingFrequencyInterval, final String recalculationCompoundingFrequencyDate,
|
||||||
final String preCloseInterestCalculationStrategy, final Account[] accounts, final String chargeId,
|
final String preCloseInterestCalculationStrategy, final Account[] accounts, final String chargeId,
|
||||||
boolean isArrearsBasedOnOriginalSchedule, final boolean isMultiTrancheLoan,
|
boolean isArrearsBasedOnOriginalSchedule, final boolean isMultiTrancheLoan,
|
||||||
final Integer recalculationCompoundingFrequencyOnDayType,
|
final Integer recalculationCompoundingFrequencyOnDayType, final Integer recalculationCompoundingFrequencyDayOfWeekType,
|
||||||
final Integer recalculationCompoundingFrequencyDayOfWeekType, final Integer recalculationRestFrequencyOnDayType,
|
final Integer recalculationRestFrequencyOnDayType, final Integer recalculationRestFrequencyDayOfWeekType) {
|
||||||
final Integer recalculationRestFrequencyDayOfWeekType) {
|
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
LoanProductTestBuilder builder = new LoanProductTestBuilder().withPrincipal("10000.00").withNumberOfRepayments("12")
|
||||||
LoanProductTestBuilder builder = new LoanProductTestBuilder()
|
.withRepaymentAfterEvery("2").withRepaymentTypeAsWeek().withinterestRatePerPeriod("2")
|
||||||
.withPrincipal("10000.00")
|
.withInterestRateFrequencyTypeAsMonths().withTranches(isMultiTrancheLoan)
|
||||||
.withNumberOfRepayments("12")
|
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).withRepaymentStrategy(repaymentStrategy)
|
||||||
.withRepaymentAfterEvery("2")
|
|
||||||
.withRepaymentTypeAsWeek()
|
|
||||||
.withinterestRatePerPeriod("2")
|
|
||||||
.withInterestRateFrequencyTypeAsMonths()
|
|
||||||
.withTranches(isMultiTrancheLoan)
|
|
||||||
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
|
|
||||||
.withRepaymentStrategy(repaymentStrategy)
|
|
||||||
.withInterestTypeAsDecliningBalance()
|
.withInterestTypeAsDecliningBalance()
|
||||||
.withInterestRecalculationDetails(interestRecalculationCompoundingMethod, rescheduleStrategyMethod,
|
.withInterestRecalculationDetails(interestRecalculationCompoundingMethod, rescheduleStrategyMethod,
|
||||||
preCloseInterestCalculationStrategy)
|
preCloseInterestCalculationStrategy)
|
||||||
@@ -332,7 +329,9 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
builder = builder.withAccountingRulePeriodicAccrual(accounts);
|
builder = builder.withAccountingRulePeriodicAccrual(accounts);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isArrearsBasedOnOriginalSchedule) builder = builder.withArrearsConfiguration();
|
if (isArrearsBasedOnOriginalSchedule) {
|
||||||
|
builder = builder.withArrearsConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
final String loanProductJSON = builder.build(chargeId);
|
final String loanProductJSON = builder.build(chargeId);
|
||||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
@@ -354,7 +353,7 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
final Integer loanProductID, final String disbursementDate, final String restStartDate, final String compoundingStartDate,
|
final Integer loanProductID, final String disbursementDate, final String restStartDate, final String compoundingStartDate,
|
||||||
final String repaymentStrategy, final List<HashMap> charges, final String graceOnInterestPayment,
|
final String repaymentStrategy, final List<HashMap> charges, final String graceOnInterestPayment,
|
||||||
final String graceOnPrincipalPayment, List<HashMap> tranches) {
|
final String graceOnPrincipalPayment, List<HashMap> tranches) {
|
||||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||||
.withPrincipal("10000.00") //
|
.withPrincipal("10000.00") //
|
||||||
.withLoanTermFrequency("24") //
|
.withLoanTermFrequency("24") //
|
||||||
@@ -388,8 +387,8 @@ public class LoanReschedulingWithinCenterTest {
|
|||||||
map.put("active", "true");
|
map.put("active", "true");
|
||||||
map.put("activationDate", "04 March 2011");
|
map.put("activationDate", "04 March 2011");
|
||||||
|
|
||||||
groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec, "/fineract-provider/api/v1/groups?"
|
groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec,
|
||||||
+ Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId");
|
"/fineract-provider/api/v1/groups?" + Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId");
|
||||||
}
|
}
|
||||||
return groupMembers;
|
return groupMembers;
|
||||||
}
|
}
|
||||||
|
|||||||
+50
-36
@@ -18,23 +18,23 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
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
|
* Client Loan Integration Test for checking Loan Disbursement with Waive
|
||||||
@@ -43,17 +43,27 @@ import com.jayway.restassured.specification.ResponseSpecification;
|
|||||||
@SuppressWarnings({ "rawtypes" })
|
@SuppressWarnings({ "rawtypes" })
|
||||||
public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(LoanWithWaiveInterestAndWriteOffIntegrationTest.class);
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
|
|
||||||
private final String LP_PRINCIPAL = "12,000.00", LP_REPAYMENTS = "2", LP_REPAYMENT_PERIOD = "6", LP_INTEREST_RATE = "1",
|
private final String LP_PRINCIPAL = "12,000.00";
|
||||||
PRINCIPAL = "4,500.00", LOAN_TERM_FREQUENCY = "18", NUMBER_OF_REPAYMENTS = "9", REPAYMENT_PERIOD = "2",
|
private final String LP_REPAYMENTS = "2";
|
||||||
DISBURSEMENT_DATE = "30 October 2010", LOAN_APPLICATION_SUBMISSION_DATE = "23 September 2010",
|
private final String LP_REPAYMENT_PERIOD = "6";
|
||||||
EXPECTED_DISBURSAL_DATE = "28 October 2010", RATE_OF_INTEREST_PER_PERIOD = "2", DATE_OF_JOINING = "04 March 2009",
|
private final String LP_INTEREST_RATE = "1";
|
||||||
INTEREST_VALUE_AMOUNT = "40.00";
|
private final String PRINCIPAL = "4,500.00";
|
||||||
|
private final String LOAN_TERM_FREQUENCY = "18";
|
||||||
|
private final String NUMBER_OF_REPAYMENTS = "9";
|
||||||
|
private final String REPAYMENT_PERIOD = "2";
|
||||||
|
private final String DISBURSEMENT_DATE = "30 October 2010";
|
||||||
|
private final String LOAN_APPLICATION_SUBMISSION_DATE = "23 September 2010";
|
||||||
|
private final String EXPECTED_DISBURSAL_DATE = "28 October 2010";
|
||||||
|
private final String RATE_OF_INTEREST_PER_PERIOD = "2";
|
||||||
|
private final String DATE_OF_JOINING = "04 March 2009";
|
||||||
|
private final String INTEREST_VALUE_AMOUNT = "40.00";
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -76,7 +86,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
|||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
|
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan("28 September 2010", loanID);
|
loanStatusHashMap = this.loanTransactionHelper.approveLoan("28 September 2010", loanID);
|
||||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||||
@@ -85,14 +95,14 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
|||||||
loanStatusHashMap = this.loanTransactionHelper.undoApproval(loanID);
|
loanStatusHashMap = this.loanTransactionHelper.undoApproval(loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("-----------------------------------RE-APPROVE LOAN-----------------------------------------");
|
LOG.info("-----------------------------------RE-APPROVE LOAN-----------------------------------------");
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan("1 October 2010", loanID);
|
loanStatusHashMap = this.loanTransactionHelper.approveLoan("1 October 2010", loanID);
|
||||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||||
|
|
||||||
// DISBURSE
|
// DISBURSE
|
||||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
|
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
|
||||||
System.out.println("DISBURSE " + loanStatusHashMap);
|
LOG.info("DISBURSE {}", loanStatusHashMap.toString());
|
||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
// PERFORM REPAYMENTS AND CHECK LOAN STATUS
|
// PERFORM REPAYMENTS AND CHECK LOAN STATUS
|
||||||
@@ -105,7 +115,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
|||||||
|
|
||||||
// DIBURSE AGAIN
|
// DIBURSE AGAIN
|
||||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
|
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
|
||||||
System.out.println("DISBURSE " + loanStatusHashMap);
|
LOG.info("DISBURSE {}", loanStatusHashMap);
|
||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
// MAKE REPAYMENTS
|
// MAKE REPAYMENTS
|
||||||
@@ -144,14 +154,14 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
|||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
|
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
|
||||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan("28 September 2010", loanID);
|
loanStatusHashMap = this.loanTransactionHelper.approveLoan("28 September 2010", loanID);
|
||||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||||
|
|
||||||
// DISBURSE
|
// DISBURSE
|
||||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
|
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
|
||||||
System.out.println("DISBURSE " + loanStatusHashMap);
|
LOG.info("DISBURSE {}", loanStatusHashMap);
|
||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
// MAKE REPAYMENTS
|
// MAKE REPAYMENTS
|
||||||
@@ -161,27 +171,31 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
|||||||
this.loanTransactionHelper.makeRepayment("1 January 2011", repayment_with_interest, loanID);
|
this.loanTransactionHelper.makeRepayment("1 January 2011", repayment_with_interest, loanID);
|
||||||
|
|
||||||
HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
|
HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
|
||||||
Assert.assertTrue("Checking for Principal paid ",
|
Assertions.assertTrue(Float.valueOf("500.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalPaid")))) == 0,
|
||||||
new Float("500.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("principalPaid")))) == 0);
|
"Checking for Principal paid ");
|
||||||
Assert.assertTrue("Checking for interestPaid paid ",
|
Assertions.assertTrue(Float.valueOf("180.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("interestPaid")))) == 0,
|
||||||
new Float("180.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("interestPaid")))) == 0);
|
"Checking for interestPaid paid ");
|
||||||
Assert.assertTrue("Checking for total paid ",
|
Assertions.assertTrue(
|
||||||
new Float("680.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("totalRepayment")))) == 0);
|
Float.valueOf("680.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("totalRepayment")))) == 0,
|
||||||
|
"Checking for total paid ");
|
||||||
|
|
||||||
// WRITE OFF LOAN AND CHECK ACCOUNT IS CLOSED
|
// WRITE OFF LOAN AND CHECK ACCOUNT IS CLOSED
|
||||||
LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("1 January 2011", loanID));
|
LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("1 January 2011", loanID));
|
||||||
toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
|
toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
|
||||||
Assert.assertTrue("Checking for Principal written off ",
|
Assertions.assertTrue(
|
||||||
new Float("4000.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("principalWrittenOff")))) == 0);
|
Float.valueOf("4000.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalWrittenOff")))) == 0,
|
||||||
Assert.assertTrue("Checking for interestPaid written off ",
|
"Checking for Principal written off ");
|
||||||
new Float("1440.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("interestWrittenOff")))) == 0);
|
Assertions.assertTrue(
|
||||||
Assert.assertTrue("Checking for total written off ",
|
Float.valueOf("1440.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("interestWrittenOff")))) == 0,
|
||||||
new Float("5440.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("totalWrittenOff")))) == 0);
|
"Checking for interestPaid written off ");
|
||||||
|
Assertions.assertTrue(
|
||||||
|
Float.valueOf("5440.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("totalWrittenOff")))) == 0,
|
||||||
|
"Checking for total written off ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer createLoanProduct() {
|
private Integer createLoanProduct() {
|
||||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL).withRepaymentTypeAsMonth()
|
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL).withRepaymentTypeAsMonth()
|
||||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||||
@@ -191,7 +205,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID) {
|
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID) {
|
||||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(this.PRINCIPAL)
|
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(this.PRINCIPAL)
|
||||||
.withLoanTermFrequency(this.LOAN_TERM_FREQUENCY).withLoanTermFrequencyAsMonths()
|
.withLoanTermFrequency(this.LOAN_TERM_FREQUENCY).withLoanTermFrequencyAsMonths()
|
||||||
.withNumberOfRepayments(this.NUMBER_OF_REPAYMENTS).withRepaymentEveryAfter(this.REPAYMENT_PERIOD)
|
.withNumberOfRepayments(this.NUMBER_OF_REPAYMENTS).withRepaymentEveryAfter(this.REPAYMENT_PERIOD)
|
||||||
|
|||||||
+8
-10
@@ -18,22 +18,20 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.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")
|
@SuppressWarnings("rawtypes")
|
||||||
public class LoanWithdrawnByApplicantIntegrationTest {
|
public class LoanWithdrawnByApplicantIntegrationTest {
|
||||||
@@ -42,7 +40,7 @@ public class LoanWithdrawnByApplicantIntegrationTest {
|
|||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
|
|||||||
+11
-13
@@ -18,11 +18,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.CalendarHelper;
|
import org.apache.fineract.integrationtests.common.CalendarHelper;
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||||
@@ -32,15 +36,9 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.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
|
* Test the creation, approval and rejection of a loan reschedule request
|
||||||
@@ -62,7 +60,7 @@ public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest {
|
|||||||
private final String interestRatePerPeriod = "18";
|
private final String interestRatePerPeriod = "18";
|
||||||
private final String groupActivationDate = "1 August 2014";
|
private final String groupActivationDate = "1 August 2014";
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
}
|
}
|
||||||
@@ -97,7 +95,7 @@ public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest {
|
|||||||
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||||
|
|
||||||
// Test for loan account is created
|
// Test for loan account is created
|
||||||
Assert.assertNotNull(this.loanId);
|
Assertions.assertNotNull(this.loanId);
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
|
|||||||
+15
-13
@@ -18,25 +18,27 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
import com.jayway.restassured.http.ContentType;
|
import io.restassured.http.ContentType;
|
||||||
import com.jayway.restassured.specification.RequestSpecification;
|
import io.restassured.specification.RequestSpecification;
|
||||||
import com.jayway.restassured.specification.ResponseSpecification;
|
import io.restassured.specification.ResponseSpecification;
|
||||||
|
import java.util.HashMap;
|
||||||
import org.apache.fineract.integrationtests.common.NotificationHelper;
|
import org.apache.fineract.integrationtests.common.NotificationHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import java.util.HashMap;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class NotificationApiTest {
|
public class NotificationApiTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(NotificationApiTest.class);
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -49,7 +51,7 @@ public class NotificationApiTest {
|
|||||||
public void testNotificationRetrieval() {
|
public void testNotificationRetrieval() {
|
||||||
HashMap<String, Object> response = (HashMap<String, Object>) NotificationHelper.getNotifications(this.requestSpec,
|
HashMap<String, Object> response = (HashMap<String, Object>) NotificationHelper.getNotifications(this.requestSpec,
|
||||||
this.responseSpec, "");
|
this.responseSpec, "");
|
||||||
System.out.println("Response : " + response.toString());
|
LOG.info("Response : {}", response.toString());
|
||||||
Assert.assertNotNull(response);
|
Assertions.assertNotNull(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+29
-35
@@ -18,49 +18,43 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import org.apache.fineract.integrationtests.common.OfficeDomain;
|
import org.apache.fineract.integrationtests.common.OfficeDomain;
|
||||||
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.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 {
|
public class OfficeIntegrationTest {
|
||||||
|
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
ContentType.JSON).build();
|
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||||
this.requestSpec
|
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
.header("Authorization",
|
}
|
||||||
"Basic "
|
|
||||||
+ Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
|
||||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOfficeModification() {
|
public void testOfficeModification() {
|
||||||
OfficeHelper oh = new OfficeHelper(requestSpec, responseSpec);
|
OfficeHelper oh = new OfficeHelper(requestSpec, responseSpec);
|
||||||
int officeId = oh.createOffice("01 July 2007");
|
int officeId = oh.createOffice("01 July 2007");
|
||||||
String name = Utils.randomNameGenerator("New_Office_", 4);
|
String name = Utils.randomNameGenerator("New_Office_", 4);
|
||||||
String date = "02 July 2007";
|
String date = "02 July 2007";
|
||||||
String[] dateArr = { "2007", "7", "2" };
|
String[] dateArr = { "2007", "7", "2" };
|
||||||
|
|
||||||
oh.updateOffice(officeId, name, date);
|
oh.updateOffice(officeId, name, date);
|
||||||
OfficeDomain newOffice = oh.retrieveOfficeByID(officeId);
|
OfficeDomain newOffice = oh.retrieveOfficeByID(officeId);
|
||||||
|
|
||||||
Assert.assertTrue(name.equals(newOffice.getName()));
|
Assertions.assertTrue(name.equals(newOffice.getName()));
|
||||||
Assert.assertArrayEquals(dateArr, newOffice.getOpeningDate());
|
Assertions.assertArrayEquals(dateArr, newOffice.getOpeningDate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-17
@@ -18,31 +18,32 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||||
import org.apache.fineract.integrationtests.common.PasswordPreferencesHelper;
|
import org.apache.fineract.integrationtests.common.PasswordPreferencesHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
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" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
public class PasswordPreferencesIntegrationTest {
|
public class PasswordPreferencesIntegrationTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(PasswordPreferencesIntegrationTest.class);
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private ResponseSpecification generalResponseSpec;
|
private ResponseSpecification generalResponseSpec;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -59,20 +60,20 @@ public class PasswordPreferencesIntegrationTest {
|
|||||||
this.validateIfThePasswordIsUpdated(validationPolicyId);
|
this.validateIfThePasswordIsUpdated(validationPolicyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateIfThePasswordIsUpdated(String validationPolicyId){
|
private void validateIfThePasswordIsUpdated(String validationPolicyId) {
|
||||||
Integer id = PasswordPreferencesHelper.getActivePasswordPreference(requestSpec, responseSpec);
|
Integer id = PasswordPreferencesHelper.getActivePasswordPreference(requestSpec, responseSpec);
|
||||||
assertEquals(validationPolicyId, id.toString());
|
assertEquals(validationPolicyId, id.toString());
|
||||||
System.out.println("---------------------------------PASSWORD PREFERENCE VALIDATED SUCCESSFULLY-----------------------------------------");
|
LOG.info("---------------------------------PASSWORD PREFERENCE VALIDATED SUCCESSFULLY-----------------------------------------");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateWithInvalidPolicyId() {
|
public void updateWithInvalidPolicyId() {
|
||||||
String invalidValidationPolicyId = "2000";
|
String invalidValidationPolicyId = "2000";
|
||||||
final List<HashMap> error = (List) PasswordPreferencesHelper.updateWithInvalidValidationPolicyId(requestSpec, generalResponseSpec, invalidValidationPolicyId,
|
final List<HashMap> error = (List) PasswordPreferencesHelper.updateWithInvalidValidationPolicyId(requestSpec, generalResponseSpec,
|
||||||
CommonConstants.RESPONSE_ERROR);
|
invalidValidationPolicyId, CommonConstants.RESPONSE_ERROR);
|
||||||
assertEquals("Password Validation Policy with identifier 2000 does not exist", "error.msg.password.validation.policy.id.invalid",
|
assertEquals("error.msg.password.validation.policy.id.invalid", error.get(0).get("userMessageGlobalisationCode"),
|
||||||
error.get(0).get("userMessageGlobalisationCode"));
|
"Password Validation Policy with identifier 2000 does not exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-21
@@ -18,27 +18,25 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.PaymentTypeDomain;
|
import org.apache.fineract.integrationtests.common.PaymentTypeDomain;
|
||||||
import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
|
import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.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 {
|
public class PaymentTypeIntegrationTest {
|
||||||
|
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -56,13 +54,13 @@ public class PaymentTypeIntegrationTest {
|
|||||||
Integer position = 1;
|
Integer position = 1;
|
||||||
|
|
||||||
Integer paymentTypeId = PaymentTypeHelper.createPaymentType(requestSpec, responseSpec, name, description, isCashPayment, position);
|
Integer paymentTypeId = PaymentTypeHelper.createPaymentType(requestSpec, responseSpec, name, description, isCashPayment, position);
|
||||||
Assert.assertNotNull(paymentTypeId);
|
Assertions.assertNotNull(paymentTypeId);
|
||||||
PaymentTypeHelper.verifyPaymentTypeCreatedOnServer(requestSpec, responseSpec, paymentTypeId);
|
PaymentTypeHelper.verifyPaymentTypeCreatedOnServer(requestSpec, responseSpec, paymentTypeId);
|
||||||
PaymentTypeDomain paymentTypeResponse = PaymentTypeHelper.retrieveById(requestSpec, responseSpec, paymentTypeId);
|
PaymentTypeDomain paymentTypeResponse = PaymentTypeHelper.retrieveById(requestSpec, responseSpec, paymentTypeId);
|
||||||
Assert.assertEquals(name, paymentTypeResponse.getName());
|
Assertions.assertEquals(name, paymentTypeResponse.getName());
|
||||||
Assert.assertEquals(description, paymentTypeResponse.getDescription());
|
Assertions.assertEquals(description, paymentTypeResponse.getDescription());
|
||||||
Assert.assertEquals(isCashPayment, paymentTypeResponse.getIsCashPayment());
|
Assertions.assertEquals(isCashPayment, paymentTypeResponse.getIsCashPayment());
|
||||||
Assert.assertEquals(position, paymentTypeResponse.getPosition());
|
Assertions.assertEquals(position, paymentTypeResponse.getPosition());
|
||||||
|
|
||||||
// Update Payment Type
|
// Update Payment Type
|
||||||
String newName = PaymentTypeHelper.randomNameGenerator("P_TU", 5);
|
String newName = PaymentTypeHelper.randomNameGenerator("P_TU", 5);
|
||||||
@@ -77,14 +75,14 @@ public class PaymentTypeIntegrationTest {
|
|||||||
request.put("position", newPosition);
|
request.put("position", newPosition);
|
||||||
PaymentTypeHelper.updatePaymentType(paymentTypeId, request, requestSpec, responseSpec);
|
PaymentTypeHelper.updatePaymentType(paymentTypeId, request, requestSpec, responseSpec);
|
||||||
PaymentTypeDomain paymentTypeUpdatedResponse = PaymentTypeHelper.retrieveById(requestSpec, responseSpec, paymentTypeId);
|
PaymentTypeDomain paymentTypeUpdatedResponse = PaymentTypeHelper.retrieveById(requestSpec, responseSpec, paymentTypeId);
|
||||||
Assert.assertEquals(newName, paymentTypeUpdatedResponse.getName());
|
Assertions.assertEquals(newName, paymentTypeUpdatedResponse.getName());
|
||||||
Assert.assertEquals(newDescription, paymentTypeUpdatedResponse.getDescription());
|
Assertions.assertEquals(newDescription, paymentTypeUpdatedResponse.getDescription());
|
||||||
Assert.assertEquals(isCashPaymentUpdatedValue, paymentTypeUpdatedResponse.getIsCashPayment());
|
Assertions.assertEquals(isCashPaymentUpdatedValue, paymentTypeUpdatedResponse.getIsCashPayment());
|
||||||
Assert.assertEquals(newPosition, paymentTypeUpdatedResponse.getPosition());
|
Assertions.assertEquals(newPosition, paymentTypeUpdatedResponse.getPosition());
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
Integer deletedPaymentTypeId = PaymentTypeHelper.deletePaymentType(paymentTypeId, requestSpec, responseSpec);
|
Integer deletedPaymentTypeId = PaymentTypeHelper.deletePaymentType(paymentTypeId, requestSpec, responseSpec);
|
||||||
Assert.assertEquals(paymentTypeId, deletedPaymentTypeId);
|
Assertions.assertEquals(paymentTypeId, deletedPaymentTypeId);
|
||||||
ResponseSpecification responseSpecification = new ResponseSpecBuilder().expectStatusCode(404).build();
|
ResponseSpecification responseSpecification = new ResponseSpecBuilder().expectStatusCode(404).build();
|
||||||
PaymentTypeHelper.retrieveById(requestSpec, responseSpecification, paymentTypeId);
|
PaymentTypeHelper.retrieveById(requestSpec, responseSpecification, paymentTypeId);
|
||||||
|
|
||||||
|
|||||||
+67
@@ -0,0 +1,67 @@
|
|||||||
|
/**
|
||||||
|
* 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 io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.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.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@SuppressWarnings({ "rawtypes" })
|
||||||
|
public class RatesTest {
|
||||||
|
|
||||||
|
private ResponseSpecification responseSpec;
|
||||||
|
private RequestSpecification requestSpec;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
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() {
|
||||||
|
|
||||||
|
// Retrieving all Rates
|
||||||
|
ArrayList<HashMap> allRatesData = RatesHelper.getRates(this.requestSpec, this.responseSpec);
|
||||||
|
Assertions.assertNotNull(allRatesData);
|
||||||
|
|
||||||
|
// Testing Creation and Update of Loan Rate
|
||||||
|
final Integer loanRateId = RatesHelper.createRates(this.requestSpec, this.responseSpec, RatesHelper.getLoanRateJSON());
|
||||||
|
Assertions.assertNotNull(loanRateId);
|
||||||
|
|
||||||
|
// Update Rate percentage
|
||||||
|
HashMap changes = RatesHelper.updateRates(this.requestSpec, this.responseSpec, loanRateId, RatesHelper.getModifyRateJSON());
|
||||||
|
|
||||||
|
HashMap rateDataAfterChanges = RatesHelper.getRateById(this.requestSpec, this.responseSpec, loanRateId);
|
||||||
|
Assertions.assertEquals(rateDataAfterChanges.get("percentage"), changes.get("percentage"), "Verifying Rate after modification");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+609
-633
File diff suppressed because it is too large
Load Diff
+40
-39
@@ -18,31 +18,32 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
||||||
import org.apache.fineract.integrationtests.useradministration.roles.RolesHelper;
|
import org.apache.fineract.integrationtests.useradministration.roles.RolesHelper;
|
||||||
import org.apache.fineract.integrationtests.useradministration.users.UserHelper;
|
import org.apache.fineract.integrationtests.useradministration.users.UserHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import org.slf4j.LoggerFactory;
|
||||||
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 RolesTest {
|
public class RolesTest {
|
||||||
|
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(RolesTest.class);
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -54,11 +55,11 @@ public class RolesTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testCreateRolesStatus() {
|
public void testCreateRolesStatus() {
|
||||||
|
|
||||||
System.out.println("---------------------------------CREATING A ROLE---------------------------------------------");
|
LOG.info("---------------------------------CREATING A ROLE---------------------------------------------");
|
||||||
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(roleId);
|
Assertions.assertNotNull(roleId);
|
||||||
|
|
||||||
System.out.println("--------------------------------- Getting ROLE -------------------------------");
|
LOG.info("--------------------------------- Getting ROLE -------------------------------");
|
||||||
HashMap<String, Object> role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
HashMap<String, Object> role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
||||||
assertEquals((Integer) role.get("id"), roleId);
|
assertEquals((Integer) role.get("id"), roleId);
|
||||||
|
|
||||||
@@ -68,20 +69,20 @@ public class RolesTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testDisableRolesStatus() {
|
public void testDisableRolesStatus() {
|
||||||
|
|
||||||
System.out.println("---------------------------------CREATING A ROLE---------------------------------------------");
|
LOG.info("---------------------------------CREATING A ROLE---------------------------------------------");
|
||||||
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(roleId);
|
Assertions.assertNotNull(roleId);
|
||||||
|
|
||||||
System.out.println("--------------------------------- Getting ROLE -------------------------------");
|
LOG.info("--------------------------------- Getting ROLE -------------------------------");
|
||||||
HashMap<String, Object> role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
HashMap<String, Object> role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
||||||
assertEquals((Integer) role.get("id"), roleId);
|
assertEquals((Integer) role.get("id"), roleId);
|
||||||
|
|
||||||
System.out.println("--------------------------------- DISABLING ROLE -------------------------------");
|
LOG.info("--------------------------------- DISABLING ROLE -------------------------------");
|
||||||
final Integer disableRoleId = RolesHelper.disableRole(this.requestSpec, this.responseSpec, roleId);
|
final Integer disableRoleId = RolesHelper.disableRole(this.requestSpec, this.responseSpec, roleId);
|
||||||
assertEquals(disableRoleId, roleId);
|
assertEquals(disableRoleId, roleId);
|
||||||
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
||||||
assertEquals((Integer) role.get("id"), roleId);
|
assertEquals((Integer) role.get("id"), roleId);
|
||||||
assertEquals((Boolean) role.get("disabled"), true);
|
assertEquals(true, (Boolean) role.get("disabled"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,27 +90,27 @@ public class RolesTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testEnableRolesStatus() {
|
public void testEnableRolesStatus() {
|
||||||
|
|
||||||
System.out.println("---------------------------------CREATING A ROLE---------------------------------------------");
|
LOG.info("---------------------------------CREATING A ROLE---------------------------------------------");
|
||||||
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(roleId);
|
Assertions.assertNotNull(roleId);
|
||||||
|
|
||||||
System.out.println("--------------------------------- Getting ROLE -------------------------------");
|
LOG.info("--------------------------------- Getting ROLE -------------------------------");
|
||||||
HashMap<String, Object> role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
HashMap<String, Object> role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
||||||
assertEquals((Integer) role.get("id"), roleId);
|
assertEquals((Integer) role.get("id"), roleId);
|
||||||
|
|
||||||
System.out.println("--------------------------------- DISABLING ROLE -------------------------------");
|
LOG.info("--------------------------------- DISABLING ROLE -------------------------------");
|
||||||
final Integer disableRoleId = RolesHelper.disableRole(this.requestSpec, this.responseSpec, roleId);
|
final Integer disableRoleId = RolesHelper.disableRole(this.requestSpec, this.responseSpec, roleId);
|
||||||
assertEquals(disableRoleId, roleId);
|
assertEquals(disableRoleId, roleId);
|
||||||
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
||||||
assertEquals((Integer) role.get("id"), roleId);
|
assertEquals((Integer) role.get("id"), roleId);
|
||||||
assertEquals((Boolean) role.get("disabled"), true);
|
assertEquals(true, (Boolean) role.get("disabled"));
|
||||||
|
|
||||||
System.out.println("--------------------------------- ENABLING ROLE -------------------------------");
|
LOG.info("--------------------------------- ENABLING ROLE -------------------------------");
|
||||||
final Integer enableRoleId = RolesHelper.enableRole(this.requestSpec, this.responseSpec, roleId);
|
final Integer enableRoleId = RolesHelper.enableRole(this.requestSpec, this.responseSpec, roleId);
|
||||||
assertEquals(enableRoleId, roleId);
|
assertEquals(enableRoleId, roleId);
|
||||||
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
||||||
assertEquals((Integer) role.get("id"), roleId);
|
assertEquals((Integer) role.get("id"), roleId);
|
||||||
assertEquals((Boolean) role.get("disabled"), false);
|
assertEquals(false, (Boolean) role.get("disabled"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,15 +118,15 @@ public class RolesTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testDeleteRoleStatus() {
|
public void testDeleteRoleStatus() {
|
||||||
|
|
||||||
System.out.println("-------------------------------- CREATING A ROLE---------------------------------------------");
|
LOG.info("-------------------------------- CREATING A ROLE---------------------------------------------");
|
||||||
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(roleId);
|
Assertions.assertNotNull(roleId);
|
||||||
|
|
||||||
System.out.println("--------------------------------- Getting ROLE -------------------------------");
|
LOG.info("--------------------------------- Getting ROLE -------------------------------");
|
||||||
HashMap<String, Object> role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
HashMap<String, Object> role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
|
||||||
assertEquals((Integer) role.get("id"), roleId);
|
assertEquals((Integer) role.get("id"), roleId);
|
||||||
|
|
||||||
System.out.println("--------------------------------- DELETE ROLE -------------------------------");
|
LOG.info("--------------------------------- DELETE ROLE -------------------------------");
|
||||||
final Integer deleteRoleId = RolesHelper.deleteRole(this.requestSpec, this.responseSpec, roleId);
|
final Integer deleteRoleId = RolesHelper.deleteRole(this.requestSpec, this.responseSpec, roleId);
|
||||||
assertEquals(deleteRoleId, roleId);
|
assertEquals(deleteRoleId, roleId);
|
||||||
}
|
}
|
||||||
@@ -133,16 +134,16 @@ public class RolesTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testRoleShouldGetDeletedIfNoActiveUserExists() {
|
public void testRoleShouldGetDeletedIfNoActiveUserExists() {
|
||||||
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(roleId);
|
Assertions.assertNotNull(roleId);
|
||||||
|
|
||||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(staffId);
|
Assertions.assertNotNull(staffId);
|
||||||
|
|
||||||
final Integer userId = UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId);
|
final Integer userId = UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId);
|
||||||
Assert.assertNotNull(userId);
|
Assertions.assertNotNull(userId);
|
||||||
|
|
||||||
final Integer deletedUserId = UserHelper.deleteUser(this.requestSpec, this.responseSpec, userId);
|
final Integer deletedUserId = UserHelper.deleteUser(this.requestSpec, this.responseSpec, userId);
|
||||||
Assert.assertEquals(deletedUserId, userId);
|
Assertions.assertEquals(deletedUserId, userId);
|
||||||
|
|
||||||
final Integer deletedRoleId = RolesHelper.deleteRole(this.requestSpec, this.responseSpec, roleId);
|
final Integer deletedRoleId = RolesHelper.deleteRole(this.requestSpec, this.responseSpec, roleId);
|
||||||
assertEquals(deletedRoleId, roleId);
|
assertEquals(deletedRoleId, roleId);
|
||||||
@@ -151,13 +152,13 @@ public class RolesTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testRoleShouldNotGetDeletedIfActiveUserExists() {
|
public void testRoleShouldNotGetDeletedIfActiveUserExists() {
|
||||||
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(roleId);
|
Assertions.assertNotNull(roleId);
|
||||||
|
|
||||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(staffId);
|
Assertions.assertNotNull(staffId);
|
||||||
|
|
||||||
final Integer userId = UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId);
|
final Integer userId = UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId);
|
||||||
Assert.assertNotNull(userId);
|
Assertions.assertNotNull(userId);
|
||||||
|
|
||||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
|
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||||
final Integer deletedRoleId = RolesHelper.deleteRole(this.requestSpec, this.responseSpec, roleId);
|
final Integer deletedRoleId = RolesHelper.deleteRole(this.requestSpec, this.responseSpec, roleId);
|
||||||
|
|||||||
+95
-83
@@ -18,106 +18,118 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import static org.awaitility.Awaitility.await;
|
||||||
import java.util.HashMap;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.apache.fineract.infrastructure.jobs.service.JobName;
|
||||||
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.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", "static-access" })
|
|
||||||
public class SchedulerJobsTest {
|
public class SchedulerJobsTest {
|
||||||
|
|
||||||
private ResponseSpecification responseSpec;
|
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private ResponseSpecification responseSpecForSchedulerJob;
|
|
||||||
private SchedulerJobHelper schedulerJobHelper;
|
private SchedulerJobHelper schedulerJobHelper;
|
||||||
|
private Boolean originalSchedulerStatus;
|
||||||
|
private final Map<Integer, Boolean> originalJobStatus = new HashMap<>();
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||||
this.requestSpec.header("Fineract-Platform-TenantId", "default");
|
requestSpec.header("Fineract-Platform-TenantId", "default");
|
||||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||||
this.responseSpecForSchedulerJob = new ResponseSpecBuilder().expectStatusCode(202).build();
|
originalSchedulerStatus = schedulerJobHelper.getSchedulerStatus();
|
||||||
|
for (Integer jobId : schedulerJobHelper.getAllSchedulerJobIds()) {
|
||||||
|
Map<String, Object> schedulerJob = schedulerJobHelper.getSchedulerJobById(jobId);
|
||||||
|
Boolean active = (Boolean) schedulerJob.get("active");
|
||||||
|
originalJobStatus.put(jobId, active);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
public void tearDown() {
|
||||||
|
schedulerJobHelper.updateSchedulerStatus(originalSchedulerStatus);
|
||||||
|
for (int jobId = 1; jobId < JobName.values().length; jobId++) {
|
||||||
|
schedulerJobHelper.updateSchedulerJob(jobId, originalJobStatus.get(jobId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test // FINERACT-926
|
||||||
|
public void testDateFormat() {
|
||||||
|
// must start scheduler and make job active to have nextRunTime (which
|
||||||
|
// is a
|
||||||
|
// java.util.Date)
|
||||||
|
schedulerJobHelper.updateSchedulerStatus(true);
|
||||||
|
schedulerJobHelper.updateSchedulerJob(1, true);
|
||||||
|
String nextRunTimeText = await().until(() -> (String) schedulerJobHelper.getSchedulerJobById(1).get("nextRunTime"),
|
||||||
|
nextRunTime -> nextRunTime != null);
|
||||||
|
DateTimeFormatter.ISO_INSTANT.parse(nextRunTimeText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSchedulerJobs() throws InterruptedException {
|
public void testFlippingSchedulerStatus() throws InterruptedException {
|
||||||
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
|
|
||||||
|
|
||||||
// Retrieving Status of Scheduler
|
// Retrieving Status of Scheduler
|
||||||
HashMap schedulerStatus = this.schedulerJobHelper.getSchedulerStatus(this.requestSpec, this.responseSpec);
|
Boolean schedulerStatus = schedulerJobHelper.getSchedulerStatus();
|
||||||
Boolean status = (Boolean) schedulerStatus.get("active");
|
if (schedulerStatus == true) {
|
||||||
if (status == true) {
|
schedulerJobHelper.updateSchedulerStatus(false);
|
||||||
this.schedulerJobHelper.updateSchedulerStatus(this.requestSpec, this.responseSpecForSchedulerJob, "stop");
|
schedulerStatus = schedulerJobHelper.getSchedulerStatus();
|
||||||
schedulerStatus = this.schedulerJobHelper.getSchedulerStatus(this.requestSpec, this.responseSpec);
|
// Verifying Status of the Scheduler after stopping
|
||||||
// Verifying Status of the Scheduler after updation
|
assertEquals(false, schedulerStatus, "Verifying Scheduler Job Status");
|
||||||
Assert.assertEquals("Verifying Scheduler Job Status", false, schedulerStatus.get("active"));
|
|
||||||
} else {
|
} else {
|
||||||
this.schedulerJobHelper.updateSchedulerStatus(this.requestSpec, this.responseSpecForSchedulerJob, "start");
|
schedulerJobHelper.updateSchedulerStatus(true);
|
||||||
schedulerStatus = this.schedulerJobHelper.getSchedulerStatus(this.requestSpec, this.responseSpec);
|
schedulerStatus = schedulerJobHelper.getSchedulerStatus();
|
||||||
// Verifying Status of the Scheduler after updation
|
// Verifying Status of the Scheduler after starting
|
||||||
Assert.assertEquals("Verifying Scheduler Job Status", true, schedulerStatus.get("active"));
|
assertEquals(true, schedulerStatus, "Verifying Scheduler Job Status");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieving All Scheduler Jobs
|
|
||||||
ArrayList<HashMap> allSchedulerJobsData = this.schedulerJobHelper.getAllSchedulerJobs(this.requestSpec, this.responseSpec);
|
|
||||||
Assert.assertNotNull(allSchedulerJobsData);
|
|
||||||
|
|
||||||
for (Integer jobIndex = 0; jobIndex < allSchedulerJobsData.size(); jobIndex++) {
|
|
||||||
|
|
||||||
Integer jobId = (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
|
|
||||||
|
|
||||||
// Retrieving Scheduler Job by ID
|
|
||||||
HashMap schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
|
||||||
Assert.assertNotNull(schedulerJob);
|
|
||||||
|
|
||||||
Boolean active = (Boolean) schedulerJob.get("active");
|
|
||||||
|
|
||||||
if (active == true) {
|
|
||||||
active = false;
|
|
||||||
} else {
|
|
||||||
active = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Updating Scheduler Job
|
|
||||||
HashMap changes = this.schedulerJobHelper.updateSchedulerJob(this.requestSpec, this.responseSpec, jobId.toString(),
|
|
||||||
active.toString());
|
|
||||||
// Verifying Scheduler Job updation
|
|
||||||
Assert.assertEquals("Verifying Scheduler Job Updation", active, changes.get("active"));
|
|
||||||
|
|
||||||
// Executing Scheduler Job
|
|
||||||
this.schedulerJobHelper.runSchedulerJob(this.requestSpec, jobId.toString());
|
|
||||||
|
|
||||||
// Retrieving Scheduler Job by ID
|
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
|
||||||
Assert.assertNotNull(schedulerJob);
|
|
||||||
|
|
||||||
// Waiting for Job to complete
|
|
||||||
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
|
||||||
Thread.sleep(15000);
|
|
||||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString());
|
|
||||||
Assert.assertNotNull(schedulerJob);
|
|
||||||
System.out.println("Job " +jobId.toString() +" is Still Running");
|
|
||||||
}
|
|
||||||
ArrayList<HashMap> jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec,
|
|
||||||
jobId.toString());
|
|
||||||
|
|
||||||
// Verifying the Status of the Recently executed Scheduler Job
|
|
||||||
Assert.assertEquals("Verifying Last Scheduler Job Status", "success",
|
|
||||||
jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNumberOfJobs() {
|
||||||
|
List<Integer> jobIds = schedulerJobHelper.getAllSchedulerJobIds();
|
||||||
|
assertEquals(JobName.values().length, jobIds.size(), "Number of jobs in database and code do not match: " + jobIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFlippingJobsActiveStatus() throws InterruptedException {
|
||||||
|
// Stop the Scheduler while we test flapping jobs' active on/off, to
|
||||||
|
// avoid side
|
||||||
|
// effects
|
||||||
|
schedulerJobHelper.updateSchedulerStatus(false);
|
||||||
|
|
||||||
|
// For each retrieved scheduled job (by ID)...
|
||||||
|
for (Integer jobId : schedulerJobHelper.getAllSchedulerJobIds()) {
|
||||||
|
// Retrieving Scheduler Job by ID
|
||||||
|
Map<String, Object> schedulerJob = schedulerJobHelper.getSchedulerJobById(jobId);
|
||||||
|
|
||||||
|
Boolean active = (Boolean) schedulerJob.get("active");
|
||||||
|
active = !active;
|
||||||
|
|
||||||
|
// Updating Scheduler Job
|
||||||
|
Map<String, Object> changes = schedulerJobHelper.updateSchedulerJob(jobId, active);
|
||||||
|
|
||||||
|
// Verifying Scheduler Job updates
|
||||||
|
assertEquals(active, changes.get("active"), "Verifying Scheduler Job Updates");
|
||||||
|
|
||||||
|
schedulerJob = schedulerJobHelper.getSchedulerJobById(jobId);
|
||||||
|
assertEquals(active, schedulerJob.get("active"), "Verifying Get Scheduler Job");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTriggeringManualExecutionOfAllSchedulerJobs() {
|
||||||
|
for (String jobName : schedulerJobHelper.getAllSchedulerJobNames()) {
|
||||||
|
schedulerJobHelper.executeAndAwaitJob(jobName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+336
-260
File diff suppressed because it is too large
Load Diff
+117
-116
@@ -18,12 +18,16 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.fineract.integrationtests.common.CalendarHelper;
|
import org.apache.fineract.integrationtests.common.CalendarHelper;
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
|
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
|
||||||
@@ -32,138 +36,135 @@ import org.apache.fineract.integrationtests.common.Utils;
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
@SuppressWarnings({ "unchecked" })
|
||||||
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 junit.framework.Assert;
|
|
||||||
|
|
||||||
@SuppressWarnings({ "static-access", "rawtypes", "unchecked", "deprecation" })
|
|
||||||
public class SkipRepaymentOnMonthFirstTest {
|
public class SkipRepaymentOnMonthFirstTest {
|
||||||
|
|
||||||
private ResponseSpecification responseSpec;
|
private final static Logger LOG = LoggerFactory.getLogger(SkipRepaymentOnMonthFirstTest.class);
|
||||||
private RequestSpecification requestSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private GlobalConfigurationHelper globalConfigurationHelper;
|
private RequestSpecification requestSpec;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
private GlobalConfigurationHelper globalConfigurationHelper;
|
||||||
private CalendarHelper calendarHelper;
|
private LoanTransactionHelper loanTransactionHelper;
|
||||||
|
private CalendarHelper calendarHelper;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
this.requestSpec.header("Authorization",
|
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||||
"Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@AfterEach
|
||||||
public void testSkippingRepaymentOnFirstDayOfMonth() {
|
public void tearDown() {
|
||||||
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
GlobalConfigurationHelper.resetAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
|
GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
|
}
|
||||||
|
|
||||||
// Retrieving All Global Configuration details
|
@Test
|
||||||
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper
|
public void testSkippingRepaymentOnFirstDayOfMonth() {
|
||||||
.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(globalConfig);
|
|
||||||
|
|
||||||
String configName = "skip-repayment-on-first-day-of-month";
|
// Retrieving All Global Configuration details
|
||||||
boolean newBooleanValue = true;
|
final ArrayList<HashMap> globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||||
|
Assertions.assertNotNull(globalConfig);
|
||||||
|
|
||||||
for (Integer configIndex = 0; configIndex < (globalConfig.size()); configIndex++) {
|
String configName = "skip-repayment-on-first-day-of-month";
|
||||||
if (globalConfig.get(configIndex).get("name").equals(configName)) {
|
boolean newBooleanValue = true;
|
||||||
String configId = (globalConfig.get(configIndex).get("id")).toString();
|
|
||||||
Integer updateConfigId = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(
|
|
||||||
this.requestSpec, this.responseSpec, configId.toString(), newBooleanValue);
|
|
||||||
Assert.assertNotNull(updateConfigId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
for (Integer configIndex = 0; configIndex < globalConfig.size(); configIndex++) {
|
||||||
|
if (globalConfig.get(configIndex).get("name").equals(configName)) {
|
||||||
|
String configId = globalConfig.get(configIndex).get("id").toString();
|
||||||
|
Integer updateConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec,
|
||||||
|
this.responseSpec, configId.toString(), newBooleanValue);
|
||||||
|
Assertions.assertNotNull(updateConfigId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
}
|
||||||
public void checkRepaymentSkipOnFirstDayOfMonth() {
|
|
||||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
|
||||||
|
|
||||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
@Test
|
||||||
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
public void checkRepaymentSkipOnFirstDayOfMonth() {
|
||||||
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(),
|
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||||
clientID.toString());
|
|
||||||
final String startDate = "15 September 2011";
|
|
||||||
final String frequency = "3"; // Monthly
|
|
||||||
final String interval = "1"; //Every One Moth
|
|
||||||
Integer calendarID = calendarHelper.createMeetingForGroup(requestSpec, responseSpec, groupID, startDate, frequency,
|
|
||||||
interval, null);
|
|
||||||
System.out.println("caladerId --------------------" + calendarID);
|
|
||||||
final Integer loanProductID = createLoanProduct();
|
|
||||||
final Integer loanID = applyForLoanApplication(groupID, loanProductID, calendarID, clientID);
|
|
||||||
System.out.println("loanID----" + loanID);
|
|
||||||
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
|
|
||||||
this.responseSpec, loanID);
|
|
||||||
verifyLoanRepaymentSchedule(loanSchedule);
|
|
||||||
|
|
||||||
}
|
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
|
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
|
||||||
|
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||||
|
final String startDate = "15 September 2011";
|
||||||
|
final String frequency = "3"; // Monthly
|
||||||
|
final String interval = "1"; // Every One Moth
|
||||||
|
Integer calendarID = CalendarHelper.createMeetingForGroup(requestSpec, responseSpec, groupID, startDate, frequency, interval, null);
|
||||||
|
LOG.info("caladerId -------------------- {}", calendarID);
|
||||||
|
final Integer loanProductID = createLoanProduct();
|
||||||
|
final Integer loanID = applyForLoanApplication(groupID, loanProductID, calendarID, clientID);
|
||||||
|
LOG.info("loanID---- {}", loanID);
|
||||||
|
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
|
||||||
|
loanID);
|
||||||
|
verifyLoanRepaymentSchedule(loanSchedule);
|
||||||
|
|
||||||
private Integer createLoanProduct() {
|
}
|
||||||
System.out.println(
|
|
||||||
"------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
|
||||||
final String loanProductJSON = new LoanProductTestBuilder() //
|
|
||||||
.withPrincipal("12,000.00") //
|
|
||||||
.withNumberOfRepayments("4") //
|
|
||||||
.withRepaymentAfterEvery("1") //
|
|
||||||
.withRepaymentTypeAsMonth() //
|
|
||||||
.withinterestRatePerPeriod("1") //
|
|
||||||
.withInterestRateFrequencyTypeAsMonths() //
|
|
||||||
.withAmortizationTypeAsEqualInstallments() //
|
|
||||||
.withInterestTypeAsDecliningBalance() //
|
|
||||||
.build(null);
|
|
||||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Integer applyForLoanApplication(final Integer groupID, final Integer loanProductID, Integer calendarID,
|
private Integer createLoanProduct() {
|
||||||
Integer clientID) {
|
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||||
System.out.println(
|
final String loanProductJSON = new LoanProductTestBuilder() //
|
||||||
"--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
.withPrincipal("12,000.00") //
|
||||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
.withNumberOfRepayments("4") //
|
||||||
.withPrincipal("12,000.00") //
|
.withRepaymentAfterEvery("1") //
|
||||||
.withLoanTermFrequency("4") //
|
.withRepaymentTypeAsMonth() //
|
||||||
.withLoanTermFrequencyAsMonths() //
|
.withinterestRatePerPeriod("1") //
|
||||||
.withNumberOfRepayments("4") //
|
.withInterestRateFrequencyTypeAsMonths() //
|
||||||
.withRepaymentEveryAfter("1") //
|
.withAmortizationTypeAsEqualInstallments() //
|
||||||
.withRepaymentFrequencyTypeAsMonths() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.withInterestRatePerPeriod("2") //
|
.build(null);
|
||||||
.withAmortizationTypeAsEqualInstallments() //
|
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
.withInterestTypeAsDecliningBalance() //
|
}
|
||||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
|
|
||||||
.withExpectedDisbursementDate("01 October 2011") //
|
|
||||||
.withCalendarID(calendarID.toString()) //
|
|
||||||
.withSubmittedOnDate("01 October 2011") //
|
|
||||||
.withLoanType("jlg").build(clientID.toString(), groupID.toString(), loanProductID.toString(), null);
|
|
||||||
System.out.println(loanApplicationJSON);
|
|
||||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void verifyLoanRepaymentSchedule(final ArrayList<HashMap> loanSchedule) {
|
private Integer applyForLoanApplication(final Integer groupID, final Integer loanProductID, Integer calendarID, Integer clientID) {
|
||||||
System.out.println("--------------------VERIFYING THE REPAYMENT DATE--------------------------");
|
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||||
assertEquals("Checking for Repayment Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 15)),
|
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||||
loanSchedule.get(1).get("dueDate"));
|
.withPrincipal("12,000.00") //
|
||||||
System.out.println("Repayment Date for 1st Month--" + loanSchedule.get(1).get("dueDate"));
|
.withLoanTermFrequency("4") //
|
||||||
|
.withLoanTermFrequencyAsMonths() //
|
||||||
|
.withNumberOfRepayments("4") //
|
||||||
|
.withRepaymentEveryAfter("1") //
|
||||||
|
.withRepaymentFrequencyTypeAsMonths() //
|
||||||
|
.withInterestRatePerPeriod("2") //
|
||||||
|
.withAmortizationTypeAsEqualInstallments() //
|
||||||
|
.withInterestTypeAsDecliningBalance() //
|
||||||
|
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
|
||||||
|
.withExpectedDisbursementDate("01 October 2011") //
|
||||||
|
.withCalendarID(calendarID.toString()) //
|
||||||
|
.withSubmittedOnDate("01 October 2011") //
|
||||||
|
.withLoanType("jlg").build(clientID.toString(), groupID.toString(), loanProductID.toString(), null);
|
||||||
|
LOG.info(loanApplicationJSON);
|
||||||
|
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||||
|
}
|
||||||
|
|
||||||
assertEquals("Checking for Repayment Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 15)),
|
private void verifyLoanRepaymentSchedule(final ArrayList<HashMap> loanSchedule) {
|
||||||
loanSchedule.get(2).get("dueDate"));
|
LOG.info("--------------------VERIFYING THE REPAYMENT DATE--------------------------");
|
||||||
System.out.println("Repayment Date for 2nd Month--" + loanSchedule.get(2).get("dueDate"));
|
assertEquals(new ArrayList<>(Arrays.asList(2011, 10, 15)), loanSchedule.get(1).get("dueDate"),
|
||||||
|
"Checking for Repayment Date for 1st Month");
|
||||||
|
LOG.info("Repayment Date for 1st Month-- {}", loanSchedule.get(1).get("dueDate"));
|
||||||
|
|
||||||
assertEquals("Checking for Repayment Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 15)),
|
assertEquals(new ArrayList<>(Arrays.asList(2011, 11, 15)), loanSchedule.get(2).get("dueDate"),
|
||||||
loanSchedule.get(3).get("dueDate"));
|
"Checking for Repayment Date for 2nd Month");
|
||||||
System.out.println("Repayment Date for 3rd Month--" + loanSchedule.get(3).get("dueDate"));
|
LOG.info("Repayment Date for 2nd Month-- {}", loanSchedule.get(2).get("dueDate"));
|
||||||
|
|
||||||
assertEquals("Checking for Repayment Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 15)),
|
assertEquals(new ArrayList<>(Arrays.asList(2011, 12, 15)), loanSchedule.get(3).get("dueDate"),
|
||||||
loanSchedule.get(4).get("dueDate"));
|
"Checking for Repayment Date for 3rd Month");
|
||||||
System.out.println("Repayment Date for 4th Month--" + loanSchedule.get(4).get("dueDate"));
|
LOG.info("Repayment Date for 3rd Month-- {}", loanSchedule.get(3).get("dueDate"));
|
||||||
}
|
|
||||||
|
assertEquals(new ArrayList<>(Arrays.asList(2012, 1, 15)), loanSchedule.get(4).get("dueDate"),
|
||||||
|
"Checking for Repayment Date for 4th Month");
|
||||||
|
LOG.info("Repayment Date for 4th Month-- {}", loanSchedule.get(4).get("dueDate"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+24
-37
@@ -18,88 +18,75 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import org.apache.fineract.integrationtests.common.ImageHelper;
|
import org.apache.fineract.integrationtests.common.ImageHelper;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
|
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
|
||||||
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.Test;
|
||||||
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 StaffImageApiTest {
|
public class StaffImageApiTest {
|
||||||
|
|
||||||
private RequestSpecification requestSpec;
|
private RequestSpecification requestSpec;
|
||||||
private ResponseSpecification responseSpec;
|
private ResponseSpecification responseSpec;
|
||||||
private LoanTransactionHelper loanTransactionHelper;
|
|
||||||
private AccountHelper accountHelper;
|
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
|
||||||
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createStaffImage() {
|
public void createStaffImage() {
|
||||||
|
|
||||||
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||||
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
|
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
|
||||||
Assert.assertNotNull("Image id should not be null", imageId);
|
assertNotNull(imageId, "Image id should not be null");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getStaffImage(){
|
public void getStaffImage() {
|
||||||
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||||
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
|
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
|
||||||
Assert.assertNotNull("Image id should not be null", imageId);
|
assertNotNull(imageId, "Image id should not be null");
|
||||||
String imageAsText = ImageHelper.getStaffImageAsText(this.requestSpec, this.responseSpec, staffId);
|
String imageAsText = ImageHelper.getStaffImageAsText(this.requestSpec, this.responseSpec, staffId);
|
||||||
Assert.assertNotNull("Image id should not be null", imageAsText);
|
assertNotNull("Image id should not be null", imageAsText);
|
||||||
|
assertEquals(ImageHelper.generateImageAsText(), imageAsText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getStaffImageAsBinary(){
|
public void getStaffImageAsBinary() {
|
||||||
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||||
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
|
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
|
||||||
Assert.assertNotNull("Image id should not be null", imageId);
|
assertNotNull(imageId, "Image id should not be null");
|
||||||
byte[] imageAsBytes = ImageHelper.getStaffImageAsBinary(this.requestSpec, this.responseSpec, staffId);
|
byte[] imageAsBytes = ImageHelper.getStaffImageAsBinary(this.requestSpec, this.responseSpec, staffId);
|
||||||
Assert.assertNotNull("Image content should not be null", imageAsBytes);
|
assertNotNull(imageAsBytes, "Image content should not be null");
|
||||||
|
assertEquals(251, imageAsBytes.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateImage() {
|
public void updateImage() {
|
||||||
|
|
||||||
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||||
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
|
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
|
||||||
Assert.assertNotNull("Image id should not be null", imageId);
|
assertNotNull(imageId, "Image id should not be null");
|
||||||
imageId = ImageHelper.updateImageForStaff(this.requestSpec, this.responseSpec, staffId);
|
imageId = ImageHelper.updateImageForStaff(this.requestSpec, this.responseSpec, staffId);
|
||||||
Assert.assertNotNull("Image id should not be null", imageId);
|
assertNotNull(imageId, "Image id should not be null");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void deleteStaffImage() {
|
public void deleteStaffImage() {
|
||||||
|
|
||||||
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||||
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
|
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
|
||||||
Assert.assertNotNull("Image id should not be null", imageId);
|
assertNotNull(imageId, "Image id should not be null");
|
||||||
imageId = ImageHelper.deleteStaffImage(this.requestSpec, this.responseSpec, staffId);
|
imageId = ImageHelper.deleteStaffImage(this.requestSpec, this.responseSpec, staffId);
|
||||||
Assert.assertNotNull("Image id should not be null", imageId);
|
assertNotNull(imageId, "Image id should not be null");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+49
-44
@@ -18,21 +18,20 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.integrationtests;
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import io.restassured.builder.RequestSpecBuilder;
|
||||||
|
import io.restassured.builder.ResponseSpecBuilder;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.specification.RequestSpecification;
|
||||||
|
import io.restassured.specification.ResponseSpecification;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
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 StaffTest {
|
public class StaffTest {
|
||||||
|
|
||||||
@@ -41,7 +40,7 @@ public class StaffTest {
|
|||||||
private ResponseSpecification responseSpecForValidationError;
|
private ResponseSpecification responseSpecForValidationError;
|
||||||
private ResponseSpecification responseSpecForNotFoundError;
|
private ResponseSpecification responseSpecForNotFoundError;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||||
@@ -53,11 +52,11 @@ public class StaffTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStaffCreate() {
|
public void testStaffCreate() {
|
||||||
final HashMap response = StaffHelper.createStaffMap(requestSpec, responseSpec);
|
Map<String, Object> response = StaffHelper.createStaffMap(requestSpec, responseSpec);
|
||||||
|
|
||||||
Assert.assertNotNull(response);
|
Assertions.assertNotNull(response);
|
||||||
Assert.assertEquals(response.get("officeId"), 1);
|
Assertions.assertEquals(1, response.get("officeId"));
|
||||||
Assert.assertNotNull(response.get("resourceId"));
|
Assertions.assertNotNull(response.get("resourceId"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -71,7 +70,7 @@ public class StaffTest {
|
|||||||
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, noFirstnameJson);
|
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, noFirstnameJson);
|
||||||
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, noLastnameJson);
|
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, noLastnameJson);
|
||||||
|
|
||||||
final HashMap<String, Object> map = new HashMap<>();
|
final Map<String, Object> map = StaffHelper.getMapWithJoiningDate();
|
||||||
|
|
||||||
map.put("officeId", 1);
|
map.put("officeId", 1);
|
||||||
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
|
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
|
||||||
@@ -85,16 +84,17 @@ public class StaffTest {
|
|||||||
/** Long lastname test */
|
/** Long lastname test */
|
||||||
map.put("lastname", Utils.randomNameGenerator("Doe_", 47));
|
map.put("lastname", Utils.randomNameGenerator("Doe_", 47));
|
||||||
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, new Gson().toJson(map));
|
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, new Gson().toJson(map));
|
||||||
map.put("lastname", Utils.randomNameGenerator("Doe_",4));
|
map.put("lastname", Utils.randomNameGenerator("Doe_", 4));
|
||||||
|
|
||||||
/** Long mobileNo test */
|
/** Long mobileNo test */
|
||||||
map.put("mobileNo", Utils.randomNameGenerator("num_", 47));
|
map.put("mobileNo", Utils.randomNameGenerator("num_", 47));
|
||||||
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, new Gson().toJson(map));
|
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, new Gson().toJson(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testStaffCreateMaxNameLength() {
|
public void testStaffCreateMaxNameLength() {
|
||||||
|
|
||||||
final HashMap<String, Object> map = new HashMap<>();
|
final Map<String, Object> map = StaffHelper.getMapWithJoiningDate();
|
||||||
|
|
||||||
map.put("officeId", 1);
|
map.put("officeId", 1);
|
||||||
map.put("firstname", Utils.randomNameGenerator("michael_", 42));
|
map.put("firstname", Utils.randomNameGenerator("michael_", 42));
|
||||||
@@ -103,8 +103,9 @@ public class StaffTest {
|
|||||||
StaffHelper.createStaffWithJson(requestSpec, responseSpec, new Gson().toJson(map));
|
StaffHelper.createStaffWithJson(requestSpec, responseSpec, new Gson().toJson(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testStaffCreateExternalIdValidationError() {
|
public void testStaffCreateExternalIdValidationError() {
|
||||||
final HashMap<String, Object> map = new HashMap<>();
|
final Map<String, Object> map = StaffHelper.getMapWithJoiningDate();
|
||||||
|
|
||||||
map.put("officeId", 1);
|
map.put("officeId", 1);
|
||||||
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
|
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
|
||||||
@@ -116,10 +117,10 @@ public class StaffTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStaffFetch() {
|
public void testStaffFetch() {
|
||||||
final HashMap response = StaffHelper.getStaff(requestSpec, responseSpec, 1);
|
Map<String, Object> response = StaffHelper.getStaff(requestSpec, responseSpec, 1);
|
||||||
Assert.assertNotNull(response);
|
Assertions.assertNotNull(response);
|
||||||
Assert.assertNotNull(response.get("id"));
|
Assertions.assertNotNull(response.get("id"));
|
||||||
Assert.assertEquals(response.get("id"), 1);
|
Assertions.assertEquals(1, response.get("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -134,26 +135,27 @@ public class StaffTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStaffListStatusActive() {
|
public void testStaffListStatusActive() {
|
||||||
final List<HashMap> responseActive = (List<HashMap>) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active");
|
List<Map<String, Object>> responseActive = StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active");
|
||||||
for(final HashMap staff : responseActive) {
|
for (final Map<String, Object> staff : responseActive) {
|
||||||
Assert.assertNotNull(staff.get("id"));
|
Assertions.assertNotNull(staff.get("id"));
|
||||||
Assert.assertEquals(staff.get("isActive"), true);
|
Assertions.assertEquals(true, staff.get("isActive"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStaffListStatusInactive() {
|
public void testStaffListStatusInactive() {
|
||||||
final List<HashMap> responseInactive = (List<HashMap>) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "inactive");
|
List<Map<String, Object>> responseInactive = StaffHelper.getStaffListWithState(requestSpec, responseSpec, "inactive");
|
||||||
|
for (final Map<String, Object> staff : responseInactive) {
|
||||||
for(final HashMap staff : responseInactive) {
|
Assertions.assertNotNull(staff.get("id"));
|
||||||
Assert.assertNotNull(staff.get("id"));
|
Assertions.assertEquals(false, staff.get("isActive"));
|
||||||
Assert.assertEquals(staff.get("isActive"), false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test // because "xyz" will return an error, not a List
|
||||||
public void testStaffListFetchWrongState() {
|
public void testStaffListFetchWrongState() throws ClassCastException {
|
||||||
StaffHelper.getStaffListWithState(requestSpec, responseSpecForValidationError, "xyz");
|
Assertions.assertThrows(ClassCastException.class, () -> {
|
||||||
|
StaffHelper.getStaffListWithState(requestSpec, responseSpecForValidationError, "xyz");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -163,7 +165,7 @@ public class StaffTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStaffUpdate() {
|
public void testStaffUpdate() {
|
||||||
final HashMap<String, Object> map = new HashMap<>();
|
final Map<String, Object> map = new HashMap<>();
|
||||||
final String firstname = Utils.randomNameGenerator("michael_", 10);
|
final String firstname = Utils.randomNameGenerator("michael_", 10);
|
||||||
final String lastname = Utils.randomNameGenerator("Doe_", 10);
|
final String lastname = Utils.randomNameGenerator("Doe_", 10);
|
||||||
final String externalId = Utils.randomStringGenerator("EXT", 97);
|
final String externalId = Utils.randomStringGenerator("EXT", 97);
|
||||||
@@ -174,16 +176,18 @@ public class StaffTest {
|
|||||||
map.put("externalId", externalId);
|
map.put("externalId", externalId);
|
||||||
map.put("mobileNo", mobileNo);
|
map.put("mobileNo", mobileNo);
|
||||||
|
|
||||||
final HashMap response = (HashMap) StaffHelper.updateStaff(requestSpec, responseSpec, 1, map);
|
Map<String, Object> response = StaffHelper.updateStaff(requestSpec, responseSpec, 1, map);
|
||||||
final HashMap changes = (HashMap) response.get("changes");
|
@SuppressWarnings("unchecked")
|
||||||
|
Map<String, Object> changes = (Map<String, Object>) response.get("changes");
|
||||||
|
|
||||||
Assert.assertEquals(1, response.get("resourceId"));
|
Assertions.assertEquals(1, response.get("resourceId"));
|
||||||
Assert.assertEquals(firstname, changes.get("firstname"));
|
Assertions.assertEquals(firstname, changes.get("firstname"));
|
||||||
Assert.assertEquals(lastname, changes.get("lastname"));
|
Assertions.assertEquals(lastname, changes.get("lastname"));
|
||||||
Assert.assertEquals(externalId, changes.get("externalId"));
|
Assertions.assertEquals(externalId, changes.get("externalId"));
|
||||||
Assert.assertEquals(mobileNo, changes.get("mobileNo"));
|
Assertions.assertEquals(mobileNo, changes.get("mobileNo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testStaffUpdateLongExternalIdError() {
|
public void testStaffUpdateLongExternalIdError() {
|
||||||
final HashMap<String, Object> map = new HashMap<>();
|
final HashMap<String, Object> map = new HashMap<>();
|
||||||
map.put("externalId", Utils.randomStringGenerator("EXT", 98));
|
map.put("externalId", Utils.randomStringGenerator("EXT", 98));
|
||||||
@@ -191,6 +195,7 @@ public class StaffTest {
|
|||||||
StaffHelper.updateStaff(requestSpec, responseSpecForValidationError, 1, map);
|
StaffHelper.updateStaff(requestSpec, responseSpecForValidationError, 1, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testStaffUpdateWrongActiveState() {
|
public void testStaffUpdateWrongActiveState() {
|
||||||
final HashMap<String, Object> map = new HashMap<>();
|
final HashMap<String, Object> map = new HashMap<>();
|
||||||
map.put("isActive", "xyz");
|
map.put("isActive", "xyz");
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user