Compare commits
508
Commits
5c9028fcd0
...
982d3d340a
@@ -17,3 +17,10 @@
|
||||
#
|
||||
build/*
|
||||
.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.
|
||||
|
||||
- [ ] 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.
|
||||
|
||||
|
||||
@@ -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
|
||||
*.war
|
||||
*.ear
|
||||
.classpath
|
||||
.project
|
||||
.settings
|
||||
.gradle
|
||||
build
|
||||
*.iml
|
||||
@@ -9,4 +12,9 @@ build
|
||||
*.iws
|
||||
*.DS_Store
|
||||
.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.
|
||||
#
|
||||
|
||||
# https://issues.apache.org/jira/browse/FINERACT-763
|
||||
dist: trusty
|
||||
# https://docs.travis-ci.com/user/reference/linux/
|
||||
# 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
|
||||
|
||||
jdk:
|
||||
- openjdk8
|
||||
language: generic
|
||||
|
||||
services:
|
||||
- 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:
|
||||
- echo "USE mysql;\nUPDATE user SET password=PASSWORD('mysql') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root
|
||||
- mysql -u root -pmysql -e 'CREATE DATABASE IF NOT EXISTS `mifosplatform-tenants`;'
|
||||
- mysql -u root -pmysql -e 'CREATE DATABASE IF NOT EXISTS `mifostenant-default`;'
|
||||
- echo $JAVA_HOME
|
||||
- which java
|
||||
- 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
|
||||
- sudo service ntp stop
|
||||
- sudo date --set="23 February 2019 01:02:03"
|
||||
|
||||
# https://docs.travis-ci.com/user/languages/java/#caching
|
||||
before_cache:
|
||||
@@ -53,5 +70,9 @@ cache:
|
||||
# https://jira.apache.org/jira/browse/FINERACT-732 removed that again, because it made Travis CI fail.
|
||||
script:
|
||||
- date
|
||||
- ./gradlew --console=plain licenseMain licenseTest licenseIntegrationTest test
|
||||
- ./gradlew --console=plain clean integrationTest
|
||||
# using "&&" instead of several "-" means that integrationTest does not run if test fails,
|
||||
# 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
|
||||
# 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
|
||||
WORKDIR /fineract
|
||||
|
||||
WORKDIR fineract
|
||||
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 ./gradlew --no-daemon -x rat -x test bootJar
|
||||
|
||||
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"
|
||||
COPY ./docker/server.xml /opt/bitnami/tomcat/conf
|
||||
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
|
||||
WORKDIR /fineract/target
|
||||
RUN jar -xf /fineract/build/libs/fineract-provider.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
|
||||
============
|
||||
* Java >= 1.8 (Oracle JVMs have been tested)
|
||||
* MySQL 5.5
|
||||
* Java >= 11 (OpenJDK JVM is tested by our CI on Travis)
|
||||
* MySQL 5.7
|
||||
|
||||
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:
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
============
|
||||
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
|
||||
|
||||
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:
|
||||
1. `./gradlew createDB -PdbName=mifosplatform-tenants`
|
||||
1. `./gradlew createDB -PdbName=mifostenant-default`
|
||||
1. `./gradlew clean integrationTest`
|
||||
The project uses Jacoco to measure unit tests code coverage, to generate a report run the following command:
|
||||
|
||||
`./gradlew clean build jacocoTestReport`
|
||||
|
||||
Generated reports can be found in build/code-coverage directory.
|
||||
|
||||
|
||||
Instructions to run using Docker and docker-compose
|
||||
===================================================
|
||||
|
||||
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
|
||||
Versions
|
||||
============
|
||||
|
||||
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")
|
||||
|
||||
|
||||
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,
|
||||
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.
|
||||
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.
|
||||
@@ -93,42 +249,107 @@ complies with the [Apache Software Foundation third-party license policy](https:
|
||||
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
|
||||
============
|
||||
|
||||
* [Community App](https://demo.openmf.org "Reference Client App")
|
||||
> 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).
|
||||
* [fineract.dev](https://www.fineract.dev) always runs the latest version of this code
|
||||
* [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
|
||||
============
|
||||
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 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
|
||||
============
|
||||
|
||||
Apache Fineract / Mifos X Demo (November 2016) - <https://www.youtube.com/watch?v=h61g9TptMBo>
|
||||
|
||||
|
||||
Governance and Policies
|
||||
=======================
|
||||
|
||||
[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.
|
||||
|
||||
|
||||
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)
|
||||
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 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.
|
||||
#
|
||||
|
||||
# NB: Travis CI (dist: bionic) supports up to v3.7
|
||||
# (unless we'd install a more recent version in .travis.yml)
|
||||
version: '3.7'
|
||||
services:
|
||||
# Backend service
|
||||
fineractmysql:
|
||||
image: mysql:5.7
|
||||
volumes:
|
||||
- ./fineract-db/docker:/docker-entrypoint-initdb.d
|
||||
- ./fineract-db/docker:/docker-entrypoint-initdb.d:Z,ro
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: mysql
|
||||
MYSQL_ROOT_PASSWORD: skdcnwauicn2ucnaecasdsajdnizucawencascdca
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "--password=skdcnwauicn2ucnaecasdsajdnizucawencascdca" ]
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
ports:
|
||||
- "3306:3306"
|
||||
fineract-server:
|
||||
@@ -35,3 +42,30 @@ services:
|
||||
- 8443:8443
|
||||
depends_on:
|
||||
- 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.
|
||||
|
||||
+5
-33
@@ -31,35 +31,6 @@
|
||||
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
|
||||
<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 single "Container" Note: A "Service" is not itself a "Container",
|
||||
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
|
||||
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"
|
||||
secure="true" SSLEnabled="true"
|
||||
keystoreFile="/opt/bitnami/tomcat/tomcat.keystore"
|
||||
@@ -137,8 +108,9 @@
|
||||
-->
|
||||
|
||||
<!-- 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
|
||||
every request. The Engine implementation for Tomcat stand alone
|
||||
@@ -188,4 +160,4 @@
|
||||
</Host>
|
||||
</Engine>
|
||||
</Service>
|
||||
</Server>
|
||||
</Server>
|
||||
|
||||
@@ -233,7 +233,7 @@ pre .tex .formula {
|
||||
<ul>
|
||||
<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>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>
|
||||
</ul>
|
||||
</p>
|
||||
@@ -276,7 +276,7 @@ pre .tex .formula {
|
||||
|
||||
<section>
|
||||
<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>
|
||||
<img src="diagrams/platform-categories.png"
|
||||
alt="platform functionality view" />
|
||||
@@ -378,7 +378,7 @@ pre .tex .formula {
|
||||
</li>
|
||||
</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>
|
||||
<h3>Multi-tenanted</h3>
|
||||
<p>
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
--
|
||||
|
||||
# create databases
|
||||
CREATE DATABASE IF NOT EXISTS `mifosplatform-tenants`;
|
||||
CREATE DATABASE IF NOT EXISTS `mifostenant-default`;
|
||||
CREATE DATABASE IF NOT EXISTS `fineract_tenants`;
|
||||
CREATE DATABASE IF NOT EXISTS `fineract_default`;
|
||||
|
||||
# create root user and grant rights
|
||||
GRANT ALL ON *.* TO 'root'@'%';
|
||||
@@ -19,14 +19,14 @@
|
||||
|
||||
-- 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
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40101 SET NAMES UTF8MB4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
@@ -40,24 +40,24 @@
|
||||
|
||||
DROP TABLE IF EXISTS `schema_version`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
/*!40101 SET character_set_client = UTF8MB4 */;
|
||||
CREATE TABLE `schema_version` (
|
||||
`version_rank` int(11) NOT NULL,
|
||||
`installed_rank` int(11) NOT NULL,
|
||||
`version_rank` INT NOT NULL,
|
||||
`installed_rank` INT NOT NULL,
|
||||
`version` varchar(50) NOT NULL,
|
||||
`description` varchar(200) NOT NULL,
|
||||
`type` varchar(20) NOT NULL,
|
||||
`script` varchar(1000) NOT NULL,
|
||||
`checksum` int(11) DEFAULT NULL,
|
||||
`checksum` INT DEFAULT NULL,
|
||||
`installed_by` varchar(100) NOT NULL,
|
||||
`installed_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`execution_time` int(11) NOT NULL,
|
||||
`success` tinyint(1) NOT NULL,
|
||||
`execution_time` INT NOT NULL,
|
||||
`success` tinyint NOT NULL,
|
||||
PRIMARY KEY (`version`),
|
||||
KEY `schema_version_vr_idx` (`version_rank`),
|
||||
KEY `schema_version_ir_idx` (`installed_rank`),
|
||||
KEY `schema_version_s_idx` (`success`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@@ -77,14 +77,14 @@ UNLOCK TABLES;
|
||||
|
||||
DROP TABLE IF EXISTS `tenants`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
/*!40101 SET character_set_client = UTF8MB4 */;
|
||||
CREATE TABLE `tenants` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`identifier` varchar(100) NOT NULL,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`schema_name` 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,
|
||||
`created_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_username` varchar(100) NOT NULL DEFAULT 'root',
|
||||
`schema_password` varchar(100) NOT NULL DEFAULT 'mysql',
|
||||
`auto_update` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`pool_initial_size` int(5) DEFAULT 5,
|
||||
`pool_validation_interval` int(11) DEFAULT 30000,
|
||||
`pool_remove_abandoned` tinyint(1) DEFAULT 1,
|
||||
`pool_remove_abandoned_timeout` int(5) DEFAULT 60,
|
||||
`pool_log_abandoned` tinyint(1) DEFAULT 1,
|
||||
`pool_abandon_when_percentage_full` int(5) DEFAULT 50,
|
||||
`pool_test_on_borrow` tinyint(1) DEFAULT 1,
|
||||
`pool_max_active` int(5) DEFAULT 40,
|
||||
`pool_min_idle` int(5) DEFAULT 20,
|
||||
`pool_max_idle` int(5) DEFAULT 10,
|
||||
`pool_suspect_timeout` int(5) DEFAULT 60,
|
||||
`pool_time_between_eviction_runs_millis` int(11) DEFAULT 34000,
|
||||
`pool_min_evictable_idle_time_millis` int(11) DEFAULT 60000,
|
||||
`auto_update` tinyint NOT NULL DEFAULT '1',
|
||||
`pool_initial_size` INT DEFAULT 5,
|
||||
`pool_validation_interval` INT DEFAULT 30000,
|
||||
`pool_remove_abandoned` tinyint DEFAULT 1,
|
||||
`pool_remove_abandoned_timeout` INT DEFAULT 60,
|
||||
`pool_log_abandoned` tinyint DEFAULT 1,
|
||||
`pool_abandon_when_percentage_full` INT DEFAULT 50,
|
||||
`pool_test_on_borrow` tinyint DEFAULT 1,
|
||||
`pool_max_active` INT DEFAULT 40,
|
||||
`pool_min_idle` INT DEFAULT 20,
|
||||
`pool_max_idle` INT DEFAULT 10,
|
||||
`pool_suspect_timeout` INT DEFAULT 60,
|
||||
`pool_time_between_eviction_runs_millis` INT DEFAULT 34000,
|
||||
`pool_min_evictable_idle_time_millis` INT DEFAULT 60000,
|
||||
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 */;
|
||||
|
||||
--
|
||||
@@ -117,7 +117,7 @@ CREATE TABLE `tenants` (
|
||||
LOCK TABLES `tenants` WRITE;
|
||||
/*!40000 ALTER TABLE `tenants` DISABLE KEYS */;
|
||||
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 */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -127,14 +127,14 @@ UNLOCK TABLES;
|
||||
|
||||
DROP TABLE IF EXISTS `timezones`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
/*!40101 SET character_set_client = UTF8MB4 */;
|
||||
CREATE TABLE `timezones` (
|
||||
`id` int(3) NOT NULL AUTO_INCREMENT,
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`country_code` varchar(2) NOT NULL,
|
||||
`timezonename` varchar(100) NOT NULL,
|
||||
`comments` varchar(150) DEFAULT NULL,
|
||||
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 */;
|
||||
|
||||
--
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
|
||||
-- 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
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40101 SET NAMES UTF8MB4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
@@ -40,14 +40,14 @@
|
||||
|
||||
DROP TABLE IF EXISTS `tenants`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
/*!40101 SET character_set_client = UTF8MB4 */;
|
||||
CREATE TABLE `tenants` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`identifier` varchar(100) NOT NULL,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`schema_name` 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,
|
||||
`created_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_username` varchar(100) NOT NULL DEFAULT 'root',
|
||||
`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`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=UTF8MB4;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@@ -66,7 +66,7 @@ CREATE TABLE `tenants` (
|
||||
|
||||
LOCK TABLES `tenants` WRITE;
|
||||
/*!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 */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -76,14 +76,14 @@ UNLOCK TABLES;
|
||||
|
||||
DROP TABLE IF EXISTS `timezones`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
/*!40101 SET character_set_client = UTF8MB4 */;
|
||||
CREATE TABLE `timezones` (
|
||||
`id` int(3) NOT NULL AUTO_INCREMENT,
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`country_code` varchar(2) NOT NULL,
|
||||
`timezonename` varchar(100) NOT NULL,
|
||||
`comments` varchar(150) DEFAULT NULL,
|
||||
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 */;
|
||||
|
||||
--
|
||||
|
||||
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`;
|
||||
CREATE TABLE `client additional data` (
|
||||
`client_id` bigint(20) NOT NULL,
|
||||
`Gender_cd` int(11) NOT NULL,
|
||||
`client_id` BIGINT NOT NULL,
|
||||
`Gender_cd` INT NOT NULL,
|
||||
`Date of Birth` date NOT NULL,
|
||||
`Home address` text NOT NULL,
|
||||
`Telephone number` varchar(20) NOT NULL,
|
||||
`Telephone number (2nd)` varchar(20) NOT NULL,
|
||||
`Email address` varchar(50) NOT NULL,
|
||||
`EducationLevel_cd` int(11) NOT NULL,
|
||||
`MaritalStatus_cd` int(11) NOT NULL,
|
||||
`Number of children` int(11) NOT NULL,
|
||||
`EducationLevel_cd` INT NOT NULL,
|
||||
`MaritalStatus_cd` INT NOT NULL,
|
||||
`Number of children` INT NOT NULL,
|
||||
`Citizenship` varchar(50) NOT NULL,
|
||||
`PovertyStatus_cd` int(11) NOT NULL,
|
||||
`YesNo_cd_Employed` int(11) NOT NULL,
|
||||
`FieldOfEmployment_cd_Field of employment` int(11) DEFAULT NULL,
|
||||
`PovertyStatus_cd` INT NOT NULL,
|
||||
`YesNo_cd_Employed` INT NOT NULL,
|
||||
`FieldOfEmployment_cd_Field of employment` INT 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,
|
||||
`YesNo_cd_Self employed` int(11) NOT NULL,
|
||||
`FieldOfEmployment_cd_Field of self-employment` int(11) DEFAULT NULL,
|
||||
`YesNo_cd_Self employed` INT NOT NULL,
|
||||
`FieldOfEmployment_cd_Field of self-employment` INT DEFAULT NULL,
|
||||
`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 net income of business activity` decimal(19,6) DEFAULT NULL,
|
||||
`Monthly rent` decimal(19,6) DEFAULT NULL,
|
||||
`Other income generating activities` varchar(100) DEFAULT NULL,
|
||||
`YesNo_cd_Bookkeeping` int(11) DEFAULT NULL,
|
||||
`YesNo_cd_Loans with other institutions` int(11) NOT NULL,
|
||||
`YesNo_cd_Bookkeeping` INT DEFAULT NULL,
|
||||
`YesNo_cd_Loans with other institutions` INT NOT NULL,
|
||||
`From whom` varchar(100) DEFAULT NULL,
|
||||
`Amount` decimal(19,6) DEFAULT NULL,
|
||||
`Interest rate pa` decimal(19,6) DEFAULT NULL,
|
||||
`Number of people depending on overal income` int(11) NOT NULL,
|
||||
`YesNo_cd_Bank account` int(11) NOT NULL,
|
||||
`YesNo_cd_Business plan provided` int(11) NOT NULL,
|
||||
`YesNo_cd_Access to internet` int(11) DEFAULT NULL,
|
||||
`Number of people depending on overal income` INT NOT NULL,
|
||||
`YesNo_cd_Bank account` INT NOT NULL,
|
||||
`YesNo_cd_Business plan provided` INT NOT NULL,
|
||||
`YesNo_cd_Access to internet` INT DEFAULT NULL,
|
||||
`Introduced by` varchar(100) DEFAULT NULL,
|
||||
`Known to introducer since` varchar(100) NOT NULL,
|
||||
`Last visited by` varchar(100) DEFAULT NULL,
|
||||
`Last visited on` date NOT NULL,
|
||||
PRIMARY KEY (`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`;
|
||||
CREATE TABLE `impact measurement` (
|
||||
`loan_id` bigint(20) NOT NULL,
|
||||
`YesNo_cd_RepaidOnSchedule` int(11) NOT NULL,
|
||||
`loan_id` BIGINT NOT NULL,
|
||||
`YesNo_cd_RepaidOnSchedule` INT NOT NULL,
|
||||
`ReasonNotRepaidOnSchedule` text DEFAULT NULL,
|
||||
`How was Loan Amount Invested` text NOT NULL,
|
||||
`Additional Income Generated` decimal(19,6) NOT NULL,
|
||||
`Additional Income Used For` text NOT NULL,
|
||||
`YesNo_cd_NewJobsCreated` int(11) NOT NULL,
|
||||
`Number of Jobs Created` bigint(20) DEFAULT NULL,
|
||||
`YesNo_cd_NewJobsCreated` INT NOT NULL,
|
||||
`Number of Jobs Created` BIGINT DEFAULT NULL,
|
||||
PRIMARY KEY (`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`;
|
||||
CREATE TABLE `loan additional data` (
|
||||
`loan_id` bigint(20) NOT NULL,
|
||||
`PurposeOfLoan_cd` int(11) NOT NULL,
|
||||
`CollateralType_cd` int(11) NOT NULL,
|
||||
`loan_id` BIGINT NOT NULL,
|
||||
`PurposeOfLoan_cd` INT NOT NULL,
|
||||
`CollateralType_cd` INT 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 relation` varchar(100) DEFAULT NULL,
|
||||
`Guarantor address` varchar(100) DEFAULT NULL,
|
||||
`Guarantor telephone number` varchar(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`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
|
||||
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`;
|
||||
CREATE TABLE `extra_client_details` (
|
||||
`client_id` bigint(20) NOT NULL,
|
||||
`client_id` BIGINT NOT NULL,
|
||||
`Business Description` varchar(100) DEFAULT NULL,
|
||||
`Years in Business` int(11) DEFAULT NULL,
|
||||
`Gender_cd` int(11) DEFAULT NULL,
|
||||
`Years in Business` INT DEFAULT NULL,
|
||||
`Gender_cd` INT DEFAULT NULL,
|
||||
`Education_cv` varchar(60) DEFAULT NULL,
|
||||
`Next Visit` date DEFAULT NULL,
|
||||
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
|
||||
`Comment` text,
|
||||
PRIMARY KEY (`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`;
|
||||
CREATE TABLE `extra_family_details` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`client_id` bigint(20) NOT NULL,
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`client_id` BIGINT NOT NULL,
|
||||
`Name` varchar(40) DEFAULT NULL,
|
||||
`Date of Birth` date DEFAULT NULL,
|
||||
`Points Score` int(11) DEFAULT NULL,
|
||||
`Education_cd_Highest` int(11) DEFAULT NULL,
|
||||
`Points Score` INT DEFAULT NULL,
|
||||
`Education_cd_Highest` INT DEFAULT NULL,
|
||||
`Other Notes` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `FK_Extra Family Details Data_1` (`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`;
|
||||
CREATE TABLE `extra_loan_details` (
|
||||
`loan_id` bigint(20) NOT NULL,
|
||||
`loan_id` BIGINT NOT NULL,
|
||||
`Business Description` varchar(100) DEFAULT NULL,
|
||||
`Years in Business` int(11) DEFAULT NULL,
|
||||
`Gender_cd` int(11) DEFAULT NULL,
|
||||
`Years in Business` INT DEFAULT NULL,
|
||||
`Gender_cd` INT DEFAULT NULL,
|
||||
`Education_cv` varchar(60) DEFAULT NULL,
|
||||
`Next Visit` date DEFAULT NULL,
|
||||
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
|
||||
`Comment` text,
|
||||
PRIMARY KEY (`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
|
||||
INSERT INTO `x_registered_table`
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
DROP TABLE IF EXISTS `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,
|
||||
`assets_cash` 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,
|
||||
PRIMARY KEY (`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`;
|
||||
CREATE TABLE `latam_extra_client_details` (
|
||||
`client_id` bigint(20) NOT NULL,
|
||||
`client_id` BIGINT NOT NULL,
|
||||
`Business Description` varchar(100) DEFAULT NULL,
|
||||
`Years in Business` int(11) DEFAULT NULL,
|
||||
`Gender_cd` int(11) DEFAULT NULL,
|
||||
`Years in Business` INT DEFAULT NULL,
|
||||
`Gender_cd` INT DEFAULT NULL,
|
||||
`Education_cv` varchar(60) DEFAULT NULL,
|
||||
`Next Visit` date DEFAULT NULL,
|
||||
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
|
||||
`Comment` text,
|
||||
PRIMARY KEY (`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`;
|
||||
CREATE TABLE `latam_family_details` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`client_id` bigint(20) NOT NULL,
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`client_id` BIGINT NOT NULL,
|
||||
`Name` varchar(40) DEFAULT NULL,
|
||||
`Date of Birth` date DEFAULT NULL,
|
||||
`Points Score` int(11) DEFAULT NULL,
|
||||
`Education_cd_Highest` int(11) DEFAULT NULL,
|
||||
`Points Score` INT DEFAULT NULL,
|
||||
`Education_cd_Highest` INT DEFAULT NULL,
|
||||
`Other Notes` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `FK_Extra Family Details Data_1` (`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`;
|
||||
CREATE TABLE `latam_extra_loan_details` (
|
||||
`loan_id` bigint(20) NOT NULL,
|
||||
`loan_id` BIGINT NOT NULL,
|
||||
`Business Description` varchar(100) DEFAULT NULL,
|
||||
`Years in Business` int(11) DEFAULT NULL,
|
||||
`Gender_cd` int(11) DEFAULT NULL,
|
||||
`Years in Business` INT DEFAULT NULL,
|
||||
`Gender_cd` INT DEFAULT NULL,
|
||||
`Education_cv` varchar(60) DEFAULT NULL,
|
||||
`Next Visit` date DEFAULT NULL,
|
||||
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
|
||||
`Comment` text,
|
||||
PRIMARY KEY (`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);
|
||||
|
||||
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.
|
||||
*/
|
||||
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")
|
||||
|
||||
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(
|
||||
// [group: 'javax.servlet', name: 'servlet-api', version: '2.5'],
|
||||
)
|
||||
// Never use "compile" scope, but make all dependencies either 'implementation', 'runtimeOnly' or 'testCompile'.
|
||||
// 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(
|
||||
// [group: 'ch.vorburger.mariaDB4j', name: 'mariaDB4j', version: '2.1.3'],
|
||||
// implementation dependencies are directly used (compiled against) in src/main (and src/test)
|
||||
//
|
||||
implementation(
|
||||
//'ch.vorburger.mariaDB4j:mariaDB4j:2.4.0',
|
||||
|
||||
[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],
|
||||
'org.springframework.boot:spring-boot-starter-web',
|
||||
'org.springframework.boot:spring-boot-starter-security',
|
||||
'org.springframework.boot:spring-boot-starter-cache',
|
||||
|
||||
[group: 'org.apache.openjpa', name:'openjpa-all', version: openJPAVersion],
|
||||
//[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],
|
||||
'org.springframework:spring-jms',
|
||||
'org.springframework:spring-context-support',
|
||||
'org.springframework.security.oauth:spring-security-oauth2',
|
||||
|
||||
[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'],
|
||||
'com.sun.jersey:jersey-servlet',
|
||||
'com.sun.jersey:jersey-server',
|
||||
'com.sun.jersey:jersey-json',
|
||||
'com.sun.jersey.contribs:jersey-spring',
|
||||
'com.sun.jersey.contribs:jersey-multipart',
|
||||
|
||||
'joda-time:joda-time',
|
||||
'com.google.code.gson:gson',
|
||||
'com.sun.jersey:jersey-core',
|
||||
'com.squareup.retrofit:retrofit',
|
||||
'jakarta.jms:jakarta.jms-api',
|
||||
'jakarta.management.j2ee:jakarta.management.j2ee-api',
|
||||
|
||||
[group: 'com.google.code.gson', name: 'gson', version: '2.2.4'],
|
||||
[group: 'com.google.guava', name: 'guava', version: '15.0'],
|
||||
'com.squareup.okhttp:okhttp',
|
||||
'com.squareup.okhttp:okhttp-urlconnection',
|
||||
|
||||
[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'],
|
||||
'org.apache.commons:commons-email',
|
||||
'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',
|
||||
|
||||
// no slf4j & logback here (anymore), as spring-boot-starter-logging already brings this now, better assembled (log4j-over-slf4j was originally forgotten here)
|
||||
'org.drizzle.jdbc:drizzle-jdbc',
|
||||
'org.flywaydb:flyway-core',
|
||||
|
||||
//[group: 'mysql', name: 'mysql-connector-java', version: '5.1.27'],
|
||||
[group: 'org.drizzle.jdbc', name: 'drizzle-jdbc', version: '1.4'],
|
||||
// [group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: tomcatVersion],
|
||||
'com.github.librepdf:openpdf',
|
||||
'com.github.spullara.mustache.java:compiler',
|
||||
'com.jayway.jsonpath:json-path',
|
||||
|
||||
// JAX-B dependencies for JDK 9+
|
||||
'jakarta.xml.bind:jakarta.xml.bind-api',
|
||||
'org.dom4j:dom4j',
|
||||
|
||||
[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'],
|
||||
'javax.cache:cache-api',
|
||||
|
||||
[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']
|
||||
'com.github.spotbugs:spotbugs-annotations',
|
||||
)
|
||||
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: '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']
|
||||
// runtimeOnly dependencies are things that Fineract code has no direct compile time dependency on, but which must be present at run-time
|
||||
runtimeOnly(
|
||||
'org.apache.bval:org.apache.bval.bundle',
|
||||
'org.springframework.boot:spring-boot-starter-actuator',
|
||||
|
||||
// Although fineract (at the time of writing) doesn't have any compile time dep. on httpclient,
|
||||
// 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
|
||||
'org.apache.httpcomponents:httpclient',
|
||||
)
|
||||
|
||||
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']
|
||||
|
||||
// testCompile dependencies are ONLY used in src/test and/or src/integrationTest, not src/main.
|
||||
// Do NOT repeat dependencies which are ALREADY in implementation or runtimeOnly!
|
||||
//
|
||||
testImplementation( 'org.mockito:mockito-core',
|
||||
'org.mockito:mockito-junit-jupiter',
|
||||
'org.junit.platform:junit-platform-runner', // required to be able to run tests directly under Eclipse, see FINERACT-943 & FINERACT-1021
|
||||
'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
|
||||
buildType=BUILD
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,6 +1,5 @@
|
||||
#Fri Jan 29 13:04:36 IST 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
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
|
||||
@@ -17,4 +17,12 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
@@ -18,4 +18,12 @@
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
@@ -18,4 +18,12 @@
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
@@ -18,4 +18,12 @@
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
+102
-102
@@ -18,10 +18,14 @@
|
||||
*/
|
||||
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.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.CenterDomain;
|
||||
import org.apache.fineract.integrationtests.common.CenterHelper;
|
||||
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.system.AccountNumberPreferencesHelper;
|
||||
import org.apache.fineract.integrationtests.common.system.CodeHelper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
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;
|
||||
|
||||
public class AccountNumberPreferencesTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(AccountNumberPreferencesTest.class);
|
||||
private RequestSpecification requestSpec;
|
||||
private ResponseSpecification responseSpec;
|
||||
private ResponseSpecification responseValidationError;
|
||||
@@ -86,8 +87,8 @@ public class AccountNumberPreferencesTest {
|
||||
private Integer groupID;
|
||||
private Integer centerId;
|
||||
private String groupAccountNo;
|
||||
|
||||
@Before
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -151,15 +152,15 @@ public class AccountNumberPreferencesTest {
|
||||
Integer id = (Integer) preferenceId.get("id");
|
||||
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 */
|
||||
System.out
|
||||
.println("---------------------------------DELETING ACCOUNT NUMBER PREFERENCE WITH INVALID ID------------------------------------------");
|
||||
LOG.info(
|
||||
"---------------------------------DELETING ACCOUNT NUMBER PREFERENCE WITH INVALID ID------------------------------------------");
|
||||
|
||||
HashMap<String, Object> deletionError = this.accountNumberPreferencesHelper.deleteAccountNumberPreference(10,
|
||||
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() {
|
||||
@@ -180,28 +181,28 @@ public class AccountNumberPreferencesTest {
|
||||
}
|
||||
|
||||
private void createAccountNumberPreference() {
|
||||
this.clientAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createClientAccountNumberPreference(
|
||||
this.responseSpec, "resourceId");
|
||||
System.out.println("Successfully created account number preferences for Client (ID: " + this.clientAccountNumberPreferenceId);
|
||||
this.clientAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
|
||||
.createClientAccountNumberPreference(this.responseSpec, "resourceId");
|
||||
LOG.info("Successfully created account number preferences for Client (ID: {})", this.clientAccountNumberPreferenceId);
|
||||
|
||||
this.loanAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createLoanAccountNumberPreference(
|
||||
this.responseSpec, "resourceId");
|
||||
System.out.println("Successfully created account number preferences for Loan (ID: " + this.loanAccountNumberPreferenceId);
|
||||
this.loanAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
|
||||
.createLoanAccountNumberPreference(this.responseSpec, "resourceId");
|
||||
LOG.info("Successfully created account number preferences for Loan (ID: {} )", this.loanAccountNumberPreferenceId);
|
||||
|
||||
this.savingsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createSavingsAccountNumberPreference(
|
||||
this.responseSpec, "resourceId");
|
||||
System.out.println("Successfully created account number preferences for Savings (ID: " + this.savingsAccountNumberPreferenceId);
|
||||
|
||||
this.groupsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createGroupsAccountNumberPreference(
|
||||
this.responseSpec, "resourceId");
|
||||
System.out.println("Successfully created account number preferences for Groups (ID: " + this.groupsAccountNumberPreferenceId);
|
||||
|
||||
this.centerAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createCenterAccountNumberPreference(
|
||||
this.responseSpec, "resourceId");
|
||||
System.out.println("Successfully created account number preferences for Center (ID: " + this.centerAccountNumberPreferenceId);
|
||||
this.savingsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
|
||||
.createSavingsAccountNumberPreference(this.responseSpec, "resourceId");
|
||||
LOG.info("Successfully created account number preferences for Savings (ID: {})", this.savingsAccountNumberPreferenceId);
|
||||
|
||||
this.groupsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
|
||||
.createGroupsAccountNumberPreference(this.responseSpec, "resourceId");
|
||||
LOG.info("Successfully created account number preferences for Groups (ID: {})", this.groupsAccountNumberPreferenceId);
|
||||
|
||||
this.centerAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
|
||||
.createCenterAccountNumberPreference(this.responseSpec, "resourceId");
|
||||
LOG.info("Successfully created account number preferences for Center (ID: {})", this.centerAccountNumberPreferenceId);
|
||||
|
||||
this.accountNumberPreferencesHelper.verifyCreationOfAccountNumberPreferences(this.clientAccountNumberPreferenceId,
|
||||
this.loanAccountNumberPreferenceId, this.savingsAccountNumberPreferenceId, this.groupsAccountNumberPreferenceId,
|
||||
this.loanAccountNumberPreferenceId, this.savingsAccountNumberPreferenceId, this.groupsAccountNumberPreferenceId,
|
||||
this.centerAccountNumberPreferenceId, this.responseSpec, this.requestSpec);
|
||||
|
||||
this.createAccountNumberPreferenceInvalidData("1000", "1001");
|
||||
@@ -211,13 +212,13 @@ public class AccountNumberPreferencesTest {
|
||||
|
||||
private void createAccountNumberPreferenceDuplicateData(final String accountType, final String prefixType) {
|
||||
/* Creating account Preference with duplicate data should fail */
|
||||
System.out
|
||||
.println("---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH DUPLICATE DATA------------------------------------------");
|
||||
LOG.info(
|
||||
"---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH DUPLICATE DATA------------------------------------------");
|
||||
|
||||
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper.createAccountNumberPreferenceWithInvalidData(
|
||||
this.responseForbiddenError, accountType, prefixType, "");
|
||||
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper
|
||||
.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));
|
||||
|
||||
}
|
||||
@@ -225,48 +226,48 @@ public class AccountNumberPreferencesTest {
|
||||
private void createAccountNumberPreferenceInvalidData(final String accountType, final String prefixType) {
|
||||
|
||||
/* Creating account Preference with invalid data should fail */
|
||||
System.out
|
||||
.println("---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
|
||||
LOG.info(
|
||||
"---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
|
||||
|
||||
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper.createAccountNumberPreferenceWithInvalidData(
|
||||
this.responseValidationError, accountType, prefixType, "");
|
||||
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper
|
||||
.createAccountNumberPreferenceWithInvalidData(this.responseValidationError, accountType, prefixType, "");
|
||||
|
||||
if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals(
|
||||
"validation.msg.accountNumberFormat.accountType.is.not.within.expected.range")) {
|
||||
Assert.assertEquals("validation.msg.accountNumberFormat.accountType.is.not.within.expected.range",
|
||||
if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)
|
||||
.equals("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));
|
||||
} else if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals(
|
||||
"validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations")) {
|
||||
Assert.assertEquals("validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations",
|
||||
} else if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)
|
||||
.equals("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));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAccountNumberPreference() {
|
||||
HashMap<String, Object> accountNumberPreferences = this.accountNumberPreferencesHelper.updateAccountNumberPreference(
|
||||
this.clientAccountNumberPreferenceId, "101", this.responseSpec, "");
|
||||
HashMap<String, Object> accountNumberPreferences = this.accountNumberPreferencesHelper
|
||||
.updateAccountNumberPreference(this.clientAccountNumberPreferenceId, "101", this.responseSpec, "");
|
||||
|
||||
System.out.println("--------------------------UPDATION SUCCESSFUL FOR ACCOUNT NUMBER PREFERENCE ID "
|
||||
+ accountNumberPreferences.get("resourceId"));
|
||||
LOG.info("--------------------------UPDATION SUCCESSFUL FOR ACCOUNT NUMBER PREFERENCE ID {}",
|
||||
accountNumberPreferences.get("resourceId"));
|
||||
|
||||
this.accountNumberPreferencesHelper.verifyUpdationOfAccountNumberPreferences((Integer) accountNumberPreferences.get("resourceId"),
|
||||
this.responseSpec, this.requestSpec);
|
||||
|
||||
/* Update invalid account preference id should fail */
|
||||
System.out
|
||||
.println("---------------------------------UPDATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
|
||||
LOG.info(
|
||||
"---------------------------------UPDATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
|
||||
|
||||
/* Invalid Account Type */
|
||||
HashMap<String, Object> updationError = this.accountNumberPreferencesHelper.updateAccountNumberPreference(9999, "101",
|
||||
this.responseNotFoundError, "");
|
||||
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 */
|
||||
HashMap<String, Object> updationError1 = this.accountNumberPreferencesHelper.updateAccountNumberPreference(
|
||||
this.clientAccountNumberPreferenceId, "103", this.responseValidationError, "");
|
||||
HashMap<String, Object> updationError1 = this.accountNumberPreferencesHelper
|
||||
.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));
|
||||
|
||||
}
|
||||
|
||||
@@ -278,7 +279,7 @@ public class AccountNumberPreferencesTest {
|
||||
this.createAndValidateClientWithoutAccountPreference();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void createAndValidateGroup(Boolean isAccountPreferenceSetUp) {
|
||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||
this.groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec);
|
||||
@@ -286,25 +287,25 @@ public class AccountNumberPreferencesTest {
|
||||
|
||||
this.groupID = GroupHelper.activateGroup(this.requestSpec, this.responseSpec, groupID.toString());
|
||||
GroupHelper.verifyGroupActivatedOnServer(this.requestSpec, this.responseSpec, groupID, true);
|
||||
|
||||
|
||||
final String GROUP_URL = "/fineract-provider/api/v1/groups/" + this.groupID + "?" + Utils.TENANT_IDENTIFIER;
|
||||
this.groupAccountNo = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "accountNo");
|
||||
|
||||
|
||||
if (isAccountPreferenceSetUp) {
|
||||
String groupsPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
||||
this.groupsAccountNumberPreferenceId, "prefixType.value");
|
||||
|
||||
String groupsPrefixName = (String) this.accountNumberPreferencesHelper
|
||||
.getAccountNumberPreference(this.groupsAccountNumberPreferenceId, "prefixType.value");
|
||||
|
||||
if (groupsPrefixName.equals(this.officeName)) {
|
||||
|
||||
|
||||
final String groupOfficeName = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "officeName");
|
||||
|
||||
|
||||
this.validateAccountNumberLengthAndStartsWithPrefix(this.groupAccountNo, groupOfficeName);
|
||||
}
|
||||
} else {
|
||||
validateAccountNumberLengthAndStartsWithPrefix(this.groupAccountNo, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void createAndValidateCenter(Boolean isAccountPreferenceSetUp) {
|
||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||
Integer officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007");
|
||||
@@ -312,27 +313,26 @@ public class AccountNumberPreferencesTest {
|
||||
String name = "CenterCreation" + new Timestamp(new java.util.Date().getTime());
|
||||
this.centerId = CenterHelper.createCenter(name, officeId, requestSpec, responseSpec);
|
||||
CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec);
|
||||
Assert.assertNotNull(center);
|
||||
Assert.assertTrue(center.getName().equals(name));
|
||||
|
||||
Assertions.assertNotNull(center);
|
||||
Assertions.assertTrue(center.getName().equals(name));
|
||||
|
||||
if (isAccountPreferenceSetUp) {
|
||||
String centerPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
||||
this.centerAccountNumberPreferenceId, "prefixType.value");
|
||||
String centerPrefixName = (String) this.accountNumberPreferencesHelper
|
||||
.getAccountNumberPreference(this.centerAccountNumberPreferenceId, "prefixType.value");
|
||||
final String CENTER_URL = "/fineract-provider/api/v1/centers/" + this.centerId + "?" + Utils.TENANT_IDENTIFIER;
|
||||
|
||||
|
||||
if (centerPrefixName.equals(this.officeName)) {
|
||||
final String centerOfficeName = Utils.performServerGet(requestSpec, responseSpec, CENTER_URL, "officeName");
|
||||
final String centerOfficeName = Utils.performServerGet(requestSpec, responseSpec, CENTER_URL, "officeName");
|
||||
this.validateAccountNumberLengthAndStartsWithPrefix(center.getAccountNo(), centerOfficeName);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
validateAccountNumberLengthAndStartsWithPrefix(center.getAccountNo(), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void createAndValidateClientWithoutAccountPreference() {
|
||||
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");
|
||||
validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, null);
|
||||
}
|
||||
@@ -340,8 +340,8 @@ public class AccountNumberPreferencesTest {
|
||||
private void createAndValidateClientBasedOnAccountPreference() {
|
||||
final String codeName = "ClientType";
|
||||
String clientAccountNo = null;
|
||||
String clientPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
||||
this.clientAccountNumberPreferenceId, "prefixType.value");
|
||||
String clientPrefixName = (String) this.accountNumberPreferencesHelper
|
||||
.getAccountNumberPreference(this.clientAccountNumberPreferenceId, "prefixType.value");
|
||||
if (clientPrefixName.equals(this.clientTypeName)) {
|
||||
|
||||
/* Retrieve Code id for the Code "ClientType" */
|
||||
@@ -359,14 +359,14 @@ public class AccountNumberPreferencesTest {
|
||||
this.clientId = ClientHelper.createClientForAccountPreference(this.requestSpec, this.responseSpec, this.clientCodeValueId,
|
||||
"clientId");
|
||||
|
||||
Assert.assertNotNull(clientId);
|
||||
Assertions.assertNotNull(clientId);
|
||||
|
||||
clientAccountNo = (String) ClientHelper.getClient(this.requestSpec, this.responseSpec, this.clientId.toString(), "accountNo");
|
||||
this.validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, this.clientCodeValueName);
|
||||
|
||||
} else if (clientPrefixName.equals(this.officeName)) {
|
||||
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(clientId);
|
||||
Assertions.assertNotNull(clientId);
|
||||
clientAccountNo = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "accountNo");
|
||||
String officeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "officeName");
|
||||
this.validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, officeName);
|
||||
@@ -375,31 +375,31 @@ public class AccountNumberPreferencesTest {
|
||||
|
||||
private void validateAccountNumberLengthAndStartsWithPrefix(final String accountNumber, String prefix) {
|
||||
if (prefix != null) {
|
||||
prefix = prefix.substring(0, Math.min(prefix.length(), 10));
|
||||
Assert.assertEquals(accountNumber.length(), prefix.length() + 9);
|
||||
Assert.assertTrue(accountNumber.startsWith(prefix));
|
||||
prefix = prefix.substring(0, Math.min(prefix.length(), 10));
|
||||
Assertions.assertEquals(accountNumber.length(), prefix.length() + 9);
|
||||
Assertions.assertTrue(accountNumber.startsWith(prefix));
|
||||
} else {
|
||||
Assert.assertEquals(accountNumber.length(), 9);
|
||||
Assertions.assertEquals(9, accountNumber.length());
|
||||
}
|
||||
}
|
||||
|
||||
private void createLoanProduct() {
|
||||
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)
|
||||
.withNumberOfRepayments(numberOfRepayments).withinterestRatePerPeriod(interestRatePerPeriod)
|
||||
.withInterestRateFrequencyTypeAsYear().build(null);
|
||||
|
||||
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) {
|
||||
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)
|
||||
.withLoanTermFrequency(numberOfRepayments).withLoanTermFrequencyAsMonths().withNumberOfRepayments(numberOfRepayments)
|
||||
@@ -408,15 +408,15 @@ public class AccountNumberPreferencesTest {
|
||||
.withSubmittedOnDate(dateString).withExpectedDisbursementDate(dateString).withPrincipalGrace("2").withInterestGrace("2")
|
||||
.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);
|
||||
String loanAccountNo = (String) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, this.loanId,
|
||||
"accountNo");
|
||||
|
||||
if (isAccountPreferenceSetUp) {
|
||||
String loanPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
||||
this.loanAccountNumberPreferenceId, "prefixType.value");
|
||||
String loanPrefixName = (String) this.accountNumberPreferencesHelper
|
||||
.getAccountNumberPreference(this.loanAccountNumberPreferenceId, "prefixType.value");
|
||||
if (loanPrefixName.equals(this.officeName)) {
|
||||
String loanOfficeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "officeName");
|
||||
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, loanOfficeName);
|
||||
@@ -425,17 +425,17 @@ public class AccountNumberPreferencesTest {
|
||||
this.loanProductId, "shortName");
|
||||
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 {
|
||||
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, null);
|
||||
System.out.println("SUCCESSFULLY CREATED LOAN APPLICATION (ID: " + loanId + ")");
|
||||
LOG.info("SUCCESSFULLY CREATED LOAN APPLICATION (ID: {} )", loanId);
|
||||
}
|
||||
}
|
||||
|
||||
private void createSavingsProduct() {
|
||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||
|
||||
System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
||||
LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
||||
|
||||
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
|
||||
|
||||
@@ -452,7 +452,7 @@ public class AccountNumberPreferencesTest {
|
||||
.withMinRequiredBalance(minRequiredBalance).withEnforceMinRequiredBalance(enforceMinRequiredBalance)
|
||||
.withMinimumOpenningBalance(this.MINIMUM_OPENING_BALANCE).build();
|
||||
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.savingsId = this.savingsAccountHelper
|
||||
.applyForSavingsApplication(this.clientId, this.savingsProductId, ACCOUNT_TYPE_INDIVIDUAL);
|
||||
this.savingsId = this.savingsAccountHelper.applyForSavingsApplication(this.clientId, this.savingsProductId,
|
||||
ACCOUNT_TYPE_INDIVIDUAL);
|
||||
|
||||
String savingsAccountNo = (String) this.savingsAccountHelper.getSavingsAccountDetail(this.savingsId, "accountNo");
|
||||
|
||||
if (isAccountPreferenceSetUp) {
|
||||
String savingsPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
||||
this.savingsAccountNumberPreferenceId, "prefixType.value");
|
||||
String savingsPrefixName = (String) this.accountNumberPreferencesHelper
|
||||
.getAccountNumberPreference(this.savingsAccountNumberPreferenceId, "prefixType.value");
|
||||
|
||||
if (savingsPrefixName.equals(this.officeName)) {
|
||||
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");
|
||||
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 {
|
||||
this.validateAccountNumberLengthAndStartsWithPrefix(savingsAccountNo, null);
|
||||
System.out.println("SUCCESSFULLY CREATED SAVINGS APPLICATION (ID: " + this.savingsId + ")");
|
||||
LOG.info("SUCCESSFULLY CREATED SAVINGS APPLICATION (ID:{} )", this.savingsId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+88
-87
@@ -18,21 +18,25 @@
|
||||
*/
|
||||
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.List;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
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.FinancialActivityAccountHelper;
|
||||
import org.apache.fineract.integrationtests.common.accounting.JournalEntry;
|
||||
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.LoanProductTestBuilder;
|
||||
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.SavingsProductHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
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;
|
||||
|
||||
/**
|
||||
* JUnit Test Cases for Account Transfer for.
|
||||
@@ -58,6 +58,7 @@ import com.jayway.restassured.specification.ResponseSpecification;
|
||||
@SuppressWarnings({ "rawtypes", "unused" })
|
||||
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 ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
|
||||
public static final String ACCOUNT_TRANSFER_AMOUNT = "15000.0";
|
||||
@@ -79,14 +80,14 @@ public class AccountTransferTest {
|
||||
private AccountHelper accountHelper;
|
||||
private JournalEntryHelper journalEntryHelper;
|
||||
|
||||
Float TRANSFER_AMOUNT = new Float(ACCOUNT_TRANSFER_AMOUNT);
|
||||
Float TRANSFER_AMOUNT_ADJUST = new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
||||
Float TRANSFER_AMOUNT = Float.valueOf(ACCOUNT_TRANSFER_AMOUNT);
|
||||
Float TRANSFER_AMOUNT_ADJUST = Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
||||
|
||||
private FinancialActivityAccountHelper financialActivityAccountHelper;
|
||||
private Integer financialActivityAccountId;
|
||||
private Account liabilityTransferAccount;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -101,17 +102,17 @@ public class AccountTransferTest {
|
||||
/** Setup liability transfer account **/
|
||||
/** Create a Liability and an Asset Transfer Account **/
|
||||
liabilityTransferAccount = accountHelper.createLiabilityAccount();
|
||||
Assert.assertNotNull(liabilityTransferAccount);
|
||||
Assertions.assertNotNull(liabilityTransferAccount);
|
||||
|
||||
/*** Create A Financial Activity to Account Mapping **/
|
||||
financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
|
||||
FinancialActivityAccountsTest.liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(),
|
||||
FinancialActivityAccountsTest.LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityTransferAccount.getAccountID(),
|
||||
responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
Assert.assertNotNull(financialActivityAccountId);
|
||||
Assertions.assertNotNull(financialActivityAccountId);
|
||||
} else {
|
||||
for (HashMap financialActivity : financialActivities) {
|
||||
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");
|
||||
liabilityTransferAccount = new Account((Integer) glAccountData.get("id"), AccountType.LIABILITY);
|
||||
financialActivityAccountId = (Integer) financialActivity.get("id");
|
||||
@@ -124,12 +125,12 @@ public class AccountTransferTest {
|
||||
/**
|
||||
* Delete the Liability transfer account
|
||||
*/
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper.deleteFinancialActivityAccount(
|
||||
financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
Assert.assertNotNull(deletedFinancialActivityAccountId);
|
||||
Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
|
||||
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper
|
||||
.deleteFinancialActivityAccount(financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
Assertions.assertNotNull(deletedFinancialActivityAccountId);
|
||||
Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -144,20 +145,20 @@ public class AccountTransferTest {
|
||||
|
||||
OfficeHelper officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec);
|
||||
Integer toOfficeId = officeHelper.createOffice("01 January 2011");
|
||||
Assert.assertNotNull(toOfficeId);
|
||||
Assertions.assertNotNull(toOfficeId);
|
||||
|
||||
// Creating Savings Account to which fund to be Transferred
|
||||
final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
||||
String.valueOf(toOfficeId));
|
||||
Assert.assertNotNull(toClientID);
|
||||
Assertions.assertNotNull(toClientID);
|
||||
|
||||
final Integer toSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, assetAccount,
|
||||
incomeAccount, expenseAccount, liabilityAccount);
|
||||
Assert.assertNotNull(toSavingsProductID);
|
||||
Assertions.assertNotNull(toSavingsProductID);
|
||||
|
||||
final Integer toSavingsID = this.savingsAccountHelper.applyForSavingsApplication(toClientID, toSavingsProductID,
|
||||
ACCOUNT_TYPE_INDIVIDUAL);
|
||||
Assert.assertNotNull(toSavingsProductID);
|
||||
Assertions.assertNotNull(toSavingsProductID);
|
||||
|
||||
HashMap toSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, toSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsPending(toSavingsStatusHashMap);
|
||||
@@ -171,20 +172,20 @@ public class AccountTransferTest {
|
||||
final HashMap toSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
||||
|
||||
Integer fromOfficeId = officeHelper.createOffice("01 January 2011");
|
||||
Assert.assertNotNull(fromOfficeId);
|
||||
Assertions.assertNotNull(fromOfficeId);
|
||||
|
||||
// Creating Savings Account from which the Fund has to be Transferred
|
||||
final Integer fromClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
||||
String.valueOf(fromOfficeId));
|
||||
Assert.assertNotNull(fromClientID);
|
||||
Assertions.assertNotNull(fromClientID);
|
||||
|
||||
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||
assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
||||
Assert.assertNotNull(fromSavingsProductID);
|
||||
Assertions.assertNotNull(fromSavingsProductID);
|
||||
|
||||
final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientID, fromSavingsProductID,
|
||||
ACCOUNT_TYPE_INDIVIDUAL);
|
||||
Assert.assertNotNull(fromSavingsID);
|
||||
Assertions.assertNotNull(fromSavingsID);
|
||||
|
||||
HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap);
|
||||
@@ -197,26 +198,26 @@ public class AccountTransferTest {
|
||||
|
||||
final HashMap fromSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||
|
||||
Float fromSavingsBalance = new Float(MINIMUM_OPENING_BALANCE);
|
||||
Float toSavingsBalance = new Float(MINIMUM_OPENING_BALANCE);
|
||||
Float fromSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||
Float toSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||
|
||||
this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, fromClientID, toSavingsID, FROM_SAVINGS_ACCOUNT_TYPE,
|
||||
TO_SAVINGS_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT);
|
||||
|
||||
fromSavingsBalance -= new Float(ACCOUNT_TRANSFER_AMOUNT);
|
||||
toSavingsBalance += new Float(ACCOUNT_TRANSFER_AMOUNT);
|
||||
fromSavingsBalance -= Float.valueOf(ACCOUNT_TRANSFER_AMOUNT);
|
||||
toSavingsBalance += Float.valueOf(ACCOUNT_TRANSFER_AMOUNT);
|
||||
|
||||
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||
assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance,
|
||||
fromSavingsSummaryAfter.get("accountBalance"));
|
||||
assertEquals(fromSavingsBalance, fromSavingsSummaryAfter.get("accountBalance"),
|
||||
"Verifying From Savings Account Balance after Account Transfer");
|
||||
|
||||
HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
||||
assertEquals("Verifying To Savings Account Balance after Account Transfer", toSavingsBalance,
|
||||
toSavingsSummaryAfter.get("accountBalance"));
|
||||
final JournalEntry[] office1LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT),
|
||||
JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] office2LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT),
|
||||
JournalEntry.TransactionType.DEBIT) };
|
||||
assertEquals(toSavingsBalance, toSavingsSummaryAfter.get("accountBalance"),
|
||||
"Verifying To Savings Account Balance after Account Transfer");
|
||||
final JournalEntry[] office1LiabilityEntries = {
|
||||
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT), JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] office2LiabilityEntries = {
|
||||
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT), JournalEntry.TransactionType.DEBIT) };
|
||||
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
|
||||
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
|
||||
@@ -243,21 +244,21 @@ public class AccountTransferTest {
|
||||
|
||||
OfficeHelper officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec);
|
||||
Integer toOfficeId = officeHelper.createOffice("01 January 2011");
|
||||
Assert.assertNotNull(toOfficeId);
|
||||
Assertions.assertNotNull(toOfficeId);
|
||||
|
||||
// Creating Loan Account to which fund to be Transferred
|
||||
final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
||||
String.valueOf(toOfficeId));
|
||||
Assert.assertNotNull(toClientID);
|
||||
Assertions.assertNotNull(toClientID);
|
||||
|
||||
Account toTransferAccount = accountHelper.createLiabilityAccount();
|
||||
Assert.assertNotNull(toTransferAccount);
|
||||
Assertions.assertNotNull(toTransferAccount);
|
||||
|
||||
final Integer toLoanProductID = createLoanProduct(loanAssetAccount, loanIncomeAccount, loanExpenseAccount, overpaymentAccount);
|
||||
Assert.assertNotNull(toLoanProductID);
|
||||
Assertions.assertNotNull(toLoanProductID);
|
||||
|
||||
final Integer toLoanID = applyForLoanApplication(toClientID, toLoanProductID);
|
||||
Assert.assertNotNull(toLoanID);
|
||||
Assertions.assertNotNull(toLoanID);
|
||||
|
||||
HashMap toLoanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, toLoanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(toLoanStatusHashMap);
|
||||
@@ -269,20 +270,20 @@ public class AccountTransferTest {
|
||||
LoanStatusChecker.verifyLoanIsActive(toLoanStatusHashMap);
|
||||
|
||||
Integer fromOfficeId = officeHelper.createOffice("01 January 2011");
|
||||
Assert.assertNotNull(fromOfficeId);
|
||||
Assertions.assertNotNull(fromOfficeId);
|
||||
|
||||
// Creating Savings Account from which the Fund has to be Transferred
|
||||
final Integer fromClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
||||
String.valueOf(fromOfficeId));
|
||||
Assert.assertNotNull(fromClientID);
|
||||
Assertions.assertNotNull(fromClientID);
|
||||
|
||||
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||
assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
||||
Assert.assertNotNull(fromSavingsProductID);
|
||||
Assertions.assertNotNull(fromSavingsProductID);
|
||||
|
||||
final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientID, fromSavingsProductID,
|
||||
ACCOUNT_TYPE_INDIVIDUAL);
|
||||
Assert.assertNotNull(fromSavingsID);
|
||||
Assertions.assertNotNull(fromSavingsID);
|
||||
|
||||
HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap);
|
||||
@@ -295,7 +296,7 @@ public class AccountTransferTest {
|
||||
|
||||
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,
|
||||
TO_LOAN_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
||||
@@ -303,17 +304,17 @@ public class AccountTransferTest {
|
||||
fromSavingsBalance -= TRANSFER_AMOUNT_ADJUST;
|
||||
|
||||
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||
assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance,
|
||||
fromSavingsSummaryAfter.get("accountBalance"));
|
||||
assertEquals(fromSavingsBalance, fromSavingsSummaryAfter.get("accountBalance"),
|
||||
"Verifying From Savings Account Balance after Account Transfer");
|
||||
|
||||
HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, toLoanID);
|
||||
assertEquals("Verifying To Loan Repayment Amount after Account Transfer", TRANSFER_AMOUNT_ADJUST,
|
||||
toLoanSummaryAfter.get("totalRepayment"));
|
||||
assertEquals(TRANSFER_AMOUNT_ADJUST, toLoanSummaryAfter.get("totalRepayment"),
|
||||
"Verifying To Loan Repayment Amount after Account Transfer");
|
||||
|
||||
final JournalEntry[] office1LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
|
||||
JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] office2LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
|
||||
JournalEntry.TransactionType.DEBIT) };
|
||||
final JournalEntry[] office1LiabilityEntries = {
|
||||
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] office2LiabilityEntries = {
|
||||
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.DEBIT) };
|
||||
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
|
||||
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
|
||||
@@ -339,20 +340,20 @@ public class AccountTransferTest {
|
||||
|
||||
OfficeHelper officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec);
|
||||
Integer toOfficeId = officeHelper.createOffice("01 January 2011");
|
||||
Assert.assertNotNull(toOfficeId);
|
||||
Assertions.assertNotNull(toOfficeId);
|
||||
|
||||
// Creating Loan Account to which fund to be Transferred
|
||||
final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
||||
String.valueOf(toOfficeId));
|
||||
Assert.assertNotNull(toClientID);
|
||||
Assertions.assertNotNull(toClientID);
|
||||
|
||||
final Integer toSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, assetAccount,
|
||||
incomeAccount, expenseAccount, liabilityAccount);
|
||||
Assert.assertNotNull(toSavingsProductID);
|
||||
Assertions.assertNotNull(toSavingsProductID);
|
||||
|
||||
final Integer toSavingsID = this.savingsAccountHelper.applyForSavingsApplication(toClientID, toSavingsProductID,
|
||||
ACCOUNT_TYPE_INDIVIDUAL);
|
||||
Assert.assertNotNull(toSavingsID);
|
||||
Assertions.assertNotNull(toSavingsID);
|
||||
|
||||
HashMap toSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, toSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsPending(toSavingsStatusHashMap);
|
||||
@@ -364,18 +365,18 @@ public class AccountTransferTest {
|
||||
SavingsStatusChecker.verifySavingsIsActive(toSavingsStatusHashMap);
|
||||
|
||||
Integer fromOfficeId = officeHelper.createOffice("01 January 2011");
|
||||
Assert.assertNotNull(fromOfficeId);
|
||||
Assertions.assertNotNull(fromOfficeId);
|
||||
|
||||
// Creating Savings Account from which the Fund has to be Transferred
|
||||
final Integer fromClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011",
|
||||
String.valueOf(fromOfficeId));
|
||||
Assert.assertNotNull(fromClientID);
|
||||
Assertions.assertNotNull(fromClientID);
|
||||
|
||||
final Integer loanProductID = createLoanProduct(loanAssetAccount, loanIncomeAccount, loanExpenseAccount, overpaymentAccount);
|
||||
Assert.assertNotNull(loanProductID);
|
||||
Assertions.assertNotNull(loanProductID);
|
||||
|
||||
final Integer loanID = applyForLoanApplication(fromClientID, loanProductID);
|
||||
Assert.assertNotNull(loanID);
|
||||
Assertions.assertNotNull(loanID);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
@@ -388,11 +389,11 @@ public class AccountTransferTest {
|
||||
|
||||
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||
assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
||||
Assert.assertNotNull(fromSavingsProductID);
|
||||
Assertions.assertNotNull(fromSavingsProductID);
|
||||
|
||||
final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientID, fromSavingsProductID,
|
||||
ACCOUNT_TYPE_INDIVIDUAL);
|
||||
Assert.assertNotNull(fromSavingsID);
|
||||
Assertions.assertNotNull(fromSavingsID);
|
||||
|
||||
HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap);
|
||||
@@ -405,7 +406,7 @@ public class AccountTransferTest {
|
||||
|
||||
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,
|
||||
TO_LOAN_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT);
|
||||
@@ -415,10 +416,10 @@ public class AccountTransferTest {
|
||||
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||
|
||||
// Verifying fromSavings Account Balance after Account Transfer
|
||||
assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance,
|
||||
fromSavingsSummaryAfter.get("accountBalance"));
|
||||
assertEquals(fromSavingsBalance, 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,
|
||||
TO_SAVINGS_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
||||
@@ -428,13 +429,13 @@ public class AccountTransferTest {
|
||||
HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
||||
|
||||
// Verifying toSavings Account Balance after Account Transfer
|
||||
assertEquals("Verifying From Savings Account Balance after Account Transfer", toSavingsBalance,
|
||||
toSavingsSummaryAfter.get("accountBalance"));
|
||||
assertEquals(toSavingsBalance, toSavingsSummaryAfter.get("accountBalance"),
|
||||
"Verifying From Savings Account Balance after Account Transfer");
|
||||
|
||||
final JournalEntry[] office1LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
|
||||
JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] office2LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
|
||||
JournalEntry.TransactionType.DEBIT) };
|
||||
final JournalEntry[] office1LiabilityEntries = {
|
||||
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] office2LiabilityEntries = {
|
||||
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.DEBIT) };
|
||||
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
|
||||
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
|
||||
@@ -445,7 +446,7 @@ public class AccountTransferTest {
|
||||
|
||||
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
final String minOpenningBalance, final Account... accounts) {
|
||||
System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
||||
LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
||||
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
|
||||
final String savingsProductJSON = savingsProductHelper //
|
||||
.withInterestCompoundingPeriodTypeAsDaily() //
|
||||
@@ -456,7 +457,7 @@ public class AccountTransferTest {
|
||||
}
|
||||
|
||||
private Integer createLoanProduct(final Account... accounts) {
|
||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
final String loanProductJSON = new LoanProductTestBuilder() //
|
||||
.withPrincipal("8,000.00") //
|
||||
.withNumberOfRepayments("4") //
|
||||
@@ -472,7 +473,7 @@ public class AccountTransferTest {
|
||||
}
|
||||
|
||||
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("8,000.00") //
|
||||
.withLoanTermFrequency("4") //
|
||||
@@ -489,4 +490,4 @@ public class AccountTransferTest {
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+195
-221
@@ -18,8 +18,13 @@
|
||||
*/
|
||||
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.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
@@ -30,7 +35,6 @@ import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
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.joda.time.Days;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
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;
|
||||
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({ "unchecked" })
|
||||
|
||||
@SuppressWarnings({ "unused", "rawtypes", "unchecked", "static-access" })
|
||||
public class AccountingScenarioIntegrationTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(AccountingScenarioIntegrationTest.class);
|
||||
private static RequestSpecification requestSpec;
|
||||
private static ResponseSpecification responseSpec;
|
||||
|
||||
@@ -89,13 +91,14 @@ public class AccountingScenarioIntegrationTest {
|
||||
public static final String WITHDRAWAL_AMOUNT = "3000";
|
||||
public static final String WITHDRAWAL_AMOUNT_ADJUSTED = "2000";
|
||||
|
||||
Float SP_BALANCE = new Float(MINIMUM_OPENING_BALANCE);
|
||||
Float SP_DEPOSIT_AMOUNT = new Float(DEPOSIT_AMOUNT);
|
||||
Float SP_WITHDRAWAL_AMOUNT = new Float(WITHDRAWAL_AMOUNT);
|
||||
Float SP_WITHDRAWAL_AMOUNT_ADJUSTED = new Float(WITHDRAWAL_AMOUNT_ADJUSTED);
|
||||
Float SP_BALANCE = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||
Float SP_DEPOSIT_AMOUNT = Float.valueOf(DEPOSIT_AMOUNT);
|
||||
Float SP_WITHDRAWAL_AMOUNT = Float.valueOf(WITHDRAWAL_AMOUNT);
|
||||
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 Float REPAYMENT_AMOUNT[] = { .0f, 2200.0f, 3000.0f, 900.0f, 2000.0f, 2500.0f };
|
||||
private final String[] REPAYMENT_DATE = { "", "04 May 2011", "04 July 2011", "04 September 2011", "04 November 2011",
|
||||
"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 LoanTransactionHelper loanTransactionHelper;
|
||||
@@ -109,18 +112,18 @@ public class AccountingScenarioIntegrationTest {
|
||||
private SchedulerJobHelper schedulerJobHelper;
|
||||
private PeriodicAccrualAccountingHelper periodicAccrualAccountingHelper;
|
||||
|
||||
@Before
|
||||
@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();
|
||||
requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||
responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
|
||||
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
|
||||
this.periodicAccrualAccountingHelper = new PeriodicAccrualAccountingHelper(this.requestSpec, this.responseSpec);
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
|
||||
this.accountHelper = new AccountHelper(requestSpec, responseSpec);
|
||||
this.journalEntryHelper = new JournalEntryHelper(requestSpec, responseSpec);
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
this.periodicAccrualAccountingHelper = new PeriodicAccrualAccountingHelper(requestSpec, responseSpec);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -133,10 +136,10 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer loanProductID = createLoanProductWithUpfrontAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||
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);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
@@ -147,19 +150,19 @@ public class AccountingScenarioIntegrationTest {
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
// CHECK ACCOUNT ENTRIES
|
||||
System.out.println("Entries ......");
|
||||
LOG.info("Entries ......");
|
||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||
final float TOTAL_INTEREST = 1000.0f;
|
||||
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.DEBIT), };
|
||||
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);
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.EXPECTED_DISBURSAL_DATE, incomeJournalEntry);
|
||||
|
||||
// MAKE 1
|
||||
System.out.println("Repayment 1 ......");
|
||||
LOG.info("Repayment 1 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], this.REPAYMENT_AMOUNT[1], loanID);
|
||||
final float FIRST_INTEREST = 200.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),
|
||||
new JournalEntry(FIRST_INTEREST + FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
|
||||
System.out.println("Repayment 1 Done......");
|
||||
LOG.info("Repayment 1 Done......");
|
||||
|
||||
// REPAYMENT 2
|
||||
System.out.println("Repayment 2 ......");
|
||||
LOG.info("Repayment 2 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
|
||||
final float SECOND_AND_THIRD_INTEREST = 400.0f;
|
||||
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),
|
||||
new JournalEntry(SECOND_AND_THIRD_INTEREST + SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
|
||||
System.out.println("Repayment 2 Done ......");
|
||||
LOG.info("Repayment 2 Done ......");
|
||||
|
||||
// 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);
|
||||
|
||||
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);
|
||||
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, this.REPAYMENT_DATE[4], expenseJournalEntry);
|
||||
System.out.println("Waive Interest Done......");
|
||||
LOG.info("Waive Interest Done......");
|
||||
|
||||
// REPAYMENT 3
|
||||
System.out.println("Repayment 3 ......");
|
||||
LOG.info("Repayment 3 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
|
||||
System.out.println("Repayment 3 Done ......");
|
||||
LOG.info("Repayment 3 Done ......");
|
||||
|
||||
// REPAYMENT 4
|
||||
System.out.println("Repayment 4 ......");
|
||||
LOG.info("Repayment 4 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
|
||||
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
|
||||
System.out.println("Repayment 4 Done ......");
|
||||
LOG.info("Repayment 4 Done ......");
|
||||
|
||||
// Repayment 5
|
||||
System.out.println("Repayment 5 ......");
|
||||
LOG.info("Repayment 5 ......");
|
||||
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
|
||||
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) {
|
||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||
@@ -235,7 +238,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
}
|
||||
|
||||
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())
|
||||
.withLoanTermFrequency(this.LOAN_TERM_FREQUENCY).withLoanTermFrequencyAsMonths().withNumberOfRepayments(this.LP_REPAYMENTS)
|
||||
.withRepaymentEveryAfter(this.LP_REPAYMENT_PERIOD).withRepaymentFrequencyTypeAsMonths()
|
||||
@@ -248,7 +251,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
@Test
|
||||
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 incomeAccount = this.accountHelper.createIncomeAccount();
|
||||
@@ -258,10 +261,10 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer savingsProductID = createSavingsProduct(MINIMUM_OPENING_BALANCE, assetAccount, incomeAccount, expenseAccount,
|
||||
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);
|
||||
|
||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsID);
|
||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(requestSpec, responseSpec, savingsID);
|
||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||
|
||||
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[] liablilityAccountInitialEntry = { new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountInitialEntry);
|
||||
this.journalEntryHelper
|
||||
.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE, liablilityAccountInitialEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
||||
liablilityAccountInitialEntry);
|
||||
|
||||
// First Transaction-Deposit
|
||||
this.savingsAccountHelper.depositToSavingsAccount(savingsID, DEPOSIT_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE,
|
||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
Float balance = SP_BALANCE + SP_DEPOSIT_AMOUNT;
|
||||
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----------------------------");
|
||||
final JournalEntry[] assetAccountFirstTransactionEntry = { new JournalEntry(this.SP_DEPOSIT_AMOUNT,
|
||||
JournalEntry.TransactionType.DEBIT) };
|
||||
final JournalEntry[] liabililityAccountFirstTransactionEntry = { new JournalEntry(this.SP_DEPOSIT_AMOUNT,
|
||||
JournalEntry.TransactionType.CREDIT) };
|
||||
LOG.info("----------------------Verifying Journal Entry after the Transaction Deposit----------------------------");
|
||||
final JournalEntry[] assetAccountFirstTransactionEntry = {
|
||||
new JournalEntry(this.SP_DEPOSIT_AMOUNT, JournalEntry.TransactionType.DEBIT) };
|
||||
final JournalEntry[] liabililityAccountFirstTransactionEntry = {
|
||||
new JournalEntry(this.SP_DEPOSIT_AMOUNT, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountFirstTransactionEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
||||
liabililityAccountFirstTransactionEntry);
|
||||
@@ -298,40 +301,39 @@ public class AccountingScenarioIntegrationTest {
|
||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
balance -= SP_WITHDRAWAL_AMOUNT;
|
||||
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----------------------");
|
||||
final JournalEntry[] assetAccountSecondTransactionEntry = { new JournalEntry(this.SP_WITHDRAWAL_AMOUNT,
|
||||
JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] liabililityAccountSecondTransactionEntry = { new JournalEntry(this.SP_WITHDRAWAL_AMOUNT,
|
||||
JournalEntry.TransactionType.DEBIT) };
|
||||
LOG.info("-------------------Verifying Journal Entry after the Transaction Withdrawal----------------------");
|
||||
final JournalEntry[] assetAccountSecondTransactionEntry = {
|
||||
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT, JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] liabililityAccountSecondTransactionEntry = {
|
||||
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT, JournalEntry.TransactionType.DEBIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountSecondTransactionEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
||||
liabililityAccountSecondTransactionEntry);
|
||||
|
||||
// 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());
|
||||
Assert.assertNotNull(withdrawalChargeId);
|
||||
Assertions.assertNotNull(withdrawalChargeId);
|
||||
|
||||
this.savingsAccountHelper.addChargesForSavings(savingsID, withdrawalChargeId, false);
|
||||
ArrayList<HashMap> chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsID);
|
||||
Assert.assertEquals(1, chargesPendingState.size());
|
||||
Assertions.assertEquals(1, chargesPendingState.size());
|
||||
HashMap savingsChargeForPay = chargesPendingState.get(0);
|
||||
HashMap paidCharge = this.savingsAccountHelper.getSavingsCharge(savingsID, (Integer) savingsChargeForPay.get("id"));
|
||||
Float chargeAmount = (Float) paidCharge.get("amount");
|
||||
|
||||
// Withdrawal after adding Charge of type Withdrawal Fee
|
||||
this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsID, WITHDRAWAL_AMOUNT_ADJUSTED,
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsID, WITHDRAWAL_AMOUNT_ADJUSTED, SavingsAccountHelper.TRANSACTION_DATE,
|
||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
summary = this.savingsAccountHelper.getSavingsSummary(savingsID);
|
||||
balance = balance - SP_WITHDRAWAL_AMOUNT_ADJUSTED - chargeAmount;
|
||||
|
||||
final JournalEntry[] liabililityAccountThirdTransactionEntry = {
|
||||
new JournalEntry(chargeAmount, JournalEntry.TransactionType.DEBIT),
|
||||
final JournalEntry[] liabililityAccountThirdTransactionEntry = { new JournalEntry(chargeAmount, JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT_ADJUSTED, JournalEntry.TransactionType.DEBIT) };
|
||||
final JournalEntry[] assetAccountThirdTransactionEntry = { new JournalEntry(this.SP_WITHDRAWAL_AMOUNT_ADJUSTED,
|
||||
JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] assetAccountThirdTransactionEntry = {
|
||||
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT_ADJUSTED, JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] incomeAccountThirdTransactionEntry = { new JournalEntry(chargeAmount, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountThirdTransactionEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
||||
@@ -339,15 +341,15 @@ public class AccountingScenarioIntegrationTest {
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.TRANSACTION_DATE, incomeAccountThirdTransactionEntry);
|
||||
|
||||
// Verifying Balance after applying Charge for Withdrawal Fee
|
||||
assertEquals("Verifying Balance", balance, summary.get("accountBalance"));
|
||||
assertEquals(balance, summary.get("accountBalance"), "Verifying Balance");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFixedDepositAccountingFlow() {
|
||||
this.fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
|
||||
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||
this.fixedDepositAccountHelper = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec);
|
||||
this.fixedDepositProductHelper = new FixedDepositProductHelper(requestSpec, responseSpec);
|
||||
this.accountHelper = new AccountHelper(requestSpec, responseSpec);
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||
this.fixedDepositAccountHelper = new FixedDepositAccountHelper(requestSpec, responseSpec);
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
DateFormat currentDateFormat = new SimpleDateFormat("dd");
|
||||
@@ -364,7 +366,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
final String APPROVED_ON_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 numberOfDaysLeft = (daysInMonth - currentDate) + 1;
|
||||
todaysDate.add(Calendar.DATE, numberOfDaysLeft);
|
||||
@@ -375,19 +377,19 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
||||
final Account liabilityAccount = this.accountHelper.createLiabilityAccount();
|
||||
|
||||
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(clientId);
|
||||
Integer clientId = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
Assertions.assertNotNull(clientId);
|
||||
|
||||
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, assetAccount, incomeAccount, expenseAccount,
|
||||
liabilityAccount);
|
||||
Assert.assertNotNull(fixedDepositProductId);
|
||||
Assertions.assertNotNull(fixedDepositProductId);
|
||||
|
||||
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM,
|
||||
VALID_TO, SUBMITTED_ON_DATE, FixedDepositTest.WHOLE_TERM);
|
||||
Assert.assertNotNull(fixedDepositAccountId);
|
||||
Assertions.assertNotNull(fixedDepositAccountId);
|
||||
|
||||
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
|
||||
this.responseSpec, fixedDepositAccountId.toString());
|
||||
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(requestSpec,
|
||||
responseSpec, fixedDepositAccountId.toString());
|
||||
FixedDepositAccountStatusChecker.verifyFixedDepositIsPending(fixedDepositAccountStatusHashMap);
|
||||
|
||||
fixedDepositAccountStatusHashMap = this.fixedDepositAccountHelper.approveFixedDeposit(fixedDepositAccountId, APPROVED_ON_DATE);
|
||||
@@ -407,7 +409,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, ACTIVATION_DATE, liablilityAccountInitialEntry);
|
||||
|
||||
Integer transactionIdForPostInterest = this.fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId);
|
||||
Assert.assertNotNull(transactionIdForPostInterest);
|
||||
Assertions.assertNotNull(transactionIdForPostInterest);
|
||||
|
||||
accountSummary = this.fixedDepositAccountHelper.getFixedDepositSummary(fixedDepositAccountId);
|
||||
Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted");
|
||||
@@ -422,9 +424,9 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testRecurringDepositAccountingFlow() {
|
||||
this.recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec);
|
||||
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
|
||||
this.recurringDepositAccountHelper = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec);
|
||||
this.recurringDepositProductHelper = new RecurringDepositProductHelper(requestSpec, responseSpec);
|
||||
this.accountHelper = new AccountHelper(requestSpec, responseSpec);
|
||||
this.recurringDepositAccountHelper = new RecurringDepositAccountHelper(requestSpec, responseSpec);
|
||||
|
||||
final Account assetAccount = this.accountHelper.createAssetAccount();
|
||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||
@@ -447,25 +449,25 @@ public class AccountingScenarioIntegrationTest {
|
||||
final String ACTIVATION_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 numberOfDaysLeft = (daysInMonth - currentDate) + 1;
|
||||
todaysDate.add(Calendar.DATE, numberOfDaysLeft);
|
||||
final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime());
|
||||
|
||||
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(clientId);
|
||||
Integer clientId = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
Assertions.assertNotNull(clientId);
|
||||
|
||||
Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, assetAccount, liabilityAccount,
|
||||
incomeAccount, expenseAccount);
|
||||
Assert.assertNotNull(recurringDepositProductId);
|
||||
Assertions.assertNotNull(recurringDepositProductId);
|
||||
|
||||
Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(),
|
||||
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(
|
||||
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
|
||||
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(requestSpec,
|
||||
responseSpec, recurringDepositAccountId.toString());
|
||||
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
|
||||
|
||||
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
|
||||
@@ -476,13 +478,13 @@ public class AccountingScenarioIntegrationTest {
|
||||
ACTIVATION_DATE);
|
||||
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsActive(recurringDepositAccountStatusHashMap);
|
||||
|
||||
HashMap recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
|
||||
this.responseSpec, recurringDepositAccountId);
|
||||
HashMap recurringDepositAccountData = RecurringDepositAccountHelper.getRecurringDepositAccountById(requestSpec, responseSpec,
|
||||
recurringDepositAccountId);
|
||||
Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount");
|
||||
|
||||
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
|
||||
depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE);
|
||||
Assert.assertNotNull(depositTransactionId);
|
||||
Assertions.assertNotNull(depositTransactionId);
|
||||
|
||||
// Checking initial Journal entries after Activation.
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) };
|
||||
@@ -493,7 +495,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
Integer interestPostingTransactionId = this.recurringDepositAccountHelper
|
||||
.postInterestForRecurringDeposit(recurringDepositAccountId);
|
||||
Assert.assertNotNull(interestPostingTransactionId);
|
||||
Assertions.assertNotNull(interestPostingTransactionId);
|
||||
|
||||
HashMap accountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId);
|
||||
Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted");
|
||||
@@ -507,7 +509,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
}
|
||||
|
||||
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() //
|
||||
.withInterestPostingPeriodTypeAsQuarterly() //
|
||||
.withInterestCalculationPeriodTypeAsDailyBalance() //
|
||||
@@ -516,8 +518,8 @@ public class AccountingScenarioIntegrationTest {
|
||||
}
|
||||
|
||||
private Integer createFixedDepositProduct(final String validFrom, final String validTo, Account... accounts) {
|
||||
System.out.println("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
|
||||
FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
|
||||
LOG.info("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
|
||||
FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(requestSpec, responseSpec);
|
||||
final String fixedDepositProductJSON = fixedDepositProductHelper //
|
||||
.withPeriodRangeChart()//
|
||||
.withAccountingRuleAsCashBased(accounts).build(validFrom, validTo);
|
||||
@@ -526,16 +528,15 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String validFrom,
|
||||
final String validTo, final String submittedOnDate, final String penalInterestType) {
|
||||
System.out.println("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
|
||||
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec) //
|
||||
LOG.info("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
|
||||
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(requestSpec, responseSpec) //
|
||||
.withSubmittedOnDate(submittedOnDate).build(clientID, productID, penalInterestType);
|
||||
return this.fixedDepositAccountHelper
|
||||
.applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec, this.responseSpec);
|
||||
return FixedDepositAccountHelper.applyFixedDepositApplication(fixedDepositApplicationJSON, requestSpec, responseSpec);
|
||||
}
|
||||
|
||||
private Integer createRecurringDepositProduct(final String validFrom, final String validTo, Account... accounts) {
|
||||
System.out.println("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------");
|
||||
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec);
|
||||
LOG.info("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------");
|
||||
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(requestSpec, responseSpec);
|
||||
final String recurringDepositProductJSON = recurringDepositProductHelper //
|
||||
.withPeriodRangeChart()//
|
||||
.withAccountingRuleAsCashBased(accounts).build(validFrom, validTo);
|
||||
@@ -544,17 +545,16 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
private Integer applyForRecurringDepositApplication(final String clientID, final String productID, final String validFrom,
|
||||
final String validTo, final String submittedOnDate, final String penalInterestType, final String expectedFirstDepositOnDate) {
|
||||
System.out.println("--------------------------------APPLYING FOR RECURRING DEPOSIT ACCOUNT --------------------------------");
|
||||
final String recurringDepositApplicationJSON = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec)
|
||||
LOG.info("--------------------------------APPLYING FOR RECURRING DEPOSIT ACCOUNT --------------------------------");
|
||||
final String recurringDepositApplicationJSON = new RecurringDepositAccountHelper(requestSpec, responseSpec)
|
||||
//
|
||||
.withSubmittedOnDate(submittedOnDate).withExpectedFirstDepositOnDate(expectedFirstDepositOnDate)
|
||||
.build(clientID, productID, penalInterestType);
|
||||
return this.recurringDepositAccountHelper.applyRecurringDepositApplication(recurringDepositApplicationJSON, this.requestSpec,
|
||||
this.responseSpec);
|
||||
return RecurringDepositAccountHelper.applyRecurringDepositApplication(recurringDepositApplicationJSON, requestSpec, responseSpec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkPeriodicAccrualAccountingFlow() {
|
||||
public void checkPeriodicAccrualAccountingFlow() throws InterruptedException, ParseException {
|
||||
final Account assetAccount = this.accountHelper.createAssetAccount();
|
||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
||||
@@ -563,10 +563,10 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||
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);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
@@ -577,7 +577,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
// CHECK ACCOUNT ENTRIES
|
||||
System.out.println("Entries ......");
|
||||
LOG.info("Entries ......");
|
||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||
final float TOTAL_INTEREST = 1000.0f;
|
||||
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);
|
||||
|
||||
final String jobName = "Add Accrual Transactions";
|
||||
try {
|
||||
this.schedulerJobHelper.executeJob(jobName);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
this.schedulerJobHelper.executeAndAwaitJob(jobName);
|
||||
|
||||
// MAKE 1
|
||||
System.out.println("Repayment 1 ......");
|
||||
LOG.info("Repayment 1 ......");
|
||||
final float FIRST_INTEREST = 200.0f;
|
||||
final float FIRST_PRINCIPAL = 2000.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),
|
||||
new JournalEntry(FIRST_INTEREST + FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
|
||||
System.out.println("Repayment 1 Done......");
|
||||
LOG.info("Repayment 1 Done......");
|
||||
|
||||
// REPAYMENT 2
|
||||
System.out.println("Repayment 2 ......");
|
||||
LOG.info("Repayment 2 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
|
||||
final float SECOND_AND_THIRD_INTEREST = 400.0f;
|
||||
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),
|
||||
new JournalEntry(SECOND_AND_THIRD_INTEREST + SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
|
||||
System.out.println("Repayment 2 Done ......");
|
||||
LOG.info("Repayment 2 Done ......");
|
||||
|
||||
// WAIVE INTEREST
|
||||
System.out.println("Waive Interest ......");
|
||||
LOG.info("Waive Interest ......");
|
||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[4]), FIRST_INTEREST,
|
||||
FEE_PORTION, PENALTY_PORTION, loanID);
|
||||
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);
|
||||
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, this.REPAYMENT_DATE[4], expenseJournalEntry);
|
||||
System.out.println("Waive Interest Done......");
|
||||
LOG.info("Waive Interest Done......");
|
||||
|
||||
// REPAYMENT 3
|
||||
System.out.println("Repayment 3 ......");
|
||||
LOG.info("Repayment 3 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
|
||||
System.out.println("Repayment 3 Done ......");
|
||||
LOG.info("Repayment 3 Done ......");
|
||||
|
||||
// REPAYMENT 4
|
||||
System.out.println("Repayment 4 ......");
|
||||
LOG.info("Repayment 4 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
|
||||
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
|
||||
System.out.println("Repayment 4 Done ......");
|
||||
LOG.info("Repayment 4 Done ......");
|
||||
|
||||
// Repayment 5
|
||||
System.out.println("Repayment 5 ......");
|
||||
LOG.info("Repayment 5 ......");
|
||||
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
|
||||
System.out.println("Repayment 5 Done ......");
|
||||
LOG.info("Repayment 5 Done ......");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkPeriodicAccrualAccountingFlow_OVER_PAYMENT() {
|
||||
public void checkPeriodicAccrualAccountingFlow_OVER_PAYMENT() throws InterruptedException, ParseException {
|
||||
final Account assetAccount = this.accountHelper.createAssetAccount();
|
||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
||||
@@ -679,10 +676,10 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||
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);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
@@ -693,7 +690,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
// CHECK ACCOUNT ENTRIES
|
||||
System.out.println("Entries ......");
|
||||
LOG.info("Entries ......");
|
||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||
final float TOTAL_INTEREST = 1000.0f;
|
||||
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);
|
||||
|
||||
final String jobName = "Add Accrual Transactions";
|
||||
try {
|
||||
this.schedulerJobHelper.executeJob(jobName);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
this.schedulerJobHelper.executeAndAwaitJob(jobName);
|
||||
|
||||
// MAKE 1
|
||||
System.out.println("Repayment 1 ......");
|
||||
LOG.info("Repayment 1 ......");
|
||||
final float FIRST_INTEREST = 200.0f;
|
||||
final float FIRST_PRINCIPAL = 2000.0f;
|
||||
final float FEE_PORTION = 0.0f;
|
||||
@@ -721,14 +715,14 @@ public class AccountingScenarioIntegrationTest {
|
||||
final JournalEntry[] assetAccountEntry = { new JournalEntry(15000f, JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(11000f, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, this.REPAYMENT_DATE[1], new JournalEntry(4000f,
|
||||
JournalEntry.TransactionType.CREDIT));
|
||||
System.out.println("Repayment Done......");
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, this.REPAYMENT_DATE[1],
|
||||
new JournalEntry(4000f, JournalEntry.TransactionType.CREDIT));
|
||||
LOG.info("Repayment Done......");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkPeriodicAccrualAccountingTillCurrentDateFlow() {
|
||||
public void checkPeriodicAccrualAccountingTillCurrentDateFlow() throws InterruptedException, ParseException {
|
||||
final Account assetAccount = this.accountHelper.createAssetAccount();
|
||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
||||
@@ -737,17 +731,17 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||
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 float FEE_PORTION = 50.0f;
|
||||
final float PENALTY_PORTION = 100.0f;
|
||||
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
|
||||
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(FEE_PORTION), false));
|
||||
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
|
||||
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
|
||||
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
|
||||
.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);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
@@ -772,16 +766,14 @@ public class AccountingScenarioIntegrationTest {
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
this.loanTransactionHelper.addChargesForLoan(
|
||||
loanID,
|
||||
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDate),
|
||||
dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
|
||||
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
|
||||
String.valueOf(flatSpecifiedDueDate), dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
|
||||
todayDate.add(Calendar.DATE, 1);
|
||||
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
|
||||
String.valueOf(flat), dateFormat.format(todayDate.getTime()), String.valueOf(FEE_PORTION)));
|
||||
|
||||
// CHECK ACCOUNT ENTRIES
|
||||
System.out.println("Entries ......");
|
||||
LOG.info("Entries ......");
|
||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||
final float TOTAL_INTEREST = 1000.0f;
|
||||
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);
|
||||
|
||||
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,
|
||||
loanID);
|
||||
this.schedulerJobHelper.executeAndAwaitJob(jobName);
|
||||
|
||||
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, responseSpec, loanID);
|
||||
// MAKE 1
|
||||
List fromDateList = (List) loanSchedule.get(1).get("fromDate");
|
||||
LocalDate fromDateLocal = LocalDate.now();
|
||||
@@ -815,7 +803,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue");
|
||||
DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US));
|
||||
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,
|
||||
PENALTY_PORTION, loanID);
|
||||
@@ -823,7 +811,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkPeriodicAccrualAccountingAPIFlow() {
|
||||
public void checkPeriodicAccrualAccountingAPIFlow() throws ParseException {
|
||||
final Account assetAccount = this.accountHelper.createAssetAccount();
|
||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
||||
@@ -832,7 +820,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||
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 float FEE_PORTION = 50.0f;
|
||||
@@ -842,15 +830,15 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
|
||||
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(FEE_PORTION), false));
|
||||
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
|
||||
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
|
||||
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
|
||||
.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
|
||||
|
||||
Integer flatNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
|
||||
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(NEXT_FEE_PORTION), false));
|
||||
Integer flatNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
|
||||
.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(NEXT_FEE_PORTION), false));
|
||||
Integer flatSpecifiedDueDateNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
|
||||
.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);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
@@ -875,32 +863,23 @@ public class AccountingScenarioIntegrationTest {
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
this.loanTransactionHelper.addChargesForLoan(
|
||||
loanID,
|
||||
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDate),
|
||||
dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
|
||||
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
|
||||
String.valueOf(flatSpecifiedDueDate), dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
|
||||
todayDate.add(Calendar.DATE, 1);
|
||||
String runOndate = dateFormat.format(todayDate.getTime());
|
||||
|
||||
this.loanTransactionHelper
|
||||
.addChargesForLoan(
|
||||
loanID,
|
||||
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flat), runOndate,
|
||||
String.valueOf(FEE_PORTION)));
|
||||
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper
|
||||
.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flat), runOndate, String.valueOf(FEE_PORTION)));
|
||||
|
||||
todayDate.add(Calendar.DATE, 1);
|
||||
this.loanTransactionHelper.addChargesForLoan(
|
||||
loanID,
|
||||
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDateNext),
|
||||
dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_PENALTY_PORTION)));
|
||||
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
|
||||
String.valueOf(flatSpecifiedDueDateNext), dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_PENALTY_PORTION)));
|
||||
|
||||
this.loanTransactionHelper.addChargesForLoan(
|
||||
loanID,
|
||||
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatNext),
|
||||
dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_FEE_PORTION)));
|
||||
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
|
||||
String.valueOf(flatNext), dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_FEE_PORTION)));
|
||||
|
||||
// CHECK ACCOUNT ENTRIES
|
||||
System.out.println("Entries ......");
|
||||
LOG.info("Entries ......");
|
||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||
final float TOTAL_INTEREST = 1000.0f;
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||
@@ -909,8 +888,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
this.periodicAccrualAccountingHelper.runPeriodicAccrualAccounting(runOndate);
|
||||
|
||||
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
|
||||
loanID);
|
||||
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, responseSpec, loanID);
|
||||
// MAKE 1
|
||||
List fromDateList = (List) loanSchedule.get(1).get("fromDate");
|
||||
LocalDate fromDateLocal = LocalDate.now();
|
||||
@@ -929,7 +907,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue");
|
||||
DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US));
|
||||
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,
|
||||
PENALTY_PORTION, loanID);
|
||||
|
||||
@@ -937,14 +915,14 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
this.periodicAccrualAccountingHelper.runPeriodicAccrualAccounting(runOndate);
|
||||
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,
|
||||
NEXT_PENALTY_PORTION, loanID);
|
||||
|
||||
}
|
||||
|
||||
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()
|
||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||
@@ -963,10 +941,10 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer loanProductID = createLoanProductWithCashBasedAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||
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);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
@@ -977,7 +955,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
// CHECK ACCOUNT ENTRIES
|
||||
System.out.println("Entries ......");
|
||||
LOG.info("Entries ......");
|
||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||
final float TOTAL_INTEREST = 1000.0f;
|
||||
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);
|
||||
|
||||
// MAKE 1
|
||||
System.out.println("Repayment 1 ......");
|
||||
LOG.info("Repayment 1 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], this.REPAYMENT_AMOUNT[1], loanID);
|
||||
final float FIRST_INTEREST = 200.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),
|
||||
new JournalEntry(FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
|
||||
System.out.println("CHECKING INCOME: ******************************************");
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[1], new JournalEntry(FIRST_INTEREST,
|
||||
JournalEntry.TransactionType.CREDIT));
|
||||
System.out.println("Repayment 1 Done......");
|
||||
LOG.info("CHECKING INCOME: ******************************************");
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[1],
|
||||
new JournalEntry(FIRST_INTEREST, JournalEntry.TransactionType.CREDIT));
|
||||
LOG.info("Repayment 1 Done......");
|
||||
|
||||
// REPAYMENT 2
|
||||
System.out.println("Repayment 2 ......");
|
||||
LOG.info("Repayment 2 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
|
||||
final float SECOND_AND_THIRD_INTEREST = 400.0f;
|
||||
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),
|
||||
new JournalEntry(SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT), };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
|
||||
System.out.println("CHECKING INCOME: ******************************************");
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[2], new JournalEntry(
|
||||
SECOND_AND_THIRD_INTEREST, JournalEntry.TransactionType.CREDIT));
|
||||
System.out.println("Repayment 2 Done ......");
|
||||
LOG.info("CHECKING INCOME: ******************************************");
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[2],
|
||||
new JournalEntry(SECOND_AND_THIRD_INTEREST, JournalEntry.TransactionType.CREDIT));
|
||||
LOG.info("Repayment 2 Done ......");
|
||||
|
||||
// WAIVE INTEREST
|
||||
System.out.println("Waive Interest ......");
|
||||
LOG.info("Waive Interest ......");
|
||||
Integer transactionId = this.loanTransactionHelper.waiveInterestAndReturnTransactionId(this.REPAYMENT_DATE[4],
|
||||
this.AMOUNT_TO_BE_WAIVE.toString(), loanID);
|
||||
// waive of fees and interest are not considered in cash based
|
||||
@@ -1023,38 +1001,38 @@ public class AccountingScenarioIntegrationTest {
|
||||
this.journalEntryHelper.ensureNoAccountingTransactionsWithTransactionId("L" + transactionId);
|
||||
|
||||
// REPAYMENT 3
|
||||
System.out.println("Repayment 3 ......");
|
||||
LOG.info("Repayment 3 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
|
||||
System.out.println("Repayment 3 Done ......");
|
||||
LOG.info("Repayment 3 Done ......");
|
||||
|
||||
// REPAYMENT 4
|
||||
System.out.println("Repayment 4 ......");
|
||||
LOG.info("Repayment 4 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
|
||||
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
|
||||
System.out.println("Repayment 4 Done ......");
|
||||
LOG.info("Repayment 4 Done ......");
|
||||
|
||||
// Repayment 5
|
||||
System.out.println("Repayment 5 ......");
|
||||
LOG.info("Repayment 5 ......");
|
||||
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
|
||||
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) {
|
||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||
@@ -1062,14 +1040,10 @@ public class AccountingScenarioIntegrationTest {
|
||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||
}
|
||||
|
||||
private LocalDate getDateAsLocalDate(String dateAsString) {
|
||||
LocalDate date = null;
|
||||
try {
|
||||
DateFormat df = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
date = new LocalDate(df.parse(dateAsString));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
private LocalDate getDateAsLocalDate(String dateAsString) throws ParseException {
|
||||
DateFormat df = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
LocalDate date = new LocalDate(df.parse(dateAsString));
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
+53
-60
@@ -18,12 +18,16 @@
|
||||
*/
|
||||
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.Arrays;
|
||||
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.BatchResponse;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
@@ -32,26 +36,18 @@ import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.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;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test class for
|
||||
* {@link org.apache.fineract.batch.command.CommandStrategyProvider}. This tests
|
||||
* the response provided by commandStrategy by injecting it with a
|
||||
* {@code BatchRequest}.
|
||||
*
|
||||
*
|
||||
* @author RishabhShukla
|
||||
*
|
||||
*
|
||||
* @see org.apache.fineract.integrationtests.common.BatchHelper
|
||||
* @see org.apache.fineract.batch.domain.BatchRequest
|
||||
*/
|
||||
@@ -60,17 +56,13 @@ public class BatchApiTest {
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
|
||||
public BatchApiTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||
@@ -81,7 +73,7 @@ public class BatchApiTest {
|
||||
* Tests for the unimplemented command Strategies by returning 501 status
|
||||
* code. For a unknownRequest a statusCode 501 is returned back with
|
||||
* response.
|
||||
*
|
||||
*
|
||||
* @see org.apache.fineract.batch.command.internal.UnknownCommandStrategy
|
||||
*/
|
||||
@Test
|
||||
@@ -96,7 +88,7 @@ public class BatchApiTest {
|
||||
|
||||
// Verify that only 501 is returned as the status code
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +96,7 @@ public class BatchApiTest {
|
||||
* Tests for the successful response for a createClient request from
|
||||
* createClientCommand. A successful response with statusCode '200' is
|
||||
* returned back.
|
||||
*
|
||||
*
|
||||
* @see org.apache.fineract.batch.command.internal.CreateClientCommandStrategy
|
||||
*/
|
||||
@Test
|
||||
@@ -116,7 +108,7 @@ public class BatchApiTest {
|
||||
|
||||
// Verify that a 200 response is returned as the status code
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +117,7 @@ public class BatchApiTest {
|
||||
* fails. If Query Parameter 'enclosingTransaction' is set to 'true' and if
|
||||
* one of the request in BatchRequest fails then all transactions are rolled
|
||||
* back.
|
||||
*
|
||||
*
|
||||
* @see org.apache.fineract.batch.command.internal.CreateClientCommandStrategy
|
||||
* @see org.apache.fineract.batch.api.BatchApiResource
|
||||
* @see org.apache.fineract.batch.service.BatchApiService
|
||||
@@ -159,15 +151,15 @@ public class BatchApiTest {
|
||||
BatchHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, "TestExtId12");
|
||||
|
||||
// Asserts that all the transactions have been successfully rolled back
|
||||
Assert.assertEquals(response.size(), 1);
|
||||
Assert.assertEquals("Verify Status code 400", (long) 400, (long) response.get(0).getStatusCode());
|
||||
Assertions.assertEquals(1, response.size());
|
||||
Assertions.assertEquals((long) 400, (long) response.get(0).getStatusCode(), "Verify Status code 400");
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that a client information was successfully updated through
|
||||
* updateClientCommand. A 'changes' parameter is returned in the response
|
||||
* after successful update of client information.
|
||||
*
|
||||
*
|
||||
* @see org.apache.fineract.batch.command.internal.UpdateClientCommandStrategy
|
||||
*/
|
||||
@Test
|
||||
@@ -193,8 +185,8 @@ public class BatchApiTest {
|
||||
final JsonObject changes = new FromJsonHelper().parse(response.get(1).getBody()).getAsJsonObject().get("changes").getAsJsonObject();
|
||||
|
||||
// Asserts the client information is successfully updated
|
||||
Assert.assertEquals("Verify Firstname", "TestFirstName", changes.get("firstname").getAsString());
|
||||
Assert.assertEquals("Verify Lastname", "TestLastName", changes.get("lastname").getAsString());
|
||||
Assertions.assertEquals("TestFirstName", changes.get("firstname").getAsString());
|
||||
Assertions.assertEquals("TestLastName", changes.get("lastname").getAsString());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,7 +194,7 @@ public class BatchApiTest {
|
||||
* 200(OK) status. It creates a new client and apply a loan to that client.
|
||||
* This also verifies the successful resolution of dependencies among two
|
||||
* requests.
|
||||
*
|
||||
*
|
||||
* @see org.apache.fineract.batch.command.internal.ApplyLoanCommandStrategy
|
||||
*/
|
||||
@Test
|
||||
@@ -244,14 +236,14 @@ public class BatchApiTest {
|
||||
// Get the clientId parameter from createClient Response
|
||||
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());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that a new savings accounts was applied to an existing client and a
|
||||
* 200(OK) status was returned. It first creates a new client and a savings
|
||||
* product, then uses the cliendId and ProductId to apply a savings account.
|
||||
*
|
||||
*
|
||||
* @see org.apache.fineract.batch.command.internal.ApplySavingsCommandStrategy
|
||||
*/
|
||||
@Test
|
||||
@@ -286,7 +278,7 @@ public class BatchApiTest {
|
||||
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
||||
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");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -294,7 +286,7 @@ public class BatchApiTest {
|
||||
* Collected properly 200(OK) status was returned for successful responses.
|
||||
* It first creates a new client and apply a loan, then creates a new charge
|
||||
* for the create loan and then fetches all the applied charges
|
||||
*
|
||||
*
|
||||
* @see org.apache.fineract.batch.command.internal.CollectChargesCommandStrategy
|
||||
* @see org.apache.fineract.batch.command.internal.CreateChargeCommandStrategy
|
||||
*/
|
||||
@@ -338,14 +330,14 @@ public class BatchApiTest {
|
||||
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
||||
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.
|
||||
* Collected properly 200(OK) status was returned for successful responses.
|
||||
* It first creates a new loan and then makes two repayments for it
|
||||
* and then verifies that 200(OK) is returned for the repayment requests.
|
||||
* Tests that batch repayment for loans is happening properly. Collected
|
||||
* properly 200(OK) status was returned for successful responses. It first
|
||||
* creates a new loan and then makes two repayments for it and then verifies
|
||||
* that 200(OK) is returned for the repayment requests.
|
||||
*
|
||||
* @see org.apache.fineract.batch.command.internal.RepayLoanCommandStrategy
|
||||
*/
|
||||
@@ -401,15 +393,15 @@ public class BatchApiTest {
|
||||
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
||||
jsonifiedRequest);
|
||||
|
||||
Assert.assertEquals("Verify Status Code 200 for Repayment", 200L, (long) response.get(5).getStatusCode());
|
||||
Assert.assertEquals("Verify Status Code 200 for Repayment", 200L, (long) response.get(6).getStatusCode());
|
||||
Assertions.assertEquals(200L, (long) response.get(5).getStatusCode(), "Verify Status Code 200 for Repayment");
|
||||
Assertions.assertEquals(200L, (long) response.get(6).getStatusCode(), "Verify Status Code 200 for Repayment");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for the successful activation of a pending client using
|
||||
* 'ActivateClientCommandStrategy'. A '200' status code is expected on
|
||||
* successful activation.
|
||||
*
|
||||
*
|
||||
* @see org.apache.fineract.batch.command.internal.ActivateClientCommandStrategy
|
||||
*/
|
||||
@Test
|
||||
@@ -431,15 +423,15 @@ public class BatchApiTest {
|
||||
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
||||
jsonifiedRequest);
|
||||
|
||||
Assert.assertEquals("Verify Status Code 200 for Create Client", 200L, (long) response.get(0).getStatusCode());
|
||||
Assert.assertEquals("Verify Status Code 200 for Activate Client", 200L, (long) response.get(1).getStatusCode());
|
||||
Assertions.assertEquals(200L, (long) response.get(0).getStatusCode(), "Verify Status Code 200 for Create Client");
|
||||
Assertions.assertEquals(200L, (long) response.get(1).getStatusCode(), "Verify Status Code 200 for Activate Client");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for the successful approval and disbursal of a loan using
|
||||
* 'ApproveLoanCommandStrategy' and 'DisburseLoanCommandStrategy'. A '200'
|
||||
* status code is expected on successful activation.
|
||||
*
|
||||
*
|
||||
* @see org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy
|
||||
* @see org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy
|
||||
*/
|
||||
@@ -486,19 +478,20 @@ public class BatchApiTest {
|
||||
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
|
||||
jsonifiedRequest);
|
||||
|
||||
Assert.assertEquals("Verify Status Code 200 for Approve Loan", 200L, (long) response.get(3).getStatusCode());
|
||||
Assert.assertEquals("Verify Status Code 200 for Disburse Loan", 200L, (long) response.get(4).getStatusCode());
|
||||
Assertions.assertEquals(200L, (long) response.get(3).getStatusCode(), "Verify Status Code 200 for Approve Loan");
|
||||
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
|
||||
* Batch API with enclosingTransaction. A '200' status code is expected on successful activation.
|
||||
* Test for the successful create client, apply loan,approval and disbursal
|
||||
* 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.DisburseLoanCommandStrategy
|
||||
*/
|
||||
@Test
|
||||
public void shouldReturnOkStatusOnSuccessfulLoanApprovalAndDisburseWithTransaction(){
|
||||
public void shouldReturnOkStatusOnSuccessfulLoanApprovalAndDisburseWithTransaction() {
|
||||
final String loanProductJSON = new LoanProductTestBuilder() //
|
||||
.withPrincipal("10000000.00") //
|
||||
.withNumberOfRepayments("24") //
|
||||
@@ -524,16 +517,16 @@ public class BatchApiTest {
|
||||
// Create a disburseLoan Request
|
||||
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 List<BatchResponse> response = BatchHelper.postBatchRequestsWithEnclosingTransaction(this.requestSpec, this.responseSpec,
|
||||
jsonifiedRequest);
|
||||
|
||||
Assert.assertEquals("Verify Status Code 200 for create client", 200L, (long) response.get(0).getStatusCode());
|
||||
Assert.assertEquals("Verify Status Code 200 for apply Loan", 200L, (long) response.get(1).getStatusCode());
|
||||
Assert.assertEquals("Verify Status Code 200 for approve Loan", 200L, (long) response.get(2).getStatusCode());
|
||||
Assert.assertEquals("Verify Status Code 200 for disburse Loan", 200L, (long) response.get(3).getStatusCode());
|
||||
Assertions.assertEquals(200L, (long) response.get(0).getStatusCode(), "Verify Status Code 200 for create client");
|
||||
Assertions.assertEquals(200L, (long) response.get(1).getStatusCode(), "Verify Status Code 200 for apply Loan");
|
||||
Assertions.assertEquals(200L, (long) response.get(2).getStatusCode(), "Verify Status Code 200 for approve Loan");
|
||||
Assertions.assertEquals(200L, (long) response.get(3).getStatusCode(), "Verify Status Code 200 for disburse Loan");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+19
-17
@@ -18,9 +18,13 @@
|
||||
*/
|
||||
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.List;
|
||||
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.integrationtests.common.BatchHelper;
|
||||
@@ -29,25 +33,22 @@ import org.apache.fineract.integrationtests.common.GroupHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Test class for testing the integration of Batch API with custom batch
|
||||
* requests and various user defined workflow. Like in the case of mifos
|
||||
* community-app
|
||||
*
|
||||
*
|
||||
* @author Rishabh Shukla
|
||||
*/
|
||||
public class BatchRequestsIntegrationTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(BatchRequestsIntegrationTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
|
||||
@@ -57,9 +58,10 @@ public class BatchRequestsIntegrationTest {
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
|
||||
Utils.initializeRESTAssured();
|
||||
@@ -70,12 +72,12 @@ public class BatchRequestsIntegrationTest {
|
||||
|
||||
@Test
|
||||
/**
|
||||
* Tests that a loan is successfully applied to client members of a group.
|
||||
* Tests that a loan is successfully applied to client members of a group.
|
||||
* Firstly, it'll create a few new clients and then will add those clients
|
||||
* to the group. Then a few loans will be created and one of those loans
|
||||
* will be chosen at random and similarily a few of the created clients will
|
||||
* be chosen on random. Now, the selected loan will be applied to these
|
||||
* clients through Batch - API ApplyLoanCommandStrategy.
|
||||
* clients through Batch - API ApplyLoanCommandStrategy.
|
||||
*/
|
||||
public void shouldReturnOkStatusForLoansAppliedToSelectedClients() {
|
||||
|
||||
@@ -90,7 +92,7 @@ public class BatchRequestsIntegrationTest {
|
||||
for (Integer i = 0; i < clientsCount; i++) {
|
||||
clientIDs[i] = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
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
|
||||
@@ -134,7 +136,7 @@ public class BatchRequestsIntegrationTest {
|
||||
|
||||
// Verify that each loan has been applied successfully
|
||||
for (BatchResponse res : response) {
|
||||
Assert.assertEquals("Verify Status Code 200", 200L, (long) res.getStatusCode());
|
||||
Assertions.assertEquals(200L, (long) res.getStatusCode(), "Verify Status Code 200");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+79
-81
@@ -18,35 +18,36 @@
|
||||
*/
|
||||
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.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.CenterDomain;
|
||||
import org.apache.fineract.integrationtests.common.CenterHelper;
|
||||
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
||||
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;
|
||||
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;
|
||||
|
||||
public class CenterIntegrationTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(CenterIntegrationTest.class);
|
||||
private RequestSpecification requestSpec;
|
||||
private ResponseSpecification responseSpec;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -62,20 +63,20 @@ public class CenterIntegrationTest {
|
||||
int resourceId = CenterHelper.createCenter(name, officeId, requestSpec, responseSpec);
|
||||
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
|
||||
|
||||
Assert.assertNotNull(center);
|
||||
Assert.assertTrue(center.getName().equals(name));
|
||||
Assert.assertTrue(center.getOfficeId() == officeId);
|
||||
Assert.assertTrue(center.isActive() == false);
|
||||
Assertions.assertNotNull(center);
|
||||
Assertions.assertTrue(center.getName().equals(name));
|
||||
Assertions.assertTrue(center.getOfficeId() == officeId);
|
||||
Assertions.assertTrue(center.isActive() == false);
|
||||
|
||||
// Test retrieval by listing all centers
|
||||
int id = CenterHelper.listCenters(requestSpec, responseSpec).get(0).getId();
|
||||
Assert.assertTrue(id > 0);
|
||||
Assertions.assertTrue(id > 0);
|
||||
|
||||
CenterDomain retrievedCenter = CenterHelper.retrieveByID(id, requestSpec, responseSpec);
|
||||
Assert.assertNotNull(retrievedCenter);
|
||||
Assert.assertNotNull(retrievedCenter.getName());
|
||||
Assert.assertNotNull(retrievedCenter.getHierarchy());
|
||||
Assert.assertNotNull(retrievedCenter.getOfficeName());
|
||||
Assertions.assertNotNull(retrievedCenter);
|
||||
Assertions.assertNotNull(retrievedCenter.getName());
|
||||
Assertions.assertNotNull(retrievedCenter.getHierarchy());
|
||||
Assertions.assertNotNull(retrievedCenter.getOfficeName());
|
||||
|
||||
}
|
||||
|
||||
@@ -90,13 +91,13 @@ public class CenterIntegrationTest {
|
||||
int resourceId = CenterHelper.createCenter(name, officeId, externalId, staffId, groupMembers, requestSpec, responseSpec);
|
||||
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
|
||||
|
||||
Assert.assertNotNull(center);
|
||||
Assert.assertTrue(center.getName().equals(name));
|
||||
Assert.assertTrue(center.getOfficeId() == officeId);
|
||||
Assert.assertTrue(center.getExternalId().equals(externalId));
|
||||
Assert.assertTrue(center.getStaffId() == staffId);
|
||||
Assert.assertTrue(center.isActive() == false);
|
||||
Assert.assertArrayEquals(center.getGroupMembers(), groupMembers);
|
||||
Assertions.assertNotNull(center);
|
||||
Assertions.assertTrue(center.getName().equals(name));
|
||||
Assertions.assertTrue(center.getOfficeId() == officeId);
|
||||
Assertions.assertTrue(center.getExternalId().equals(externalId));
|
||||
Assertions.assertTrue(center.getStaffId() == staffId);
|
||||
Assertions.assertTrue(center.isActive() == false);
|
||||
Assertions.assertArrayEquals(center.getGroupMembers(), groupMembers);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -104,10 +105,10 @@ public class CenterIntegrationTest {
|
||||
ArrayList<CenterDomain> paginatedList = CenterHelper.paginatedListCenters(requestSpec, responseSpec);
|
||||
ArrayList<CenterDomain> list = CenterHelper.listCenters(requestSpec, responseSpec);
|
||||
|
||||
Assert.assertNotNull(paginatedList);
|
||||
Assert.assertNotNull(list);
|
||||
Assert.assertTrue(Arrays.equals(paginatedList.toArray(new CenterDomain[paginatedList.size()]),
|
||||
list.toArray(new CenterDomain[list.size()])));
|
||||
Assertions.assertNotNull(paginatedList);
|
||||
Assertions.assertNotNull(list);
|
||||
Assertions.assertTrue(
|
||||
Arrays.equals(paginatedList.toArray(new CenterDomain[paginatedList.size()]), list.toArray(new CenterDomain[list.size()])));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -116,7 +117,7 @@ public class CenterIntegrationTest {
|
||||
int id = arr.get(arr.size() - 1).getId() + 1;
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
||||
CenterDomain center = CenterHelper.retrieveByID(id, requestSpec, responseSpec);
|
||||
Assert.assertNotNull(center);
|
||||
Assertions.assertNotNull(center);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@@ -137,7 +138,7 @@ public class CenterIntegrationTest {
|
||||
int[] associateResponse = CenterHelper.associateGroups(resourceId, associateGroupMembers, requestSpec, responseSpec);
|
||||
Arrays.sort(associateResponse);
|
||||
Arrays.sort(associateGroupMembers);
|
||||
Assert.assertArrayEquals(associateResponse, associateGroupMembers);
|
||||
Assertions.assertArrayEquals(associateResponse, associateGroupMembers);
|
||||
|
||||
int[] newGroupMembers = new int[5];
|
||||
for (int i = 0; i < 5; i++) {
|
||||
@@ -153,17 +154,17 @@ public class CenterIntegrationTest {
|
||||
request.put("externalId", newExternalId);
|
||||
request.put("staffId", newStaffId);
|
||||
HashMap response = CenterHelper.updateCenter(resourceId, request, requestSpec, responseSpec);
|
||||
Assert.assertNotNull(response);
|
||||
Assert.assertEquals(newName, response.get("name"));
|
||||
Assert.assertEquals(newExternalId, response.get("externalId"));
|
||||
Assert.assertEquals(newStaffId, response.get("staffId"));
|
||||
Assertions.assertNotNull(response);
|
||||
Assertions.assertEquals(newName, response.get("name"));
|
||||
Assertions.assertEquals(newExternalId, response.get("externalId"));
|
||||
Assertions.assertEquals(Integer.valueOf(newStaffId), Integer.valueOf(response.get("staffId").toString()));
|
||||
|
||||
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
|
||||
Assert.assertNotNull(center);
|
||||
Assert.assertEquals(newName, center.getName());
|
||||
Assert.assertEquals(newExternalId, center.getExternalId());
|
||||
Assert.assertEquals((Integer)newStaffId, center.getStaffId());
|
||||
Assert.assertArrayEquals(newGroupMembers, center.getGroupMembers());
|
||||
Assertions.assertNotNull(center);
|
||||
Assertions.assertEquals(newName, center.getName());
|
||||
Assertions.assertEquals(newExternalId, center.getExternalId());
|
||||
Assertions.assertEquals((Integer) newStaffId, center.getStaffId());
|
||||
Assertions.assertArrayEquals(newGroupMembers, center.getGroupMembers());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -175,7 +176,7 @@ public class CenterIntegrationTest {
|
||||
CenterHelper.deleteCenter(resourceId, requestSpec, responseSpec);
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
||||
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
|
||||
Assert.assertNotNull(center);
|
||||
Assertions.assertNotNull(center);
|
||||
}
|
||||
|
||||
private int[] generateGroupMembers(int size, int officeId) {
|
||||
@@ -190,8 +191,8 @@ public class CenterIntegrationTest {
|
||||
map.put("active", "true");
|
||||
map.put("activationDate", "04 March 2011");
|
||||
|
||||
groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec, "/fineract-provider/api/v1/groups?"
|
||||
+ Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId");
|
||||
groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec,
|
||||
"/fineract-provider/api/v1/groups?" + Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId");
|
||||
}
|
||||
return groupMembers;
|
||||
}
|
||||
@@ -200,65 +201,62 @@ public class CenterIntegrationTest {
|
||||
public void testStaffAssignmentDuringCenterCreation() {
|
||||
|
||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
System.out.println("--------------creating first staff with id-------------" + staffId);
|
||||
Assert.assertNotNull(staffId);
|
||||
LOG.info("--------------creating first staff with id------------- {}", staffId);
|
||||
Assertions.assertNotNull(staffId);
|
||||
|
||||
final int centerWithStaffId = CenterHelper.createCenterWithStaffId(this.requestSpec, this.responseSpec, staffId);
|
||||
final CenterDomain center = CenterHelper.retrieveByID(centerWithStaffId, requestSpec, responseSpec);
|
||||
Assert.assertNotNull(center);
|
||||
Assert.assertTrue(center.getId() == centerWithStaffId);
|
||||
Assert.assertTrue(center.getStaffId().intValue() == staffId);
|
||||
Assert.assertTrue(center.isActive() == true);
|
||||
Assertions.assertNotNull(center);
|
||||
Assertions.assertTrue(center.getId() == centerWithStaffId);
|
||||
Assertions.assertTrue(center.getStaffId().intValue() == staffId);
|
||||
Assertions.assertTrue(center.isActive() == true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignStaffToCenter() {
|
||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
System.out.println("--------------creating first staff with id-------------" + staffId);
|
||||
Assert.assertNotNull(staffId);
|
||||
LOG.info("--------------creating first staff with id------------- {}", staffId);
|
||||
Assertions.assertNotNull(staffId);
|
||||
|
||||
final Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec);
|
||||
CenterHelper.verifyCenterCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
|
||||
|
||||
final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec,
|
||||
this.responseSpec, groupID.toString(),
|
||||
staffId.longValue());
|
||||
assertEquals("Verify assigned staff id is the same as id sent", assignStaffToCenterResponseMap.get("staffId"), staffId);
|
||||
final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec, this.responseSpec,
|
||||
groupID.toString(), staffId.longValue());
|
||||
assertEquals(assignStaffToCenterResponseMap.get("staffId"), staffId, "Verify assigned staff id is the same as id sent");
|
||||
|
||||
final CenterDomain center = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
|
||||
Assert.assertNotNull(center);
|
||||
Assert.assertTrue(center.getId().intValue() == groupID);
|
||||
Assert.assertTrue(center.getStaffId().intValue() == staffId);
|
||||
Assertions.assertNotNull(center);
|
||||
Assertions.assertTrue(center.getId().intValue() == groupID);
|
||||
Assertions.assertTrue(center.getStaffId().intValue() == staffId);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnassignStaffToCenter() {
|
||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
System.out.println("--------------creating first staff with id-------------" + staffId);
|
||||
Assert.assertNotNull(staffId);
|
||||
LOG.info("--------------creating first staff with id------------- {}", staffId);
|
||||
Assertions.assertNotNull(staffId);
|
||||
|
||||
final Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec);
|
||||
CenterHelper.verifyCenterCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
|
||||
|
||||
final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec,
|
||||
this.responseSpec, groupID.toString(),
|
||||
staffId.longValue());
|
||||
assertEquals("Verify assigned staff id is the same as id sent", assignStaffToCenterResponseMap.get("staffId"), staffId);
|
||||
|
||||
final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec, this.responseSpec,
|
||||
groupID.toString(), staffId.longValue());
|
||||
assertEquals(assignStaffToCenterResponseMap.get("staffId"), staffId, "Verify assigned staff id is the same as id sent");
|
||||
final CenterDomain centerWithStaffAssigned = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
|
||||
Assert.assertNotNull(centerWithStaffAssigned);
|
||||
Assert.assertTrue(centerWithStaffAssigned.getId().intValue() == groupID);
|
||||
Assert.assertTrue(centerWithStaffAssigned.getStaffId().intValue() == staffId);
|
||||
|
||||
final HashMap unassignStaffToCenterResponseMap = (HashMap) CenterHelper.unassignStaff(this.requestSpec,
|
||||
this.responseSpec, groupID.toString(),
|
||||
staffId.longValue());
|
||||
assertEquals("Verify staffId is null after unassigning ", unassignStaffToCenterResponseMap.get("staffId"), null);
|
||||
Assertions.assertNotNull(centerWithStaffAssigned);
|
||||
Assertions.assertTrue(centerWithStaffAssigned.getId().intValue() == groupID);
|
||||
Assertions.assertTrue(centerWithStaffAssigned.getStaffId().intValue() == staffId);
|
||||
|
||||
final HashMap unassignStaffToCenterResponseMap = (HashMap) CenterHelper.unassignStaff(this.requestSpec, this.responseSpec,
|
||||
groupID.toString(), staffId.longValue());
|
||||
assertEquals(unassignStaffToCenterResponseMap.get("staffId"), null, "Verify staffId is null after unassigning ");
|
||||
final CenterDomain centerWithStaffUnssigned = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
|
||||
Assert.assertNotNull(centerWithStaffUnssigned);
|
||||
Assert.assertTrue(centerWithStaffUnssigned.getId().intValue() == groupID);
|
||||
Assert.assertTrue(centerWithStaffUnssigned.getStaffId() == null);
|
||||
|
||||
Assertions.assertNotNull(centerWithStaffUnssigned);
|
||||
Assertions.assertTrue(centerWithStaffUnssigned.getId().intValue() == groupID);
|
||||
Assertions.assertTrue(centerWithStaffUnssigned.getStaffId() == null);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+56
-58
@@ -18,20 +18,18 @@
|
||||
*/
|
||||
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.charges.ChargesHelper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
public class ChargesTest {
|
||||
@@ -39,7 +37,7 @@ public class ChargesTest {
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -52,19 +50,19 @@ public class ChargesTest {
|
||||
|
||||
// Retrieving all Charges
|
||||
ArrayList<HashMap> allChargesData = ChargesHelper.getCharges(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(allChargesData);
|
||||
Assertions.assertNotNull(allChargesData);
|
||||
|
||||
// Testing Creation, Updation and Deletion of Disbursement Charge
|
||||
final Integer disbursementChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||
ChargesHelper.getLoanDisbursementJSON());
|
||||
Assert.assertNotNull(disbursementChargeId);
|
||||
Assertions.assertNotNull(disbursementChargeId);
|
||||
|
||||
// Updating Charge Amount
|
||||
HashMap changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, disbursementChargeId,
|
||||
ChargesHelper.getModifyChargeJSON());
|
||||
|
||||
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,
|
||||
ChargesHelper.getModifyChargeAsPecentageAmountJSON());
|
||||
@@ -72,10 +70,10 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId);
|
||||
|
||||
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");
|
||||
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,
|
||||
ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON());
|
||||
@@ -83,7 +81,7 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId);
|
||||
|
||||
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,
|
||||
ChargesHelper.getModifyChargeAsPercentageInterestJSON());
|
||||
@@ -91,22 +89,22 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId);
|
||||
|
||||
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);
|
||||
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
|
||||
final Integer specifiedDueDateChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||
ChargesHelper.getLoanSpecifiedDueDateJSON());
|
||||
Assert.assertNotNull(specifiedDueDateChargeId);
|
||||
Assertions.assertNotNull(specifiedDueDateChargeId);
|
||||
|
||||
// Updating Charge Amount
|
||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId,
|
||||
ChargesHelper.getModifyChargeJSON());
|
||||
|
||||
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,
|
||||
ChargesHelper.getModifyChargeAsPecentageAmountJSON());
|
||||
@@ -114,10 +112,10 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
||||
|
||||
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");
|
||||
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,
|
||||
ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON());
|
||||
@@ -125,7 +123,7 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
||||
|
||||
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,
|
||||
ChargesHelper.getModifyChargeAsPercentageInterestJSON());
|
||||
@@ -133,10 +131,10 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
|
||||
|
||||
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);
|
||||
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
|
||||
final Integer installmentFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||
@@ -147,7 +145,7 @@ public class ChargesTest {
|
||||
ChargesHelper.getModifyChargeJSON());
|
||||
|
||||
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,
|
||||
ChargesHelper.getModifyChargeAsPecentageAmountJSON());
|
||||
@@ -155,10 +153,10 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId);
|
||||
|
||||
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");
|
||||
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,
|
||||
ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON());
|
||||
@@ -166,7 +164,7 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId);
|
||||
|
||||
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,
|
||||
ChargesHelper.getModifyChargeAsPercentageInterestJSON());
|
||||
@@ -174,22 +172,22 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId);
|
||||
|
||||
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);
|
||||
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
|
||||
// Charge
|
||||
final Integer overdueFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||
ChargesHelper.getLoanOverdueFeeJSON());
|
||||
Assert.assertNotNull(overdueFeeChargeId);
|
||||
Assertions.assertNotNull(overdueFeeChargeId);
|
||||
|
||||
// Updating Charge Amount
|
||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId, ChargesHelper.getModifyChargeJSON());
|
||||
|
||||
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,
|
||||
ChargesHelper.getModifyChargeAsPecentageAmountJSON());
|
||||
@@ -197,10 +195,10 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
||||
|
||||
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");
|
||||
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,
|
||||
ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON());
|
||||
@@ -208,7 +206,7 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
||||
|
||||
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,
|
||||
ChargesHelper.getModifyChargeAsPercentageInterestJSON());
|
||||
@@ -216,7 +214,7 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
||||
|
||||
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,
|
||||
ChargesHelper.getModifyChargeFeeFrequencyAsYearsJSON());
|
||||
@@ -224,10 +222,10 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
|
||||
|
||||
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);
|
||||
Assert.assertEquals("Verifying Charge ID after deletion", overdueFeeChargeId, chargeIdAfterDeletion);
|
||||
Assertions.assertEquals(overdueFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -236,37 +234,37 @@ public class ChargesTest {
|
||||
// Testing Creation, Updation and Deletion of Specified due date Charge
|
||||
final Integer specifiedDueDateChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||
ChargesHelper.getSavingsSpecifiedDueDateJSON());
|
||||
Assert.assertNotNull(specifiedDueDateChargeId);
|
||||
Assertions.assertNotNull(specifiedDueDateChargeId);
|
||||
|
||||
// Updating Charge Amount
|
||||
HashMap changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId,
|
||||
ChargesHelper.getModifyChargeJSON());
|
||||
|
||||
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);
|
||||
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
|
||||
final Integer savingsActivationChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||
ChargesHelper.getSavingsActivationFeeJSON());
|
||||
Assert.assertNotNull(savingsActivationChargeId);
|
||||
Assertions.assertNotNull(savingsActivationChargeId);
|
||||
|
||||
// Updating Charge Amount
|
||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, savingsActivationChargeId,
|
||||
ChargesHelper.getModifyChargeJSON());
|
||||
|
||||
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);
|
||||
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
|
||||
final Integer withdrawalFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||
ChargesHelper.getSavingsWithdrawalFeeJSON());
|
||||
Assert.assertNotNull(withdrawalFeeChargeId);
|
||||
Assertions.assertNotNull(withdrawalFeeChargeId);
|
||||
|
||||
// Updating Charge-Calculation-Type to Withdrawal-Fee
|
||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, withdrawalFeeChargeId,
|
||||
@@ -275,52 +273,52 @@ public class ChargesTest {
|
||||
chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, withdrawalFeeChargeId);
|
||||
|
||||
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);
|
||||
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
|
||||
final Integer annualFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||
ChargesHelper.getSavingsAnnualFeeJSON());
|
||||
Assert.assertNotNull(annualFeeChargeId);
|
||||
Assertions.assertNotNull(annualFeeChargeId);
|
||||
|
||||
// Updating Charge Amount
|
||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, annualFeeChargeId, ChargesHelper.getModifyChargeJSON());
|
||||
|
||||
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);
|
||||
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
|
||||
final Integer monthlyFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||
ChargesHelper.getSavingsMonthlyFeeJSON());
|
||||
Assert.assertNotNull(monthlyFeeChargeId);
|
||||
Assertions.assertNotNull(monthlyFeeChargeId);
|
||||
|
||||
// Updating Charge Amount
|
||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, monthlyFeeChargeId, ChargesHelper.getModifyChargeJSON());
|
||||
|
||||
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);
|
||||
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
|
||||
final Integer overdraftFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||
ChargesHelper.getSavingsOverdraftFeeJSON());
|
||||
Assert.assertNotNull(overdraftFeeChargeId);
|
||||
Assertions.assertNotNull(overdraftFeeChargeId);
|
||||
|
||||
// Updating Charge Amount
|
||||
changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdraftFeeChargeId,
|
||||
ChargesHelper.getModifyChargeJSON());
|
||||
|
||||
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);
|
||||
Assert.assertEquals("Verifying Charge ID after deletion", overdraftFeeChargeId, chargeIdAfterDeletion);
|
||||
Assertions.assertEquals(overdraftFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion");
|
||||
}
|
||||
}
|
||||
|
||||
+739
-739
File diff suppressed because it is too large
Load Diff
Executable → Regular
+873
-960
File diff suppressed because it is too large
Load Diff
+21
-17
@@ -18,44 +18,48 @@
|
||||
*/
|
||||
package org.apache.fineract.integrationtests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.HashMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ClientStatusChecker {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(ClientStatusChecker.class);
|
||||
|
||||
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) {
|
||||
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS CLOSED ------------------------------------");
|
||||
assertEquals((int) clientStatusHashMap.get("id"), 600);
|
||||
System.out.println("Client Status:" + clientStatusHashMap + "\n");
|
||||
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS CLOSED ------------------------------------");
|
||||
assertEquals(600, (int) clientStatusHashMap.get("id"));
|
||||
LOG.info("Client Status: {} \n", clientStatusHashMap);
|
||||
}
|
||||
|
||||
public static void verifyClientPending(final HashMap<String, Object> clientStatusHashMap) {
|
||||
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS PENDING ------------------------------------");
|
||||
assertEquals((int) clientStatusHashMap.get("id"), 100);
|
||||
System.out.println("Client Status:" + clientStatusHashMap + "\n");
|
||||
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS PENDING ------------------------------------");
|
||||
assertEquals(100, (int) clientStatusHashMap.get("id"));
|
||||
LOG.info("Client Status: {} \n", clientStatusHashMap);
|
||||
}
|
||||
|
||||
public static void verifyClientRejected(final HashMap<String, Object> clientStatusHashMap) {
|
||||
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS REJECTED ------------------------------------");
|
||||
assertEquals((int) clientStatusHashMap.get("id"), 700);
|
||||
System.out.println("Client Status:" + clientStatusHashMap + "\n");
|
||||
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS REJECTED ------------------------------------");
|
||||
assertEquals(700, (int) clientStatusHashMap.get("id"));
|
||||
LOG.info("Client Status: {} \n", clientStatusHashMap);
|
||||
}
|
||||
|
||||
public static void verifyClientActiavted(final HashMap<String, Object> clientStatusHashMap) {
|
||||
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS ACTIVATED ------------------------------------");
|
||||
assertEquals((int) clientStatusHashMap.get("id"), 300);
|
||||
System.out.println("Client Status:" + clientStatusHashMap + "\n");
|
||||
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS ACTIVATED ------------------------------------");
|
||||
assertEquals(300, (int) clientStatusHashMap.get("id"));
|
||||
LOG.info("Client Status: {} \n", clientStatusHashMap);
|
||||
}
|
||||
|
||||
public static void verifyClientWithdrawn(final HashMap<String, Object> clientStatusHashMap) {
|
||||
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS WITHDRAWN ------------------------------------");
|
||||
assertEquals((int) clientStatusHashMap.get("id"), 800);
|
||||
System.out.println("Client Status:" + clientStatusHashMap + "\n");
|
||||
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS WITHDRAWN ------------------------------------");
|
||||
assertEquals(800, (int) clientStatusHashMap.get("id"));
|
||||
LOG.info("Client Status: {} \n", clientStatusHashMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+18
-20
@@ -18,19 +18,17 @@
|
||||
*/
|
||||
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 org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ClientTest {
|
||||
|
||||
@@ -38,7 +36,7 @@ public class ClientTest {
|
||||
private RequestSpecification requestSpec;
|
||||
private ClientHelper clientHelper;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -51,7 +49,7 @@ public class ClientTest {
|
||||
public void testClientStatus() {
|
||||
this.clientHelper = new ClientHelper(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));
|
||||
ClientStatusChecker.verifyClientIsActive(status);
|
||||
@@ -78,13 +76,13 @@ public class ClientTest {
|
||||
ClientStatusChecker.verifyClientWithdrawn(clientStatusHashMap);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
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);
|
||||
Assert.assertNotNull(clientId);
|
||||
Assertions.assertNotNull(clientId);
|
||||
|
||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||
ClientStatusChecker.verifyClientIsActive(status);
|
||||
@@ -111,13 +109,13 @@ public class ClientTest {
|
||||
ClientStatusChecker.verifyClientWithdrawn(clientStatusHashMap);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
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);
|
||||
Assert.assertNotNull(clientId);
|
||||
Assertions.assertNotNull(clientId);
|
||||
|
||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||
ClientStatusChecker.verifyClientIsActive(status);
|
||||
|
||||
+260
-285
@@ -18,336 +18,311 @@
|
||||
*/
|
||||
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.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
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.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
||||
import org.apache.fineract.portfolio.client.api.ClientApiConstants;
|
||||
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;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@SuppressWarnings({ "unused" })
|
||||
public class ClientUndoRejectAndWithdrawalIntegrationTest {
|
||||
|
||||
private static final String CREATE_CLIENT_URL = "/fineract-provider/api/v1/clients?" + Utils.TENANT_IDENTIFIER;
|
||||
public static final String DATE_FORMAT = "dd MMMM yyyy";
|
||||
private final String submittedOnDate = "submittedOnDate";
|
||||
private final String officeId = "officeId";
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
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();
|
||||
private static final String CREATE_CLIENT_URL = "/fineract-provider/api/v1/clients?" + Utils.TENANT_IDENTIFIER;
|
||||
public static final String DATE_FORMAT = "dd MMMM yyyy";
|
||||
private final String submittedOnDate = "submittedOnDate";
|
||||
private final String officeId = "officeId";
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private ClientHelper clientHelper;
|
||||
|
||||
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
|
||||
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);
|
||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||
}
|
||||
|
||||
// CREATE CLIENT
|
||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(clientId);
|
||||
@Test
|
||||
public void clientUndoRejectIntegrationTest() {
|
||||
|
||||
// GET CLIENT STATUS
|
||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
|
||||
String.valueOf(clientId));
|
||||
// CREATE CLIENT
|
||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||
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.verifyClientRejected(status);
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
|
||||
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoRejectedclient(clientId,
|
||||
CommonConstants.RESPONSE_ERROR, ClientHelper.CREATED_DATE);
|
||||
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.rejectClient(clientId);
|
||||
ClientStatusChecker.verifyClientRejected(status);
|
||||
|
||||
status = this.clientHelper.undoReject(clientId);
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
}
|
||||
status = this.clientHelper.undoReject(clientId);
|
||||
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
|
||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(clientId);
|
||||
@Test
|
||||
public void testClientUndoRejectWithDateBeforeRejectDate() {
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||
|
||||
// GET CLIENT STATUS
|
||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
|
||||
String.valueOf(clientId));
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
// CREATE CLIENT
|
||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||
Assertions.assertNotNull(clientId);
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
Calendar todaysDate = Calendar.getInstance();
|
||||
final String undoRejectDate = dateFormat.format(todaysDate.getTime());
|
||||
// GET CLIENT STATUS
|
||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||
|
||||
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoRejectedclient(clientId,
|
||||
CommonConstants.RESPONSE_ERROR, undoRejectDate);
|
||||
assertEquals("error.msg.client.undorejection.on.nonrejected.account",
|
||||
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
|
||||
status = this.clientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
status = this.clientHelper.rejectClient(clientId);
|
||||
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
|
||||
public void testClientUndoRejectWithFutureDate() {
|
||||
status = this.clientHelper.undoReject(clientId);
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
}
|
||||
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||
@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
|
||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(clientId);
|
||||
// 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));
|
||||
// GET CLIENT STATUS
|
||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, 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);
|
||||
ClientStatusChecker.verifyClientRejected(status);
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
Calendar todaysDate = Calendar.getInstance();
|
||||
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));
|
||||
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoRejectedclient(clientId,
|
||||
CommonConstants.RESPONSE_ERROR, undoRejectDate);
|
||||
assertEquals("error.msg.client.undorejection.on.nonrejected.account",
|
||||
clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
status = this.clientHelper.undoReject(clientId);
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clientUndoWithDrawnIntegrationTest() {
|
||||
@Test
|
||||
public void testClientUndoRejectWithFutureDate() {
|
||||
|
||||
// CREATE CLIENT
|
||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(clientId);
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||
|
||||
// GET CLIENT STATUS
|
||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
|
||||
String.valueOf(clientId));
|
||||
// CREATE CLIENT
|
||||
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||
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.verifyClientWithdrawn(status);
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
|
||||
status = this.clientHelper.undoWithdrawn(clientId);
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
status = this.clientHelper.rejectClient(clientId);
|
||||
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();
|
||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||
@Test
|
||||
public void clientUndoWithDrawnIntegrationTest() {
|
||||
|
||||
// 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.withdrawClient(clientId);
|
||||
ClientStatusChecker.verifyClientWithdrawn(status);
|
||||
|
||||
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoWithdrawclient(clientId,
|
||||
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));
|
||||
|
||||
status = this.clientHelper.undoWithdrawn(clientId);
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Test
|
||||
public void testClientUndoWithDrawnWithoutWithdrawal() {
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||
// 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));
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
Calendar todaysDate = Calendar.getInstance();
|
||||
final String undoWithdrawDate = dateFormat.format(todaysDate.getTime());
|
||||
|
||||
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoWithdrawclient(clientId,
|
||||
CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
|
||||
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));
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClientUndoWithDrawnWithFutureDate() {
|
||||
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||
|
||||
// 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.withdrawClient(clientId);
|
||||
ClientStatusChecker.verifyClientWithdrawn(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());
|
||||
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoWithdrawclient(clientId,
|
||||
CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
|
||||
assertEquals("validation.msg.client.reopenedDate.is.greater.than.date",
|
||||
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
status = this.clientHelper.undoWithdrawn(clientId);
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Test
|
||||
public void testValidateReopenedDate() {
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||
|
||||
// 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.withdrawClient(clientId);
|
||||
ClientStatusChecker.verifyClientWithdrawn(status);
|
||||
status = this.clientHelper.undoWithdrawn(clientId);
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.activateClient(clientId,
|
||||
CommonConstants.RESPONSE_ERROR);
|
||||
assertEquals("error.msg.clients.submittedOnDate.after.reopened.date",
|
||||
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReopenedDate() {
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||
|
||||
// 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.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");
|
||||
}
|
||||
// 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);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClientUndoWithDrawnWithDateBeforeWithdrawal() {
|
||||
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||
|
||||
// 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);
|
||||
|
||||
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
|
||||
CommonConstants.RESPONSE_ERROR, ClientHelper.CREATED_DATE);
|
||||
assertEquals("error.msg.client.reopened.date.cannot.before.client.withdrawal.date",
|
||||
clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
status = this.clientHelper.undoWithdrawn(clientId);
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Test
|
||||
public void testClientUndoWithDrawnWithoutWithdrawal() {
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||
// 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));
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
Date todaysDate = Utils.getLocalDateOfTenant().toDate();
|
||||
final String undoWithdrawDate = dateFormat.format(todaysDate);
|
||||
|
||||
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
|
||||
CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
|
||||
assertEquals("error.msg.client.undoWithdrawal.on.nonwithdrawal.account",
|
||||
clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClientUndoWithDrawnWithFutureDate() {
|
||||
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||
|
||||
// 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);
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
Date tomorrowsDate = Utils.getLocalDateOfTenant().plusDays(1).toDate();
|
||||
final String undoWithdrawDate = dateFormat.format(tomorrowsDate);
|
||||
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
|
||||
CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
|
||||
assertEquals("validation.msg.client.reopenedDate.is.greater.than.date",
|
||||
clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
status = this.clientHelper.undoWithdrawn(clientId);
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Test
|
||||
public void testValidateReopenedDate() {
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
|
||||
|
||||
// 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);
|
||||
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.activateClient(clientId, CommonConstants.RESPONSE_ERROR);
|
||||
assertEquals("error.msg.clients.submittedOnDate.after.reopened.date",
|
||||
clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReopenedDate() {
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
// final ClientHelper validationErrorHelper = new
|
||||
// ClientHelper(this.requestSpec, errorResponse);
|
||||
|
||||
// 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;
|
||||
|
||||
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.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.accounting.Account;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ConcurrencyIntegrationTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(ConcurrencyIntegrationTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
@@ -50,7 +51,7 @@ public class ConcurrencyIntegrationTest {
|
||||
|
||||
final int MYTHREADS = 30;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -75,7 +76,7 @@ public class ConcurrencyIntegrationTest {
|
||||
date.set(2011, 9, 20);
|
||||
Float repaymentAmount = 100.0f;
|
||||
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);
|
||||
repaymentAmount = repaymentAmount + 100;
|
||||
Runnable worker = new LoanRepaymentExecutor(loanTransactionHelper, loanID, repaymentAmount, date);
|
||||
@@ -87,12 +88,12 @@ public class ConcurrencyIntegrationTest {
|
||||
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) {
|
||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
LoanProductTestBuilder builder = new LoanProductTestBuilder() //
|
||||
.withPrincipal("12,000.00") //
|
||||
.withNumberOfRepayments("4") //
|
||||
@@ -113,7 +114,7 @@ public class ConcurrencyIntegrationTest {
|
||||
}
|
||||
|
||||
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() //
|
||||
.withPrincipal(principal) //
|
||||
.withLoanTermFrequency("4") //
|
||||
@@ -152,13 +153,13 @@ public class ConcurrencyIntegrationTest {
|
||||
try {
|
||||
this.loanTransactionHelper.makeRepayment(repaymentDate, repaymentAmount, loanId);
|
||||
} catch (Exception e) {
|
||||
System.out.println("Found an exception" + e.getMessage());
|
||||
System.out.println("Details of failed concurrent transaction (date, amount, loanId) are " + repaymentDate + ","
|
||||
+ repaymentAmount + "," + loanId);
|
||||
LOG.info("Found an exception {}", e.getMessage());
|
||||
LOG.info("Details of failed concurrent transaction (date, amount, loanId) are {},{},{}", repaymentDate, repaymentAmount,
|
||||
loanId);
|
||||
throw (e);
|
||||
}
|
||||
System.out.println("Details of passed concurrent transaction, details (date, amount, loanId) are " + repaymentDate + ","
|
||||
+ repaymentAmount + "," + loanId);
|
||||
LOG.info("Details of passed concurrent transaction, details (date, amount, loanId) are {},{},{}", repaymentDate,
|
||||
repaymentAmount, loanId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+20
-23
@@ -18,21 +18,19 @@
|
||||
*/
|
||||
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.Collections;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.CurrenciesHelper;
|
||||
import org.apache.fineract.integrationtests.common.CurrencyDomain;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@SuppressWarnings({ "unused", "rawtypes" })
|
||||
public class CurrenciesTest {
|
||||
@@ -40,7 +38,7 @@ public class CurrenciesTest {
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -54,13 +52,13 @@ public class CurrenciesTest {
|
||||
CurrencyDomain currency = CurrenciesHelper.getCurrencybyCode(requestSpec, responseSpec, "USD");
|
||||
CurrencyDomain usd = CurrencyDomain.create("USD", "US Dollar", 2, "$", "currency.USD", "US Dollar ($)").build();
|
||||
|
||||
Assert.assertTrue(currency.getDecimalPlaces() >= 0);
|
||||
Assert.assertNotNull(currency.getName());
|
||||
Assert.assertNotNull(currency.getDisplaySymbol());
|
||||
Assert.assertNotNull(currency.getDisplayLabel());
|
||||
Assert.assertNotNull(currency.getNameCode());
|
||||
Assertions.assertTrue(currency.getDecimalPlaces() >= 0);
|
||||
Assertions.assertNotNull(currency.getName());
|
||||
Assertions.assertNotNull(currency.getDisplaySymbol());
|
||||
Assertions.assertNotNull(currency.getDisplayLabel());
|
||||
Assertions.assertNotNull(currency.getNameCode());
|
||||
|
||||
Assert.assertEquals(usd, currency);
|
||||
Assertions.assertEquals(usd, currency);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -75,12 +73,11 @@ public class CurrenciesTest {
|
||||
currenciestoUpdate.add("USD");
|
||||
currenciestoUpdate.add("INR");
|
||||
|
||||
|
||||
ArrayList<String> currenciesOutput = CurrenciesHelper.updateSelectedCurrencies(this.requestSpec, this.responseSpec,
|
||||
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
|
||||
ArrayList<CurrencyDomain> currenciesBeforeUpdate = new ArrayList<CurrencyDomain>();
|
||||
@@ -90,8 +87,8 @@ public class CurrenciesTest {
|
||||
Collections.sort(currenciesBeforeUpdate);
|
||||
|
||||
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;
|
||||
|
||||
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.savings.SavingsAccountHelper;
|
||||
import org.junit.Before;
|
||||
|
||||
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 org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
public class CurrencyIntegrationTest {
|
||||
|
||||
@@ -34,8 +33,7 @@ public class CurrencyIntegrationTest {
|
||||
private RequestSpecification requestSpec;
|
||||
private SavingsAccountHelper savingsAccountHelper;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
|
||||
+82
-46
@@ -18,34 +18,39 @@
|
||||
*/
|
||||
package org.apache.fineract.integrationtests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
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.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.*;
|
||||
import org.apache.fineract.integrationtests.common.loans.*;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
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;
|
||||
import org.apache.fineract.integrationtests.common.CalendarHelper;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.GroupHelper;
|
||||
import org.apache.fineract.integrationtests.common.LoanRescheduleRequestHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanRescheduleRequestTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Tests loan schedule change based on group meeting changes and loan
|
||||
* rescheduling
|
||||
**/
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
@Ignore
|
||||
@Disabled
|
||||
public class DisbursalAndRepaymentScheduleTest {
|
||||
|
||||
private ResponseSpecification responseSpec;
|
||||
@@ -66,14 +71,16 @@ public class DisbursalAndRepaymentScheduleTest {
|
||||
|
||||
private final SimpleDateFormat dateFormatterStandard = new SimpleDateFormat("dd MMMM yyyy");
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRescheduleJLGLoanSynk() {
|
||||
System.out.println("---------------------------------STARTING RESCHEDULE JLG LOAN TEST ------------------------------------------");
|
||||
// system.out.println("---------------------------------STARTING
|
||||
// RESCHEDULE JLG
|
||||
// LOAN TEST ------------------------------------------");
|
||||
|
||||
Calendar meetingCalendar = Calendar.getInstance();
|
||||
meetingCalendar.setFirstDayOfWeek(Calendar.MONDAY);
|
||||
@@ -122,7 +129,9 @@ public class DisbursalAndRepaymentScheduleTest {
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(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
|
||||
this.createRequiredEntitiesForJLGLoanSync(groupMeetingDate);
|
||||
|
||||
@@ -137,7 +146,7 @@ public class DisbursalAndRepaymentScheduleTest {
|
||||
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
|
||||
// Test for loan account is created
|
||||
Assert.assertNotNull(this.loanId);
|
||||
Assertions.assertNotNull(this.loanId);
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
||||
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
@@ -152,25 +161,33 @@ public class DisbursalAndRepaymentScheduleTest {
|
||||
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
||||
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(),
|
||||
groupMeetingNewStartDate, "2", "2", "2"); // New meeting dates
|
||||
// will be the tuesday
|
||||
groupMeetingNewStartDate, "2", "2", "2"); // New
|
||||
// meeting
|
||||
// dates
|
||||
// will be
|
||||
// the
|
||||
// tuesday
|
||||
// after the
|
||||
// coming
|
||||
// monday
|
||||
|
||||
ArrayList loanRepaymnetSchedule = this.loanTransactionHelper
|
||||
.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, this.loanId);
|
||||
ArrayList loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec,
|
||||
this.loanId);
|
||||
|
||||
ArrayList dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
|
||||
Calendar dueDateCalendar = Calendar.getInstance();
|
||||
dueDateCalendar.setFirstDayOfWeek(Calendar.MONDAY);
|
||||
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
|
||||
(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")
|
||||
.updateNewInterestRate(rescheduleInterestRate).updateRescheduleFromDate(rescheduleDate)
|
||||
@@ -183,12 +200,16 @@ public class DisbursalAndRepaymentScheduleTest {
|
||||
dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
|
||||
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
|
||||
(Integer) dueDateLoanSchedule.get(2));
|
||||
assertEquals("AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER LOAN RESCHEDULE REQUEST WAS SENT", 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, 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)
|
||||
.getApproveLoanRescheduleRequestJSON();
|
||||
@@ -202,18 +223,25 @@ public class DisbursalAndRepaymentScheduleTest {
|
||||
dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
|
||||
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
|
||||
(Integer) dueDateLoanSchedule.get(2));
|
||||
assertEquals("AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER RESCHEDULE", 3,
|
||||
dueDateCalendar.get(Calendar.DAY_OF_WEEK));
|
||||
System.out.println("Successfully changed group meeting date (CAELNDAR ID: " + this.groupCalendarId
|
||||
+ ") and rescheduled loan (RESCHEDULE ID: " + this.loanRescheduleRequestId + ")");
|
||||
assertEquals(3, 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
|
||||
// + ") and rescheduled loan (RESCHEDULE ID: " +
|
||||
// this.loanRescheduleRequestId +
|
||||
// ")");
|
||||
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChangeGroupMeetingMaturedOnDate() {
|
||||
System.out
|
||||
.println("---------------------------------STARTING GROUP LOAN MEETING CHANGE DATE EXPECTED MATURED CHANGE------------------------------------------");
|
||||
// system.out
|
||||
// .println("---------------------------------STARTING GROUP LOAN
|
||||
// MEETING CHANGE
|
||||
// DATE EXPECTED MATURED
|
||||
// CHANGE------------------------------------------");
|
||||
|
||||
Calendar meetingCalendar = Calendar.getInstance();
|
||||
meetingCalendar.setFirstDayOfWeek(Calendar.MONDAY);
|
||||
@@ -257,7 +285,9 @@ public class DisbursalAndRepaymentScheduleTest {
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(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
|
||||
this.createRequiredEntitiesForJLGLoanSync(groupMeetingDate);
|
||||
|
||||
@@ -272,7 +302,7 @@ public class DisbursalAndRepaymentScheduleTest {
|
||||
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
|
||||
// Test for loan account is created
|
||||
Assert.assertNotNull(this.loanId);
|
||||
Assertions.assertNotNull(this.loanId);
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
||||
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
@@ -287,10 +317,16 @@ public class DisbursalAndRepaymentScheduleTest {
|
||||
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
||||
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(),
|
||||
groupMeetingNewStartDate, "2", "2", "2"); // New meeting dates
|
||||
// will be the tuesday
|
||||
groupMeetingNewStartDate, "2", "2", "2"); // New
|
||||
// meeting
|
||||
// dates
|
||||
// will be
|
||||
// the
|
||||
// tuesday
|
||||
// after the
|
||||
// coming
|
||||
// monday
|
||||
@@ -303,8 +339,8 @@ public class DisbursalAndRepaymentScheduleTest {
|
||||
expectedMaturityCalendar.set((Integer) expectedMaturityDate.get(0), (Integer) expectedMaturityDate.get(1) - 1,
|
||||
(Integer) expectedMaturityDate.get(2));
|
||||
|
||||
assertEquals("AFTER MEETING CHANGE DATE THE EXPECTED MATURITY SHOULD BE ON TUESDAY", 3,
|
||||
expectedMaturityCalendar.get(Calendar.DAY_OF_WEEK));
|
||||
assertEquals(3, 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);
|
||||
}
|
||||
@@ -365,4 +401,4 @@ public class DisbursalAndRepaymentScheduleTest {
|
||||
public void setGroupCalendarId(Integer groupCalendarId) {
|
||||
this.groupCalendarId = groupCalendarId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+35
-34
@@ -18,30 +18,30 @@
|
||||
*/
|
||||
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.ExternalServicesConfigurationHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
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;
|
||||
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 {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(ExternalServicesConfigurationTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private ExternalServicesConfigurationHelper externalServicesConfigurationHelper;
|
||||
private ResponseSpecification httpStatusForidden;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -57,27 +57,27 @@ public class ExternalServicesConfigurationTest {
|
||||
|
||||
// Checking for S3
|
||||
String configName = "s3_access_key";
|
||||
ArrayList<HashMap> externalServicesConfig = this.externalServicesConfigurationHelper
|
||||
ArrayList<HashMap> externalServicesConfig = ExternalServicesConfigurationHelper
|
||||
.getExternalServicesConfigurationByServiceName(requestSpec, responseSpec, "S3");
|
||||
Assert.assertNotNull(externalServicesConfig);
|
||||
for (Integer configIndex = 0; configIndex < (externalServicesConfig.size()); configIndex++) {
|
||||
Assertions.assertNotNull(externalServicesConfig);
|
||||
for (Integer configIndex = 0; configIndex < externalServicesConfig.size(); configIndex++) {
|
||||
String name = (String) externalServicesConfig.get(configIndex).get("name");
|
||||
String value = null;
|
||||
if (name.equals(configName)) {
|
||||
value = (String) externalServicesConfig.get(configIndex).get("value");
|
||||
if(value == null){
|
||||
if (value == null) {
|
||||
value = "testnull";
|
||||
}
|
||||
String newValue = "test";
|
||||
System.out.println(name + ":" + value);
|
||||
HashMap arrayListValue = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
||||
LOG.info("{} : {}", name, value);
|
||||
HashMap arrayListValue = ExternalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
||||
responseSpec, "S3", name, newValue);
|
||||
Assert.assertNotNull(arrayListValue.get("value"));
|
||||
Assert.assertEquals(arrayListValue.get("value"), newValue);
|
||||
HashMap arrayListValue1 = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
||||
Assertions.assertNotNull(arrayListValue.get("value"));
|
||||
Assertions.assertEquals(arrayListValue.get("value"), newValue);
|
||||
HashMap arrayListValue1 = ExternalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
||||
responseSpec, "S3", name, value);
|
||||
Assert.assertNotNull(arrayListValue1.get("value"));
|
||||
Assert.assertEquals(arrayListValue1.get("value"), value);
|
||||
Assertions.assertNotNull(arrayListValue1.get("value"));
|
||||
Assertions.assertEquals(arrayListValue1.get("value"), value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -85,27 +85,28 @@ public class ExternalServicesConfigurationTest {
|
||||
// Checking for SMTP:
|
||||
|
||||
configName = "username";
|
||||
externalServicesConfig = this.externalServicesConfigurationHelper.getExternalServicesConfigurationByServiceName(requestSpec,
|
||||
externalServicesConfig = ExternalServicesConfigurationHelper.getExternalServicesConfigurationByServiceName(requestSpec,
|
||||
responseSpec, "SMTP");
|
||||
Assert.assertNotNull(externalServicesConfig);
|
||||
for (Integer configIndex = 0; configIndex < (externalServicesConfig.size()); configIndex++) {
|
||||
Assertions.assertNotNull(externalServicesConfig);
|
||||
|
||||
for (Integer configIndex = 0; configIndex < externalServicesConfig.size(); configIndex++) {
|
||||
String name = (String) externalServicesConfig.get(configIndex).get("name");
|
||||
String value = null;
|
||||
if (name.equals(configName)) {
|
||||
value = (String) externalServicesConfig.get(configIndex).get("value");
|
||||
if(value == null){
|
||||
if (value == null) {
|
||||
value = "testnull";
|
||||
}
|
||||
String newValue = "test";
|
||||
System.out.println(name + ":" + value);
|
||||
HashMap arrayListValue = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
||||
LOG.info("{} : {}", name, value);
|
||||
HashMap arrayListValue = ExternalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
||||
responseSpec, "SMTP", name, newValue);
|
||||
Assert.assertNotNull(arrayListValue.get("value"));
|
||||
Assert.assertEquals(arrayListValue.get("value"), newValue);
|
||||
HashMap arrayListValue1 = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
||||
Assertions.assertNotNull(arrayListValue.get("value"));
|
||||
Assertions.assertEquals(arrayListValue.get("value"), newValue);
|
||||
HashMap arrayListValue1 = ExternalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
|
||||
responseSpec, "SMTP", name, value);
|
||||
Assert.assertNotNull(arrayListValue1.get("value"));
|
||||
Assert.assertEquals(arrayListValue1.get("value"), value);
|
||||
Assertions.assertNotNull(arrayListValue1.get("value"));
|
||||
Assertions.assertEquals(arrayListValue1.get("value"), value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Executable → Regular
+38
-39
@@ -18,12 +18,16 @@
|
||||
*/
|
||||
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.List;
|
||||
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.exception.DuplicateFinancialActivityAccountFoundException;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.exception.FinancialActivityAccountInvalidException;
|
||||
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.AccountHelper;
|
||||
import org.apache.fineract.integrationtests.common.accounting.FinancialActivityAccountHelper;
|
||||
import org.junit.Assert;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class FinancialActivityAccountsTest {
|
||||
@@ -53,10 +50,10 @@ public class FinancialActivityAccountsTest {
|
||||
private RequestSpecification requestSpec;
|
||||
private AccountHelper accountHelper;
|
||||
private FinancialActivityAccountHelper financialActivityAccountHelper;
|
||||
private final Integer assetTransferFinancialActivityId = FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue();
|
||||
public static final Integer liabilityTransferFinancialActivityId = FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue();
|
||||
private final Integer assetTransferFinancialActivityId = FinancialActivity.ASSET_TRANSFER.getValue();
|
||||
public static final Integer LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID = FinancialActivity.LIABILITY_TRANSFER.getValue();
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -76,35 +73,36 @@ public class FinancialActivityAccountsTest {
|
||||
/** Create a Liability and an Asset Transfer Account **/
|
||||
Account liabilityTransferAccount = accountHelper.createLiabilityAccount();
|
||||
Account assetTransferAccount = accountHelper.createAssetAccount();
|
||||
Assert.assertNotNull(assetTransferAccount);
|
||||
Assert.assertNotNull(liabilityTransferAccount);
|
||||
Assertions.assertNotNull(assetTransferAccount);
|
||||
Assertions.assertNotNull(liabilityTransferAccount);
|
||||
|
||||
/*** Create A Financial Activity to Account Mapping **/
|
||||
Integer financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
|
||||
liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(), responseSpec,
|
||||
LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityTransferAccount.getAccountID(), responseSpec,
|
||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
Assert.assertNotNull(financialActivityAccountId);
|
||||
Assertions.assertNotNull(financialActivityAccountId);
|
||||
|
||||
/***
|
||||
* Fetch Created Financial Activity to Account Mapping and validate
|
||||
* created values
|
||||
**/
|
||||
assertFinancialActivityAccountCreation(financialActivityAccountId, liabilityTransferFinancialActivityId, liabilityTransferAccount);
|
||||
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID,
|
||||
liabilityTransferAccount);
|
||||
|
||||
/**
|
||||
* Update Existing Financial Activity to Account Mapping and assert
|
||||
* changes
|
||||
**/
|
||||
Account newLiabilityTransferAccount = accountHelper.createLiabilityAccount();
|
||||
Assert.assertNotNull(newLiabilityTransferAccount);
|
||||
Assertions.assertNotNull(newLiabilityTransferAccount);
|
||||
|
||||
HashMap changes = (HashMap) financialActivityAccountHelper.updateFinancialActivityAccount(financialActivityAccountId,
|
||||
liabilityTransferFinancialActivityId, newLiabilityTransferAccount.getAccountID(), responseSpec,
|
||||
LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, newLiabilityTransferAccount.getAccountID(), responseSpec,
|
||||
CommonConstants.RESPONSE_CHANGES);
|
||||
Assert.assertEquals(newLiabilityTransferAccount.getAccountID(), changes.get("glAccountId"));
|
||||
Assertions.assertEquals(newLiabilityTransferAccount.getAccountID(), changes.get("glAccountId"));
|
||||
|
||||
/** Validate update works correctly **/
|
||||
assertFinancialActivityAccountCreation(financialActivityAccountId, liabilityTransferFinancialActivityId,
|
||||
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID,
|
||||
newLiabilityTransferAccount);
|
||||
|
||||
/** Update with Invalid Financial Activity should fail **/
|
||||
@@ -116,7 +114,7 @@ public class FinancialActivityAccountsTest {
|
||||
|
||||
/** Creating Duplicate Financial Activity should fail **/
|
||||
List<HashMap> duplicateFinancialActivityAccountError = (List<HashMap>) financialActivityAccountHelper
|
||||
.createFinancialActivityAccount(liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(),
|
||||
.createFinancialActivityAccount(LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityTransferAccount.getAccountID(),
|
||||
responseSpecForDomainRuleViolation, CommonConstants.RESPONSE_ERROR);
|
||||
assertEquals(DuplicateFinancialActivityAccountFoundException.getErrorcode(),
|
||||
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));
|
||||
|
||||
/** Should be able to delete a Financial Activity to Account Mapping **/
|
||||
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper.deleteFinancialActivityAccount(
|
||||
financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
Assert.assertNotNull(deletedFinancialActivityAccountId);
|
||||
Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
|
||||
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper
|
||||
.deleteFinancialActivityAccount(financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
Assertions.assertNotNull(deletedFinancialActivityAccountId);
|
||||
Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
|
||||
|
||||
/*** Trying to fetch a Deleted Account Mapping should give me a 404 **/
|
||||
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);
|
||||
Assert.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id"));
|
||||
Assert.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id"));
|
||||
Assertions.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id"));
|
||||
Assertions.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the Financial activities
|
||||
*/
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
|
||||
for (HashMap financialActivity : financialActivities) {
|
||||
Integer financialActivityAccountId = (Integer) financialActivity.get("id");
|
||||
Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper.deleteFinancialActivityAccount(
|
||||
financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
Assert.assertNotNull(deletedFinancialActivityAccountId);
|
||||
Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
|
||||
Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper
|
||||
.deleteFinancialActivityAccount(financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
Assertions.assertNotNull(deletedFinancialActivityAccountId);
|
||||
Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+752
-614
File diff suppressed because it is too large
Load Diff
+36
-33
@@ -18,12 +18,16 @@
|
||||
*/
|
||||
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.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
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.SavingsProductHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
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;
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unused", "unchecked" })
|
||||
public class FlexibleSavingsInterestPostingIntegrationTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(FlexibleSavingsInterestPostingIntegrationTest.class);
|
||||
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
|
||||
|
||||
private ResponseSpecification responseSpec;
|
||||
@@ -52,7 +53,7 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
|
||||
private SavingsProductHelper savingsProductHelper;
|
||||
private SavingsAccountHelper savingsAccountHelper;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -67,15 +68,14 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
|
||||
// client activation, savings activation and 1st transaction date
|
||||
final String startDate = "01 December 2013";
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, startDate);
|
||||
Assert.assertNotNull(clientID);
|
||||
Assertions.assertNotNull(clientID);
|
||||
|
||||
// Configuring global config flags
|
||||
configureInterestPosting(true, 4);
|
||||
|
||||
final Integer savingsId = createSavingsAccount(clientID, startDate);
|
||||
|
||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1000", startDate,
|
||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1000", startDate, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
|
||||
/***
|
||||
* Perform Post interest transaction and verify the posted transaction
|
||||
@@ -85,22 +85,23 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
|
||||
HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
|
||||
ArrayList<HashMap<String, Object>> transactions = (ArrayList<HashMap<String, Object>>) accountDetails.get("transactions");
|
||||
HashMap<String, Object> interestPostingTransaction = transactions.get(transactions.size() - 2);
|
||||
for (Entry<String, Object> entry : interestPostingTransaction.entrySet())
|
||||
System.out.println(entry.getKey() + "-" + entry.getValue().toString());
|
||||
for (Entry<String, Object> entry : interestPostingTransaction.entrySet()) {
|
||||
LOG.info("{} - {}", entry.getKey(), entry.getValue().toString());
|
||||
}
|
||||
// 1st Dec 13 to 31st March 14 - 365 days, daily compounding using daily
|
||||
// balance
|
||||
// 33.7016 obtained from formula in excel provided by Subramanya
|
||||
assertEquals("Equality check for interest posted amount", "33.7016", interestPostingTransaction.get("amount").toString());
|
||||
assertEquals("Date check for Interest Posting transaction", "[2014, 3, 31]", interestPostingTransaction.get("date").toString());
|
||||
assertEquals("33.7016", interestPostingTransaction.get("amount").toString(), "Equality check for interest posted amount");
|
||||
assertEquals("[2014, 3, 31]", interestPostingTransaction.get("date").toString(), "Date check for Interest Posting transaction");
|
||||
|
||||
}
|
||||
|
||||
private Integer createSavingsAccount(final Integer clientID, final String startDate) {
|
||||
final Integer savingsProductID = createSavingsProduct();
|
||||
Assert.assertNotNull(savingsProductID);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplicationOnDate(clientID, savingsProductID,
|
||||
ACCOUNT_TYPE_INDIVIDUAL, startDate);
|
||||
Assert.assertNotNull(savingsId);
|
||||
Assertions.assertNotNull(savingsId);
|
||||
HashMap savingsStatusHashMap = this.savingsAccountHelper.approveSavingsOnDate(savingsId, startDate);
|
||||
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
|
||||
savingsStatusHashMap = this.savingsAccountHelper.activateSavingsAccount(savingsId, startDate);
|
||||
@@ -110,33 +111,34 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
|
||||
|
||||
private void configureInterestPosting(final Boolean periodEndEnable, final Integer financialYearBeginningMonth) {
|
||||
final ArrayList<HashMap> globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(globalConfig);
|
||||
Assertions.assertNotNull(globalConfig);
|
||||
|
||||
// Updating flag for interest posting at period end
|
||||
Integer periodEndConfigId = (Integer) globalConfig.get(10).get("id");
|
||||
Assert.assertNotNull(periodEndConfigId);
|
||||
Assertions.assertNotNull(periodEndConfigId);
|
||||
|
||||
HashMap periodEndConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
||||
periodEndConfigId.toString());
|
||||
Assert.assertNotNull(periodEndConfigData);
|
||||
Assertions.assertNotNull(periodEndConfigData);
|
||||
|
||||
Boolean enabled = (Boolean) globalConfig.get(10).get("enabled");
|
||||
|
||||
if (enabled != periodEndEnable)
|
||||
if (!enabled.equals(periodEndEnable)) {
|
||||
periodEndConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||
periodEndConfigId.toString(), periodEndEnable);
|
||||
}
|
||||
|
||||
// Updating value for financial year beginning month
|
||||
Integer financialYearBeginningConfigId = (Integer) globalConfig.get(11).get("id");
|
||||
Assert.assertNotNull(financialYearBeginningConfigId);
|
||||
Assertions.assertNotNull(financialYearBeginningConfigId);
|
||||
|
||||
HashMap financialYearBeginningConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec,
|
||||
this.responseSpec, financialYearBeginningConfigId.toString());
|
||||
Assert.assertNotNull(financialYearBeginningConfigData);
|
||||
HashMap financialYearBeginningConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
||||
financialYearBeginningConfigId.toString());
|
||||
Assertions.assertNotNull(financialYearBeginningConfigData);
|
||||
|
||||
financialYearBeginningConfigId = GlobalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||
financialYearBeginningConfigId.toString(), financialYearBeginningMonth.toString());
|
||||
Assert.assertNotNull(financialYearBeginningConfigId);
|
||||
Assertions.assertNotNull(financialYearBeginningConfigId);
|
||||
}
|
||||
|
||||
private Integer createSavingsProduct() {
|
||||
@@ -146,9 +148,10 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
|
||||
}
|
||||
|
||||
// Reset configuration fields
|
||||
@After
|
||||
@AfterEach
|
||||
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;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
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.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.funds.FundsHelper;
|
||||
import org.apache.fineract.integrationtests.common.funds.FundsResourceHandler;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
|
||||
import java.util.*;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Funds Integration Test for checking Funds Application.
|
||||
@@ -46,7 +47,7 @@ public class FundsIntegrationTest {
|
||||
private ResponseSpecification statusOkResponseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -56,121 +57,91 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testCreateFund() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assert.assertNotNull(fundID);
|
||||
Assertions.assertNotNull(fundID);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateFundWithEmptyName() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(null)
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(null).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, responseSpec);
|
||||
Assert.assertNull(fundID);
|
||||
Assertions.assertNull(fundID);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateFundWithEmptyExternalId() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(null)
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(null).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assert.assertNotNull(fundID);
|
||||
Assertions.assertNotNull(fundID);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateFundWithDuplicateName() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assert.assertNotNull(fundID);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
FundsHelper fh2 = FundsHelper
|
||||
.create(fh.getName())
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh2 = FundsHelper.create(fh.getName()).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
jsonData = fh2.toJSON();
|
||||
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
final Long fundID2 = createFund(jsonData, this.requestSpec, responseSpec);
|
||||
Assert.assertNull(fundID2);
|
||||
Assertions.assertNull(fundID2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateFundWithDuplicateExternalId() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assert.assertNotNull(fundID);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
FundsHelper fh2 = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(fh.getExternalId())
|
||||
.build();
|
||||
FundsHelper fh2 = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(fh.getExternalId()).build();
|
||||
jsonData = fh2.toJSON();
|
||||
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
final Long fundID2 = createFund(jsonData, this.requestSpec, responseSpec);
|
||||
Assert.assertNull(fundID2);
|
||||
Assertions.assertNull(fundID2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateFundWithInvalidName() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 120))
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 120)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, responseSpec);
|
||||
Assert.assertNull(fundID);
|
||||
Assertions.assertNull(fundID);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateFundWithInvalidExternalId() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(Utils.randomNameGenerator("fund-", 120))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 120)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, responseSpec);
|
||||
Assert.assertNull(fundID);
|
||||
Assertions.assertNull(fundID);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRetrieveFund() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assert.assertNotNull(fundID);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
jsonData = FundsResourceHandler.retrieveFund(fundID, this.requestSpec, this.statusOkResponseSpec);
|
||||
FundsHelper fh2 = FundsHelper.fromJSON(jsonData);
|
||||
@@ -180,47 +151,41 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testRetrieveAllFunds() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assert.assertNotNull(fundID);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
List<FundsHelper> fhList = FundsResourceHandler.retrieveAllFunds(this.requestSpec, this.statusOkResponseSpec);
|
||||
|
||||
Assert.assertNotNull(fhList);
|
||||
Assert.assertThat(fhList.size(), greaterThanOrEqualTo(1));
|
||||
Assert.assertThat(fhList, hasItem(fh));
|
||||
Assertions.assertNotNull(fhList);
|
||||
assertThat(fhList.size(), greaterThanOrEqualTo(1));
|
||||
assertThat(fhList, hasItem(fh));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRetrieveUnknownFund() {
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
||||
String jsonData = FundsResourceHandler.retrieveFund(Long.MAX_VALUE, this.requestSpec, responseSpec);
|
||||
HashMap<String, String> map = new Gson().fromJson(jsonData, HashMap.class);
|
||||
assertEquals(map.get("userMessageGlobalisationCode"), "error.msg.resource.not.found");
|
||||
HashMap<String, Object> map = new Gson().fromJson(jsonData, new TypeToken<HashMap<String, Object>>() {}.getType());
|
||||
assertEquals("error.msg.resource.not.found", map.get("userMessageGlobalisationCode"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFund() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assert.assertNotNull(fundID);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
String newName = Utils.randomNameGenerator("", 10);
|
||||
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, this.statusOkResponseSpec);
|
||||
|
||||
Assert.assertEquals(newName, fh2.getName());
|
||||
Assert.assertEquals(newExternalId, fh2.getExternalId());
|
||||
Assertions.assertEquals(newName, fh2.getName());
|
||||
Assertions.assertEquals(newExternalId, fh2.getExternalId());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -228,120 +193,100 @@ public class FundsIntegrationTest {
|
||||
String newName = Utils.randomNameGenerator("", 10);
|
||||
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
||||
FundsHelper fh = FundsResourceHandler.updateFund(Long.MAX_VALUE, newName, newExternalId, this.requestSpec,
|
||||
responseSpec);
|
||||
Assert.assertNull(fh);
|
||||
FundsHelper fh = FundsResourceHandler.updateFund(Long.MAX_VALUE, newName, newExternalId, this.requestSpec, responseSpec);
|
||||
Assertions.assertNull(fh);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFundWithInvalidNewName() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assert.assertNotNull(fundID);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
String newName = Utils.randomNameGenerator("", 120);
|
||||
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec,
|
||||
responseSpec);
|
||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, responseSpec);
|
||||
|
||||
Assert.assertNull(fh2);
|
||||
Assertions.assertNull(fh2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFundWithNewExternalId() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assert.assertNotNull(fundID);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, null, newExternalId, this.requestSpec, this.statusOkResponseSpec);
|
||||
|
||||
Assert.assertEquals(newExternalId, fh2.getExternalId());
|
||||
Assertions.assertEquals(newExternalId, fh2.getExternalId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFundWithInvalidNewExternalId() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assert.assertNotNull(fundID);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
String newName = Utils.randomNameGenerator("", 10);
|
||||
String newExternalId = Utils.randomNameGenerator("fund-", 120);
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec,
|
||||
responseSpec);
|
||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, responseSpec);
|
||||
|
||||
Assert.assertNull(fh2);
|
||||
Assertions.assertNull(fh2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFundWithNewName() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assert.assertNotNull(fundID);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
String newName = Utils.randomNameGenerator("", 10);
|
||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, null, this.requestSpec, this.statusOkResponseSpec);
|
||||
|
||||
Assert.assertEquals(newName, fh2.getName());
|
||||
Assertions.assertEquals(newName, fh2.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFundWithEmptyParams() {
|
||||
FundsHelper fh = FundsHelper
|
||||
.create(Utils.randomNameGenerator("", 10))
|
||||
.externalId(Utils.randomNameGenerator("fund-", 5))
|
||||
.build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
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);
|
||||
|
||||
Assert.assertNull(fh2.getName());
|
||||
Assert.assertNull(fh2.getExternalId());
|
||||
Assertions.assertNull(fh2.getName());
|
||||
Assertions.assertNull(fh2.getExternalId());
|
||||
|
||||
// assert that there was no change in
|
||||
// the name and external ID of the fund
|
||||
jsonData = FundsResourceHandler.retrieveFund(fundID, this.requestSpec, this.statusOkResponseSpec);
|
||||
FundsHelper fh3 = new Gson().fromJson(jsonData, FundsHelper.class);
|
||||
|
||||
Assert.assertEquals(fh.getName(), fh3.getName());
|
||||
Assert.assertEquals(fh.getExternalId(), fh3.getExternalId());
|
||||
Assertions.assertEquals(fh.getName(), fh3.getName());
|
||||
Assertions.assertEquals(fh.getExternalId(), fh3.getExternalId());
|
||||
}
|
||||
|
||||
private Long createFund(final String fundJSON,
|
||||
final RequestSpecification requestSpec,
|
||||
final ResponseSpecification responseSpec) {
|
||||
private Long createFund(final String fundJSON, final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
|
||||
String fundId = String.valueOf(FundsResourceHandler.createFund(fundJSON, requestSpec, responseSpec));
|
||||
if (fundId.equals("null")) {
|
||||
// Invalid JSON data parameters
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Long(fundId);
|
||||
return Long.valueOf(fundId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+36
-36
@@ -18,62 +18,62 @@
|
||||
*/
|
||||
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.GlobalConfigurationHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest {
|
||||
|
||||
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private GlobalConfigurationHelper globalConfigurationHelper;
|
||||
|
||||
@Before
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
@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
|
||||
public void testInterestChargedFromDateSameAsDisbursalDate(){
|
||||
public void testInterestChargedFromDateSameAsDisbursalDate() {
|
||||
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
// Retrieving All Global Configuration details
|
||||
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper
|
||||
.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(globalConfig);
|
||||
|
||||
|
||||
// Retrieving All Global Configuration details
|
||||
final ArrayList<HashMap> globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||
Assertions.assertNotNull(globalConfig);
|
||||
|
||||
String configName = "interest-charged-from-date-same-as-disbursal-date";
|
||||
boolean newBooleanValue = true;
|
||||
|
||||
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 = 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+97
-105
@@ -18,23 +18,23 @@
|
||||
*/
|
||||
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.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
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;
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked", "static-access" })
|
||||
public class GlobalConfigurationTest {
|
||||
|
||||
private ResponseSpecification responseSpec;
|
||||
@@ -42,7 +42,7 @@ public class GlobalConfigurationTest {
|
||||
private GlobalConfigurationHelper globalConfigurationHelper;
|
||||
private ResponseSpecification httpStatusForidden;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -51,37 +51,42 @@ public class GlobalConfigurationTest {
|
||||
this.httpStatusForidden = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
GlobalConfigurationHelper.resetAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||
GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGlobalConfigurations() {
|
||||
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
// Retrieving All Global Configuration details
|
||||
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec,
|
||||
this.responseSpec);
|
||||
Assert.assertNotNull(globalConfig);
|
||||
final ArrayList<HashMap> globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||
Assertions.assertNotNull(globalConfig);
|
||||
|
||||
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)) {
|
||||
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());
|
||||
Assert.assertNotNull(configDataBefore);
|
||||
Assertions.assertNotNull(configDataBefore);
|
||||
|
||||
Integer value = (Integer) configDataBefore.get("value") + 1;
|
||||
|
||||
// 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());
|
||||
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());
|
||||
|
||||
// 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
|
||||
// Configuration
|
||||
@@ -93,14 +98,14 @@ public class GlobalConfigurationTest {
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
configId = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||
configId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||
configId.toString(), enabled);
|
||||
|
||||
configDataAfter = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
||||
configDataAfter = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
|
||||
configId.toString());
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
@@ -111,15 +116,15 @@ public class GlobalConfigurationTest {
|
||||
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
// Retrieving Is Cache Enabled Global Configuration details
|
||||
ArrayList<HashMap> isCacheGlobalConfig = this.globalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec,
|
||||
ArrayList<HashMap> isCacheGlobalConfig = GlobalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec,
|
||||
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
|
||||
isCacheGlobalConfig = this.globalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(isCacheGlobalConfig);
|
||||
isCacheGlobalConfig = GlobalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec, this.responseSpec);
|
||||
Assertions.assertNotNull(isCacheGlobalConfig);
|
||||
|
||||
HashMap cacheTypeAsHashMap = (HashMap) isCacheGlobalConfig.get(cacheType).get("cacheType");
|
||||
Integer cacheTypeId = (Integer) cacheTypeAsHashMap.get("id");
|
||||
@@ -132,90 +137,77 @@ public class GlobalConfigurationTest {
|
||||
cacheTypeId -= 1;
|
||||
}
|
||||
|
||||
HashMap changes = this.globalConfigurationHelper.updateIsCacheEnabledForGlobalConfiguration(this.requestSpec,
|
||||
this.responseSpec, cacheTypeId.toString());
|
||||
Assert.assertEquals("Verifying Is Cache Enabled Global Config after Updation", cacheTypeId, changes.get("cacheType"));
|
||||
HashMap changes = GlobalConfigurationHelper.updateIsCacheEnabledForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||
cacheTypeId.toString());
|
||||
Assertions.assertEquals(cacheTypeId, changes.get("cacheType"), "Verifying Is Cache Enabled Global Config after Updation");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGlobalConfigForcePasswordResetDays() {
|
||||
public void testGlobalConfigForcePasswordResetDays() {
|
||||
|
||||
// Retrieving All Global Configuration details
|
||||
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper
|
||||
.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(globalConfig);
|
||||
// Retrieving All Global Configuration details
|
||||
final ArrayList<HashMap> globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||
Assertions.assertNotNull(globalConfig);
|
||||
|
||||
String configName = "force-password-reset-days";
|
||||
String newValue = "0";
|
||||
String newBooleanValue = "true";
|
||||
String configName = "force-password-reset-days";
|
||||
String newValue = "0";
|
||||
String newBooleanValue = "true";
|
||||
|
||||
for (Integer configIndex = 0; configIndex < (globalConfig.size() - 1); configIndex++) {
|
||||
if (globalConfig.get(configIndex).get("name").equals(configName)) {
|
||||
Integer configId = (Integer) globalConfig.get(configIndex).get(
|
||||
"id");
|
||||
Assert.assertNotNull(configId);
|
||||
for (Integer configIndex = 0; configIndex < globalConfig.size() - 1; configIndex++) {
|
||||
if (globalConfig.get(configIndex).get("name").equals(configName)) {
|
||||
Integer configId = (Integer) globalConfig.get(configIndex).get("id");
|
||||
Assertions.assertNotNull(configId);
|
||||
|
||||
/*
|
||||
* Update force-password-reset-days with value as 0 and Enable
|
||||
* as true - failure case
|
||||
*/
|
||||
ArrayList error = (ArrayList) this.globalConfigurationHelper
|
||||
.updatePasswordResetDaysForGlobalConfiguration(
|
||||
this.requestSpec, this.httpStatusForidden,
|
||||
configId, newValue, newBooleanValue,
|
||||
CommonConstants.RESPONSE_ERROR);
|
||||
HashMap hash = (HashMap) error.get(0);
|
||||
/*
|
||||
* Update force-password-reset-days with value as 0 and Enable
|
||||
* as true - failure case
|
||||
*/
|
||||
ArrayList error = (ArrayList) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(this.requestSpec,
|
||||
this.httpStatusForidden, configId, newValue, newBooleanValue, CommonConstants.RESPONSE_ERROR);
|
||||
HashMap hash = (HashMap) error.get(0);
|
||||
|
||||
Assert.assertEquals(
|
||||
"Force Password Reset days value must be greater than zero.",
|
||||
"error.msg.password.reset.days.value.must.be.greater.than.zero",
|
||||
hash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
Assertions.assertEquals("error.msg.password.reset.days.value.must.be.greater.than.zero",
|
||||
hash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE),
|
||||
"Force Password Reset days value must be greater than zero.");
|
||||
|
||||
/*
|
||||
* Update force-password-reset-days with value as 50 and Enable
|
||||
* as true - success case
|
||||
*/
|
||||
final HashMap updateSuccess = (HashMap) this.globalConfigurationHelper
|
||||
.updatePasswordResetDaysForGlobalConfiguration(
|
||||
this.requestSpec, this.responseSpec, configId,
|
||||
"50", newBooleanValue, "changes");
|
||||
Assert.assertNotNull(updateSuccess);
|
||||
/*
|
||||
* Update force-password-reset-days with value as 50 and Enable
|
||||
* as true - success case
|
||||
*/
|
||||
final HashMap updateSuccess = (HashMap) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(
|
||||
this.requestSpec, this.responseSpec, configId, "50", newBooleanValue, "changes");
|
||||
Assertions.assertNotNull(updateSuccess);
|
||||
|
||||
/* Update with value as 0 and Enable as false - success case */
|
||||
final HashMap updateSuccess1 = (HashMap) this.globalConfigurationHelper
|
||||
.updatePasswordResetDaysForGlobalConfiguration(
|
||||
this.requestSpec, this.responseSpec, configId,
|
||||
newValue, "false", "changes");
|
||||
Assert.assertNotNull(updateSuccess1);
|
||||
/* Update with value as 0 and Enable as false - success case */
|
||||
final HashMap updateSuccess1 = (HashMap) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(
|
||||
this.requestSpec, this.responseSpec, configId, newValue, "false", "changes");
|
||||
Assertions.assertNotNull(updateSuccess1);
|
||||
|
||||
/* Update without sending value and Enable as true - failure case*/
|
||||
ArrayList failure = (ArrayList) this.globalConfigurationHelper
|
||||
.updatePasswordResetDaysForGlobalConfiguration(
|
||||
this.requestSpec, this.httpStatusForidden, configId,
|
||||
null, newBooleanValue, CommonConstants.RESPONSE_ERROR);
|
||||
HashMap failureHash = (HashMap) failure.get(0);
|
||||
Assert.assertEquals(
|
||||
"Force 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));
|
||||
/*
|
||||
* Update without sending value and Enable as true - failure
|
||||
* case
|
||||
*/
|
||||
ArrayList failure = (ArrayList) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(this.requestSpec,
|
||||
this.httpStatusForidden, configId, null, newBooleanValue, CommonConstants.RESPONSE_ERROR);
|
||||
HashMap failureHash = (HashMap) failure.get(0);
|
||||
Assertions.assertEquals("error.msg.password.reset.days.value.must.be.greater.than.zero",
|
||||
failureHash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE),
|
||||
"Force Password Reset days value must be greater than zero.");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Update other global configuration property */
|
||||
String otherConfigName = "maker-checker";
|
||||
for (Integer configIndex = 0; configIndex < (globalConfig.size() - 1); configIndex++) {
|
||||
if (globalConfig.get(configIndex).get("name")
|
||||
.equals(otherConfigName)) {
|
||||
String configId = (globalConfig.get(configIndex).get("id"))
|
||||
.toString();
|
||||
Integer updateConfigId = this.globalConfigurationHelper
|
||||
.updateValueForGlobalConfiguration(this.requestSpec,
|
||||
this.responseSpec, configId, newValue);
|
||||
Assert.assertNotNull(updateConfigId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Update other global configuration property */
|
||||
String otherConfigName = "maker-checker";
|
||||
for (Integer configIndex = 0; configIndex < globalConfig.size() - 1; configIndex++) {
|
||||
if (globalConfig.get(configIndex).get("name").equals(otherConfigName)) {
|
||||
String configId = globalConfig.get(configIndex).get("id").toString();
|
||||
Integer updateConfigId = GlobalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec,
|
||||
configId, newValue);
|
||||
Assertions.assertNotNull(updateConfigId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+172
-37
@@ -18,26 +18,31 @@
|
||||
*/
|
||||
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.Arrays;
|
||||
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.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.GroupHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Group Loan Integration Test for checking Loan Application Repayment Schedule.
|
||||
@@ -48,8 +53,9 @@ public class GroupLoanIntegrationTest {
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
private final static Logger LOG = LoggerFactory.getLogger(GroupLoanIntegrationTest.class);
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
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,
|
||||
loanID);
|
||||
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() {
|
||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
final String loanProductJSON = new LoanProductTestBuilder() //
|
||||
.withPrincipal("12,000.00") //
|
||||
.withNumberOfRepayments("4") //
|
||||
@@ -89,7 +204,7 @@ public class GroupLoanIntegrationTest {
|
||||
}
|
||||
|
||||
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() //
|
||||
.withPrincipal("12,000.00") //
|
||||
.withLoanTermFrequency("4") //
|
||||
@@ -104,31 +219,51 @@ public class GroupLoanIntegrationTest {
|
||||
.withExpectedDisbursementDate("20 September 2011") //
|
||||
.withSubmittedOnDate("20 September 2011") //
|
||||
.withLoanType("group").build(groupID.toString(), loanProductID.toString(), null);
|
||||
System.out.println(loanApplicationJSON);
|
||||
LOG.info(loanApplicationJSON);
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
}
|
||||
|
||||
private void verifyLoanRepaymentSchedule(final ArrayList<HashMap> loanSchedule) {
|
||||
System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------");
|
||||
|
||||
assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 20)),
|
||||
loanSchedule.get(1).get("dueDate"));
|
||||
assertEquals("Checking for Principal Due for 1st Month", new Float("2911.49"), loanSchedule.get(1).get("principalOriginalDue"));
|
||||
assertEquals("Checking for Interest Due for 1st Month", new Float("240.00"), loanSchedule.get(1).get("interestOriginalDue"));
|
||||
|
||||
assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 20)),
|
||||
loanSchedule.get(2).get("dueDate"));
|
||||
assertEquals("Checking for Principal Due for 2nd Month", new Float("2969.72"), loanSchedule.get(2).get("principalDue"));
|
||||
assertEquals("Checking for Interest Due for 2nd Month", new Float("181.77"), loanSchedule.get(2).get("interestOriginalDue"));
|
||||
|
||||
assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 20)),
|
||||
loanSchedule.get(3).get("dueDate"));
|
||||
assertEquals("Checking for Principal Due for 3rd Month", new Float("3029.11"), loanSchedule.get(3).get("principalDue"));
|
||||
assertEquals("Checking for Interest Due for 3rd Month", new Float("122.38"), loanSchedule.get(3).get("interestOriginalDue"));
|
||||
|
||||
assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 20)),
|
||||
loanSchedule.get(4).get("dueDate"));
|
||||
assertEquals("Checking for Principal Due for 4th Month", new Float("3089.68"), loanSchedule.get(4).get("principalDue"));
|
||||
assertEquals("Checking for Interest Due for 4th Month", new Float("61.79"), loanSchedule.get(4).get("interestOriginalDue"));
|
||||
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) {
|
||||
LOG.info("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------");
|
||||
|
||||
assertEquals(new ArrayList<>(Arrays.asList(2011, 10, 20)), loanSchedule.get(1).get("dueDate"),
|
||||
"Checking for Due Date for 1st Month");
|
||||
assertEquals(Float.valueOf("2911.49"), loanSchedule.get(1).get("principalOriginalDue"), "Checking for Principal Due for 1st Month");
|
||||
assertEquals(Float.valueOf("240.00"), loanSchedule.get(1).get("interestOriginalDue"), "Checking for Interest Due for 1st Month");
|
||||
|
||||
assertEquals(new ArrayList<>(Arrays.asList(2011, 11, 20)), loanSchedule.get(2).get("dueDate"),
|
||||
"Checking for Due Date for 2nd Month");
|
||||
assertEquals(Float.valueOf("2969.72"), loanSchedule.get(2).get("principalDue"), "Checking for Principal Due for 2nd Month");
|
||||
assertEquals(Float.valueOf("181.77"), loanSchedule.get(2).get("interestOriginalDue"), "Checking for Interest Due for 2nd Month");
|
||||
|
||||
assertEquals(new ArrayList<>(Arrays.asList(2011, 12, 20)), loanSchedule.get(3).get("dueDate"),
|
||||
"Checking for Due Date for 3rd Month");
|
||||
assertEquals(Float.valueOf("3029.11"), loanSchedule.get(3).get("principalDue"), "Checking for Principal Due for 3rd Month");
|
||||
assertEquals(Float.valueOf("122.38"), loanSchedule.get(3).get("interestOriginalDue"), "Checking for Interest Due for 3rd Month");
|
||||
|
||||
assertEquals(new ArrayList<>(Arrays.asList(2012, 1, 20)), loanSchedule.get(4).get("dueDate"),
|
||||
"Checking for Due Date for 4th Month");
|
||||
assertEquals(Float.valueOf("3089.68"), loanSchedule.get(4).get("principalDue"), "Checking for Principal Due for 4th Month");
|
||||
assertEquals(Float.valueOf("61.79"), loanSchedule.get(4).get("interestOriginalDue"), "Checking for Interest Due for 4th Month");
|
||||
}
|
||||
}
|
||||
|
||||
+346
-90
@@ -18,8 +18,13 @@
|
||||
*/
|
||||
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.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -28,25 +33,22 @@ import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import java.util.Map;
|
||||
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.PaymentTypeHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Group Savings Integration Test for checking Savings Application.
|
||||
@@ -63,8 +65,9 @@ public class GroupSavingsIntegrationTest {
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private SavingsAccountHelper savingsAccountHelper;
|
||||
private final static Logger LOG = LoggerFactory.getLogger(GroupSavingsIntegrationTest.class);
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -77,26 +80,26 @@ public class GroupSavingsIntegrationTest {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, 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);
|
||||
Assert.assertNotNull(groupID);
|
||||
Assertions.assertNotNull(groupID);
|
||||
|
||||
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||
Assert.assertNotNull(groupID);
|
||||
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);
|
||||
Assert.assertNotNull(savingsProductID);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
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);
|
||||
Assert.assertTrue(modifications.containsKey("submittedOnDate"));
|
||||
Assertions.assertTrue(modifications.containsKey("submittedOnDate"));
|
||||
|
||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||
@@ -114,9 +117,10 @@ public class GroupSavingsIntegrationTest {
|
||||
|
||||
this.savingsAccountHelper.postInterestForSavings(savingsId);
|
||||
summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||
Assert.assertFalse(summaryBefore.equals(summary));
|
||||
Assertions.assertFalse(summaryBefore.equals(summary));
|
||||
|
||||
final Object savingsInterest = this.savingsAccountHelper.getSavingsInterest(savingsId);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -127,23 +131,23 @@ public class GroupSavingsIntegrationTest {
|
||||
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(clientID);
|
||||
Assertions.assertNotNull(clientID);
|
||||
|
||||
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());
|
||||
Assert.assertNotNull(groupID);
|
||||
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);
|
||||
Assert.assertNotNull(savingsProductID);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
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);
|
||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||
@@ -158,14 +162,15 @@ public class GroupSavingsIntegrationTest {
|
||||
Calendar todaysDate = Calendar.getInstance();
|
||||
final String CLOSEDON_DATE = dateFormat.format(todaysDate.getTime());
|
||||
String withdrawBalance = "false";
|
||||
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.closeSavingsAccountAndGetBackRequiredField(
|
||||
savingsId, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
|
||||
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper
|
||||
.closeSavingsAccountAndGetBackRequiredField(savingsId, 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.closeSavingsAccount(savingsId, withdrawBalance);
|
||||
savingsStatusHashMap = this.savingsAccountHelper.closeSavingsAccount(savingsId, withdrawBalance);
|
||||
SavingsStatusChecker.verifySavingsAccountIsClosed(savingsStatusHashMap);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -177,23 +182,23 @@ public class GroupSavingsIntegrationTest {
|
||||
new ResponseSpecBuilder().build());
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(clientID);
|
||||
Assertions.assertNotNull(clientID);
|
||||
|
||||
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());
|
||||
Assert.assertNotNull(groupID);
|
||||
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);
|
||||
Assert.assertNotNull(savingsProductID);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
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);
|
||||
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")
|
||||
@Test
|
||||
public void testSavingsAccount_REJECT_APPLICATION() {
|
||||
@@ -226,23 +453,23 @@ public class GroupSavingsIntegrationTest {
|
||||
new ResponseSpecBuilder().build());
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(clientID);
|
||||
Assertions.assertNotNull(clientID);
|
||||
|
||||
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());
|
||||
Assert.assertNotNull(groupID);
|
||||
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);
|
||||
Assert.assertNotNull(savingsProductID);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
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);
|
||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||
@@ -268,6 +495,7 @@ public class GroupSavingsIntegrationTest {
|
||||
|
||||
savingsStatusHashMap = this.savingsAccountHelper.rejectApplication(savingsId);
|
||||
SavingsStatusChecker.verifySavingsIsRejected(savingsStatusHashMap);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -276,23 +504,23 @@ public class GroupSavingsIntegrationTest {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(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);
|
||||
Assert.assertNotNull(groupID);
|
||||
Assertions.assertNotNull(groupID);
|
||||
|
||||
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||
Assert.assertNotNull(groupID);
|
||||
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);
|
||||
Assert.assertNotNull(savingsProductID);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
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);
|
||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||
@@ -310,23 +538,23 @@ public class GroupSavingsIntegrationTest {
|
||||
new ResponseSpecBuilder().build());
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(clientID);
|
||||
Assertions.assertNotNull(clientID);
|
||||
|
||||
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());
|
||||
Assert.assertNotNull(groupID);
|
||||
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);
|
||||
Assert.assertNotNull(savingsProductID);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
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);
|
||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||
@@ -348,40 +576,40 @@ public class GroupSavingsIntegrationTest {
|
||||
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
||||
|
||||
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||
Float balance = new Float(MINIMUM_OPENING_BALANCE);
|
||||
assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
|
||||
Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||
assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance");
|
||||
|
||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
|
||||
balance += new Float(DEPOSIT_AMOUNT);
|
||||
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
|
||||
assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance"));
|
||||
balance += Float.valueOf(DEPOSIT_AMOUNT);
|
||||
assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), "Verifying Deposit Amount");
|
||||
assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit");
|
||||
|
||||
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
|
||||
balance -= new Float(WITHDRAW_AMOUNT);
|
||||
assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"));
|
||||
assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance"));
|
||||
balance -= Float.valueOf(WITHDRAW_AMOUNT);
|
||||
assertEquals(Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"), "Verifying Withdrawal Amount");
|
||||
assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal");
|
||||
|
||||
Integer newWithdrawTransactionId = this.savingsAccountHelper.updateSavingsAccountTransaction(savingsId, withdrawTransactionId,
|
||||
WITHDRAW_AMOUNT_ADJUSTED);
|
||||
HashMap newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, newWithdrawTransactionId);
|
||||
balance = balance + new Float(WITHDRAW_AMOUNT) - new Float(WITHDRAW_AMOUNT_ADJUSTED);
|
||||
assertEquals("Verifying adjusted Amount", new Float(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount"));
|
||||
assertEquals("Verifying Balance after adjust", balance, newWithdrawTransaction.get("runningBalance"));
|
||||
balance = balance + Float.valueOf(WITHDRAW_AMOUNT) - Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED);
|
||||
assertEquals(Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount"), "Verifying adjusted Amount");
|
||||
assertEquals(balance, newWithdrawTransaction.get("runningBalance"), "Verifying Balance after adjust");
|
||||
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);
|
||||
Assert.assertTrue((Boolean) withdrawTransaction.get("reversed"));
|
||||
Assertions.assertTrue((Boolean) withdrawTransaction.get("reversed"));
|
||||
|
||||
this.savingsAccountHelper.undoSavingsAccountTransaction(savingsId, newWithdrawTransactionId);
|
||||
newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
|
||||
Assert.assertTrue((Boolean) newWithdrawTransaction.get("reversed"));
|
||||
Assertions.assertTrue((Boolean) newWithdrawTransaction.get("reversed"));
|
||||
summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||
balance += new Float(WITHDRAW_AMOUNT_ADJUSTED);
|
||||
assertEquals("Verifying Balance After Undo Transaction", balance, summary.get("accountBalance"));
|
||||
balance += Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED);
|
||||
assertEquals(balance, summary.get("accountBalance"), "Verifying Balance After Undo Transaction");
|
||||
|
||||
error = (List) savingsAccountHelperValidationError.withdrawalFromSavingsAccount(savingsId, "5000",
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);
|
||||
@@ -414,44 +642,44 @@ public class GroupSavingsIntegrationTest {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(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);
|
||||
Assert.assertNotNull(groupID);
|
||||
Assertions.assertNotNull(groupID);
|
||||
|
||||
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
|
||||
Assert.assertNotNull(groupID);
|
||||
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);
|
||||
Assert.assertNotNull(savingsProductID);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
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);
|
||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||
|
||||
final Integer withdrawalChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||
ChargesHelper.getSavingsWithdrawalFeeJSON());
|
||||
Assert.assertNotNull(withdrawalChargeId);
|
||||
Assertions.assertNotNull(withdrawalChargeId);
|
||||
|
||||
this.savingsAccountHelper.addChargesForSavings(savingsId, withdrawalChargeId, false);
|
||||
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");
|
||||
HashMap chargeChanges = this.savingsAccountHelper.updateCharges(savingsChargeId, savingsId);
|
||||
Assert.assertTrue(chargeChanges.containsKey("amount"));
|
||||
Assertions.assertTrue(chargeChanges.containsKey("amount"));
|
||||
|
||||
Integer deletedChargeId = this.savingsAccountHelper.deleteCharge(savingsChargeId, savingsId);
|
||||
assertEquals(savingsChargeId, deletedChargeId);
|
||||
|
||||
chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
||||
Assert.assertTrue(chargesPendingState == null || chargesPendingState.size() == 0);
|
||||
Assertions.assertTrue(chargesPendingState == null || chargesPendingState.size() == 0);
|
||||
|
||||
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
|
||||
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
|
||||
@@ -460,17 +688,17 @@ public class GroupSavingsIntegrationTest {
|
||||
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
||||
|
||||
final Integer chargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsAnnualFeeJSON());
|
||||
Assert.assertNotNull(chargeId);
|
||||
Assertions.assertNotNull(chargeId);
|
||||
|
||||
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);
|
||||
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
||||
Assert.assertEquals(1, charges.size());
|
||||
Assertions.assertEquals(1, charges.size());
|
||||
|
||||
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();
|
||||
List dates = (List) savingsChargeForPay.get("dueDate");
|
||||
cal.set(Calendar.YEAR, (Integer) dates.get(0));
|
||||
@@ -484,11 +712,11 @@ public class GroupSavingsIntegrationTest {
|
||||
|
||||
final Integer monthlyFeechargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||
ChargesHelper.getSavingsMonthlyFeeJSON());
|
||||
Assert.assertNotNull(monthlyFeechargeId);
|
||||
Assertions.assertNotNull(monthlyFeechargeId);
|
||||
|
||||
this.savingsAccountHelper.addChargesForSavings(savingsId, monthlyFeechargeId, true);
|
||||
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
||||
Assert.assertEquals(2, charges.size());
|
||||
Assertions.assertEquals(2, charges.size());
|
||||
|
||||
HashMap savingsChargeForWaive = charges.get(1);
|
||||
this.savingsAccountHelper.waiveCharge((Integer) savingsChargeForWaive.get("id"), savingsId);
|
||||
@@ -500,13 +728,14 @@ public class GroupSavingsIntegrationTest {
|
||||
BigDecimal totalWaiveAmount = BigDecimal.valueOf(Double.valueOf((Float) savingsChargeForWaive.get("amount")));
|
||||
totalWaiveAmount = totalWaiveAmount.add(totalWaiveAmount);
|
||||
assertEquals(totalWaiveAmount.floatValue(), waiveCharge.get("amountWaived"));
|
||||
|
||||
final Integer weeklyFeeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsWeeklyFeeJSON());
|
||||
Assert.assertNotNull(weeklyFeeId);
|
||||
|
||||
|
||||
final Integer weeklyFeeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
|
||||
ChargesHelper.getSavingsWeeklyFeeJSON());
|
||||
Assertions.assertNotNull(weeklyFeeId);
|
||||
|
||||
this.savingsAccountHelper.addChargesForSavings(savingsId, weeklyFeeId, true);
|
||||
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
|
||||
Assert.assertEquals(3, charges.size());
|
||||
Assertions.assertEquals(3, charges.size());
|
||||
|
||||
savingsChargeForPay = charges.get(2);
|
||||
cal = Calendar.getInstance();
|
||||
@@ -518,7 +747,7 @@ public class GroupSavingsIntegrationTest {
|
||||
// Depositing huge amount as scheduler job deducts the fee amount
|
||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "100000",
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
Assert.assertNotNull(depositTransactionId);
|
||||
Assertions.assertNotNull(depositTransactionId);
|
||||
|
||||
this.savingsAccountHelper.payCharge((Integer) savingsChargeForPay.get("id"), savingsId,
|
||||
((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))
|
||||
.plusWeeks((Integer) paidCharge.get("feeInterval"));
|
||||
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,
|
||||
final String minOpenningBalance, final String minBalanceForInterestCalculation, final String minRequiredBalance,
|
||||
final String enforceMinRequiredBalance) {
|
||||
System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
||||
LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
||||
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
|
||||
final String savingsProductJSON = savingsProductHelper //
|
||||
.withInterestCompoundingPeriodTypeAsDaily() //
|
||||
@@ -550,4 +779,31 @@ public class GroupSavingsIntegrationTest {
|
||||
.withMinimumOpenningBalance(minOpenningBalance).build();
|
||||
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
+26
-25
@@ -18,11 +18,15 @@
|
||||
*/
|
||||
package org.apache.fineract.integrationtests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
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 org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.GroupHelper;
|
||||
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.LoanTransactionHelper;
|
||||
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Group Test for checking Group: Creation, Activation, Client Association,
|
||||
@@ -46,6 +46,7 @@ import com.jayway.restassured.specification.ResponseSpecification;
|
||||
*/
|
||||
public class GroupTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(GroupTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
@@ -54,7 +55,7 @@ public class GroupTest {
|
||||
private final String numberOfRepayments = "5";
|
||||
private final String interestRatePerPeriod = "18";
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -109,22 +110,22 @@ public class GroupTest {
|
||||
|
||||
// create staff
|
||||
Integer createStaffId1 = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
System.out.println("--------------creating first staff with id-------------" + createStaffId1);
|
||||
Assert.assertNotNull(createStaffId1);
|
||||
LOG.info("--------------creating first staff with id------------- {}", createStaffId1);
|
||||
Assertions.assertNotNull(createStaffId1);
|
||||
|
||||
Integer createStaffId2 = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
System.out.println("--------------creating second staff with id-------------" + createStaffId2);
|
||||
Assert.assertNotNull(createStaffId2);
|
||||
LOG.info("--------------creating second staff with id------------- {}", createStaffId2);
|
||||
Assertions.assertNotNull(createStaffId2);
|
||||
|
||||
// assign staff "createStaffId1" to group
|
||||
HashMap assignStaffGroupId = (HashMap) GroupHelper.assignStaff(this.requestSpec, this.responseSpec, groupID.toString(),
|
||||
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
|
||||
final HashMap assignStaffToClientChanges = (HashMap) ClientHelper.assignStaffToClient(this.requestSpec, this.responseSpec,
|
||||
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();
|
||||
|
||||
@@ -139,13 +140,13 @@ public class GroupTest {
|
||||
|
||||
// assert if client staff officer has change Note client was assigned
|
||||
// staff with createStaffId2
|
||||
assertNotEquals("Verify if client stuff has changed", assignStaffAndInheritStaffForClientAccounts.get("staffId"), createStaffId2);
|
||||
assertEquals("Verify if client inherited staff assigned above", assignStaffAndInheritStaffForClientAccounts.get("staffId"),
|
||||
getClientStaffId);
|
||||
assertNotEquals(assignStaffAndInheritStaffForClientAccounts.get("staffId"), createStaffId2, "Verify if client stuff has changed");
|
||||
assertEquals(assignStaffAndInheritStaffForClientAccounts.get("staffId"), getClientStaffId,
|
||||
"Verify if client inherited staff assigned above");
|
||||
|
||||
// assert if clients loan officer has changed
|
||||
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) {
|
||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||
.withPrincipal(principal) //
|
||||
.withLoanTermFrequency("4") //
|
||||
@@ -175,4 +176,4 @@ public class GroupTest {
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+33
-31
@@ -18,36 +18,37 @@
|
||||
*/
|
||||
package org.apache.fineract.integrationtests;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.jupiter.api.Assertions.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 org.apache.fineract.integrationtests.common.HookHelper;
|
||||
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.http.conn.HttpHostConnectException;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.RestAssured;
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
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;
|
||||
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;
|
||||
|
||||
public class HookIntegrationTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(HookIntegrationTest.class);
|
||||
private RequestSpecification requestSpec;
|
||||
private ResponseSpecification responseSpec;
|
||||
|
||||
private HookHelper hookHelper;
|
||||
private OfficeHelper officeHelper;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -62,7 +63,8 @@ public class HookIntegrationTest {
|
||||
// Subject to https://echo-webhook.herokuapp.com being up
|
||||
// See
|
||||
// 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);
|
||||
final Integer createdOfficeID = this.officeHelper.createOffice("01 January 2012");
|
||||
try {
|
||||
@@ -76,9 +78,9 @@ public class HookIntegrationTest {
|
||||
try {
|
||||
final String json = RestAssured.get(payloadURL.replace("?", "")).asString();
|
||||
final Integer notificationOfficeId = JsonPath.with(json).get("officeId");
|
||||
Assert.assertEquals("Equality check for created officeId and hook received payload officeId", createdOfficeID,
|
||||
notificationOfficeId);
|
||||
System.out.println("Notification Office Id - " + notificationOfficeId);
|
||||
Assertions.assertEquals(createdOfficeID, notificationOfficeId,
|
||||
"Equality check for created officeId and hook received payload officeId");
|
||||
LOG.info("Notification Office Id - {}", notificationOfficeId);
|
||||
i = 6;
|
||||
} catch (Exception e) {
|
||||
TimeUnit.SECONDS.sleep(3);
|
||||
@@ -94,22 +96,22 @@ public class HookIntegrationTest {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void createUpdateAndDeleteHook(){
|
||||
final String payloadURL = "http://echo-webhook.herokuapp.com:80/Z7RXoCBdLSFMDrpn?";
|
||||
final String updateURL = "http://localhost";
|
||||
public void createUpdateAndDeleteHook() {
|
||||
final String payloadURL = "http://echo-webhook.herokuapp.com:80/Z7RXoCBdLSFMDrpn?";
|
||||
final String updateURL = "http://localhost";
|
||||
|
||||
Long hookId = this.hookHelper.createHook(payloadURL).longValue();
|
||||
Assert.assertNotNull(hookId);
|
||||
Assertions.assertNotNull(hookId);
|
||||
this.hookHelper.verifyHookCreatedOnServer(hookId);
|
||||
System.out.println("---------------------SUCCESSFULLY CREATED AND VERIFIED HOOK-------------------------"+hookId);
|
||||
this.hookHelper.updateHook(updateURL, hookId);
|
||||
this.hookHelper.verifyUpdateHook(updateURL, hookId);
|
||||
System.out.println("---------------------SUCCESSFULLY UPDATED AND VERIFIED HOOK-------------------------"+hookId);
|
||||
this.hookHelper.deleteHook(hookId);
|
||||
this.hookHelper.verifyDeleteHook(hookId);
|
||||
System.out.println("---------------------SUCCESSFULLY DELETED AND VERIFIED HOOK-------------------------"+hookId);
|
||||
LOG.info("---------------------SUCCESSFULLY CREATED AND VERIFIED HOOK------------------------- {}", hookId);
|
||||
this.hookHelper.updateHook(updateURL, hookId);
|
||||
this.hookHelper.verifyUpdateHook(updateURL, hookId);
|
||||
LOG.info("---------------------SUCCESSFULLY UPDATED AND VERIFIED HOOK------------------------- {}", hookId);
|
||||
this.hookHelper.deleteHook(hookId);
|
||||
this.hookHelper.verifyDeleteHook(hookId);
|
||||
LOG.info("---------------------SUCCESSFULLY DELETED AND VERIFIED HOOK------------------------- {}", hookId);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+27
-30
@@ -18,12 +18,16 @@
|
||||
*/
|
||||
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.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
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.LoanStatusChecker;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class LoanApplicationApprovalTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(LoanApplicationApprovalTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private ResponseSpecification responseSpecForStatusCode403;
|
||||
private ResponseSpecification responseSpecForStatusCode400;
|
||||
private RequestSpecification requestSpec;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -130,14 +131,13 @@ public class LoanApplicationApprovalTest {
|
||||
createTranches.add(createTrancheDetail("23 March 2014", "4000"));
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
|
||||
+ clientID);
|
||||
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
|
||||
|
||||
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
|
||||
.withInterestTypeAsDecliningBalance().withTranches(true).withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
|
||||
.build(null));
|
||||
System.out.println("----------------------------------LOAN PRODUCT CREATED WITH ID-------------------------------------------"
|
||||
+ loanProductID);
|
||||
final Integer loanProductID = this.loanTransactionHelper
|
||||
.getLoanProductId(new LoanProductTestBuilder().withInterestTypeAsDecliningBalance().withTranches(true)
|
||||
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).build(null));
|
||||
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
|
||||
loanProductID);
|
||||
|
||||
this.trancheLoansApprovedAmountLesserThanProposedAmount(clientID, loanProductID, createTranches);
|
||||
this.trancheLoansApprovalValidation(clientID, loanProductID, createTranches);
|
||||
@@ -155,19 +155,17 @@ public class LoanApplicationApprovalTest {
|
||||
approveTranches.add(createTrancheDetail("23 March 2014", "1000"));
|
||||
|
||||
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
|
||||
System.out.println("-----------------------------------LOAN CREATED WITH LOANID-------------------------------------------------"
|
||||
+ loanID);
|
||||
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
||||
loanID, approveTranches);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
System.out
|
||||
.println("-----------------------------------MULTI DISBURSAL LOAN APPROVED SUCCESSFULLY---------------------------------------");
|
||||
LOG.info("-----------------------------------MULTI DISBURSAL LOAN APPROVED SUCCESSFULLY---------------------------------------");
|
||||
|
||||
}
|
||||
|
||||
@@ -202,13 +200,12 @@ public class LoanApplicationApprovalTest {
|
||||
approveTranche4.add(createTrancheDetail("24 March 2014", "100"));
|
||||
|
||||
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
|
||||
System.out.println("-----------------------------------LOAN CREATED WITH LOANID-------------------------------------------------"
|
||||
+ loanID);
|
||||
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
|
||||
|
||||
HashMap<String, Object> loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode400);
|
||||
|
||||
/* Tranches with same expected disbursement date */
|
||||
@@ -234,8 +231,8 @@ public class LoanApplicationApprovalTest {
|
||||
/* No. of tranches exceeds the max tranche count at product level */
|
||||
error = this.loanTransactionHelper.approveLoanForTranches(approveDate, expectedDisbursementDate, approvalAmount3, loanID,
|
||||
approveTranche3, CommonConstants.RESPONSE_ERROR);
|
||||
assertEquals("error.msg.disbursementData.exceeding.max.tranche.count", error.get(0)
|
||||
.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
assertEquals("error.msg.disbursementData.exceeding.max.tranche.count",
|
||||
error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
/* 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,
|
||||
List<HashMap> tranches) {
|
||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
||||
//
|
||||
//
|
||||
.withPrincipal(principal)
|
||||
//
|
||||
.withLoanTermFrequency("5")
|
||||
|
||||
+27
-31
@@ -18,38 +18,36 @@
|
||||
*/
|
||||
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.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.fineract.integrationtests.LoanApplicationApprovalTest;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
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;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class LoanApplicationUndoLastTrancheTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(LoanApplicationUndoLastTrancheTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
private LoanApplicationApprovalTest loanApplicationApprovalTest;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -60,7 +58,7 @@ public class LoanApplicationUndoLastTrancheTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void LoanApplicationUndoLastTranche() {
|
||||
public void loanApplicationUndoLastTranche() {
|
||||
|
||||
final String proposedAmount = "5000";
|
||||
final String approvalAmount = "2000";
|
||||
@@ -70,15 +68,14 @@ public class LoanApplicationUndoLastTrancheTest {
|
||||
|
||||
// CREATE CLIENT
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
|
||||
+ clientID);
|
||||
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
|
||||
|
||||
// CREATE LOAN MULTIDISBURSAL PRODUCT
|
||||
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
|
||||
.withInterestTypeAsDecliningBalance().withTranches(true).withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
|
||||
.build(null));
|
||||
System.out.println("----------------------------------LOAN PRODUCT CREATED WITH ID-------------------------------------------"
|
||||
+ loanProductID);
|
||||
final Integer loanProductID = this.loanTransactionHelper
|
||||
.getLoanProductId(new LoanProductTestBuilder().withInterestTypeAsDecliningBalance().withTranches(true)
|
||||
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).build(null));
|
||||
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
|
||||
loanProductID);
|
||||
|
||||
// CREATE TRANCHES
|
||||
List<HashMap> createTranches = new ArrayList<>();
|
||||
@@ -92,14 +89,13 @@ public class LoanApplicationUndoLastTrancheTest {
|
||||
|
||||
// APPLY FOR LOAN WITH TRANCHES
|
||||
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
|
||||
System.out.println("-----------------------------------LOAN CREATED WITH LOANID-------------------------------------------------"
|
||||
+ loanID);
|
||||
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
|
||||
// VALIDATE THE LOAN STATUS
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
||||
loanID, approveTranches);
|
||||
|
||||
@@ -114,11 +110,11 @@ public class LoanApplicationUndoLastTrancheTest {
|
||||
// VALIDATE THE LOAN IS ACTIVE STATUS
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
System.out.println("-------------Make repayment 1-----------");
|
||||
LOG.info("-------------Make repayment 1-----------");
|
||||
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);
|
||||
System.out.println("-------------Make repayment 3-----------");
|
||||
LOG.info("-------------Make repayment 3-----------");
|
||||
this.loanTransactionHelper.makeRepayment("01 June 2014", Float.valueOf("204"), loanID);
|
||||
// DISBURSE A SECOND TRANCHE
|
||||
this.loanTransactionHelper.disburseLoan("23 June 2014", loanID);
|
||||
@@ -128,15 +124,15 @@ public class LoanApplicationUndoLastTrancheTest {
|
||||
}
|
||||
|
||||
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,
|
||||
List<HashMap> tranches) {
|
||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
||||
//
|
||||
//
|
||||
.withPrincipal(principal)
|
||||
//
|
||||
.withLoanTermFrequency("5")
|
||||
|
||||
+32
-39
@@ -18,9 +18,13 @@
|
||||
*/
|
||||
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.List;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
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.LoanStatusChecker;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
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;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class LoanDisbursalDateValidationTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(LoanDisbursalDateValidationTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
private ResponseSpecification responseForbiddenError;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -57,7 +58,7 @@ public class LoanDisbursalDateValidationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void LoanApplicationValidateDisbursalDate() {
|
||||
public void loanApplicationValidateDisbursalDate() {
|
||||
|
||||
final String proposedAmount = "5000";
|
||||
final String approveDate = "1 March 2014";
|
||||
@@ -65,25 +66,23 @@ public class LoanDisbursalDateValidationTest {
|
||||
|
||||
// CREATE CLIENT
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
|
||||
+ clientID);
|
||||
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
|
||||
|
||||
// CREATE LOAN PRODUCT
|
||||
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
|
||||
.withSyncExpectedWithDisbursementDate(true).build(null));
|
||||
System.out.println("----------------------------------LOAN PRODUCT CREATED WITH ID-------------------------------------------"
|
||||
+ loanProductID);
|
||||
// CREATE LOAN PRODUCT
|
||||
final Integer loanProductID = this.loanTransactionHelper
|
||||
.getLoanProductId(new LoanProductTestBuilder().withSyncExpectedWithDisbursementDate(true).build(null));
|
||||
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
|
||||
loanProductID);
|
||||
|
||||
// APPLY FOR LOAN
|
||||
// APPLY FOR LOAN
|
||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID, proposedAmount);
|
||||
System.out.println("-----------------------------------LOAN CREATED WITH LOANID-------------------------------------------------"
|
||||
+ loanID);
|
||||
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
|
||||
// VALIDATE THE LOAN STATUS
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(approveDate, loanID);
|
||||
|
||||
// VALIDATE THE LOAN IS APPROVED
|
||||
@@ -92,26 +91,20 @@ public class LoanDisbursalDateValidationTest {
|
||||
|
||||
// DISBURSE A LOAN
|
||||
@SuppressWarnings("unchecked")
|
||||
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",
|
||||
disbursalError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
List<HashMap> disbursalError = (List<HashMap>) this.loanTransactionHelper.disburseLoan(disbursalDate, loanID,
|
||||
this.responseForbiddenError);
|
||||
|
||||
Assertions.assertEquals(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) {
|
||||
final String loanApplication = new LoanApplicationTestBuilder()
|
||||
.withPrincipal(proposedAmount).withLoanTermFrequency("5")
|
||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("5")
|
||||
.withRepaymentEveryAfter("1")
|
||||
.withRepaymentFrequencyTypeAsMonths()
|
||||
.withInterestRatePerPeriod("2")
|
||||
.withExpectedDisbursementDate("1 March 2014")
|
||||
.withSubmittedOnDate("26 February 2014").
|
||||
build(clientID.toString(), loanProductID.toString(), null);
|
||||
final String loanApplication = new LoanApplicationTestBuilder().withPrincipal(proposedAmount).withLoanTermFrequency("5")
|
||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("5").withRepaymentEveryAfter("1")
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("2").withExpectedDisbursementDate("1 March 2014")
|
||||
.withSubmittedOnDate("26 February 2014").build(clientID.toString(), loanProductID.toString(), null);
|
||||
return this.loanTransactionHelper.getLoanId(loanApplication);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+77
-87
@@ -18,16 +18,18 @@
|
||||
*/
|
||||
package org.apache.fineract.integrationtests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
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.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
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.LoanStatusChecker;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public class LoanDisbursementDetailsIntegrationTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(LoanDisbursementDetailsIntegrationTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
@@ -57,7 +56,7 @@ public class LoanDisbursementDetailsIntegrationTest {
|
||||
final String proposedAmount = "5000";
|
||||
final String approvalAmount = "5000";
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
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"));
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
|
||||
+ clientID);
|
||||
LOG.info("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------{}", clientID);
|
||||
|
||||
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
|
||||
.withInterestTypeAsDecliningBalance().withMoratorium("", "").withAmortizationTypeAsEqualInstallments().withTranches(true)
|
||||
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).build(null));
|
||||
System.out.println("----------------------------------LOAN PRODUCT CREATED WITH ID-------------------------------------------"
|
||||
+ loanProductID);
|
||||
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
|
||||
loanProductID);
|
||||
|
||||
final Integer loanIDWithEmi = applyForLoanApplicationWithEmiAmount(clientID, loanProductID, proposedAmount, createTranches,
|
||||
installmentAmount);
|
||||
|
||||
System.out
|
||||
.println("-----------------------------------LOAN CREATED WITH EMI LOANID-------------------------------------------------"
|
||||
+ loanIDWithEmi);
|
||||
LOG.info("-----------------------------------LOAN CREATED WITH EMI LOANID------------------------------------------------- {}",
|
||||
loanIDWithEmi);
|
||||
|
||||
HashMap repaymentScheduleWithEmi = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec,
|
||||
loanIDWithEmi, "repaymentSchedule");
|
||||
|
||||
ArrayList<HashMap> periods = (ArrayList<HashMap>) repaymentScheduleWithEmi.get("periods");
|
||||
assertEquals(periods.size(), 15);
|
||||
assertEquals(15, periods.size());
|
||||
|
||||
this.validateRepaymentScheduleWithEMI(periods);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanIDWithEmi);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount("01 June 2015", "01 June 2015", "10000", loanIDWithEmi,
|
||||
createTranches);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
System.out
|
||||
.println("-----------------------------------MULTI DISBURSAL LOAN WITH EMI APPROVED SUCCESSFULLY---------------------------------------");
|
||||
LOG.info(
|
||||
"-----------------------------------MULTI DISBURSAL LOAN WITH EMI APPROVED SUCCESSFULLY---------------------------------------");
|
||||
|
||||
final Integer loanIDWithoutEmi = applyForLoanApplicationWithEmiAmount(clientID, loanProductID, proposedAmount, createTranches,
|
||||
withoutInstallmentAmount);
|
||||
@@ -119,11 +116,10 @@ public class LoanDisbursementDetailsIntegrationTest {
|
||||
loanIDWithoutEmi, "repaymentSchedule");
|
||||
|
||||
ArrayList<HashMap> periods1 = (ArrayList<HashMap>) repaymentScheduleWithEmi.get("periods");
|
||||
assertEquals(periods1.size(), 15);
|
||||
assertEquals(15, periods1.size());
|
||||
|
||||
System.out
|
||||
.println("-----------------------------------LOAN CREATED WITHOUT EMI LOANID-------------------------------------------------"
|
||||
+ loanIDWithoutEmi);
|
||||
LOG.info("-----------------------------------LOAN CREATED WITHOUT EMI LOANID------------------------------------------------- {}",
|
||||
loanIDWithoutEmi);
|
||||
|
||||
/* To be uncommented once issue MIFOSX-2006 is closed. */
|
||||
// this.validateRepaymentScheduleWithoutEMI(periods1);
|
||||
@@ -131,13 +127,13 @@ public class LoanDisbursementDetailsIntegrationTest {
|
||||
HashMap loanStatusMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanIDWithoutEmi);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusMap);
|
||||
|
||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount("01 June 2015", "01 June 2015", "10000",
|
||||
loanIDWithoutEmi, createTranches);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
System.out
|
||||
.println("-----------------------------------MULTI DISBURSAL LOAN WITHOUT EMI APPROVED SUCCESSFULLY---------------------------------------");
|
||||
LOG.info(
|
||||
"-----------------------------------MULTI DISBURSAL LOAN WITHOUT EMI APPROVED SUCCESSFULLY---------------------------------------");
|
||||
|
||||
}
|
||||
|
||||
@@ -213,21 +209,22 @@ public class LoanDisbursementDetailsIntegrationTest {
|
||||
|
||||
assertEquals(period.get("dueDate").toString(), expectedRepaymentSchedule.getDueDate());
|
||||
assertEquals(period.get("principalLoanBalanceOutstanding"), expectedRepaymentSchedule.getPrincipalLoanBalanceOutstanding());
|
||||
System.out.println(period.get("totalOriginalDueForPeriod").toString());
|
||||
assertEquals(new Float(period.get("totalOriginalDueForPeriod").toString()), expectedRepaymentSchedule
|
||||
.getTotalOriginalDueForPeriod().floatValue(), 0.0f);
|
||||
LOG.info("{}", period.get("totalOriginalDueForPeriod").toString());
|
||||
assertEquals(Float.valueOf(period.get("totalOriginalDueForPeriod").toString()),
|
||||
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);
|
||||
|
||||
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);
|
||||
assertEquals(new Float(period.get("principalOutstanding").toString()).floatValue(),
|
||||
assertEquals(Float.valueOf(period.get("principalOutstanding").toString()).floatValue(),
|
||||
expectedRepaymentSchedule.getPrincipalOutstanding(), 0.0f);
|
||||
assertEquals(new Float(period.get("principalDue").toString()).floatValue(), expectedRepaymentSchedule.getPrincipalDue(), 0.0f);
|
||||
assertEquals(new Float(period.get("principalOriginalDue").toString()).floatValue(),
|
||||
assertEquals(Float.valueOf(period.get("principalDue").toString()).floatValue(), expectedRepaymentSchedule.getPrincipalDue(),
|
||||
0.0f);
|
||||
assertEquals(Float.valueOf(period.get("principalOriginalDue").toString()).floatValue(),
|
||||
expectedRepaymentSchedule.getPrincipalOriginalDue(), 0.0f);
|
||||
assertEquals(period.get("fromDate").toString(), expectedRepaymentSchedule.getFromDate());
|
||||
}
|
||||
@@ -239,63 +236,63 @@ public class LoanDisbursementDetailsIntegrationTest {
|
||||
* periods){ LoanDisbursementTestBuilder expectedRepaymentSchedule0 = new
|
||||
* LoanDisbursementTestBuilder( "[2015, 6, 1]", 0.0f, 0.0f, null, null,
|
||||
* 5000.0f, null, null, null);
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule1 = new
|
||||
* LoanDisbursementTestBuilder( "[2015, 7, 1]", 800.0f, 800.0f, 50.0f,
|
||||
* 750.0f, 4250.0f, 750.0f, 750.0f, "[2015, 6, 1]");
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule2 = new
|
||||
* LoanDisbursementTestBuilder( "[2015, 8, 1]", 800.0f, 800.0f, 42.5f,
|
||||
* 757.5f, 3492.5f, 757.5f, 757.5f, "[2015, 7, 1]");
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule3 = new
|
||||
* LoanDisbursementTestBuilder( "[2015, 9, 1]", 0.0f, 0.0f, null, null,
|
||||
* 5000.0f, null, null, null);
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule4 = new
|
||||
* LoanDisbursementTestBuilder( "[2015, 9, 1]", 800.0f, 800.0f, 34.92f,
|
||||
* 765.08f, 7727.42f, 765.08f, 765.08f, "[2015, 8, 1]");
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule5 = new
|
||||
* LoanDisbursementTestBuilder( "[2015, 10, 1]", 800.0f, 800.0f, 77.27f,
|
||||
* 722.73f, 7004.69f, 722.73f, 722.73f, "[2015, 9, 1]");
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule6 = new
|
||||
* LoanDisbursementTestBuilder( "[2015, 11, 1]", 800.0f, 800.0f, 70.05f,
|
||||
* 729.95f, 6274.74f, 729.95f, 729.95f, "[2015, 10, 1]");
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule7 = new
|
||||
* LoanDisbursementTestBuilder( "[2015, 12, 1]", 800.0f, 800.0f, 62.75f,
|
||||
* 737.25f, 5537.49f, 737.25f, 737.25f, "[2015, 11, 1]");
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule8 = new
|
||||
* LoanDisbursementTestBuilder( "[2016, 1, 1]", 800.0f, 800.0f, 55.37f,
|
||||
* 744.63f, 4792.86f, 744.63f, 744.63f, "[2015, 12, 1]");
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule9 = new
|
||||
* LoanDisbursementTestBuilder( "[2016, 2, 1]", 800.0f, 800.0f, 47.93f,
|
||||
* 752.07f, 4040.79f, 752.07f, 752.07f, "[2016, 1, 1]");
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule10 = new
|
||||
* LoanDisbursementTestBuilder( "[2016, 3, 1]", 800.0f, 800.0f, 40.41f,
|
||||
* 759.59f, 3281.2f, 759.59f, 759.59f, "[2016, 2, 1]");
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule11 = new
|
||||
* LoanDisbursementTestBuilder( "[2016, 4, 1]", 800.0f, 800.0f, 32.81f,
|
||||
* 767.19f, 2514.01f, 767.19f, 767.19f, "[2016, 3, 1]");
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule12 = new
|
||||
* LoanDisbursementTestBuilder( "[2016, 5, 1]", 800.0f, 800.0f, 25.14f,
|
||||
* 774.86f, 1739.15f, 774.86f, 774.86f, "[2016, 4, 1]");
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule13 = new
|
||||
* LoanDisbursementTestBuilder( "[2016, 6, 1]", 800.0f, 800.0f, 17.39f,
|
||||
* 782.61f, 956.54f, 782.61f, 782.61f, "[2016, 5, 1]");
|
||||
*
|
||||
*
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule14 = new
|
||||
* LoanDisbursementTestBuilder( "[2016, 7, 1]", 966.11f, 966.11f, 9.57f,
|
||||
* 956.54f, 0.0f, 956.54f, 956.54f, "[2016, 6, 1]");
|
||||
*
|
||||
*
|
||||
* ArrayList<LoanDisbursementTestBuilder> list = new
|
||||
* ArrayList<LoanDisbursementTestBuilder>();
|
||||
* list.add(expectedRepaymentSchedule0);
|
||||
@@ -313,14 +310,14 @@ public class LoanDisbursementDetailsIntegrationTest {
|
||||
* list.add(expectedRepaymentSchedule12);
|
||||
* list.add(expectedRepaymentSchedule13);
|
||||
* list.add(expectedRepaymentSchedule14);
|
||||
*
|
||||
*
|
||||
* for (int i = 0; i < list.size(); i++) {
|
||||
* this.assertRepaymentScheduleValuesWithoutEMI(periods.get(i), list.get(i),
|
||||
* i); } }
|
||||
*
|
||||
*
|
||||
* private void assertRepaymentScheduleValuesWithoutEMI(HashMap period,
|
||||
* LoanDisbursementTestBuilder expectedRepaymentSchedule, int position) {
|
||||
*
|
||||
*
|
||||
* assertEquals(period.get("dueDate").toString(),
|
||||
* expectedRepaymentSchedule.getDueDate());
|
||||
* assertEquals(period.get("principalLoanBalanceOutstanding"),
|
||||
@@ -329,9 +326,9 @@ public class LoanDisbursementDetailsIntegrationTest {
|
||||
* expectedRepaymentSchedule.getTotalOriginalDueForPeriod());
|
||||
* assertEquals(period.get("totalOutstandingForPeriod"),
|
||||
* expectedRepaymentSchedule.getTotalOutstandingForPeriod());
|
||||
*
|
||||
*
|
||||
* if (position != 0 && position != 3) {
|
||||
*
|
||||
*
|
||||
* assertEquals(period.get("interestOutstanding"),
|
||||
* expectedRepaymentSchedule.getInterestOutstanding());
|
||||
* assertEquals(period.get("principalOutstanding"),
|
||||
@@ -346,9 +343,9 @@ public class LoanDisbursementDetailsIntegrationTest {
|
||||
private Integer applyForLoanApplicationWithEmiAmount(final Integer clientID, final Integer loanProductID, final String proposedAmount,
|
||||
List<HashMap> tranches, final String installmentAmount) {
|
||||
|
||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
||||
//
|
||||
//
|
||||
.withPrincipal(proposedAmount)
|
||||
//
|
||||
.withLoanTermFrequency("12")
|
||||
@@ -370,49 +367,46 @@ public class LoanDisbursementDetailsIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createApproveAndValidateMultiDisburseLoan() {
|
||||
public void createApproveAndValidateMultiDisburseLoan() throws ParseException {
|
||||
|
||||
List<HashMap> createTranches = new ArrayList<>();
|
||||
String id = null;
|
||||
createTranches.add(this.loanTransactionHelper.createTrancheDetail(id, "01 March 2014", "1000"));
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
|
||||
+ clientID);
|
||||
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
|
||||
|
||||
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
|
||||
.withInterestTypeAsDecliningBalance().withTranches(true).withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
|
||||
.build(null));
|
||||
System.out.println("----------------------------------LOAN PRODUCT CREATED WITH ID-------------------------------------------"
|
||||
+ loanProductID);
|
||||
final Integer loanProductID = this.loanTransactionHelper
|
||||
.getLoanProductId(new LoanProductTestBuilder().withInterestTypeAsDecliningBalance().withTranches(true)
|
||||
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).build(null));
|
||||
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
|
||||
loanProductID);
|
||||
|
||||
this.loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
|
||||
System.out.println("-----------------------------------LOAN CREATED WITH LOANID-------------------------------------------------"
|
||||
+ loanID);
|
||||
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
||||
loanID, createTranches);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
System.out
|
||||
.println("-----------------------------------MULTI DISBURSAL LOAN APPROVED SUCCESSFULLY---------------------------------------");
|
||||
LOG.info("-----------------------------------MULTI DISBURSAL LOAN APPROVED SUCCESSFULLY---------------------------------------");
|
||||
ArrayList<HashMap> disbursementDetails = (ArrayList<HashMap>) this.loanTransactionHelper.getLoanDetail(this.requestSpec,
|
||||
this.responseSpec, this.loanID, "disbursementDetails");
|
||||
this.disbursementId = (Integer) disbursementDetails.get(0).get("id");
|
||||
this.editLoanDisbursementDetails();
|
||||
}
|
||||
|
||||
private void editLoanDisbursementDetails() {
|
||||
private void editLoanDisbursementDetails() throws ParseException {
|
||||
this.editDateAndPrincipalOfExistingTranche();
|
||||
this.addNewDisbursementDetails();
|
||||
this.deleteDisbursmentDetails();
|
||||
}
|
||||
|
||||
private void addNewDisbursementDetails() {
|
||||
private void addNewDisbursementDetails() throws ParseException {
|
||||
List<HashMap> addTranches = new ArrayList<>();
|
||||
ArrayList<HashMap> disbursementDetails = (ArrayList<HashMap>) this.loanTransactionHelper.getLoanDetail(this.requestSpec,
|
||||
this.responseSpec, this.loanID, "disbursementDetails");
|
||||
@@ -430,7 +424,7 @@ public class LoanDisbursementDetailsIntegrationTest {
|
||||
addTranches, "");
|
||||
}
|
||||
|
||||
private void deleteDisbursmentDetails() {
|
||||
private void deleteDisbursmentDetails() throws ParseException {
|
||||
List<HashMap> deleteTranches = new ArrayList<>();
|
||||
ArrayList<HashMap> disbursementDetails = (ArrayList<HashMap>) this.loanTransactionHelper.getLoanDetail(this.requestSpec,
|
||||
this.responseSpec, this.loanID, "disbursementDetails");
|
||||
@@ -447,7 +441,7 @@ public class LoanDisbursementDetailsIntegrationTest {
|
||||
deleteTranches, "");
|
||||
}
|
||||
|
||||
private void editDateAndPrincipalOfExistingTranche() {
|
||||
private void editDateAndPrincipalOfExistingTranche() throws ParseException {
|
||||
String updatedExpectedDisbursementDate = "01 March 2014";
|
||||
String updatedPrincipal = "900";
|
||||
/* 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 target = new SimpleDateFormat("dd MMMM yyyy");
|
||||
String date = null;
|
||||
try {
|
||||
date = target.format(source.parse(expectedDisbursementDate));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String date = target.format(source.parse(expectedDisbursementDate));
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
private Integer applyForLoanApplicationWithTranches(final Integer clientID, final Integer loanProductID, String principal,
|
||||
List<HashMap> tranches) {
|
||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
||||
//
|
||||
//
|
||||
.withPrincipal(principal)
|
||||
//
|
||||
.withLoanTermFrequency("5")
|
||||
|
||||
+66
-72
@@ -18,15 +18,19 @@
|
||||
*/
|
||||
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.Arrays;
|
||||
import java.util.Calendar;
|
||||
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.Utils;
|
||||
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.LoanStatusChecker;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class LoanRepaymentRescheduleAtDisbursementTest {
|
||||
|
||||
private ResponseSpecification responseSpec;
|
||||
private final static Logger LOG = LoggerFactory.getLogger(LoanRepaymentRescheduleAtDisbursementTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
private LoanApplicationApprovalTest loanApplicationApprovalTest;
|
||||
private ResponseSpecification generalResponseSpec;
|
||||
|
||||
@Before
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -62,62 +63,62 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
||||
this.loanApplicationApprovalTest = new LoanApplicationApprovalTest();
|
||||
this.generalResponseSpec = new ResponseSpecBuilder().build();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testLoanRepaymentRescheduleAtDisbursement(){
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testLoanRepaymentRescheduleAtDisbursement() {
|
||||
|
||||
final String approvalAmount = "10000";
|
||||
final String approveDate = "01 March 2015";
|
||||
final String expectedDisbursementDate = "01 March 2015";
|
||||
final String disbursementDate = "01 March 2015";
|
||||
final String adjustRepaymentDate = "16 March 2015";
|
||||
|
||||
// CREATE CLIENT
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
|
||||
+ clientID);
|
||||
|
||||
// CREATE LOAN MULTIDISBURSAL PRODUCT WITH INTEREST RECALCULATION
|
||||
// CREATE CLIENT
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
|
||||
|
||||
// CREATE LOAN MULTIDISBURSAL PRODUCT WITH INTEREST RECALCULATION
|
||||
final Integer loanProductID = createLoanProductWithInterestRecalculation(LoanProductTestBuilder.RBI_INDIA_STRATEGY,
|
||||
LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
|
||||
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
|
||||
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0",
|
||||
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null);
|
||||
|
||||
|
||||
// CREATE TRANCHES
|
||||
List<HashMap> createTranches = new ArrayList<>();
|
||||
createTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("01 March 2015", "5000"));
|
||||
createTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("01 May 2015", "5000"));
|
||||
|
||||
|
||||
// APPROVE TRANCHES
|
||||
List<HashMap> approveTranches = new ArrayList<>();
|
||||
approveTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("01 March 2015", "5000"));
|
||||
approveTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("01 May 2015", "5000"));
|
||||
|
||||
// APPLY FOR TRANCHE LOAN WITH INTEREST RECALCULATION
|
||||
|
||||
// APPLY FOR TRANCHE LOAN WITH INTEREST RECALCULATION
|
||||
final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, disbursementDate,
|
||||
LoanApplicationTestBuilder.RBI_INDIA_STRATEGY, new ArrayList<HashMap>(0), createTranches);
|
||||
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
|
||||
|
||||
// VALIDATE THE LOAN STATUS
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
||||
loanID, approveTranches);
|
||||
|
||||
|
||||
// VALIDATE THE LOAN IS APPROVED
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
|
||||
// DISBURSE A FIRST TRANCHE
|
||||
this.loanTransactionHelper.disburseLoanWithRepaymentReschedule(disbursementDate, loanID, adjustRepaymentDate);
|
||||
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
|
||||
ArrayList<HashMap> loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, loanID);
|
||||
HashMap firstInstallement = loanRepaymnetSchedule.get(1);
|
||||
|
||||
ArrayList<HashMap> loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec,
|
||||
loanID);
|
||||
HashMap firstInstallement = loanRepaymnetSchedule.get(1);
|
||||
Map<String, Object> expectedvalues = new HashMap<>(3);
|
||||
Calendar date = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
||||
date.set(2015, Calendar.MARCH, 16);
|
||||
@@ -127,23 +128,23 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
||||
expectedvalues.put("feeChargesDue", "0");
|
||||
expectedvalues.put("penaltyChargesDue", "0");
|
||||
expectedvalues.put("totalDueForPeriod", "884.03");
|
||||
|
||||
|
||||
// VALIDATE REPAYMENT SCHEDULE
|
||||
verifyLoanRepaymentSchedule(firstInstallement, expectedvalues);
|
||||
|
||||
}
|
||||
|
||||
private void verifyLoanRepaymentSchedule(final HashMap firstInstallement, final Map<String, Object> expectedvalues) {
|
||||
|
||||
assertEquals(expectedvalues.get("dueDate"), firstInstallement.get("dueDate"));
|
||||
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("feeChargesDue")), String.valueOf(firstInstallement.get("feeChargesDue")));
|
||||
assertEquals(String.valueOf(expectedvalues.get("penaltyChargesDue")), String.valueOf(firstInstallement.get("penaltyChargesDue")));
|
||||
assertEquals(String.valueOf(expectedvalues.get("totalDueForPeriod")), String.valueOf(firstInstallement.get("totalDueForPeriod")));
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void verifyLoanRepaymentSchedule(final HashMap firstInstallement, final Map<String, Object> expectedvalues) {
|
||||
|
||||
assertEquals(expectedvalues.get("dueDate"), firstInstallement.get("dueDate"));
|
||||
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("feeChargesDue")), String.valueOf(firstInstallement.get("feeChargesDue")));
|
||||
assertEquals(String.valueOf(expectedvalues.get("penaltyChargesDue")), String.valueOf(firstInstallement.get("penaltyChargesDue")));
|
||||
assertEquals(String.valueOf(expectedvalues.get("totalDueForPeriod")), String.valueOf(firstInstallement.get("totalDueForPeriod")));
|
||||
|
||||
}
|
||||
|
||||
private Integer createLoanProductWithInterestRecalculation(final String repaymentStrategy,
|
||||
final String interestRecalculationCompoundingMethod, final String rescheduleStrategyMethod,
|
||||
final String recalculationRestFrequencyType, final String recalculationRestFrequencyInterval,
|
||||
@@ -160,7 +161,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
||||
accounts, null, false, recalculationCompoundingFrequencyOnDayType, recalculationCompoundingFrequencyDayOfWeekType,
|
||||
recalculationRestFrequencyOnDayType, recalculationRestFrequencyDayOfWeekType);
|
||||
}
|
||||
|
||||
|
||||
private Integer createLoanProductWithInterestRecalculation(final String repaymentStrategy,
|
||||
final String interestRecalculationCompoundingMethod, final String rescheduleStrategyMethod,
|
||||
final String recalculationRestFrequencyType, final String recalculationRestFrequencyInterval,
|
||||
@@ -169,18 +170,11 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
||||
boolean isArrearsBasedOnOriginalSchedule, final Integer recalculationCompoundingFrequencyOnDayType,
|
||||
final Integer recalculationCompoundingFrequencyDayOfWeekType, final Integer recalculationRestFrequencyOnDayType,
|
||||
final Integer recalculationRestFrequencyDayOfWeekType) {
|
||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
LoanProductTestBuilder builder = new LoanProductTestBuilder()
|
||||
.withPrincipal("10000.00")
|
||||
.withNumberOfRepayments("12")
|
||||
.withRepaymentAfterEvery("2")
|
||||
.withRepaymentTypeAsWeek()
|
||||
.withinterestRatePerPeriod("2")
|
||||
.withInterestRateFrequencyTypeAsMonths()
|
||||
.withTranches(true)
|
||||
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
|
||||
.withRepaymentStrategy(repaymentStrategy)
|
||||
.withInterestTypeAsDecliningBalance()
|
||||
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
LoanProductTestBuilder builder = new LoanProductTestBuilder().withPrincipal("10000.00").withNumberOfRepayments("12")
|
||||
.withRepaymentAfterEvery("2").withRepaymentTypeAsWeek().withinterestRatePerPeriod("2")
|
||||
.withInterestRateFrequencyTypeAsMonths().withTranches(true).withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
|
||||
.withRepaymentStrategy(repaymentStrategy).withInterestTypeAsDecliningBalance()
|
||||
.withInterestRecalculationDetails(interestRecalculationCompoundingMethod, rescheduleStrategyMethod,
|
||||
preCloseInterestCalculationStrategy)
|
||||
.withInterestRecalculationRestFrequencyDetails(recalculationRestFrequencyType, recalculationRestFrequencyInterval,
|
||||
@@ -192,12 +186,14 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
||||
builder = builder.withAccountingRulePeriodicAccrual(accounts);
|
||||
}
|
||||
|
||||
if (isArrearsBasedOnOriginalSchedule) builder = builder.withArrearsConfiguration();
|
||||
if (isArrearsBasedOnOriginalSchedule) {
|
||||
builder = builder.withArrearsConfiguration();
|
||||
}
|
||||
|
||||
final String loanProductJSON = builder.build(chargeId);
|
||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||
}
|
||||
|
||||
|
||||
private Integer applyForLoanApplicationForInterestRecalculation(final Integer clientID, final Integer loanProductID,
|
||||
final String disbursementDate, final String repaymentStrategy, final List<HashMap> charges, List<HashMap> tranches) {
|
||||
final String graceOnInterestPayment = null;
|
||||
@@ -205,11 +201,11 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
||||
return applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, disbursementDate, repaymentStrategy, charges,
|
||||
graceOnInterestPayment, graceOnPrincipalPayment, tranches);
|
||||
}
|
||||
|
||||
|
||||
private Integer applyForLoanApplicationForInterestRecalculation(final Integer clientID, final Integer loanProductID,
|
||||
final String disbursementDate, final String repaymentStrategy, final List<HashMap> charges, final String graceOnInterestPayment,
|
||||
final String graceOnPrincipalPayment, List<HashMap> tranches) {
|
||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||
.withPrincipal("10000.00") //
|
||||
.withLoanTermFrequency("24") //
|
||||
@@ -219,8 +215,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
||||
.withRepaymentFrequencyTypeAsWeeks() //
|
||||
.withInterestRatePerPeriod("2") //
|
||||
.withAmortizationTypeAsEqualInstallments() //
|
||||
.withTranches(tranches)
|
||||
.withFixedEmiAmount("") //
|
||||
.withTranches(tranches).withFixedEmiAmount("") //
|
||||
.withInterestTypeAsDecliningBalance() //
|
||||
.withInterestCalculationPeriodTypeAsDays() //
|
||||
.withInterestCalculationPeriodTypeAsDays() //
|
||||
@@ -231,14 +226,13 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
}
|
||||
|
||||
|
||||
private List getDateAsArray(Calendar date, int addPeriod) {
|
||||
return getDateAsArray(date, addPeriod, Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
private List getDateAsArray(Calendar date, int addvalue, int type) {
|
||||
date.add(type, addvalue);
|
||||
return new ArrayList<>(Arrays.asList(date.get(Calendar.YEAR), date.get(Calendar.MONTH) + 1,
|
||||
date.get(Calendar.DAY_OF_MONTH)));
|
||||
date.add(type, addvalue);
|
||||
return new ArrayList<>(Arrays.asList(date.get(Calendar.YEAR), date.get(Calendar.MONTH) + 1, date.get(Calendar.DAY_OF_MONTH)));
|
||||
}
|
||||
}
|
||||
|
||||
+127
-137
@@ -18,11 +18,15 @@
|
||||
*/
|
||||
package org.apache.fineract.integrationtests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
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 org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.LoanRescheduleRequestHelper;
|
||||
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.LoanRescheduleRequestTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
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;
|
||||
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" })
|
||||
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 LoanTransactionHelper loanTransactionHelper;
|
||||
private LoanRescheduleRequestHelper loanRescheduleRequestHelper;
|
||||
@@ -53,14 +55,14 @@ public class LoanRescheduleRequestTest {
|
||||
private Integer loanProductId;
|
||||
private Integer loanId;
|
||||
private Integer loanRescheduleRequestId;
|
||||
private String loanPrincipalAmount = "100000.00";
|
||||
private String numberOfRepayments = "12";
|
||||
private String interestRatePerPeriod = "18";
|
||||
private String dateString = "4 September 2014";
|
||||
|
||||
@Before
|
||||
private final String loanPrincipalAmount = "100000.00";
|
||||
private final String numberOfRepayments = "12";
|
||||
private final String interestRatePerPeriod = "18";
|
||||
private final String dateString = "4 September 2014";
|
||||
|
||||
@BeforeEach
|
||||
public void initialize() {
|
||||
Utils.initializeRESTAssured();
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||
@@ -68,152 +70,140 @@ public class LoanRescheduleRequestTest {
|
||||
this.loanRescheduleRequestHelper = new LoanRescheduleRequestHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
this.generalResponseSpec = new ResponseSpecBuilder().build();
|
||||
|
||||
|
||||
// create all required entities
|
||||
this.createRequiredEntities();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the client, loan product, and loan entities
|
||||
|
||||
/**
|
||||
* Creates the client, loan product, and loan entities
|
||||
**/
|
||||
private void createRequiredEntities() {
|
||||
this.createClientEntity();
|
||||
this.createLoanProductEntity();
|
||||
this.createLoanEntity();
|
||||
this.createClientEntity();
|
||||
this.createLoanProductEntity();
|
||||
this.createLoanEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new client
|
||||
**/
|
||||
|
||||
/**
|
||||
* create a new client
|
||||
**/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new loan product
|
||||
|
||||
/**
|
||||
* create a new loan product
|
||||
**/
|
||||
private void createLoanProductEntity() {
|
||||
System.out.println("---------------------------------CREATING LOAN PRODUCT------------------------------------------");
|
||||
|
||||
final String loanProductJSON = new LoanProductTestBuilder()
|
||||
.withPrincipal(loanPrincipalAmount)
|
||||
.withNumberOfRepayments(numberOfRepayments)
|
||||
.withinterestRatePerPeriod(interestRatePerPeriod)
|
||||
.withInterestRateFrequencyTypeAsYear()
|
||||
.build(null);
|
||||
|
||||
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||
System.out.println("Successfully created loan product (ID: " + this.loanProductId + ")");
|
||||
LOG.info("---------------------------------CREATING LOAN PRODUCT------------------------------------------");
|
||||
|
||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(loanPrincipalAmount)
|
||||
.withNumberOfRepayments(numberOfRepayments).withinterestRatePerPeriod(interestRatePerPeriod)
|
||||
.withInterestRateFrequencyTypeAsYear().build(null);
|
||||
|
||||
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||
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() {
|
||||
System.out.println("---------------------------------NEW LOAN APPLICATION------------------------------------------");
|
||||
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder()
|
||||
.withPrincipal(loanPrincipalAmount)
|
||||
.withLoanTermFrequency(numberOfRepayments)
|
||||
.withLoanTermFrequencyAsMonths()
|
||||
.withNumberOfRepayments(numberOfRepayments)
|
||||
.withRepaymentEveryAfter("1")
|
||||
.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);
|
||||
|
||||
System.out.println("Sucessfully created loan (ID: " + this.loanId + ")");
|
||||
|
||||
this.approveLoanApplication();
|
||||
this.disburseLoan();
|
||||
LOG.info("---------------------------------NEW LOAN APPLICATION------------------------------------------");
|
||||
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
|
||||
.withLoanTermFrequency(numberOfRepayments).withLoanTermFrequencyAsMonths().withNumberOfRepayments(numberOfRepayments)
|
||||
.withRepaymentEveryAfter("1").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);
|
||||
|
||||
LOG.info("Sucessfully created loan (ID: {} )", this.loanId);
|
||||
|
||||
this.approveLoanApplication();
|
||||
this.disburseLoan();
|
||||
}
|
||||
|
||||
/**
|
||||
* approve the loan application
|
||||
|
||||
/**
|
||||
* approve the loan application
|
||||
**/
|
||||
private void approveLoanApplication() {
|
||||
|
||||
if(this.loanId != null) {
|
||||
this.loanTransactionHelper.approveLoan(this.dateString, this.loanId);
|
||||
System.out.println("Successfully approved loan (ID: " + this.loanId + ")");
|
||||
}
|
||||
|
||||
if (this.loanId != null) {
|
||||
this.loanTransactionHelper.approveLoan(this.dateString, this.loanId);
|
||||
LOG.info("Successfully approved loan (ID: {} )", this.loanId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* disburse the newly created loan
|
||||
|
||||
/**
|
||||
* disburse the newly created loan
|
||||
**/
|
||||
private void disburseLoan() {
|
||||
|
||||
if(this.loanId != null) {
|
||||
this.loanTransactionHelper.disburseLoan(this.dateString, this.loanId);
|
||||
System.out.println("Successfully disbursed loan (ID: " + this.loanId + ")");
|
||||
}
|
||||
|
||||
if (this.loanId != null) {
|
||||
this.loanTransactionHelper.disburseLoan(this.dateString, this.loanId);
|
||||
LOG.info("Successfully disbursed loan (ID: {} )", this.loanId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* create new loan reschedule request
|
||||
|
||||
/**
|
||||
* create new loan reschedule request
|
||||
**/
|
||||
private void createLoanRescheduleRequest() {
|
||||
System.out.println("---------------------------------CREATING LOAN RESCHEDULE REQUEST------------------------------------------");
|
||||
|
||||
final String requestJSON = new LoanRescheduleRequestTestBuilder().build(this.loanId.toString());
|
||||
|
||||
this.loanRescheduleRequestId = this.loanRescheduleRequestHelper.createLoanRescheduleRequest(requestJSON);
|
||||
this.loanRescheduleRequestHelper.verifyCreationOfLoanRescheduleRequest(this.loanRescheduleRequestId);
|
||||
|
||||
System.out.println("Successfully created loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
|
||||
LOG.info("---------------------------------CREATING LOAN RESCHEDULE REQUEST------------------------------------------");
|
||||
|
||||
final String requestJSON = new LoanRescheduleRequestTestBuilder().build(this.loanId.toString());
|
||||
|
||||
this.loanRescheduleRequestId = this.loanRescheduleRequestHelper.createLoanRescheduleRequest(requestJSON);
|
||||
this.loanRescheduleRequestHelper.verifyCreationOfLoanRescheduleRequest(this.loanRescheduleRequestId);
|
||||
|
||||
LOG.info("Successfully created loan reschedule request (ID: {} )", this.loanRescheduleRequestId);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCreateLoanRescheduleRequest() {
|
||||
this.createLoanRescheduleRequest();
|
||||
this.createLoanRescheduleRequest();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRejectLoanRescheduleRequest() {
|
||||
this.createLoanRescheduleRequest();
|
||||
|
||||
System.out.println("-----------------------------REJECTING LOAN RESCHEDULE REQUEST--------------------------");
|
||||
|
||||
final String requestJSON = new LoanRescheduleRequestTestBuilder().getRejectLoanRescheduleRequestJSON();
|
||||
this.loanRescheduleRequestHelper.rejectLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
|
||||
|
||||
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
|
||||
assertTrue((Boolean)response.get("rejected"));
|
||||
|
||||
System.out.println("Successfully rejected loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
|
||||
this.createLoanRescheduleRequest();
|
||||
|
||||
LOG.info("-----------------------------REJECTING LOAN RESCHEDULE REQUEST--------------------------");
|
||||
|
||||
final String requestJSON = new LoanRescheduleRequestTestBuilder().getRejectLoanRescheduleRequestJSON();
|
||||
this.loanRescheduleRequestHelper.rejectLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
|
||||
|
||||
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
|
||||
assertTrue((Boolean) response.get("rejected"));
|
||||
|
||||
LOG.info("Successfully rejected loan reschedule request (ID: {} )", this.loanRescheduleRequestId);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testApproveLoanRescheduleRequest() {
|
||||
this.createLoanRescheduleRequest();
|
||||
|
||||
System.out.println("-----------------------------APPROVING LOAN RESCHEDULE REQUEST--------------------------");
|
||||
|
||||
final String requestJSON = new LoanRescheduleRequestTestBuilder().getApproveLoanRescheduleRequestJSON();
|
||||
this.loanRescheduleRequestHelper.approveLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
|
||||
|
||||
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
|
||||
assertTrue((Boolean)response.get("approved"));
|
||||
|
||||
final Integer numberOfRepayments = (Integer) this.loanTransactionHelper.getLoanDetail(requestSpec, generalResponseSpec, loanId, "numberOfRepayments");
|
||||
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("TOTAL EXPECTED REPAYMENT MUST BE EQUAL TO 118000.0", "118000.0", totalExpectedRepayment.toString());
|
||||
|
||||
System.out.println("Successfully approved loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
|
||||
this.createLoanRescheduleRequest();
|
||||
|
||||
LOG.info("-----------------------------APPROVING LOAN RESCHEDULE REQUEST--------------------------");
|
||||
|
||||
final String requestJSON = new LoanRescheduleRequestTestBuilder().getApproveLoanRescheduleRequestJSON();
|
||||
this.loanRescheduleRequestHelper.approveLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
|
||||
|
||||
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
|
||||
assertTrue((Boolean) response.get("approved"));
|
||||
|
||||
final Integer numberOfRepayments = (Integer) this.loanTransactionHelper.getLoanDetail(requestSpec, generalResponseSpec, loanId,
|
||||
"numberOfRepayments");
|
||||
final HashMap loanSummary = this.loanTransactionHelper.getLoanSummary(requestSpec, generalResponseSpec, loanId);
|
||||
final Float totalExpectedRepayment = (Float) loanSummary.get("totalExpectedRepayment");
|
||||
|
||||
assertEquals(12, numberOfRepayments, "NUMBER OF REPAYMENTS is NOK");
|
||||
assertEquals(118000, totalExpectedRepayment, "TOTAL EXPECTED REPAYMENT is NOK");
|
||||
|
||||
LOG.info("Successfully approved loan reschedule request (ID: {})", this.loanRescheduleRequestId);
|
||||
}
|
||||
}
|
||||
|
||||
+61
-62
@@ -18,9 +18,14 @@
|
||||
*/
|
||||
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.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -29,14 +34,11 @@ import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
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.CenterDomain;
|
||||
import org.apache.fineract.integrationtests.common.CenterHelper;
|
||||
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.OfficeHelper;
|
||||
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.LoanTransactionHelper;
|
||||
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
public class LoanReschedulingWithinCenterTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(LoanReschedulingWithinCenterTest.class);
|
||||
private RequestSpecification requestSpec;
|
||||
private ResponseSpecification responseSpec;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
private ResponseSpecification generalResponseSpec;
|
||||
private LoanApplicationApprovalTest loanApplicationApprovalTest;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -71,6 +72,8 @@ public class LoanReschedulingWithinCenterTest {
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||
this.loanApplicationApprovalTest = new LoanApplicationApprovalTest();
|
||||
this.generalResponseSpec = new ResponseSpecBuilder().build();
|
||||
|
||||
GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -87,16 +90,16 @@ public class LoanReschedulingWithinCenterTest {
|
||||
responseSpec);
|
||||
CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec);
|
||||
Integer groupId = groupMembers[0];
|
||||
Assert.assertNotNull(center);
|
||||
Assert.assertTrue(center.getStaffId() == staffId);
|
||||
Assert.assertTrue(center.isActive() == true);
|
||||
Assertions.assertNotNull(center);
|
||||
Assertions.assertTrue(center.getStaffId() == staffId);
|
||||
Assertions.assertTrue(center.isActive() == true);
|
||||
|
||||
Integer calendarId = createCalendarMeeting(centerId);
|
||||
|
||||
Integer clientId = createClient(officeId);
|
||||
|
||||
associateClientsToGroup(groupId, clientId);
|
||||
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
|
||||
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
|
||||
Calendar today = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
||||
@@ -111,15 +114,14 @@ public class LoanReschedulingWithinCenterTest {
|
||||
LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
|
||||
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
|
||||
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0", recalculationRestFrequencyDate,
|
||||
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan,
|
||||
null, null);
|
||||
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan, null, null);
|
||||
|
||||
// APPLY FOR TRANCHE LOAN WITH INTEREST RECALCULATION
|
||||
final Integer loanId = applyForLoanApplicationForInterestRecalculation(clientId, groupId, calendarId, loanProductID, disbursalDate,
|
||||
recalculationRestFrequencyDate, LoanApplicationTestBuilder.RBI_INDIA_STRATEGY, new ArrayList<HashMap>(0), null);
|
||||
|
||||
// Test for loan account is created
|
||||
Assert.assertNotNull(loanId);
|
||||
Assertions.assertNotNull(loanId);
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanId);
|
||||
|
||||
// Test for loan account is created, can be approved
|
||||
@@ -132,7 +134,7 @@ public class LoanReschedulingWithinCenterTest {
|
||||
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanId);
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
System.out.println("---------------------------------CHANGING GROUP MEETING DATE ------------------------------------------");
|
||||
LOG.info("---------------------------------CHANGING GROUP MEETING DATE ------------------------------------------");
|
||||
Calendar todaysdate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
||||
todaysdate.add(Calendar.DAY_OF_MONTH, 14);
|
||||
String oldMeetingDate = dateFormat.format(todaysdate.getTime());
|
||||
@@ -148,10 +150,9 @@ public class LoanReschedulingWithinCenterTest {
|
||||
|
||||
// VERIFY THE INTEREST
|
||||
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) {
|
||||
// Associate client to the group
|
||||
GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupId.toString(), clientId.toString());
|
||||
@@ -173,11 +174,15 @@ public class LoanReschedulingWithinCenterTest {
|
||||
final String startDate = dateFormat.format(today.getTime());
|
||||
final String frequency = "2"; // 2:Weekly
|
||||
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,
|
||||
interval, repeatsOnDay.toString());
|
||||
System.out.println("calendarId " + calendarId);
|
||||
LOG.info("calendarId {}", calendarId);
|
||||
return calendarId;
|
||||
}
|
||||
|
||||
@@ -195,9 +200,9 @@ public class LoanReschedulingWithinCenterTest {
|
||||
responseSpec);
|
||||
CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec);
|
||||
Integer groupId = groupMembers[0];
|
||||
Assert.assertNotNull(center);
|
||||
Assert.assertTrue(center.getStaffId() == staffId);
|
||||
Assert.assertTrue(center.isActive() == true);
|
||||
Assertions.assertNotNull(center);
|
||||
Assertions.assertTrue(center.getStaffId() == staffId);
|
||||
Assertions.assertTrue(center.isActive() == true);
|
||||
|
||||
Integer calendarId = createCalendarMeeting(centerId);
|
||||
|
||||
@@ -223,13 +228,12 @@ public class LoanReschedulingWithinCenterTest {
|
||||
LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
|
||||
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
|
||||
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0", recalculationRestFrequencyDate,
|
||||
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan,
|
||||
null, null);
|
||||
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan, null, null);
|
||||
|
||||
Calendar seondTrancheDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
||||
seondTrancheDate.add(Calendar.MONTH, 1);
|
||||
String secondDisbursement = dateFormat.format(seondTrancheDate.getTime()) ;
|
||||
|
||||
String secondDisbursement = dateFormat.format(seondTrancheDate.getTime());
|
||||
|
||||
// CREATE TRANCHES
|
||||
List<HashMap> createTranches = new ArrayList<>();
|
||||
createTranches.add(this.loanApplicationApprovalTest.createTrancheDetail(disbursementDate, "5000"));
|
||||
@@ -249,7 +253,7 @@ public class LoanReschedulingWithinCenterTest {
|
||||
// VALIDATE THE LOAN STATUS
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
|
||||
loanID, approveTranches);
|
||||
|
||||
@@ -261,7 +265,7 @@ public class LoanReschedulingWithinCenterTest {
|
||||
this.loanTransactionHelper.disburseLoan(disbursementDate, 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());
|
||||
todaysdate.add(Calendar.DAY_OF_MONTH, 14);
|
||||
String oldMeetingDate = dateFormat.format(todaysdate.getTime());
|
||||
@@ -277,15 +281,15 @@ public class LoanReschedulingWithinCenterTest {
|
||||
|
||||
// VERIFY THE INTEREST
|
||||
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,
|
||||
final String interestRecalculationCompoundingMethod, final String rescheduleStrategyMethod,
|
||||
final String recalculationRestFrequencyType, final String recalculationRestFrequencyInterval,
|
||||
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 recalculationCompoundingFrequencyInterval = null;
|
||||
final String recalculationCompoundingFrequencyDate = null;
|
||||
@@ -294,9 +298,9 @@ public class LoanReschedulingWithinCenterTest {
|
||||
return createLoanProductWithInterestRecalculation(repaymentStrategy, interestRecalculationCompoundingMethod,
|
||||
rescheduleStrategyMethod, recalculationRestFrequencyType, recalculationRestFrequencyInterval,
|
||||
recalculationRestFrequencyDate, recalculationCompoundingFrequencyType, recalculationCompoundingFrequencyInterval,
|
||||
recalculationCompoundingFrequencyDate, preCloseInterestCalculationStrategy, accounts, null, false, isMultiTrancheLoan,
|
||||
recalculationCompoundingFrequencyOnDayType, recalculationCompoundingFrequencyDayOfWeekType, recalculationRestFrequencyOnDayType,
|
||||
recalculationRestFrequencyDayOfWeekType);
|
||||
recalculationCompoundingFrequencyDate, preCloseInterestCalculationStrategy, accounts, null, false, isMultiTrancheLoan,
|
||||
recalculationCompoundingFrequencyOnDayType, recalculationCompoundingFrequencyDayOfWeekType,
|
||||
recalculationRestFrequencyOnDayType, recalculationRestFrequencyDayOfWeekType);
|
||||
}
|
||||
|
||||
private Integer createLoanProductWithInterestRecalculation(final String repaymentStrategy,
|
||||
@@ -305,21 +309,14 @@ public class LoanReschedulingWithinCenterTest {
|
||||
final String recalculationRestFrequencyDate, final String recalculationCompoundingFrequencyType,
|
||||
final String recalculationCompoundingFrequencyInterval, final String recalculationCompoundingFrequencyDate,
|
||||
final String preCloseInterestCalculationStrategy, final Account[] accounts, final String chargeId,
|
||||
boolean isArrearsBasedOnOriginalSchedule, final boolean isMultiTrancheLoan,
|
||||
final Integer recalculationCompoundingFrequencyOnDayType,
|
||||
final Integer recalculationCompoundingFrequencyDayOfWeekType, final Integer recalculationRestFrequencyOnDayType,
|
||||
final Integer recalculationRestFrequencyDayOfWeekType) {
|
||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
LoanProductTestBuilder builder = new LoanProductTestBuilder()
|
||||
.withPrincipal("10000.00")
|
||||
.withNumberOfRepayments("12")
|
||||
.withRepaymentAfterEvery("2")
|
||||
.withRepaymentTypeAsWeek()
|
||||
.withinterestRatePerPeriod("2")
|
||||
.withInterestRateFrequencyTypeAsMonths()
|
||||
.withTranches(isMultiTrancheLoan)
|
||||
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
|
||||
.withRepaymentStrategy(repaymentStrategy)
|
||||
boolean isArrearsBasedOnOriginalSchedule, final boolean isMultiTrancheLoan,
|
||||
final Integer recalculationCompoundingFrequencyOnDayType, final Integer recalculationCompoundingFrequencyDayOfWeekType,
|
||||
final Integer recalculationRestFrequencyOnDayType, final Integer recalculationRestFrequencyDayOfWeekType) {
|
||||
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
LoanProductTestBuilder builder = new LoanProductTestBuilder().withPrincipal("10000.00").withNumberOfRepayments("12")
|
||||
.withRepaymentAfterEvery("2").withRepaymentTypeAsWeek().withinterestRatePerPeriod("2")
|
||||
.withInterestRateFrequencyTypeAsMonths().withTranches(isMultiTrancheLoan)
|
||||
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).withRepaymentStrategy(repaymentStrategy)
|
||||
.withInterestTypeAsDecliningBalance()
|
||||
.withInterestRecalculationDetails(interestRecalculationCompoundingMethod, rescheduleStrategyMethod,
|
||||
preCloseInterestCalculationStrategy)
|
||||
@@ -332,7 +329,9 @@ public class LoanReschedulingWithinCenterTest {
|
||||
builder = builder.withAccountingRulePeriodicAccrual(accounts);
|
||||
}
|
||||
|
||||
if (isArrearsBasedOnOriginalSchedule) builder = builder.withArrearsConfiguration();
|
||||
if (isArrearsBasedOnOriginalSchedule) {
|
||||
builder = builder.withArrearsConfiguration();
|
||||
}
|
||||
|
||||
final String loanProductJSON = builder.build(chargeId);
|
||||
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 String repaymentStrategy, final List<HashMap> charges, final String graceOnInterestPayment,
|
||||
final String graceOnPrincipalPayment, List<HashMap> tranches) {
|
||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||
.withPrincipal("10000.00") //
|
||||
.withLoanTermFrequency("24") //
|
||||
@@ -388,8 +387,8 @@ public class LoanReschedulingWithinCenterTest {
|
||||
map.put("active", "true");
|
||||
map.put("activationDate", "04 March 2011");
|
||||
|
||||
groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec, "/fineract-provider/api/v1/groups?"
|
||||
+ Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId");
|
||||
groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec,
|
||||
"/fineract-provider/api/v1/groups?" + Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId");
|
||||
}
|
||||
return groupMembers;
|
||||
}
|
||||
@@ -403,4 +402,4 @@ public class LoanReschedulingWithinCenterTest {
|
||||
return new ArrayList<>(Arrays.asList(date.get(Calendar.YEAR), date.get(Calendar.MONTH) + 1, date.get(Calendar.DAY_OF_MONTH)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+50
-36
@@ -18,23 +18,23 @@
|
||||
*/
|
||||
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 org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Client Loan Integration Test for checking Loan Disbursement with Waive
|
||||
@@ -43,17 +43,27 @@ import com.jayway.restassured.specification.ResponseSpecification;
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(LoanWithWaiveInterestAndWriteOffIntegrationTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
|
||||
private final String LP_PRINCIPAL = "12,000.00", LP_REPAYMENTS = "2", LP_REPAYMENT_PERIOD = "6", LP_INTEREST_RATE = "1",
|
||||
PRINCIPAL = "4,500.00", LOAN_TERM_FREQUENCY = "18", NUMBER_OF_REPAYMENTS = "9", REPAYMENT_PERIOD = "2",
|
||||
DISBURSEMENT_DATE = "30 October 2010", LOAN_APPLICATION_SUBMISSION_DATE = "23 September 2010",
|
||||
EXPECTED_DISBURSAL_DATE = "28 October 2010", RATE_OF_INTEREST_PER_PERIOD = "2", DATE_OF_JOINING = "04 March 2009",
|
||||
INTEREST_VALUE_AMOUNT = "40.00";
|
||||
private final String LP_PRINCIPAL = "12,000.00";
|
||||
private final String LP_REPAYMENTS = "2";
|
||||
private final String LP_REPAYMENT_PERIOD = "6";
|
||||
private final String LP_INTEREST_RATE = "1";
|
||||
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;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -76,7 +86,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
|
||||
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan("28 September 2010", loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
@@ -85,14 +95,14 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
loanStatusHashMap = this.loanTransactionHelper.undoApproval(loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
System.out.println("-----------------------------------RE-APPROVE LOAN-----------------------------------------");
|
||||
LOG.info("-----------------------------------RE-APPROVE LOAN-----------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan("1 October 2010", loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
// DISBURSE
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
|
||||
System.out.println("DISBURSE " + loanStatusHashMap);
|
||||
LOG.info("DISBURSE {}", loanStatusHashMap.toString());
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
// PERFORM REPAYMENTS AND CHECK LOAN STATUS
|
||||
@@ -105,7 +115,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
|
||||
// DIBURSE AGAIN
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
|
||||
System.out.println("DISBURSE " + loanStatusHashMap);
|
||||
LOG.info("DISBURSE {}", loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
// MAKE REPAYMENTS
|
||||
@@ -144,14 +154,14 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
|
||||
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan("28 September 2010", loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
// DISBURSE
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
|
||||
System.out.println("DISBURSE " + loanStatusHashMap);
|
||||
LOG.info("DISBURSE {}", loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
// MAKE REPAYMENTS
|
||||
@@ -161,27 +171,31 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
this.loanTransactionHelper.makeRepayment("1 January 2011", repayment_with_interest, loanID);
|
||||
|
||||
HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
|
||||
Assert.assertTrue("Checking for Principal paid ",
|
||||
new Float("500.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("principalPaid")))) == 0);
|
||||
Assert.assertTrue("Checking for interestPaid paid ",
|
||||
new Float("180.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("interestPaid")))) == 0);
|
||||
Assert.assertTrue("Checking for total paid ",
|
||||
new Float("680.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("totalRepayment")))) == 0);
|
||||
Assertions.assertTrue(Float.valueOf("500.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalPaid")))) == 0,
|
||||
"Checking for Principal paid ");
|
||||
Assertions.assertTrue(Float.valueOf("180.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("interestPaid")))) == 0,
|
||||
"Checking for interestPaid paid ");
|
||||
Assertions.assertTrue(
|
||||
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
|
||||
LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("1 January 2011", loanID));
|
||||
toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
|
||||
Assert.assertTrue("Checking for Principal written off ",
|
||||
new Float("4000.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("principalWrittenOff")))) == 0);
|
||||
Assert.assertTrue("Checking for interestPaid written off ",
|
||||
new Float("1440.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("interestWrittenOff")))) == 0);
|
||||
Assert.assertTrue("Checking for total written off ",
|
||||
new Float("5440.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("totalWrittenOff")))) == 0);
|
||||
Assertions.assertTrue(
|
||||
Float.valueOf("4000.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalWrittenOff")))) == 0,
|
||||
"Checking for Principal written off ");
|
||||
Assertions.assertTrue(
|
||||
Float.valueOf("1440.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("interestWrittenOff")))) == 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() {
|
||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL).withRepaymentTypeAsMonth()
|
||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||
@@ -191,7 +205,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
}
|
||||
|
||||
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)
|
||||
.withLoanTermFrequency(this.LOAN_TERM_FREQUENCY).withLoanTermFrequencyAsMonths()
|
||||
.withNumberOfRepayments(this.NUMBER_OF_REPAYMENTS).withRepaymentEveryAfter(this.REPAYMENT_PERIOD)
|
||||
|
||||
+8
-10
@@ -18,22 +18,20 @@
|
||||
*/
|
||||
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 org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class LoanWithdrawnByApplicantIntegrationTest {
|
||||
@@ -42,7 +40,7 @@ public class LoanWithdrawnByApplicantIntegrationTest {
|
||||
private RequestSpecification requestSpec;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
|
||||
+12
-14
@@ -18,11 +18,15 @@
|
||||
*/
|
||||
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.List;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.CalendarHelper;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
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.LoanStatusChecker;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* 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 groupActivationDate = "1 August 2014";
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
}
|
||||
@@ -97,7 +95,7 @@ public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest {
|
||||
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
|
||||
// Test for loan account is created
|
||||
Assert.assertNotNull(this.loanId);
|
||||
Assertions.assertNotNull(this.loanId);
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
@@ -217,4 +215,4 @@ public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest {
|
||||
public void setGroupCalendarId(Integer groupCalendarId) {
|
||||
this.groupCalendarId = groupCalendarId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-13
@@ -18,25 +18,27 @@
|
||||
*/
|
||||
package org.apache.fineract.integrationtests;
|
||||
|
||||
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 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 org.apache.fineract.integrationtests.common.NotificationHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
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;
|
||||
|
||||
public class NotificationApiTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(NotificationApiTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -49,7 +51,7 @@ public class NotificationApiTest {
|
||||
public void testNotificationRetrieval() {
|
||||
HashMap<String, Object> response = (HashMap<String, Object>) NotificationHelper.getNotifications(this.requestSpec,
|
||||
this.responseSpec, "");
|
||||
System.out.println("Response : " + response.toString());
|
||||
Assert.assertNotNull(response);
|
||||
LOG.info("Response : {}", response.toString());
|
||||
Assertions.assertNotNull(response);
|
||||
}
|
||||
}
|
||||
|
||||
+29
-35
@@ -18,49 +18,43 @@
|
||||
*/
|
||||
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.OfficeHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class OfficeIntegrationTest {
|
||||
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(
|
||||
ContentType.JSON).build();
|
||||
this.requestSpec
|
||||
.header("Authorization",
|
||||
"Basic "
|
||||
+ Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200)
|
||||
.build();
|
||||
}
|
||||
@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 testOfficeModification() {
|
||||
OfficeHelper oh = new OfficeHelper(requestSpec, responseSpec);
|
||||
int officeId = oh.createOffice("01 July 2007");
|
||||
String name = Utils.randomNameGenerator("New_Office_", 4);
|
||||
String date = "02 July 2007";
|
||||
String[] dateArr = { "2007", "7", "2" };
|
||||
@Test
|
||||
public void testOfficeModification() {
|
||||
OfficeHelper oh = new OfficeHelper(requestSpec, responseSpec);
|
||||
int officeId = oh.createOffice("01 July 2007");
|
||||
String name = Utils.randomNameGenerator("New_Office_", 4);
|
||||
String date = "02 July 2007";
|
||||
String[] dateArr = { "2007", "7", "2" };
|
||||
|
||||
oh.updateOffice(officeId, name, date);
|
||||
OfficeDomain newOffice = oh.retrieveOfficeByID(officeId);
|
||||
oh.updateOffice(officeId, name, date);
|
||||
OfficeDomain newOffice = oh.retrieveOfficeByID(officeId);
|
||||
|
||||
Assert.assertTrue(name.equals(newOffice.getName()));
|
||||
Assert.assertArrayEquals(dateArr, newOffice.getOpeningDate());
|
||||
}
|
||||
Assertions.assertTrue(name.equals(newOffice.getName()));
|
||||
Assertions.assertArrayEquals(dateArr, newOffice.getOpeningDate());
|
||||
}
|
||||
}
|
||||
|
||||
+19
-18
@@ -18,31 +18,32 @@
|
||||
*/
|
||||
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.List;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.PasswordPreferencesHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public class PasswordPreferencesIntegrationTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(PasswordPreferencesIntegrationTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private ResponseSpecification generalResponseSpec;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -59,20 +60,20 @@ public class PasswordPreferencesIntegrationTest {
|
||||
this.validateIfThePasswordIsUpdated(validationPolicyId);
|
||||
}
|
||||
|
||||
private void validateIfThePasswordIsUpdated(String validationPolicyId){
|
||||
private void validateIfThePasswordIsUpdated(String validationPolicyId) {
|
||||
Integer id = PasswordPreferencesHelper.getActivePasswordPreference(requestSpec, responseSpec);
|
||||
assertEquals(validationPolicyId, id.toString());
|
||||
System.out.println("---------------------------------PASSWORD PREFERENCE VALIDATED SUCCESSFULLY-----------------------------------------");
|
||||
LOG.info("---------------------------------PASSWORD PREFERENCE VALIDATED SUCCESSFULLY-----------------------------------------");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void updateWithInvalidPolicyId() {
|
||||
String invalidValidationPolicyId = "2000";
|
||||
final List<HashMap> error = (List) PasswordPreferencesHelper.updateWithInvalidValidationPolicyId(requestSpec, generalResponseSpec, invalidValidationPolicyId,
|
||||
CommonConstants.RESPONSE_ERROR);
|
||||
assertEquals("Password Validation Policy with identifier 2000 does not exist", "error.msg.password.validation.policy.id.invalid",
|
||||
error.get(0).get("userMessageGlobalisationCode"));
|
||||
final List<HashMap> error = (List) PasswordPreferencesHelper.updateWithInvalidValidationPolicyId(requestSpec, generalResponseSpec,
|
||||
invalidValidationPolicyId, CommonConstants.RESPONSE_ERROR);
|
||||
assertEquals("error.msg.password.validation.policy.id.invalid", 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;
|
||||
|
||||
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 org.apache.fineract.integrationtests.common.PaymentTypeDomain;
|
||||
import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class PaymentTypeIntegrationTest {
|
||||
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -56,13 +54,13 @@ public class PaymentTypeIntegrationTest {
|
||||
Integer position = 1;
|
||||
|
||||
Integer paymentTypeId = PaymentTypeHelper.createPaymentType(requestSpec, responseSpec, name, description, isCashPayment, position);
|
||||
Assert.assertNotNull(paymentTypeId);
|
||||
Assertions.assertNotNull(paymentTypeId);
|
||||
PaymentTypeHelper.verifyPaymentTypeCreatedOnServer(requestSpec, responseSpec, paymentTypeId);
|
||||
PaymentTypeDomain paymentTypeResponse = PaymentTypeHelper.retrieveById(requestSpec, responseSpec, paymentTypeId);
|
||||
Assert.assertEquals(name, paymentTypeResponse.getName());
|
||||
Assert.assertEquals(description, paymentTypeResponse.getDescription());
|
||||
Assert.assertEquals(isCashPayment, paymentTypeResponse.getIsCashPayment());
|
||||
Assert.assertEquals(position, paymentTypeResponse.getPosition());
|
||||
Assertions.assertEquals(name, paymentTypeResponse.getName());
|
||||
Assertions.assertEquals(description, paymentTypeResponse.getDescription());
|
||||
Assertions.assertEquals(isCashPayment, paymentTypeResponse.getIsCashPayment());
|
||||
Assertions.assertEquals(position, paymentTypeResponse.getPosition());
|
||||
|
||||
// Update Payment Type
|
||||
String newName = PaymentTypeHelper.randomNameGenerator("P_TU", 5);
|
||||
@@ -77,14 +75,14 @@ public class PaymentTypeIntegrationTest {
|
||||
request.put("position", newPosition);
|
||||
PaymentTypeHelper.updatePaymentType(paymentTypeId, request, requestSpec, responseSpec);
|
||||
PaymentTypeDomain paymentTypeUpdatedResponse = PaymentTypeHelper.retrieveById(requestSpec, responseSpec, paymentTypeId);
|
||||
Assert.assertEquals(newName, paymentTypeUpdatedResponse.getName());
|
||||
Assert.assertEquals(newDescription, paymentTypeUpdatedResponse.getDescription());
|
||||
Assert.assertEquals(isCashPaymentUpdatedValue, paymentTypeUpdatedResponse.getIsCashPayment());
|
||||
Assert.assertEquals(newPosition, paymentTypeUpdatedResponse.getPosition());
|
||||
Assertions.assertEquals(newName, paymentTypeUpdatedResponse.getName());
|
||||
Assertions.assertEquals(newDescription, paymentTypeUpdatedResponse.getDescription());
|
||||
Assertions.assertEquals(isCashPaymentUpdatedValue, paymentTypeUpdatedResponse.getIsCashPayment());
|
||||
Assertions.assertEquals(newPosition, paymentTypeUpdatedResponse.getPosition());
|
||||
|
||||
// Delete
|
||||
Integer deletedPaymentTypeId = PaymentTypeHelper.deletePaymentType(paymentTypeId, requestSpec, responseSpec);
|
||||
Assert.assertEquals(paymentTypeId, deletedPaymentTypeId);
|
||||
Assertions.assertEquals(paymentTypeId, deletedPaymentTypeId);
|
||||
ResponseSpecification responseSpecification = new ResponseSpecBuilder().expectStatusCode(404).build();
|
||||
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");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+629
-653
File diff suppressed because it is too large
Load Diff
+41
-40
@@ -18,31 +18,32 @@
|
||||
*/
|
||||
package org.apache.fineract.integrationtests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
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 org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
||||
import org.apache.fineract.integrationtests.useradministration.roles.RolesHelper;
|
||||
import org.apache.fineract.integrationtests.useradministration.users.UserHelper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
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;
|
||||
|
||||
public class RolesTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(RolesTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -54,11 +55,11 @@ public class RolesTest {
|
||||
@Test
|
||||
public void testCreateRolesStatus() {
|
||||
|
||||
System.out.println("---------------------------------CREATING A ROLE---------------------------------------------");
|
||||
LOG.info("---------------------------------CREATING A ROLE---------------------------------------------");
|
||||
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);
|
||||
assertEquals((Integer) role.get("id"), roleId);
|
||||
|
||||
@@ -68,20 +69,20 @@ public class RolesTest {
|
||||
@Test
|
||||
public void testDisableRolesStatus() {
|
||||
|
||||
System.out.println("---------------------------------CREATING A ROLE---------------------------------------------");
|
||||
LOG.info("---------------------------------CREATING A ROLE---------------------------------------------");
|
||||
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);
|
||||
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);
|
||||
assertEquals(disableRoleId, roleId);
|
||||
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, 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
|
||||
public void testEnableRolesStatus() {
|
||||
|
||||
System.out.println("---------------------------------CREATING A ROLE---------------------------------------------");
|
||||
LOG.info("---------------------------------CREATING A ROLE---------------------------------------------");
|
||||
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);
|
||||
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);
|
||||
assertEquals(disableRoleId, roleId);
|
||||
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, 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);
|
||||
assertEquals(enableRoleId, roleId);
|
||||
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, 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
|
||||
public void testDeleteRoleStatus() {
|
||||
|
||||
System.out.println("-------------------------------- CREATING A ROLE---------------------------------------------");
|
||||
LOG.info("-------------------------------- CREATING A ROLE---------------------------------------------");
|
||||
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);
|
||||
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);
|
||||
assertEquals(deleteRoleId, roleId);
|
||||
}
|
||||
@@ -133,16 +134,16 @@ public class RolesTest {
|
||||
@Test
|
||||
public void testRoleShouldGetDeletedIfNoActiveUserExists() {
|
||||
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(roleId);
|
||||
Assertions.assertNotNull(roleId);
|
||||
|
||||
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);
|
||||
Assert.assertNotNull(userId);
|
||||
Assertions.assertNotNull(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);
|
||||
assertEquals(deletedRoleId, roleId);
|
||||
@@ -151,17 +152,17 @@ public class RolesTest {
|
||||
@Test
|
||||
public void testRoleShouldNotGetDeletedIfActiveUserExists() {
|
||||
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(roleId);
|
||||
Assertions.assertNotNull(roleId);
|
||||
|
||||
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);
|
||||
Assert.assertNotNull(userId);
|
||||
Assertions.assertNotNull(userId);
|
||||
|
||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
final Integer deletedRoleId = RolesHelper.deleteRole(this.requestSpec, this.responseSpec, roleId);
|
||||
assertNotEquals(deletedRoleId, roleId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+96
-84
@@ -18,106 +18,118 @@
|
||||
*/
|
||||
package org.apache.fineract.integrationtests;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
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.Utils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
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;
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked", "static-access" })
|
||||
public class SchedulerJobsTest {
|
||||
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private ResponseSpecification responseSpecForSchedulerJob;
|
||||
private SchedulerJobHelper schedulerJobHelper;
|
||||
private Boolean originalSchedulerStatus;
|
||||
private final Map<Integer, Boolean> originalJobStatus = new HashMap<>();
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||
this.requestSpec.header("Fineract-Platform-TenantId", "default");
|
||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||
this.responseSpecForSchedulerJob = new ResponseSpecBuilder().expectStatusCode(202).build();
|
||||
requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||
requestSpec.header("Fineract-Platform-TenantId", "default");
|
||||
schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
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
|
||||
public void testSchedulerJobs() throws InterruptedException {
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
public void testFlippingSchedulerStatus() throws InterruptedException {
|
||||
// Retrieving Status of Scheduler
|
||||
HashMap schedulerStatus = this.schedulerJobHelper.getSchedulerStatus(this.requestSpec, this.responseSpec);
|
||||
Boolean status = (Boolean) schedulerStatus.get("active");
|
||||
if (status == true) {
|
||||
this.schedulerJobHelper.updateSchedulerStatus(this.requestSpec, this.responseSpecForSchedulerJob, "stop");
|
||||
schedulerStatus = this.schedulerJobHelper.getSchedulerStatus(this.requestSpec, this.responseSpec);
|
||||
// Verifying Status of the Scheduler after updation
|
||||
Assert.assertEquals("Verifying Scheduler Job Status", false, schedulerStatus.get("active"));
|
||||
Boolean schedulerStatus = schedulerJobHelper.getSchedulerStatus();
|
||||
if (schedulerStatus == true) {
|
||||
schedulerJobHelper.updateSchedulerStatus(false);
|
||||
schedulerStatus = schedulerJobHelper.getSchedulerStatus();
|
||||
// Verifying Status of the Scheduler after stopping
|
||||
assertEquals(false, schedulerStatus, "Verifying Scheduler Job Status");
|
||||
} else {
|
||||
this.schedulerJobHelper.updateSchedulerStatus(this.requestSpec, this.responseSpecForSchedulerJob, "start");
|
||||
schedulerStatus = this.schedulerJobHelper.getSchedulerStatus(this.requestSpec, this.responseSpec);
|
||||
// Verifying Status of the Scheduler after updation
|
||||
Assert.assertEquals("Verifying Scheduler Job Status", true, schedulerStatus.get("active"));
|
||||
schedulerJobHelper.updateSchedulerStatus(true);
|
||||
schedulerStatus = schedulerJobHelper.getSchedulerStatus();
|
||||
// Verifying Status of the Scheduler after starting
|
||||
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
+120
-119
@@ -18,12 +18,16 @@
|
||||
*/
|
||||
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.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.fineract.integrationtests.common.CalendarHelper;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
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.LoanProductTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
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;
|
||||
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({ "unchecked" })
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
@SuppressWarnings({ "static-access", "rawtypes", "unchecked", "deprecation" })
|
||||
public class SkipRepaymentOnMonthFirstTest {
|
||||
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private GlobalConfigurationHelper globalConfigurationHelper;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
private CalendarHelper calendarHelper;
|
||||
private final static Logger LOG = LoggerFactory.getLogger(SkipRepaymentOnMonthFirstTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private GlobalConfigurationHelper globalConfigurationHelper;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
private CalendarHelper calendarHelper;
|
||||
|
||||
@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();
|
||||
}
|
||||
@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 testSkippingRepaymentOnFirstDayOfMonth() {
|
||||
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
GlobalConfigurationHelper.resetAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||
GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||
}
|
||||
|
||||
// Retrieving All Global Configuration details
|
||||
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper
|
||||
.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(globalConfig);
|
||||
@Test
|
||||
public void testSkippingRepaymentOnFirstDayOfMonth() {
|
||||
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
String configName = "skip-repayment-on-first-day-of-month";
|
||||
boolean newBooleanValue = true;
|
||||
// Retrieving All Global Configuration details
|
||||
final ArrayList<HashMap> globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
|
||||
Assertions.assertNotNull(globalConfig);
|
||||
|
||||
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 = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(
|
||||
this.requestSpec, this.responseSpec, configId.toString(), newBooleanValue);
|
||||
Assert.assertNotNull(updateConfigId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
String configName = "skip-repayment-on-first-day-of-month";
|
||||
boolean newBooleanValue = true;
|
||||
|
||||
}
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
@Test
|
||||
public void checkRepaymentSkipOnFirstDayOfMonth() {
|
||||
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 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,
|
||||
Integer clientID) {
|
||||
System.out.println(
|
||||
"--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||
.withPrincipal("12,000.00") //
|
||||
.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);
|
||||
System.out.println(loanApplicationJSON);
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
}
|
||||
private Integer createLoanProduct() {
|
||||
LOG.info("------------------------------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 void verifyLoanRepaymentSchedule(final ArrayList<HashMap> loanSchedule) {
|
||||
System.out.println("--------------------VERIFYING THE REPAYMENT DATE--------------------------");
|
||||
assertEquals("Checking for Repayment Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 15)),
|
||||
loanSchedule.get(1).get("dueDate"));
|
||||
System.out.println("Repayment Date for 1st Month--" + loanSchedule.get(1).get("dueDate"));
|
||||
|
||||
assertEquals("Checking for Repayment Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 15)),
|
||||
loanSchedule.get(2).get("dueDate"));
|
||||
System.out.println("Repayment Date for 2nd Month--" + loanSchedule.get(2).get("dueDate"));
|
||||
|
||||
assertEquals("Checking for Repayment Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 15)),
|
||||
loanSchedule.get(3).get("dueDate"));
|
||||
System.out.println("Repayment Date for 3rd Month--" + loanSchedule.get(3).get("dueDate"));
|
||||
|
||||
assertEquals("Checking for Repayment Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 15)),
|
||||
loanSchedule.get(4).get("dueDate"));
|
||||
System.out.println("Repayment Date for 4th Month--" + loanSchedule.get(4).get("dueDate"));
|
||||
}
|
||||
private Integer applyForLoanApplication(final Integer groupID, final Integer loanProductID, Integer calendarID, Integer clientID) {
|
||||
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||
.withPrincipal("12,000.00") //
|
||||
.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);
|
||||
}
|
||||
|
||||
private void verifyLoanRepaymentSchedule(final ArrayList<HashMap> loanSchedule) {
|
||||
LOG.info("--------------------VERIFYING THE REPAYMENT DATE--------------------------");
|
||||
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(new ArrayList<>(Arrays.asList(2011, 11, 15)), loanSchedule.get(2).get("dueDate"),
|
||||
"Checking for Repayment Date for 2nd Month");
|
||||
LOG.info("Repayment Date for 2nd Month-- {}", loanSchedule.get(2).get("dueDate"));
|
||||
|
||||
assertEquals(new ArrayList<>(Arrays.asList(2011, 12, 15)), loanSchedule.get(3).get("dueDate"),
|
||||
"Checking for Repayment Date for 3rd Month");
|
||||
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;
|
||||
|
||||
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.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.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||
import com.jayway.restassured.builder.ResponseSpecBuilder;
|
||||
import com.jayway.restassured.http.ContentType;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class StaffImageApiTest {
|
||||
|
||||
private RequestSpecification requestSpec;
|
||||
private ResponseSpecification responseSpec;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
private AccountHelper accountHelper;
|
||||
|
||||
@Before
|
||||
@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();
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createStaffImage() {
|
||||
|
||||
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
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
|
||||
public void getStaffImage(){
|
||||
public void getStaffImage() {
|
||||
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
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);
|
||||
Assert.assertNotNull("Image id should not be null", imageAsText);
|
||||
assertNotNull("Image id should not be null", imageAsText);
|
||||
assertEquals(ImageHelper.generateImageAsText(), imageAsText);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getStaffImageAsBinary(){
|
||||
public void getStaffImageAsBinary() {
|
||||
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
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);
|
||||
Assert.assertNotNull("Image content should not be null", imageAsBytes);
|
||||
assertNotNull(imageAsBytes, "Image content should not be null");
|
||||
assertEquals(251, imageAsBytes.length);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateImage() {
|
||||
|
||||
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
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);
|
||||
Assert.assertNotNull("Image id should not be null", imageId);
|
||||
|
||||
assertNotNull(imageId, "Image id should not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteStaffImage() {
|
||||
|
||||
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
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);
|
||||
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;
|
||||
|
||||
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.List;
|
||||
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
||||
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;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class StaffTest {
|
||||
|
||||
@@ -41,7 +40,7 @@ public class StaffTest {
|
||||
private ResponseSpecification responseSpecForValidationError;
|
||||
private ResponseSpecification responseSpecForNotFoundError;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
@@ -53,11 +52,11 @@ public class StaffTest {
|
||||
|
||||
@Test
|
||||
public void testStaffCreate() {
|
||||
final HashMap response = StaffHelper.createStaffMap(requestSpec, responseSpec);
|
||||
Map<String, Object> response = StaffHelper.createStaffMap(requestSpec, responseSpec);
|
||||
|
||||
Assert.assertNotNull(response);
|
||||
Assert.assertEquals(response.get("officeId"), 1);
|
||||
Assert.assertNotNull(response.get("resourceId"));
|
||||
Assertions.assertNotNull(response);
|
||||
Assertions.assertEquals(1, response.get("officeId"));
|
||||
Assertions.assertNotNull(response.get("resourceId"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -71,7 +70,7 @@ public class StaffTest {
|
||||
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, noFirstnameJson);
|
||||
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("firstname", Utils.randomNameGenerator("michael_", 5));
|
||||
@@ -85,16 +84,17 @@ public class StaffTest {
|
||||
/** Long lastname test */
|
||||
map.put("lastname", Utils.randomNameGenerator("Doe_", 47));
|
||||
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 */
|
||||
map.put("mobileNo", Utils.randomNameGenerator("num_", 47));
|
||||
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, new Gson().toJson(map));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStaffCreateMaxNameLength() {
|
||||
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
final Map<String, Object> map = StaffHelper.getMapWithJoiningDate();
|
||||
|
||||
map.put("officeId", 1);
|
||||
map.put("firstname", Utils.randomNameGenerator("michael_", 42));
|
||||
@@ -103,8 +103,9 @@ public class StaffTest {
|
||||
StaffHelper.createStaffWithJson(requestSpec, responseSpec, new Gson().toJson(map));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStaffCreateExternalIdValidationError() {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
final Map<String, Object> map = StaffHelper.getMapWithJoiningDate();
|
||||
|
||||
map.put("officeId", 1);
|
||||
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
|
||||
@@ -116,10 +117,10 @@ public class StaffTest {
|
||||
|
||||
@Test
|
||||
public void testStaffFetch() {
|
||||
final HashMap response = StaffHelper.getStaff(requestSpec, responseSpec, 1);
|
||||
Assert.assertNotNull(response);
|
||||
Assert.assertNotNull(response.get("id"));
|
||||
Assert.assertEquals(response.get("id"), 1);
|
||||
Map<String, Object> response = StaffHelper.getStaff(requestSpec, responseSpec, 1);
|
||||
Assertions.assertNotNull(response);
|
||||
Assertions.assertNotNull(response.get("id"));
|
||||
Assertions.assertEquals(1, response.get("id"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -134,26 +135,27 @@ public class StaffTest {
|
||||
|
||||
@Test
|
||||
public void testStaffListStatusActive() {
|
||||
final List<HashMap> responseActive = (List<HashMap>) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active");
|
||||
for(final HashMap staff : responseActive) {
|
||||
Assert.assertNotNull(staff.get("id"));
|
||||
Assert.assertEquals(staff.get("isActive"), true);
|
||||
List<Map<String, Object>> responseActive = StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active");
|
||||
for (final Map<String, Object> staff : responseActive) {
|
||||
Assertions.assertNotNull(staff.get("id"));
|
||||
Assertions.assertEquals(true, staff.get("isActive"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStaffListStatusInactive() {
|
||||
final List<HashMap> responseInactive = (List<HashMap>) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "inactive");
|
||||
|
||||
for(final HashMap staff : responseInactive) {
|
||||
Assert.assertNotNull(staff.get("id"));
|
||||
Assert.assertEquals(staff.get("isActive"), false);
|
||||
List<Map<String, Object>> responseInactive = StaffHelper.getStaffListWithState(requestSpec, responseSpec, "inactive");
|
||||
for (final Map<String, Object> staff : responseInactive) {
|
||||
Assertions.assertNotNull(staff.get("id"));
|
||||
Assertions.assertEquals(false, staff.get("isActive"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStaffListFetchWrongState() {
|
||||
StaffHelper.getStaffListWithState(requestSpec, responseSpecForValidationError, "xyz");
|
||||
@Test // because "xyz" will return an error, not a List
|
||||
public void testStaffListFetchWrongState() throws ClassCastException {
|
||||
Assertions.assertThrows(ClassCastException.class, () -> {
|
||||
StaffHelper.getStaffListWithState(requestSpec, responseSpecForValidationError, "xyz");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -163,7 +165,7 @@ public class StaffTest {
|
||||
|
||||
@Test
|
||||
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 lastname = Utils.randomNameGenerator("Doe_", 10);
|
||||
final String externalId = Utils.randomStringGenerator("EXT", 97);
|
||||
@@ -174,16 +176,18 @@ public class StaffTest {
|
||||
map.put("externalId", externalId);
|
||||
map.put("mobileNo", mobileNo);
|
||||
|
||||
final HashMap response = (HashMap) StaffHelper.updateStaff(requestSpec, responseSpec, 1, map);
|
||||
final HashMap changes = (HashMap) response.get("changes");
|
||||
Map<String, Object> response = StaffHelper.updateStaff(requestSpec, responseSpec, 1, map);
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> changes = (Map<String, Object>) response.get("changes");
|
||||
|
||||
Assert.assertEquals(1, response.get("resourceId"));
|
||||
Assert.assertEquals(firstname, changes.get("firstname"));
|
||||
Assert.assertEquals(lastname, changes.get("lastname"));
|
||||
Assert.assertEquals(externalId, changes.get("externalId"));
|
||||
Assert.assertEquals(mobileNo, changes.get("mobileNo"));
|
||||
Assertions.assertEquals(1, response.get("resourceId"));
|
||||
Assertions.assertEquals(firstname, changes.get("firstname"));
|
||||
Assertions.assertEquals(lastname, changes.get("lastname"));
|
||||
Assertions.assertEquals(externalId, changes.get("externalId"));
|
||||
Assertions.assertEquals(mobileNo, changes.get("mobileNo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStaffUpdateLongExternalIdError() {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("externalId", Utils.randomStringGenerator("EXT", 98));
|
||||
@@ -191,6 +195,7 @@ public class StaffTest {
|
||||
StaffHelper.updateStaff(requestSpec, responseSpecForValidationError, 1, map);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStaffUpdateWrongActiveState() {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
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