Compare commits

...
508 Commits
Author SHA1 Message Date
Renovate BotandMichael Vorburger ⛑️ 982d3d340a Update dependency gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin to v4.4.1
Validate Gradle Wrapper / Validation (push) Canceled after 0s
2020-06-20 00:02:24 +02:00
percyashuandMichael Vorburger ⛑️ cf4acffb01 FINERACT-822 enable BadImport error check 2020-06-20 00:01:23 +02:00
percyashuandAwasum Yannick a72c2f4e47 FINERACT-822 Enforce ClassCanBeStatic check 2020-06-19 14:39:03 +01:00
percyashuandYemdjih Kaze Nasser fa854e9f0d FINERACT-822 update ErrorProne 2020-06-19 10:48:59 +01:00
percyashuandYemdjih Kaze Nasser dcf5ac009c FINERACT-822 Adding more checks to be enabled 2020-06-19 10:48:59 +01:00
thesmallstarandMichael Vorburger ⛑️ e269c3e91e FINERACT-821 Added NoFinalizer checkstyle 2020-06-18 09:31:39 +02:00
thesmallstarandMichael Vorburger ⛑️ 74b04cd4d3 FINERACT-821 Added and Enforced FinalClass checkstyle 2020-06-18 09:31:16 +02:00
Renovate BotandMichael Vorburger ⛑️ 37769dc74e Update dependency com.diffplug.spotless:spotless-plugin-gradle to v4.3.1 2020-06-17 22:11:49 +02:00
Renovate BotandMichael Vorburger ⛑️ 752b3993e9 Update dependency com.amazonaws:aws-java-sdk-s3 to v1.11.804 2020-06-17 22:11:00 +02:00
Rhys ArkinsandMichael Vorburger ⛑️ 526a964418 Reduce AWS SDK Dependency Updating to monthly
This Renovate Bot configuration change will mean that PRs for `com.amazonaws:aws-java-sdk-s3` will be created only on the first day of each month. Existing (open) PRs will continue to get rebased (if conflicted) or updated (if a newer version gets released), but once the PR is merged or closed then another one won't be created again until the next month.

Discussion: https://github.com/apache/fineract/pull/1071#issuecomment-644957795
2020-06-17 22:10:28 +02:00
Petri TuomolaandMichael Vorburger ⛑️ d3b6a3574c FINERACT-723: Fixed to use the right date in more tests 2020-06-17 22:07:19 +02:00
kiran-vsmandMichael Vorburger ⛑️ 520ee5b82d FINERACT-976 : Client date of birth can not be greater than the client submitted on date 2020-06-16 21:28:01 +02:00
Petri TuomolaandMichael Vorburger ⛑️ 8443f2edad FINERACT-689 Making interest rate slabs mandatory when creating 2020-06-16 21:04:34 +02:00
thesmallstarandMichael Vorburger ⛑️ 8289fe1b09 FINERACT-821 Removed Linelength and Indentation checkstyle from TODO 2020-06-16 21:03:48 +02:00
thesmallstarandMichael Vorburger ⛑️ f009888f79 FINERACT-821 Added Rightcurly checkstyle 2020-06-16 21:02:39 +02:00
thesmallstarandMichael Vorburger ⛑️ 94904543f1 FINERACT-821 Added OuterTypeFilename Checkstyle 2020-06-16 20:59:05 +02:00
thesmallstarandMichael Vorburger ⛑️ c78ff0b12b FINERACT-821 Added and Enforced ParenPad Checkstyle 2020-06-16 20:58:28 +02:00
thesmallstarandMichael Vorburger ⛑️ ce34c880da FINERACT-821 Added SeparatorWrap(1) Checkstyle 2020-06-16 20:56:57 +02:00
thesmallstarandMichael Vorburger ⛑️ 7427ef32bc FINERACT-821 Added MethodParamPad Checkstyle 2020-06-16 20:56:31 +02:00
Petri TuomolaandMichael Vorburger ⛑️ abc36006e3 FINERACT-1039: Fixing duplicate classfiles in JAR/WAR issue 2020-06-16 20:51:44 +02:00
thesmallstarandMichael Vorburger ⛑️ dedd3be1dc FINERACT-821 Added and Enforced LeftCurly Checkstyle 2020-06-15 10:53:47 +02:00
thesmallstarandMichael Vorburger ⛑️ 7c689a81b9 FINERACT-821 Added SeparatorWrap(2) Checkstyle 2020-06-15 10:06:06 +02:00
thesmallstarandMichael Vorburger ⛑️ c97f0f9935 FINERACT-821 Added and Enforced OperatorWrap Checkstyle 2020-06-15 10:03:13 +02:00
thesmallstarandMichael Vorburger ⛑️ 31c69cff39 FINERACT-821 Added and Enforced GenericWhitespace Checkstyle 2020-06-15 09:53:07 +02:00
thesmallstarandYemdjih Kaze Nasser 8aab991194 FINERACT-821 Added and Enforced EmptyLineSeparator Checkstyle 2020-06-15 04:07:42 +01:00
nnatarajanandYemdjih Kaze Nasser 03f38e33b3 FINERACT-1029 Failing lint test for static 2020-06-15 04:06:30 +01:00
thesmallstarandMichael Vorburger ⛑️ f6f1af9e95 FINERACT-821 Added and Enforced WhitespaceAround Checkstyle 2020-06-14 23:01:10 +02:00
Renovate BotandMichael Vorburger ⛑️ e78bf84ae8 Update dependency com.diffplug.spotless:spotless-plugin-gradle to v4.3.0 2020-06-14 21:56:35 +02:00
Petri TuomolaandMichael Vorburger ⛑️ 05479682e6 FINERACT-1038: Ignoring .settings directory in Spotless 2020-06-14 21:56:01 +02:00
Michael Vorburger 9da5932307 bulk auto reformat ca. 2900 files using ./gradlew :spotlessApply [FINERACT-1006] 2020-06-14 18:31:47 +02:00
Manthan SurkarandMichael Vorburger ⛑️ 89e321acaf FINERACT-1006 Added spotless to auto format source code 2020-06-14 18:31:47 +02:00
Michael Vorburger 64628345a0 remove (old, bad) SchedulerJobHelper.executeJob() [FINERACT-922] 2020-06-14 17:51:57 +02:00
Michael Vorburger 67e6e27b54 fix broken tests under JUnit 5 [FINERACT-1021] 2020-06-14 17:21:07 +02:00
Michael Vorburger 508e915b4f add missing useJUnitPlatform() to make Gradle run JUnit 5 [FINERACT-1021] 2020-06-14 17:21:07 +02:00
rrpawar96andMichael Vorburger ⛑️ 3f04247ceb gsim_glim_documentation 2020-06-14 16:02:42 +02:00
e8ecd79b9d FINERACT-857: Fixing scheduler integration tests and migrating to executeAndAwaitJob (#1049)
Co-authored-by: Michael Vorburger ⛑️ <mike@vorburger.ch>
2020-06-14 14:09:41 +02:00
percyashuandMichael Vorburger ⛑️ 3564f98689 FINERACT-822 enable MissingOverride error 2020-06-14 14:04:17 +02:00
percyashuandMichael Vorburger ⛑️ de20a987ae FINERACT-822 enable EqualsUnsafeCast error check 2020-06-14 14:03:55 +02:00
percyashuandMichael Vorburger ⛑️ 4b46f27253 FINERACT-822 enable JodaPlusMinusLong error 2020-06-14 13:59:05 +02:00
percyashuandMichael Vorburger ⛑️ 7c6b15e3bc FINERACT-822 enable ImmutableEnumChecker error 2020-06-14 13:51:50 +02:00
Renovate BotandMichael Vorburger ⛑️ f8dee63114 Update dependency gradle to v6.5 2020-06-14 13:43:42 +02:00
Renovate BotandMichael Vorburger ⛑️ 7adb2d8199 Update dependency com.amazonaws:aws-java-sdk-s3 to v1.11.802 2020-06-14 13:41:37 +02:00
Manthan SurkarandMichael Vorburger ⛑️ bc7d75d7b2 FINERACT-942 Added and Enforced EmptyCatchBlock checkstyle 2020-06-14 13:37:08 +02:00
xurrorandMichael Vorburger ⛑️ f2624b584c FINERACT-1021 - Update to JUnit 5 2020-06-14 12:52:18 +02:00
Renovate BotandMichael Vorburger ⛑️ 2aa01b93b4 Update dependency io.github.classgraph:classgraph to v4.8.86 2020-06-13 14:22:28 +02:00
xurrorandMichael Vorburger ⛑️ ca97a37544 FINERACT-1022 - Update to org.ehcache 2020-06-13 14:21:45 +02:00
percyashuandYemdjih Kaze Nasser 17cb620ec0 FINERACT-822 enable BigDecimalEquals error 2020-06-13 11:34:49 +01:00
percyashuandYemdjih Kaze Nasser 73a8816f13 FINERACT-822 enable MixedMutabilityReturnType error
FINERACT-822 enable MixedMutabilityReturnType error
2020-06-13 11:29:25 +01:00
Manthan SurkarandMichael Vorburger ⛑️ 885a501c64 INERACT-821 Added and Enforced EmptyBlock Checkstyle 2020-06-11 23:50:04 +02:00
Renovate BotandMichael Vorburger ⛑️ 8a1863b3b9 Update dependency org.apache.activemq:activemq-broker to v5.15.13 2020-06-11 23:39:46 +02:00
Renovate BotandMichael Vorburger ⛑️ 4f59569736 Update dependency org.flywaydb:flyway-core to v6.4.4 2020-06-11 23:39:39 +02:00
Renovate BotandMichael Vorburger ⛑️ 7d8671a2ee Update dependency org.awaitility:awaitility to v4.0.3 2020-06-11 23:39:23 +02:00
Renovate BotandMichael Vorburger ⛑️ 38a5bd092e Update dependency com.github.librepdf:openpdf to v1.3.19 2020-06-11 23:39:01 +02:00
thesmallstarandMichael Vorburger ⛑️ 99c667ab1a FINERACT-821 Added and Enforced AnnotationLocation(1) Checkstyle 2020-06-11 23:38:15 +02:00
Renovate BotandMichael Vorburger ⛑️ 50eea6529d Update dependency org.springframework.security.oauth:spring-security-oauth2 to v2.5.0.RELEASE 2020-06-11 22:36:53 +02:00
percyashuandMichael Vorburger ⛑️ cd5fed5eda FINERACT-822 enable ReferenceEquality error 2020-06-11 22:32:37 +02:00
Manthan SurkarandMichael Vorburger ⛑️ dae424da1a FINERACT-821 Made changes to enforce ConstantName Checkstyle (3) 2020-06-11 22:23:26 +02:00
Renovate BotandMichael Vorburger ⛑️ 52fa7a9832 Update dependency com.github.spotbugs:spotbugs-annotations to v4.0.4 2020-06-11 22:02:30 +02:00
Renovate BotandMichael Vorburger ⛑️ ce42df4897 Update dependency com.github.spullara.mustache.java:compiler to v0.9.6 2020-06-11 22:02:17 +02:00
percyashuandMichael Vorburger ⛑️ 15f244c09f FINERACT-822 enable InconsistentCapitalization error 2020-06-11 21:55:11 +02:00
thesmallstarandMichael Vorburger ⛑️ 960ae3f855 Removed already added MethodName checkstyle from comments 2020-06-11 21:52:33 +02:00
thesmallstarandMichael Vorburger ⛑️ f88c244053 FINERACT-821 Added and Enforced AnnotationLocation(2) Checkstyle 2020-06-11 21:50:49 +02:00
Renovate BotandMichael Vorburger ⛑️ a9d850e02e Update dependency io.github.classgraph:classgraph to v4.8.85 2020-06-11 21:39:09 +02:00
thesmallstarandMichael Vorburger ⛑️ a582ec63ee FINERACT-942 Added and Enforced IllegalThrows checkstyle 2020-06-11 21:36:42 +02:00
thesmallstarandMichael Vorburger ⛑️ 708dddd5f7 FINERACT-821 Added ForbidCertainImportsCheck
checkstyle
2020-06-11 21:35:45 +02:00
Renovate BotandMichael Vorburger ⛑️ 6f4de4186b Update dependency org.mnode.ical4j:ical4j to v3.0.19 2020-06-11 21:15:55 +02:00
Renovate BotandYemdjih Kaze Nasser aed079b5c1 Update dependency com.amazonaws:aws-java-sdk-s3 to v1.11.800 2020-06-11 04:01:12 +01:00
percyashuandMichael Vorburger ⛑️ 23ffe45ceb minor JavaDoc fix in SearchParameters 2020-06-09 20:42:55 +02:00
percyashuandMichael Vorburger ⛑️ 4c004f0a87 FINERACT-822 enable DoubleBraceInitialization error 2020-06-09 20:42:08 +02:00
nnatarajanandMichael Vorburger ⛑️ 117398b765 FINERACT-959 Tighten javac compilerArgs, turn more warnings into errors (and fix related problems) 2020-06-09 20:31:25 +02:00
xurror 030a5143c7 update apache commons io(FINERACT-1020) 2020-06-09 13:54:28 +01:00
Renovate BotandMichael Vorburger ⛑️ 28e4fd15a2 Update dependency com.github.spotbugs:spotbugs to v4.0.4 2020-06-09 08:04:30 +02:00
Josue AraujoandMichael Vorburger ⛑️ 4e9914ae6f * Added missing quotes in query. (FINERACT-897 https://github.com/apache/fineract/pull/757) 2020-06-09 07:56:34 +02:00
Manthan SurkarandMichael Vorburger ⛑️ 417c9e297e FINERACT-821 Added FallThrough Checkstyle 2020-06-08 22:40:56 +02:00
Petri TuomolaandYemdjih Kaze Nasser 4ba33daa74 FINERACT-1025: Upgrade Docker Compose and fix MySQL heartbeat 2020-06-08 19:30:20 +01:00
Petri TuomolaandYemdjih Kaze Nasser e0f8bc5e46 FINERACT-1024: Changing Travis profile to minimal 2020-06-08 13:10:37 +01:00
percyashuandYemdjih Kaze Nasser 731079ede7 FINERACT-822 enable JdkObsolete error 2020-06-08 13:07:10 +01:00
percyashuandMichael Vorburger ⛑️ 829cfb1911 FINERACT-822 enable EqualsGetClass error 2020-06-08 07:11:44 +02:00
percyashuandMichael Vorburger ⛑️ f226bbae6e FINERACT-822 enable EqualsGetClass error 2020-06-08 07:11:44 +02:00
Petri TuomolaandMichael Vorburger ⛑️ a54c124449 FINERACT-899: Fixing AccountingScenarioIntegrationTests 2020-06-08 07:04:28 +02:00
Petri TuomolaandMichael Vorburger ⛑️ b31e6c2881 FINERACT-1019: Fix failing import integration tests 2020-06-08 07:00:15 +02:00
Petri TuomolaandMichael Vorburger ⛑️ 6eb3873a5b Fixed OfficeImportTest 2020-06-08 07:00:15 +02:00
percyashuandYemdjih Kaze Nasser cfe5848a02 FINERACT-822 enable OperatorPrecedence error 2020-06-08 02:32:30 +01:00
percyashuandYemdjih Kaze Nasser d5af661231 FINERACT-822 enable OperatorPrecedence error 2020-06-08 02:32:30 +01:00
Renovate BotandMichael Vorburger ⛑️ 62d8d49312 Update dependency org.apache.tomcat:tomcat to v9.0.36 2020-06-07 23:04:18 +02:00
Michael Vorburger 4528231fd1 remove bad 'default:' in SavingsEnumerations switch
This default: is "wrong", because it's not required - the switch,
in this particular case, *IS* actually already handling all cases.

But if in the future someone were to add an additional new
SavingsAccountTransactionType, then we would want Error Prone to
fail to signal that it needs to be handled here - but the "default:"
would "hide" that.

This is a follow-up to https://github.com/apache/fineract/pull/983/
for FINERACT-822, and also related to the discussion started on
https://github.com/apache/fineract/pull/989.

There originally used to be a "default:" in the middle of the switch,
that obviously WAS completely wrong and an old copy-paste bug.
2020-06-07 18:40:08 +02:00
Renovate BotandMichael Vorburger ⛑️ 2db2e38796 Update dependency org.apache.tomcat:tomcat to v9.0.35 2020-06-07 15:30:09 +02:00
Renovate BotandMichael Vorburger ⛑️ 37a958e614 Update dependency org.nosphere.apache:creadur-rat-gradle to v0.7.0 2020-06-07 15:29:40 +02:00
Renovate BotandMichael Vorburger ⛑️ 9e67c27749 Update dependency net.ltgt.gradle:gradle-errorprone-plugin to v1.2.1 2020-06-07 14:12:23 +02:00
Renovate BotandMichael Vorburger ⛑️ 916e33daa8 Update dependency gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin to v4.3.0 2020-06-07 14:11:38 +02:00
Michael Vorburger dcaaf1a4e8 do NOT .gitignore gradle/ as it IS in Git (FINERACT-962) 2020-06-07 14:11:04 +02:00
Michael VorburgerandYemdjih Kaze Nasser 0e6a0e3ee3 remove old constructor from SchedulerJobHelper (related to FINERACT-922) 2020-06-07 13:08:08 +01:00
xurrorandMichael Vorburger ⛑️ 4aa3404e88 FINERACT-1002(distch plus and use fixed versions instead) 2020-06-07 12:49:25 +02:00
Manthan SurkarandMichael Vorburger ⛑️ b0ff8dbb60 FINERACT-821 Added and Enforced MethodName Checkstyle 2020-06-07 02:05:40 +02:00
Manthan SurkarandMichael Vorburger ⛑️ 73e1fe77e9 FINERACT-821 Made changes to enforce ConstantName Checkstyle (2) 2020-06-07 02:03:16 +02:00
Percy Ayuk AshuandGitHub 910eb1f7a8 FINERACT-822 enable MissingCasesInEnumSwitch error (#989) 2020-06-06 22:05:43 +01:00
Percy Ayuk AshuandGitHub cd3621cb60 FINERACT-822 Enabling ErrorProne error checks (#983) 2020-06-05 16:42:01 +01:00
Percy Ayuk AshuandGitHub 78857bcf81 FINERACT-822 Enabling MultiVariableDeclaration check (#981) 2020-06-05 10:28:00 +01:00
Percy Ayuk AshuandGitHub 99b0136f40 FINERACT-822 Enabling AssertEqualsArgumentOrderChecker check (#982) 2020-06-05 09:10:18 +01:00
percyashuandYemdjih Kaze Nasser 960e81af1c FINERACT-822 Enabling UnnecessaryParentheses check 2020-06-04 02:14:25 +01:00
thesmallstarandYemdjih Kaze Nasser cc6bf4b4b0 FINERACT-821 Added MethodTypeParameterName checkstyle 2020-06-04 02:08:09 +01:00
Petri TuomolaandMichael Vorburger ⛑️ 14b14aecac FINERACT-1017: Fixing LoanImport integration tests 2020-06-03 22:25:36 +02:00
Michael Vorburger ⛑️andGitHub 7a2d459af3 Merge pull request #972 from percyashu/errorprone_variableNameSameAsType
FINERACT-822 enable variableNameSameAsType warning
2020-06-03 22:13:56 +02:00
Manthan SurkarandMichael Vorburger ⛑️ 9cda5f984a FINERACT-821 Made changes to enforce ConstantName Checkstyle (1) 2020-06-03 22:13:19 +02:00
nnatarajanandMichael Vorburger ⛑️ 3521b0ed33 FINERACT-933 Fixed ArrayIndexOutOfBoundsException at ClientPersonImportHandler 2020-06-03 10:50:48 +02:00
nnatarajanandMichael Vorburger ⛑️ 8d7fa73b46 FINERACT-933 Suggestion to fix ArrayIndexOutOfBoundsException 2020-06-03 10:50:48 +02:00
nnatarajanandMichael Vorburger ⛑️ 97cbb13c9c FINERACT-1004 Resolved NPE in AddressWritePlatformServiceImpl.updateClientAddress() 2020-06-03 09:55:24 +02:00
Michael VorburgerandYemdjih Kaze Nasser 0c6903fc36 executeAndAwaitJob() instead executeJob() in un-ignored FixedDepositTest
re. FINERACT-950 and FINERACT-922
2020-06-03 01:59:14 +01:00
thesmallstarandMichael Vorburger ⛑️ 140435bca4 FINERACT-821 Added OneTopLevelClass checkstyle 2020-06-02 22:49:02 +02:00
Renovate BotandMichael Vorburger ⛑️ 44eff92e6f chore(deps): update dependency com.puppycrawl.tools:checkstyle to v8.33 2020-06-02 22:43:04 +02:00
percyashu f685eb7a68 FINERACT-822 enable VariableNameSameAsType warning 2020-06-02 21:34:12 +01:00
Renovate BotandMichael Vorburger ⛑️ bdb979e8ce Update dependency com.github.sevntu-checkstyle:sevntu-checks to v1.37.1 2020-06-02 21:26:17 +02:00
Michael Vorburger c95fb17f6e minor: simplify hashCode() in CenterDomain 2020-06-02 21:15:36 +02:00
Michael VorburgerandYemdjih Kaze Nasser 60dd63d55f executeAndAwaitJob() !executeJob() ClientSavingsIntegrationTest
re. FINERACT-852 and FINERACT-922
2020-06-02 19:49:09 +01:00
Michael VorburgerandYemdjih Kaze Nasser a58b14c9d2 executeAndAwaitJob() !executeJob() ClientLoanIntegrationTest un-ignore
re. FINERACT-885 and FINERACT-922
2020-06-02 19:46:04 +01:00
Michael Vorburger ⛑️ 734cbb1d1f Renovate ignore docs/ and add label [FINERACT-962] 2020-06-02 19:57:42 +02:00
Renovate BotandMichael Vorburger ⛑️ 9558f53765 Add renovate.json 2020-06-02 19:57:42 +02:00
Michael Vorburger fd3b75711c remove line in AbstractLoanScheduleGenerator [FINERACT-977]
It was wrongly added in commit re. fix possible NPE in AbstractLoanScheduleGenerator.
2020-06-02 19:52:30 +02:00
Percy Ayuk AshuandGitHub 16a69e7a4c FINERACT-822 enable ArgumentSelectionDefectChecker warning (#961) 2020-06-02 17:32:52 +01:00
Michael VorburgerandYemdjih Kaze Nasser 6f128bf508 minor clean-up to eliminate 'dead code' in CodeValue
This fixes one of too many ;) warnings Eclipse shows.

It is correct that the condition this checked is useless,
because that is already checked for in the method it calls.
(BTW it's actually pretty impressive that JDT, the Eclipse
Java compiler, can figure this out; it's "smarter" than javac).
2020-06-02 15:36:09 +01:00
Michael VorburgerandYemdjih Kaze Nasser 956a84114f improve StaffImageApiTest (for FINERACT-965 non-regression) 2020-06-02 15:29:45 +01:00
Michael VorburgerandYemdjih Kaze Nasser 83de217b64 minor clean-up in StaffImageApiTest (re. FINERACT-965) 2020-06-02 15:29:45 +01:00
Michael VorburgerandYemdjih Kaze Nasser 619fe44d0e bump OpenPDF from 1.1.0 to 1.3.17 + swap Base64 [FINERACT-965]
and replace com.lowagie.text.pdf.codec.Base64 with java.util.Base64
2020-06-02 15:29:45 +01:00
nnatarajanandYemdjih Kaze Nasser df0bcb1b97 FINERACT-965 Upgrade, Replace itext 2.1.7 with Openpdf 1.1.0 2020-06-02 15:29:45 +01:00
Michael Vorburger d439aa9545 replace api-docs links to mifos.io with fineract.dev [FINERACT-840] 2020-06-02 13:20:17 +02:00
Petri TuomolaandMichael Vorburger ⛑️ 23fa22e096 FINERACT-855: Fixing test failures due to rounding difference 2020-06-02 13:00:00 +02:00
Saransh SharmaandMichael Vorburger ⛑️ b6e6eba56f fix possible NPE in AbstractLoanScheduleGenerator 2020-06-01 21:53:02 +02:00
percyashuandMichael Vorburger ⛑️ aed3e41ca4 FINERACT-822 Enable CompareToZero check 2020-06-01 12:43:49 +02:00
Petri TuomolaandMichael Vorburger ⛑️ e295bef743 FINERACT-918: Changes to running and debugging in Eclipse 2020-06-01 11:45:15 +02:00
Petri TuomolaandMichael Vorburger ⛑️ 1a397c5663 FINERACT-1005: Fixing staff validations and tests 2020-06-01 10:59:22 +02:00
Manthan SurkarandMichael Vorburger ⛑️ 3545cbef4c Remove already added checkstyle from comments 2020-05-31 18:53:33 +02:00
Manthan SurkarandMichael Vorburger ⛑️ b8ad1984f3 Fix typo in readme 2020-05-31 18:18:22 +02:00
Manthan SurkarandMichael Vorburger ⛑️ fbb580edbf Minor readme improvement 2020-05-31 18:18:22 +02:00
Vishwas Babu A JandGitHub 096d842c38 Merge pull request #924 from percyashu/FINERACT-609
FINERACT-609 TopUp
2020-05-29 22:38:42 -07:00
ManojandMichael Vorburger ⛑️ 561ea0a95e FINERACT-1008-flyway-migration-fix 2020-05-29 08:39:18 +02:00
thesmallstarandMichael Vorburger ⛑️ 7b09c1a4b0 FINERACT-821 Added IllegalTokenText Checkstyle 2020-05-29 08:37:43 +02:00
Michael VorburgerandYemdjih Kaze Nasser 1db6e8d206 fix ClasspathHellDuplicatesCheckRuleTest (FINERACT-966)
and prevent FINERACT-940 related javax.xml.parsers problems

as per https://github.com/spotbugs/spotbugs/issues/1128
2020-05-29 06:13:23 +01:00
nnatarajanandYemdjih Kaze Nasser fedea8c248 FINERACT-966 Bump dom4j from 2.1.0 to 2.1.3 2020-05-29 06:13:23 +01:00
Michael Vorburger 4b108f02ec fix broken build due to @Deprecated error [FINERACT-1012] 2020-05-28 22:36:03 +02:00
dependabot-preview[bot]andMichael Vorburger ⛑️ 0322d4f94b Bump spring-security-oauth2 in /fineract-provider
Bumps [spring-security-oauth2](https://github.com/SpringSource/spring-security-oauth) from 2.3.6.RELEASE to 2.4.1.RELEASE.
- [Release notes](https://github.com/SpringSource/spring-security-oauth/releases)
- [Commits](https://github.com/SpringSource/spring-security-oauth/compare/2.3.6.RELEASE...2.4.1.RELEASE)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-28 21:16:30 +02:00
Awasum YannickandMichael Vorburger ⛑️ ea794f9c74 FINERACT-1011 increase timeout for Gradle Cargo Plugin 2020-05-28 20:51:29 +02:00
percyashuandMichael Vorburger ⛑️ e10a78b2bd FINERACT-822 Integrating Error Prone 2020-05-28 20:40:35 +02:00
percyashu c1ca960ace FINERACT-609 TopUp 2020-05-28 19:16:47 +01:00
Manthan SurkarandYemdjih Kaze Nasser 896571d479 FINERACT-821 Added NoLineWrap Checkstyle 2020-05-28 16:50:13 +01:00
Manthan SurkarandMichael Vorburger ⛑️ ef538e5c75 FINERACT-821 Added and Enforced ArrayTypeStyle checkstyle 2020-05-27 11:27:32 +02:00
Manthan SurkarandMichael Vorburger ⛑️ 3e95c32e18 FINERACT-821 Added and enforced NeedBraces Checkstyle 2020-05-27 00:13:22 +02:00
Avik GangulyandGitHub 50d5d08378 Merge pull request #769 from fynmanoj/findevfdrollover
FINERACT-893-fixed-deposit-rollover
2020-05-26 21:07:42 +05:30
Manthan SurkarandMichael Vorburger ⛑️ 01e8014ea2 FINERACT-821 Added and Enforced upperEll checkstyle 2020-05-26 09:30:59 +02:00
nnatarajanandMichael Vorburger ⛑️ e928c6487f FINERACT-804 upgrade OkHTTP to 2.7.5 2020-05-26 09:28:06 +02:00
Petri TuomolaandGitHub 562b2a1d97 FINERACT-874: Removing files related to old release process (#890) 2020-05-25 08:50:24 +01:00
thesmallstarandMichael Vorburger ⛑️ 718ff205e5 FINERACT-821 Added AvoidEscapedUnicodeCharacters checkstyle 2020-05-25 09:27:16 +02:00
Michael Vorburger ⛑️andGitHub b3da50c960 intro. SchedulerJobsHelper.executeAndAwaitJob() [FINERACT-922] (#817) 2020-05-24 20:54:37 +01:00
Michael Vorburger ⛑️andGitHub 4cb9f9d3e0 improve logging in SchedulerTriggerListener (re. FINERACT-922) (#812) 2020-05-24 20:18:36 +01:00
Saransh SharmaandMichael Vorburger ⛑️ ce570b4b33 Fixed Accounting findProductIdAndProductTypeAndFinancialAccountTypeAndChargeId 2020-05-24 10:43:29 +02:00
xurrorandMichael Vorburger ⛑️ 81fc89c58c Create no-args constructors for PU 2020-05-24 10:12:38 +02:00
Michael Vorburger ⛑️ 4194da2b90 add new Logging Guidelines section to README (re. FINERACT-942) 2020-05-23 20:48:44 +02:00
Manoj bd99138aad FINERACT-893-fixed-deposit-rollover 2020-05-23 22:52:39 +05:30
Michael Vorburger ⛑️andGitHub dc7c1f8404 add link to our shiny new JIRA Dashboard to README [FINERACT-1000] (#929)
also remove link to supposed "Roadmap", because that really was just a confusing link to 1000 JIRA issues.

see FINERACT-1000
2020-05-23 14:52:28 +01:00
Michael VorburgerandYemdjih Kaze Nasser 5b1c46c821 remove logback.xml (see FINERACT-888)
Read e.g. https://12factor.net/logs for why we don't want to log
to a fineract-platform.log file anymore by default.  Of course, anyone
could still customize logging as they see fit for their own deployments.
2020-05-23 12:38:20 +01:00
thesmallstarandMichael Vorburger ⛑️ baa1177854 FINERACT-821 Added and Enforced Typename checkstyle 2020-05-22 15:23:23 +02:00
thesmallstarandMichael Vorburger ⛑️ 014c6bba40 FINERACT-821 Added PackageName checkstyle 2020-05-22 09:31:14 +02:00
Michael VorburgerandYemdjih Kaze Nasser 3d0d515b4b ignore StorageTest [FINERACT-828] 2020-05-22 03:56:22 +01:00
Michael VorburgerandYemdjih Kaze Nasser d4e8a7edd0 do not attempt to run Deploy to Fineract.dev GitHub Workflow on Forks [FINERACT-970] 2020-05-22 03:47:17 +01:00
Petri TuomolaandMichael Vorburger ⛑️ 2efca89722 FINERACT-991: Upgrade RAT plug-in 2020-05-22 00:10:20 +02:00
nnatarajanandMichael Vorburger ⛑️ 96452f3ff4 Fineract-955 - Upgrade ical4j from ancient version 1.0.7 to current 3.0.18 2020-05-22 00:07:37 +02:00
thesmallstarandMichael Vorburger ⛑️ 16fb971f45 FINERACT-942 Remove use of printStackTrace and added checkstyle 2020-05-21 21:48:11 +02:00
Petri TuomolaandMichael Vorburger ⛑️ 1bff035d3c FINERACT-830: Configuring Dockerfile to use Google Distroless base image 2020-05-21 15:47:12 +02:00
Petri TuomolaandMichael Vorburger ⛑️ acfec8bb94 FINERACT-723: Fixing date comparisons that resulting in a problem when timezone is different on database and application server 2020-05-21 11:50:30 +02:00
xurrorandMichael Vorburger ⛑️ 3bc7914068 Update spotbugs to v4.2.0(FINERACT-986) 2020-05-21 10:52:42 +02:00
Michael Vorburger ⛑️andGitHub f93cd4dbbd minor README moves (#909) 2020-05-20 11:33:09 +01:00
Michael Vorburger ⛑️andGitHub a36c0f725b add new Dependency Upgrades section to README (#910) 2020-05-20 10:56:33 +01:00
Michael Vorburger ⛑️andGitHub e8276f0aea Remove direct explicit Guava dependency (FINERACT-963) (#913)
We *ARE* using Guava, but, unless we have a real need for a more recent
specific version, it seems "safer" (and less hassle to maintain bumping)
just using whatever version we transitively inherit from other libraries
we use that themselves depend on Guava (currently Swagger, Mustache and
activemq-broker).

Currently that "whatever version" is a 28.2 (we used 28.1 before).

This removes two fairly different kinds of Guava dependencies we have:
One for run-time (above), and one for build time which seems to have
been added due to some SpotBugs related issue (but it now works without
that, so that must have been some issue in SpotBugs that meanwhile go
fixed in the recent versions).
2020-05-20 10:00:29 +01:00
Yemdjih Kaze NasserandGitHub 44376ca1fe Merge pull request #911 from vorburger/FINERACT-953_groovy
improve ClasspathHellDuplicatesCheckRuleTest (req. by FINERACT-953)
2020-05-20 01:21:45 +01:00
xurrorandMichael Vorburger ⛑️ dc3af0c867 FINERACT-964
bump json-path from 0.9.1 to 2.4.0
2020-05-20 00:56:20 +02:00
percyashuandMichael Vorburger ⛑️ 610375753c FINERACT-959 make javac fail for Xlint:cast 2020-05-20 00:42:20 +02:00
Michael Vorburger dd0c838439 improve ClasspathHellDuplicatesCheckRuleTest (req. by FINERACT-953)
to ignore all META-INF/groovy** such as
META-INF/groovy/org.codehaus.groovy.runtime.ExtensionModule which is
part of both groovy-xml-3.0.3.jar as well as e.g. ical4j-3.0.18.jar
2020-05-19 23:01:28 +02:00
Michael Vorburger 5557b8be4a fix moar flaky StorageTest.testNotificationStorage() [FINERACT-828]
similar fix to earlier Pull Request for the same

also added some more toString()
2020-05-17 21:29:20 +02:00
Michael Vorburger ⛑️andGitHub e7889f8463 copy .git/** into build container so git.properties can be generated [FINERACT-983] (#904) 2020-05-17 10:33:29 +01:00
Michael Vorburger 7a98ad8d07 add new testNumberOfJobs() to SchedulerJobsTest (re. FINERACT-922)
This would catch problems such as the integration tests running "too
early" (before Flyway has fully initialized the database), which I have
a suspicion could be one of (many) causes of the unstable scheduler
tests, notably because of the IllegalArgumentException at
SchedulerJobsTest.java:90 in https://github.com/apache/fineract/pull/817
2020-05-17 10:56:59 +02:00
Michael Vorburger 904da67bbd Remove un-used "Send messages to Email gateway" Job (FINERACT-952) 2020-05-17 10:56:59 +02:00
Michael Vorburger cbc274f603 remove (useless) SenderTest + mockrunner-jms/nekohtml (FINERACT-938) 2020-05-17 10:53:42 +02:00
Michael Vorburger ⛑️andGitHub f7f52f04d1 Merge pull request #852 from vorburger/FINERACT-922_SchedulerJobsTest-reset-world-as-found
make SchedulerJobsTest preserve scheduler and job states (FINERACT-922)
2020-05-17 02:52:27 +02:00
Michael Vorburger e0d4a1f376 make SchedulerJobsTest preserve scheduler and job states (FINERACT-922) 2020-05-17 02:25:51 +02:00
Michael Vorburger ⛑️andGitHub ddaffd13c0 Merge pull request #857 from xurror/FINERACT-897
[WIP] MySQL v8(FINERACT-897)
2020-05-17 02:13:49 +02:00
Michael Vorburger 00aa71b0e1 rm .github/workflows/first-interaction.yml
because it's broken, see
https://github.com/actions/first-interaction/issues/10
2020-05-17 00:21:00 +02:00
Michael Vorburger a0e20588aa fix canceling previous ongoing jobs on Fineract.dev [FINERACT-970] 2020-05-17 00:19:11 +02:00
Michael Vorburger edcdcc34a2 cancel previous ongoing jobs on Fineract.dev when updating [FINERACT-970] 2020-05-17 00:08:07 +02:00
Michael Vorburger 1fdc033923 use --no-daemon in Dockerfile (and don't clean; really no need) [FINERACT-970] 2020-05-16 23:46:27 +02:00
Michael Vorburger 711ea1d6cd gcloud components install beta to deploy to https://Fineract.dev [FINERACT-970] 2020-05-16 23:34:46 +02:00
Michael Vorburger 84dfb32c34 use --quiet to deploy to https://Fineract.dev [FINERACT-970] 2020-05-16 23:26:43 +02:00
Michael Vorburger 04d3ce673c automatically deploy to https://Fineract.dev [FINERACT-970] 2020-05-16 23:07:53 +02:00
Michael Vorburger c764d32d5e fix Flyway table name problem (FINERACT-979) 2020-05-16 18:34:19 +02:00
thesmallstarandMichael Vorburger ⛑️ 20e8a02294 FINERACT-942 Remove bad logging pattern(Use of system.out) and added checkstyle 2020-05-16 18:13:43 +02:00
xurror 4360260ac6 FINERACT-897
make fineract compatible with both mysql5.5 and  mysql v8
2020-05-16 07:36:28 +01:00
Michael Vorburger 9ce72fe67b fix broken build
Combination of recently separately merged PRs #865 and #859 broke it.
2020-05-15 22:56:13 +02:00
Michael Vorburger ⛑️andGitHub 0eee0ff775 make javac fail, not just warn, for (Xlint) unchecked (FINERACT-959) (#859)
This is just a first step - we should aim for -Xlint:all! ;)
2020-05-15 21:31:16 +01:00
Michael Vorburger ⛑️andGitHub 39675c9a23 rewrite MultiException to actually contain all causes (FINERACT-858) (#855) 2020-05-15 21:30:33 +01:00
Michael Vorburger 2aca64056a fix flaky StorageTest.testNotificationStorage() (FINERACT-828) 2020-05-15 20:12:37 +02:00
Petri TuomolaandMichael Vorburger ⛑️ 439ba93ebd FINERACT-972: Ensure Tomcat is started after the integration tests have been compiled 2020-05-15 19:54:21 +02:00
thesmallstarandMichael Vorburger ⛑️ 9eccd61333 Added Empty Statement Check and enforced checkstyle 2020-05-15 19:43:16 +02:00
Michael Vorburger 297e483742 fix invalid YAML syntax in (broken) GitHub Action 2020-05-12 20:54:27 +02:00
Petri TuomolaandMichael Vorburger ⛑️ b58404be41 FINERACT-910: Serving apiDocs as part of the fineract-provider 2020-05-11 19:59:15 +02:00
Michael Vorburger ⛑️andGitHub dec9d21f71 add First Interaction Greeting GitHub Action (#880) 2020-05-11 12:09:57 +01:00
xurrorandMichael Vorburger ⛑️ 2285797eff bump flyway from 2.1.1 to 6.4.1 2020-05-11 12:21:40 +02:00
Michael Vorburger 3226b63383 remove broken dev-dependencies.gradle (until FINERACT-939) 2020-05-10 21:48:05 +02:00
Michael Vorburger 8743fc9743 fix (?) .github/workflows/rebase.yml (FINERACT-829) 2020-05-10 16:20:45 +02:00
Michael Vorburger 47549ae438 add toString() to Notification (to help debug FINERACT-828 next time) 2020-05-10 16:19:09 +02:00
Michael Vorburger 0cc18d7b8c fix obvious bug in Notification setActor()
This method doesn't seem to be used anywhere, so it never mattered.

Eclipse pointed out "The assignment to variable actorId has no effect".

We should not ignore javac/Eclipse compiler warnings! => FINERACT-959
2020-05-10 16:19:09 +02:00
Michael Vorburger d2d013b78f use Java >11.0.2 instead of Java 12 on Travis (FINERACT-937)
by ditching Travis' own sad state of Java (cough) 'support'

and just re-installing it ourselves instead
2020-05-10 15:04:26 +02:00
dependabot-preview[bot]andMichael Vorburger ⛑️ 00b3687f95 Bump checkstyle from 8.28 to 8.32 in /fineract-provider
Bumps [checkstyle](https://github.com/checkstyle/checkstyle) from 8.28 to 8.32.
- [Release notes](https://github.com/checkstyle/checkstyle/releases)
- [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-8.28...checkstyle-8.32)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-10 14:55:17 +02:00
Michael Vorburger b525925b57 bump org.apache.bval.bundle from 2.0.2 to 2.0.3
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-10 14:54:19 +02:00
dependabot-preview[bot]andMichael Vorburger ⛑️ e3d3b5551b Bump gradle-jrebel-plugin from 1.1.2 to 1.1.10 in /fineract-provider
Bumps [gradle-jrebel-plugin](https://github.com/zeroturnaround/gradle-jrebel-plugin) from 1.1.2 to 1.1.10.
- [Release notes](https://github.com/zeroturnaround/gradle-jrebel-plugin/releases)
- [Changelog](https://github.com/zeroturnaround/gradle-jrebel-plugin/blob/master/changelog.txt)
- [Commits](https://github.com/zeroturnaround/gradle-jrebel-plugin/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-10 14:52:15 +02:00
dependabot-preview[bot]andMichael Vorburger ⛑️ e63007c363 Bump classgraph from 4.8.43 to 4.8.78 in /fineract-provider
Bumps [classgraph](https://github.com/classgraph/classgraph) from 4.8.43 to 4.8.78.
- [Release notes](https://github.com/classgraph/classgraph/releases)
- [Commits](https://github.com/classgraph/classgraph/compare/classgraph-4.8.43...classgraph-4.8.78)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-10 14:50:25 +02:00
dependabot-preview[bot]andMichael Vorburger ⛑️ 306ee35b03 Bump bug-pattern from 1.4.2 to 1.5.0 in /fineract-provider
Bumps [bug-pattern](https://github.com/KengoTODA/findbugs-slf4j) from 1.4.2 to 1.5.0.
- [Release notes](https://github.com/KengoTODA/findbugs-slf4j/releases)
- [Changelog](https://github.com/KengoTODA/findbugs-slf4j/blob/master/CHANGELOG.md)
- [Commits](https://github.com/KengoTODA/findbugs-slf4j/compare/findbugs-slf4j-1.4.2...findbugs-slf4j-1.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-10 14:49:51 +02:00
dependabot-preview[bot]andMichael Vorburger ⛑️ bb7df3c9e8 Bump retrofit from 1.6.1 to 1.9.0 in /fineract-provider
Bumps [retrofit](https://github.com/square/retrofit) from 1.6.1 to 1.9.0.
- [Release notes](https://github.com/square/retrofit/releases)
- [Changelog](https://github.com/square/retrofit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/retrofit/compare/parent-1.6.1...parent-1.9.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-10 14:48:37 +02:00
dependabot-preview[bot]andMichael Vorburger ⛑️ 2d0d76fc01 Bump tika-core from 1.9 to 1.24.1 in /fineract-provider
Bumps [tika-core](https://github.com/apache/tika) from 1.9 to 1.24.1.
- [Release notes](https://github.com/apache/tika/releases)
- [Changelog](https://github.com/apache/tika/blob/1.24.1/CHANGES.txt)
- [Commits](https://github.com/apache/tika/commits/1.24.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-10 14:46:55 +02:00
dependabot-preview[bot]andMichael Vorburger ⛑️ ea61519b63 Bump creadur-rat-gradle from 0.2.2 to 0.3.1 in /fineract-provider
Bumps creadur-rat-gradle from 0.2.2 to 0.3.1.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-10 14:44:47 +02:00
dependabot-preview[bot]andMichael Vorburger ⛑️ 6464518179 Bump swagger-jersey-jaxrs from 1.5.15 to 1.6.1 in /fineract-provider
Bumps swagger-jersey-jaxrs from 1.5.15 to 1.6.1.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-10 14:35:08 +02:00
dependabot-preview[bot]andMichael Vorburger ⛑️ a45c2072a0 Bump aws-java-sdk-s3 from 1.11.80 to 1.11.779 in /fineract-provider
Bumps [aws-java-sdk-s3](https://github.com/aws/aws-sdk-java) from 1.11.80 to 1.11.779.
- [Release notes](https://github.com/aws/aws-sdk-java/releases)
- [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-java/compare/1.11.80...1.11.779)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-10 13:43:49 +02:00
Michael Vorburger 55af726cf9 improve SchedulerJobsTest.testDateFormat() by introducing Awaitility
This recently introduced new test (FINERACT-926) would locally pass, but
then fail on the next run, because another test in the same class would
modify job state to be inactive.  It now sets the first jobs state as it
requires it to be, and properly awaits the expected outcome.
2020-05-09 17:05:32 +02:00
Petri TuomolaandMichael Vorburger ⛑️ f3b3ebc58c Upgrading Travis distro and MySQL 2020-05-09 13:38:18 +02:00
Michael Vorburger e122f1ffd3 fix bug causing NullPointerException in SavingsAccount (FINERACT-957) 2020-05-09 13:31:39 +02:00
Michael Vorburger 27d754529e bulk replace org.apache.commons.lang with lang3 imports (FINERACT-954)
We apparently currently have both on the classpath, but really nowadays
should have, and can, only use lang3 with this minor clean up.
2020-05-09 05:48:31 +02:00
Michael Vorburger 6a8f48c06c remove fixed Slfj4j versions to fix broken logging (FINERACT-956) 2020-05-09 05:48:15 +02:00
Michael Vorburger fa74e77e7e clean up dependencies.gradle and clarify scopes (FINERACT-777)
This also solves this Gradle messages:  Deprecated Gradle features were
used in this build, making it incompatible with Gradle 7.0. Use
'--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.4/userguide/command_line_interface.html#sec:command_line_warnings
2020-05-09 05:47:13 +02:00
Michael Vorburger 6c3598535b upgrade Gradle (wrapper) from 6.1 to 6.4 (FINERACT-945) 2020-05-09 00:05:10 +02:00
Michael Vorburger ff1c15d263 rm application.properties from Git, and .gitignore it (because we copy it during build) 2020-05-09 00:03:57 +02:00
Michael Vorburger f6c7bf970b ignore yet another :( RecurringDepositTest (FINERACT-855)
testRecurringDepositAccountWithClosureTypeTransferToSavings_WITH_HOLD_TAX
2020-05-09 00:03:50 +02:00
Michael Vorburger 4ade89d57d add integration test for (new) ISO-8601 Date Format (FINERACT-926)
using SchedulerJobsTest, just because that's convenient
2020-05-08 23:29:38 +02:00
Michael Vorburger 3ac7c29e51 clean up CommandHandlerProviderTest 2020-05-08 23:04:08 +02:00
Michael Vorburger 29d64d3cb0 remove org.gradle.daemon (FINERACT-948) 2020-05-08 22:41:14 +02:00
Michael Vorburger ⛑️ c6b5b2776b add "Instructions to build the JAR file" to README 2020-05-08 22:02:16 +02:00
Michael Vorburger ⛑️andGitHub bee3fb7ce5 add java.util.Date ISO-8601 GSON type adapter (FINERACT-926) (#816)
* minor clean-up in existing JsonSerializer implementations (FINERACT-926)

* centralize registration of GSON type adapters (FINERACT-926)

* add java.util.Date ISO-8601 GSON type adapter (FINERACT-926)
2020-05-08 19:56:19 +01:00
Michael Vorburger ⛑️ f049892600 clarify Docker Compose UI self-signed SSL certificate
as suggested by Scott Dunbar on dev list
2020-05-08 20:31:12 +02:00
Michael Vorburger 6b1878a1d8 ignore one flaky FixedDepositTest (FINERACT-950)
testFixedDepositAccountClosureTypeWithdrawal_WITH_HOLD_TAX()
2020-05-08 20:30:25 +02:00
Michael Vorburger 077065c1b5 fix generic warnings in StaffTest (re. FINERACT-949) 2020-05-08 20:24:31 +02:00
Michael Vorburger ⛑️andGitHub 22224709b6 upgrade Spotbugs plugin from 2.0.1 to latest 4.0.8 (FINERACT-947) (#841) 2020-05-08 19:15:19 +01:00
Michael Vorburger ⛑️andGitHub d2a0493be4 add server.forward-headers-strategy=framework (FINERACT-914) (#798) 2020-05-08 18:47:53 +01:00
Michael Vorburger ⛑️andGitHub e2d076f15e ignore another flaky test in SchedulerJobsTestResults (FINERACT-857) (#839)
testUpdateLoanArrearsAgingJobOutcome()
2020-05-08 18:18:26 +01:00
Michael Vorburger ⛑️andGitHub 1263a00691 change Oracle to OpenJDK in README (#836) 2020-05-08 18:17:21 +01:00
Michael Vorburger bbadeb9591 add Gradle Wrapper Validation GitHub Action (FINERACT-946)
see https://github.com/marketplace/actions/gradle-wrapper-validation
2020-05-08 18:07:22 +02:00
Michael Vorburger ea85f9c739 clean up XBRLBuilderTest (re. FINERACT-940) 2020-05-08 17:04:43 +02:00
Michael Vorburger 69a7b1e8da add junit-platform-runner dependency (FINERACT-943) 2020-05-08 16:59:52 +02:00
Michael Vorburger 9254a74bb5 upgrade Spring Boot from 2.2.4 to 2.2.7 (FINERACT-941) 2020-05-08 16:16:56 +02:00
Petri TuomolaandMichael Vorburger ⛑️ ec9ef92ff6 FINERACT-938: Upgrading nekohtml and removing direct reference to Xerces 2020-05-08 12:33:25 +02:00
Petri TuomolaandMichael Vorburger ⛑️ 0e4aeef1af FINERACT-846: Migrating to Java 11, upgrading dependencies, fixing compiler warnings 2020-05-07 22:28:19 +02:00
Courage AngehandGitHub 7ace5d47b2 Merge pull request #826 from vorburger/gitignore-keystore.jks
add keystore.jks to .gitignore
2020-05-05 18:54:36 -04:00
Michael Vorburger bb4f1ac29a add keystore.jks to .gitignore
This file is created by the Tomcat embedded by Spring Boot
when running "java -jar build/libs/fineract-provider.jar",
having it on .gitignore avoids anyone commiting it by mistake.
2020-05-05 22:50:23 +02:00
Sidney WasibaniandGitHub a855d3a9cc re-use styles so that Excel's 4k row limit isn't exceeded (FINERACT-930) 2020-05-05 22:30:25 +02:00
Petri TuomolaandMichael Vorburger ⛑️ b05162f60b FINERACT-730: Fixed dependencies, SSL config and main class etc to get bootRun to work. Migrated from Gradle Tomcat plugin to Cargo plugin to fix integration test 2020-05-05 22:04:04 +02:00
Michael Vorburger cb690f6d5b ignore three more flaky tests in SchedulerJobsTestResults (FINERACT-857)
testInterestTransferForSavings()
testExecuteStandingInstructionsJobOutcome()
testAvoidUnncessaryPenaltyWhenAmountZeroForOverdueLoansJobOutcome()
2020-05-05 20:13:11 +02:00
rrpawar96andMichael Vorburger ⛑️ 489faf96b0 GLIM_GSIM enhancement (FINERACT-603) 2020-05-05 12:43:40 +02:00
Michael Vorburger edfcb931e9 Gradle testLogging exceptionFormat "full" (FINERACT-927)
as well as integrationTest --fail-fast
2020-05-05 10:52:02 +02:00
Michael Vorburger b6c6d50501 fix moar 3rd-party versions in build.gradle (see FINERACT-805) 2020-05-04 03:00:31 +02:00
Michael Vorburger ⛑️andGitHub d33e0ba72a add new /echo debug API endpoint (FINERACT-915) (#797) 2020-05-03 22:34:37 +01:00
Michael Vorburger c4797ab96b more clean up in SchedulerJobsTest (re. FINERACT-922)
This does NOT, yet, fix FINERACT-922, but it splits the old test into
new smaller test methods, which (hopefully) should always pass, except
for the last one.
2020-05-03 20:22:54 +02:00
Michael Vorburger 404f055b65 remove old spring-jms:4.0.7 & fix JMS dependencies (FINERACT-805) 2020-05-03 19:52:12 +02:00
Michael Vorburger 83cdb17d8f exclude dependencies causing classpath duplicates (FINERACT-919) 2020-05-03 19:52:12 +02:00
Michael Vorburger.ch b0367099bc add classpath duplicates detection test (FINERACT-919) 2020-05-03 19:52:12 +02:00
Michael Vorburger 2212675af4 second step to clean up in SchedulerJobsTest (re. FINERACT-922)
do more un-static-ify SchedulerJobHelper

This does NOT, yet, fix FINERACT-922.
2020-05-03 19:49:27 +02:00
Michael Vorburger 85bf8dc3e9 first step to clean up in SchedulerJobsTest (preparing for FINERACT-922)
make two methods in SchedulerJobHelper private

and start to un-static-ify SchedulerJobHelper

This does NOT, yet, fix FINERACT-922.
2020-05-03 19:49:27 +02:00
Saransh SharmaandMichael Vorburger ⛑️ 90dec19201 FINERACT-925 2020-05-03 18:41:10 +02:00
Saransh SharmaandMichael Vorburger ⛑️ cb0624c073 FINERACT-924 2020-05-03 18:41:10 +02:00
Saransh SharmaandMichael Vorburger ⛑️ c0ac209ed2 FINERACT-923 2020-05-03 18:41:10 +02:00
Michael Vorburger ⛑️ 62214ea1f7 add (obvious) rebase step to PR Help in README 2020-05-03 12:23:11 +02:00
Michael Vorburger 1e2e88c8bb add @Ignore to another SchedulerJobsTestResults method (FINERACT-857)
testUpdateOverdueDaysForNPA()
2020-05-03 05:52:06 +02:00
Michael Vorburger c9f2591766 Upgrade Jersey library from 1.17 to 1.19.4 (FINERACT-920) 2020-05-03 03:12:15 +02:00
Michael Vorburger 7fe9d2bcbf use throw instead of confusing return null inside catch
in JournalEntryWritePlatformServiceJpaRepositoryImpl
2020-05-03 00:07:49 +02:00
Michael Vorburger 8418dd424f upgrade OpenJPA from 3.1.0 to 3.1.1 (FINERACT-908) 2020-05-02 22:42:10 +02:00
Michael Vorburger 1baecf27f6 add @Ignore to another SchedulerJobsTestResults methods (FINERACT-857)
testUpdateLoanPaidInAdvanceJobOutcome()
2020-05-02 22:39:58 +02:00
Michael Vorburger 89fdc804f0 add @Ignore to more SchedulerJobsTestResults methods (FINERACT-857)
testUpdateAccountingRunningBalancesJobOutcome()
testTransferFeeForLoansFromSavingsJobOutcome()
2020-05-02 20:55:00 +02:00
Michael Vorburger c579086af0 change community-app port in docker compose from 80 to 9090 (FINERACT-845)
This makes it much easier and more secure to use it "rootless",
e.g. with https://podman.io's podman-compose instead (Moby) Docker.

Also includes minor README improvements useful for beginners.
2020-05-02 14:17:58 +02:00
rrpawar96andMichael Vorburger ⛑️ 9cd459273c add @ignore to SchedulerJobsTestResults.testInterestPostingForSavingsJobOutcome 2020-05-02 14:16:18 +02:00
Michael Vorburger 6e91a091f3 add @Ignore to another SchedulerJobsTestResults methods (FINERACT-857)
testApplyDueFeeChargesForSavingsJobOutcome()
2020-05-02 12:22:36 +02:00
xurrorandMichael Vorburger ⛑️ 9184f5975f FINERACT-845
Integrate community-app in fineract docker build
2020-05-02 12:21:31 +02:00
Michael Vorburger ede38dc8fa add @Ignore to another ClientLoanIntegrationTest method (FINERACT-885)
loanWithFlatCahargesAndPeriodicAccrualAccountingEnabled()
2020-04-26 18:41:27 +02:00
Michael Vorburger ⛑️ d3aebf570e add link to Web UIs, Mobile App, and fineract.dev 2020-04-26 17:26:13 +02:00
Michael Vorburger ⛑️ 09fd882c72 add Policy re. unstable tests to README 2020-04-26 16:59:28 +02:00
Michael Vorburger 348d5bc855 add @Ignore to more ClientLoanIntegrationTest methods (FINERACT-885)
loanWithCahargesOfTypeAmountPercentageAndPeriodicAccrualAccountingEnabled()
loanWithCahargesOfTypeAmountPlusInterestPercentageAndPeriodicAccrualAccountingEnabled()
2020-04-26 16:55:56 +02:00
Michael Vorburger a1815c1b51 add @Ignore in AccountingScenarioIntegrationTest (FINERACT-899)
checkPeriodicAccrualAccountingFlow()
2020-04-26 16:55:56 +02:00
xurrorandMichael Vorburger ⛑️ 394a7fb1d1 IntegrationTests for git build info 2020-04-26 16:47:27 +02:00
xurrorandMichael Vorburger ⛑️ 0a80195ac2 Fix rat reports 2020-04-26 16:47:27 +02:00
xurrorandMichael Vorburger ⛑️ c317db110f FINERACT-883
Display fineracts git build info actuator/info endpoint
2020-04-26 16:47:27 +02:00
Michael Vorburger 4b724c2917 add @Ignore to flaky method in ClientLoanIntegrationTest (FINERACT-885)
testLoanScheduleWithInterestRecalculation_WITH_REST_DAILY_INTEREST_COMPOUND_INTEREST_FEE_STRATEGY_WITH_OVERDUE_CHARGE()
2020-04-26 12:51:27 +02:00
thesmallstarandMichael Vorburger ⛑️ c62328756b FINERACT-111 Do not update charges amount paid if loan transaction is accruals 2020-04-26 12:32:32 +02:00
Michael Vorburger ⛑️andGitHub fd9a1ba1be add @Ignore to flaky method in RecurringDepositTest (FINERACT-855) (#783)
testRecurringDepositAccountWithPrematureClosureTypeReinvest()
2020-04-26 11:12:13 +01:00
Nikhil PawarandMichael Vorburger ⛑️ d9d44383c0 Refactoring guideline added to README.md 2020-04-26 11:11:28 +02:00
Josue AraujoandMichael Vorburger ⛑️ 78ca45ef27 * Added missing grouping keywords from https://github.com/apache/fineract/pull/757 2020-04-22 17:17:27 +02:00
Michael Vorburger ⛑️andGitHub d59ed17d97 replace long outdated '0.4.0-incubating' in API Docs by simply 'Fineract' (#776) 2020-04-22 09:55:54 +01:00
xurrorandMichael Vorburger ⛑️ dd1ec2f356 Clean up on #772 2020-04-19 14:15:21 +02:00
xurrorandMichael Vorburger ⛑️ 8b92b38886 FINERACT-881
Remove hard-coded default passwords
2020-04-19 12:18:49 +02:00
Michael Vorburger 212cd679e9 Ignore :( flaky :( AccountingScenarioIntegrationTest (FINERACT-899)
both checkPeriodicAccrualAccountingFlow_OVER_PAYMENT()
as well as checkPeriodicAccrualAccountingTillCurrentDateFlow()
but not the others
2020-04-18 23:07:24 +02:00
percyashuandMichael Vorburger ⛑️ 83899c2fb0 FINERACT-826 Remove unused getTimeZone 2020-04-18 17:37:46 +02:00
Michael Vorburger ⛑️andGitHub 005cc2129a remove JAVA_OPTS from docker-compose.yml (FINERACT-900) (#773) 2020-04-18 06:26:45 +01:00
thesmallstarandMichael Vorburger ⛑️ dd2e934cb1 Added One Statement per line and Enforced checkstyle 2020-04-18 03:23:54 +02:00
Michael Vorburger 1c74398d90 add MySQL JDBC Driver (LGPL) to Dockerfile + doc (fixes FINERACT-762)
Note that it is NOT enabled by default, which should be OK for the ASF.

The main point here is just to clearly document it for end-users.

I've obviously tried out what's documented, and can confirm it works.
2020-04-18 01:46:56 +02:00
Michael Vorburger 64e02bc123 comment out broken MySQL JDBC driver logger (awaiting FINERACT-890) 2020-04-18 01:46:56 +02:00
Michael Vorburger ⛑️andGitHub c7b58b9869 escape all grouping in SQL files for MySQL 8 compatibility (#757)
Indirectly related to FINERACT-762 - not sure if strictly required,
but seems like a good idea anyway at this opportunity, so why not.

As originally on https://github.com/apache/fineract/pull/638/files
2020-04-17 22:40:42 +01:00
Michael Vorburger 059d1bebe7 comment out flaky testSavingsAccount_DormancyTracking (FINERACT-852) 2020-04-17 19:37:28 +02:00
Michael Vorburger a5b35b8d31 clean-up to remove apparently unused PORT ENV (related to FINERACT-762)
This environment variable is actually never used.  The port of a Tenant
DB instead appears to be read from schemaServerPort of the
tenant_server_connections table.
2020-04-17 19:09:24 +02:00
Michael Vorburger f1c7a7b4bc add DRIVERCLASS_NAME, PROTOCOL, SUB_PROTOCOL to docker-compose.yml
These are the default values, from jdbc.properties, only added for
clarity and to make it obvious that they need to be changed e.g. for
FINERACT-762.

The different formats and naming conventions are a little bit of a mess,
but changing them now leads to backwards incompatibility, so for now
let's leave as is; possible clean up later in FINERACT-889.
2020-04-15 17:58:36 +02:00
Michael Vorburger 519dd204d8 set fineract_tenants_* more nicely in docker-compose.yml
We can use environment variables instead of system properties.

We originally had to use system properties and could not use environment
variables, because these used to read by Tomcat, but since the switch
to Hikari in FINERACT-796 these are read by Spring Boot instead of
Tomcat, so we can now use system properties.

This both "looks nicer" and is useful e.g. for FINERACT-881.
2020-04-15 17:58:36 +02:00
Michael Vorburger ⛑️andGitHub 9517051340 comment out flaky SchedulerJobsTest (FINERACT-852) (#764)
Also adds a new assertion for a clearer failure message than the
confusing low-level technical ArrayIndexOutOfBoundsException for
whenever this test will be re-activated later.
2020-04-15 10:36:46 +01:00
Michael Vorburger ⛑️andGitHub fd7fa63002 improve ClientSavingsIntegrationTest error reporting (FINERACT-852) (#765)
Adds a new assertion for a hopefully clearer failure message than the
confusing low-level technical ArrayIndexOutOfBoundsException we
regularly hit on Travis CI.

Similar to https://github.com/apache/fineract/pull/764
2020-04-15 09:34:33 +01:00
26b619eea7 FINERACT-809 (#719) : Upgrade RestAssured version
Upgrade RestAssured version

closes https://issues.apache.org/jira/browse/FINERACT-809

Co-authored-by: percyashu <percyayukashu@gmail.com>

Co-authored-by: percyashu <percyayukashu@gmail.com>
2020-04-12 20:36:15 +01:00
Michael Vorburger c9a1b38b0e chmod +x kubernetes/*.sh (and some README updates) 2020-04-12 13:37:47 +02:00
xurrorandMichael Vorburger ⛑️ a9c2140463 Setup configMap and startup and shutdown scripts 2020-04-12 11:06:38 +02:00
xurrorandMichael Vorburger ⛑️ 472f5b6280 FINERACT-783
- Update README.md with instructions for kubernetes
 - Setup fineractmysql configuration file
 - Setup fineract-server configuration file
closes https://issues.apache.org/jira/browse/FINERACT-783
2020-04-12 11:06:38 +02:00
thesmallstarandMichael Vorburger ⛑️ beee2e5330 Fixed: Checkstyle Violations 2020-04-07 23:46:20 +02:00
Michael Vorburger 09d0cfaa52 Remove AbstractPersistableCustom's PK parameterization
Because both are pointless, as the PK @Id is hard-coded to Long anyway,
and the U is (rightfully) fixed to always be an AppUser here.
2020-04-07 23:46:20 +02:00
Michael Vorburger dccea1d65e add @Transient to AbstractPersistableCustom isNew()
see https://jira.spring.io/browse/DATAJPA-622

Even though we don't use Hibernate, copying this annotation from the
original class in Spring Data seems prudent - just in case.  It should
not cause any harm or side effects on OpenJPA.
2020-04-07 23:46:20 +02:00
Michael Vorburger ae4117052b add missing doc to AbstractPersistableCustom & AbstractAuditableCustom 2020-04-07 23:46:20 +02:00
NatashaandMichael Vorburger ⛑️ d0c8c6a012 FINERACT-538 populated updated and created address 2020-04-07 23:15:25 +02:00
NatashaandMichael Vorburger ⛑️ eb8a3572ae FINERACT-122 added clientId, officeId, and groupId. 2020-04-07 23:11:48 +02:00
Manthan SurkarandMichael Vorburger ⛑️ 110684bf30 Added: IntelliJ Checkstyle plugin tip to README 2020-04-07 10:08:03 +02:00
Michael Vorburger ⛑️andGitHub a0a82a0748 add link to Release Process page on Wiki to README 2020-04-06 12:03:11 +02:00
Manthan SurkarandGitHub 402c41dd95 Add Jacoco to measure code coverage (FINERACT-725 / PR #742)
* Added Code Coverage Section in Readme
2020-04-01 23:29:15 +02:00
Michael Vorburger ⛑️ 4ccbcba3a6 add Eclipse Checkstyle plugin tip to README 2020-03-29 13:13:29 +02:00
Michael Vorburger 53e8658d74 apply Hikari's recommended MySQL Configuration (FINERACT-796)
from https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration
and https://github.com/brettwooldridge/HikariCP/wiki/JDBC-Logging#mysql-connectorj
2020-03-28 17:58:39 +01:00
Michael Vorburger 5f2ba51f5a Minor clean ups in DataSource Connection Pool related code 2020-03-28 17:58:39 +01:00
Michael Vorburger 99794914a5 Fix wrong @OneToOne to @ManyToOne in AbstractAuditableCustom 2020-03-28 15:07:28 +01:00
xurrorandMichael Vorburger ⛑️ 3475c0cfb7 FINERACT-796
Use Hikari instead of Tomcat Connection Pool
 - Created hikari connection pool bean
 - Configured connection parameters to match hikari
 - Removed tomcat-jdbc and dbcp
 - Remove unused classes
 - Add Hikari to logback
 - update hikaridatasource bean

closes https://issues.apache.org/jira/browse/FINERACT-796

remove hikaricp import from gradle files

more specific bean config

- Set up datasource properties
- Cleanup unused classes
- Add hikari to logback
2020-03-28 15:06:34 +01:00
percyashuandMichael Vorburger ⛑️ 2e620b4de8 FINERACT-823 Gradle modernizer fixing violations 2020-03-23 00:54:00 +01:00
percyashuandMichael Vorburger ⛑️ ef5bba4d52 Minor Typo fix 2020-03-17 20:53:02 +01:00
thesmallstarandMichael Vorburger ⛑️ 3f11dc51a9 Fix: Duplicate migration version 2020-03-15 11:05:30 +01:00
Michael Vorburger b1eb62f221 fix broken build due to small logging error detected by SpotBugs
significant reformatting due to Eclipse auto-save action (someone really
needs to finish the Checkstyle uniform formatting)

see https://github.com/apache/fineract/pull/592
2020-03-15 11:05:30 +01:00
Angel CajasandMichael Vorburger ⛑️ b9b265b915 Fineract-614
Changes to comply with Checkstyle rules
2020-03-13 17:15:25 +01:00
Angel CajasandMichael Vorburger ⛑️ 8df44af628 Fineract-614:
Updating Global Configurations
Fixing some rebase conflicts
Change to imports on IntegrationTest for CheckStyle
2020-03-13 17:15:25 +01:00
Angel CajasandMichael Vorburger ⛑️ 15a4a7695a Fineract-614:
Updating Global Configurations
Fixing some rebase conflicts
2020-03-13 17:15:25 +01:00
Angel CajasandMichael Vorburger ⛑️ 3a1a90d15e Fineract-614: Renaming SQL file for a higher version number 2020-03-13 17:15:25 +01:00
Angel CajasandMichael Vorburger ⛑️ e2f5c95034 Fixing some code to be compatible with Spring update 2020-03-13 17:15:25 +01:00
Angel CajasandMichael Vorburger ⛑️ c342f5b43d FINERACT-737: Updated Api Docs to include loan charges paid by
FINERACT-736: Api Docs were updated to include rates documentation
FINERACT-735: Integration test were created for rates creation, retrieval and update

Missing permission READ_RATE
2020-03-13 17:15:25 +01:00
Angel CajasandMichael Vorburger ⛑️ a7d4c83e92 A new rates module was added to define new rates that can be used to set min and max nominal interest rate, when a new loan account is created they can be used to determine which rates may be applicable for the loan account. 2020-03-13 17:15:25 +01:00
xurrorandMichael Vorburger ⛑️ f484f884a0 FINERACT-696
add spotbug bug-pattern plugin.

Apply suggestions from code review

closes https://issues.apache.org/jira/browse/FINERACT-696

Co-Authored-By: Michael Vorburger ⛑️ <mike@vorburger.ch>
2020-03-13 09:27:34 +01:00
thesmallstarandMichael Vorburger ⛑️ de329e2489 FINERACT-83 Made interestIncome variable null-safe 2020-03-12 12:57:18 +01:00
thesmallstarandMichael Vorburger ⛑️ 93d1716630 Added: SQL builder toString function 2020-03-12 12:54:46 +01:00
Michael Vorburger 1b1e80b6b1 Log errors from cron jobs individually and with cause (FINERACT-858)
instead of current huge JobExecutionException message (without cause)
2020-03-10 17:10:01 +01:00
Michael Vorburger ⛑️andGitHub 0c9273a11b throw exception with details in InteropServiceImpl (FINERACT-860) (#728)
instead of the NoSuchElementException from Optional.get(), we're now
throwing an UnsupportedOperationException which includes the details of
the missing object.  (This kind of detailed exception was already thrown
in two existing places in the same code after a null check, but it never
reached there, because the Optional.get() failed earlier.  Another
option would have been to return null for an absent Optional, but this
is better.)

The other unrelated changes are automatic clean up actions (in Eclipse).
2020-03-10 12:29:07 +01:00
thesmallstarandMichael Vorburger ⛑️ a34742b59a Made SQL builder ColumnName regex more general 2020-03-10 11:36:49 +01:00
Michael Vorburger 753554e281 Fix audit trails filter (FINERACT-808)
As per the great analysis by Manthan Surkar (@thesmallstar) in the
original PR https://github.com/apache/fineract/pull/723, the cause of
the FINERACT-808 bug was that "the backend would treat "UPDATE" and
similar strings as SQL injection".

The root cause of that was that (IMHO..) how Fineract does SQL injection
is more of a workaround (blacklisting some keywords and some heuristic
checks) then how this really should be done (by using JDBC Prepared
statements with arguments for all external data, instead inlined SQL).

This also lays the foundation for more like this in FINERACT-854.
2020-03-10 11:36:49 +01:00
xurrorandMichael Vorburger ⛑️ a7ebef4781 FINERACT-807
change mifosplatform-tenants and mifostenant-default to fineract_tenants
 and fineract_default respectively

closes https://issues.apache.org/jira/projects/FINERACT/issues/FINERACT-807?filter=allopenissues
2020-03-08 14:16:05 +01:00
Awasum YannickandMichael Vorburger ⛑️ 51f23613ad Fix checkstyle problem in UserAdministrationTest 2020-03-05 15:19:38 +01:00
Awasum YannickandGitHub d4002f22a8 FINERACT-802-restrict-client-to-have-single-self-service-user (#664) 2020-03-05 09:40:13 +01:00
Manthan SurkarandGitHub 867579d321 FINERACT-557: Readme Improvement (#718) 2020-03-02 21:01:01 +01:00
Manthan SurkarandGitHub 49c3450bed FINERACT-80: Include Group loans in resultset (#717) 2020-03-02 20:57:35 +01:00
228ec22a60 Allow customizing Tenants DB JDBC uid/pwd/driver (FINERACT-806) (#713)
* Allow customizing Tenants DB JDBC uid/pwd/driver (FINERACT-806)

Added Java system properties for username and password to docker-compose

Modified sever.xml to get username and password

* Fixes for customizing Tenants DB JDBC uid/pwd/driver (FINERACT-806)

* Use random MYSQL_ROOT_PASSWORD in docker-compose.yml (FINERACT-806)

This provides future non-regression testing that the the customized
MySQL password is actually really used, and it doesn't just work because
"mysql" is still hard-coded anywhere.

Co-authored-by: Yemdjih Kaze Nasser <kaze.nasser@outlook.com>
2020-02-09 19:36:58 +01:00
Michael Vorburger ⛑️andGitHub c6b2c09032 COPY only the minimal required files to build in the Dockerfile (#712)
This speeds up e.g. "podman-compose build" for me from 5m to 4m.

BEFORE:
real	5m29.884s
user	4m17.643s
sys	    2m57.567s

AFTER:
real	4m19.458s
user	3m13.815s
sys	    2m 3.095s
2020-02-09 19:35:27 +01:00
xurrorandMichael Vorburger ⛑️ 78eb402206 FINERACT-840
Update API docs and demo app URL
2020-02-06 18:26:47 -08:00
Tomer MosheandGitHub 45978337b2 Fixed openjpa.persistence.InvalidStateException (#711)
* Update AbstractPersistableCustom.java

Made AbstractPersistableCustom serializable to solve org.apache.openjpa.persistence.InvalidStateException

* Update AbstractPersistableCustom.java

removed space
2020-02-06 08:20:42 +01:00
percyashuandMichael Vorburger ⛑️ aadc2a006c FINERACT-775 Clean up Util 2020-02-02 11:36:53 +01:00
Yemdjih Kaze NasserandGitHub 7919a35a6b Update links for demo app and API documentation (#705) 2020-01-31 16:31:55 +01:00
percyashuandMichael Vorburger ⛑️ 7d99d783d5 FINERACT-776 Fix TopicTest failure 2020-01-30 20:24:40 +01:00
Michael Vorburger ⛑️andAwasum Yannick 28db242884 Activate and Enforce new Checkstyle check related to import statement order (FINERACT-821) (#704)
* Minor manually done fix up of fineractdev-eclipse-preferences.epf file

This in theory should not change anything about the conventions,
it's just a first manual clean up of this very old file here.

The few extra new lines are what I found when exporting Preferences.

Related to https://issues.apache.org/jira/browse/FINERACT-821

* fineractdev-eclipse-preferences.epf imported and re-exported in Eclipse.

This in theory should not change anything about the conventions, as
presumably Eclipse during an Import and re-Export of an EPF just adds
new settings, and perhaps removes old settings.  I've not actually made
any manual changes in Preferences in this step.

Related to https://issues.apache.org/jira/browse/FINERACT-821

* fineractdev-eclipse-preferences.epf "import" in line with Checkstyle

The non-import related Code Formatter settings may need further tuning;
this will be done in future changes; the focus in this round is on
import.

Related to https://issues.apache.org/jira/browse/FINERACT-821

* Use Eclipse's Source > Organize Import to re-order all import statements

This uses the fineractdev-eclipse-preferences.epf from the previous
commit, which just so happens ;) to exactly match the expected import
rules which the next commit is going to enforce using Checkstyle.

This is of course not specific to only Eclipse per se; other IDEs can
be similarly configured to match these coding conventions; I just happen
to have used Eclipse.

Related to https://issues.apache.org/jira/browse/FINERACT-821

* Activate and Enforce all Checkstyle import related new checks

and update the README to explain Checkstyle, and the availability of the
Eclipse Preferences configuration file which matches the import
code format conventions which are now enforced.

Contributions for a similar preferences file for other IDEs welcome! ;)

Related to https://issues.apache.org/jira/browse/FINERACT-821
2020-01-28 00:28:11 +01:00
Michael Vorburger ⛑️andAwasum Yannick 3a17da44df Activate and Enforce Checkstyle EqualsHashCode check. (#703)
Thanks to prior work for SpotBugs, this passes without requiring any
code adjustments.  (Fineract had a nubmer of problems in this space
before the SpotBugs work.)

Enabling this helps to ensure non-regression so that no new equals() and
hashCode() related bugs creep in.  (This does overlap a little bit with
SpotBugs, but the build time overhead to run the extra check is
completely negligible, so it seems worth having this.  If only just in
case SpotBugs for whatever reason in the future would get deactivated
again.)
2020-01-27 22:02:41 +01:00
Michael Vorburger ⛑️andAwasum Yannick 14175a1854 Minor: Remove comment in build.gradle re. springDataJpaVersion (#702)
This has been removed in a20f76d686,
and it's confusing to look for what that means, e.g. while code
reviewing proposed "bump" changes to the used versions of
spring.gradle:dependency-management-plugin and
springframework.boot:spring-boot-gradle-plugin.
2020-01-27 22:00:28 +01:00
Awasum YannickandMichael Vorburger ⛑️ 66ae79bbe7 Upgrade Spring Boot from 2.1.7 to 2.2.4 2020-01-27 21:05:29 +01:00
Angel CajasandMichael Vorburger ⛑️ 5c19ed9385 FINERACT-820: Add a new condition so the Java Calendar Sunday value matches witch Fineract 2020-01-27 08:09:54 +01:00
Shaik Nazeer Hussain 1848056e6f Revert "FINERACT-820 - Fixing Integration Test which fails on Sundays"
This reverts commit e9e0bbc930.
2020-01-26 17:43:15 +05:30
Awasum YannickandMichael Vorburger ⛑️ 7774766245 Update Gradle version from 5.6.1 to 6.1 2020-01-26 10:19:55 +01:00
Shaik Nazeer Hussain e9e0bbc930 FINERACT-820 - Fixing Integration Test which fails on Sundays 2020-01-25 12:18:59 +05:30
Awasum YannickandGitHub 1c7bea6fe0 Merge pull request #697 from apache/vorburger-README-link-mailinglist
Add link to mailing list to README
2020-01-23 20:49:32 +01:00
Michael Vorburger ⛑️andGitHub 216566fcc1 Add link to mailing list to README 2020-01-23 19:55:11 +01:00
Awasum YannickandGitHub dfcad321d8 Merge pull request #696 from adamsaghy/bugfix/loanproductdata
FINERACT-839: NPE when creating a Loan for a client fix
2020-01-23 16:32:13 +01:00
Adam Saghy e1666ba8fc FINERACT-839: NPE when creating a Loan for a client fix 2020-01-23 15:10:28 +01:00
Awasum YannickandGitHub 3790fdbb99 Merge pull request #689 from vorburger/checkstyle1
introduce Checkstyle, start enforcing whitespace related rules (FINERACT-821)
2020-01-22 08:15:32 +01:00
Michael Vorburger fbccc57fb9 enforce initial set of Checkstyle rules (FINERACT-821)
This is, intentionally, for whitespace related rules, only.

The idea is to now gradually extend it.
2020-01-19 19:59:38 +01:00
Michael Vorburger dd7503f296 remove all trailing spaces in Java files (FINERACT-821)
find . -type f -name "*.java" -exec sed -i 's/ *$//' '{}' ';'
2020-01-19 19:58:21 +01:00
Michael Vorburger b0196049f1 replace 51013 Tabs with 4 Spaces in 3122 Java files (FINERACT-821)
rpl -eRxjava "\t" "    " .
2020-01-19 19:58:21 +01:00
Michael Vorburger 68006ae8f2 convert all Java files from DOS to UNIX line ending (FINERACT-821)
find . -type f -name "*.java" -exec dos2unix '{}' ';'
2020-01-19 19:58:21 +01:00
Michael Vorburger 125924303b Temporarily remove the build realted Swagger changes (FINERACT-733)
as well as implement all review feedback provided on the original PR

see https://github.com/apache/fineract/pull/629 for background

also https://jira.apache.org/jira/browse/FINERACT-733
2020-01-19 15:24:11 +01:00
Kang BrederandMichael Vorburger ⛑️ e424471162 Initial Swagger related changes from GSOC 2019 contrib (FINERACT-733)
This commit does not yet provide the full Swagger requirement, as was
outlined in FINERACT-733, but it's a first step forming the basis of
more to come (hopefully).  Here's the original PR description (but
note that some of this is about to be reverted in the next commit):


Reflected all API descriptions on swagger UI.

Formatted API descriptions.

Added swagger docs for new APIs.

Added swagger-gradle-plugin for automatic save of json during build.

Leveraged swagger codegen for generation of language-specific libraries
using gradle-swagger-generator plugin.
2020-01-19 15:24:11 +01:00
Michael Vorburger b0dce97b82 fix broken Dockerfile build (FINERACT-833) 2020-01-19 14:25:19 +01:00
Michael Vorburger ⛑️andGitHub 091710e8dd Minor typo fix in rebase.yml (FINERACT-829)
porting https://github.com/cirrus-actions/rebase/pull/31

https://issues.apache.org/jira/browse/FINERACT-829
2020-01-14 09:40:16 +01:00
Michael Vorburger ⛑️andMichael Vorburger ⛑️ 653b0b76dd add /rebase comment support for Pull Requests
https://github.com/marketplace/actions/automatic-rebase

https://github.com/cirrus-actions/rebase
2020-01-14 08:40:10 +01:00
Awasum YannickandGitHub eee163aece Merge pull request #685 from vorburger/spotbugs-extra-GLAccountBuilder
clean up GLAccountBuilder, following SpotBugs (FINERACT-702)
2020-01-14 08:37:58 +01:00
Awasum YannickandGitHub fc786fa3f6 Merge pull request #684 from vorburger/spotbugs-extra
more SpotBugs related / inspired code clean up (see FINERACT-702)
2020-01-14 08:37:20 +01:00
Angel CajasandMichael Vorburger ⛑️ efb0a558c8 FINERACT-824:
Removed the second validation since realCause.getCause() is null if it is equal to realCause
2020-01-14 08:28:43 +01:00
Michael Vorburger ⛑️andMichael Vorburger ⛑️ 54b7ddf210 add GitHub Action to autoclose stale pull requests
It will automatically add a comment after 30 days, and then another 30 days later (so after a total of 60 days of inactivity) automatically close Pull Requests.

https://github.com/marketplace/actions/close-stale-issues
https://github.com/actions/stale/blob/master/action.yml
https://github.com/actions/stale
2020-01-14 08:26:49 +01:00
Michael Vorburger 0379ba7628 fix build.gradle for RAT to ignore .github/workflows/ 2020-01-13 09:53:24 +01:00
Michael Vorburger 6ca1a678cb more SpotBugs related / inspired code clean up (see FINERACT-702)
based upon code review of changes made by @awasum in previous commit:

 - fix clear contains() GC_UNRELATED_TYPES bug in Loan

 - fix clear equals() EC_UNRELATED_TYPES bug in Loan

 - fix more equals() & hashCode() in...
    * Charge
    * TrialBalance
    * LoanProductBorrowerCycleVariations
    * LoanProductProvisioningEntry

 - fix AccountingConstants to avoid using @FindBugsSuppressWarnings

 - fix SelfLoansDataValidator instead of @FindBugsSuppressWarnings

 - minor clean up in build.gradle (spotbugs has replaced findbugs)

PS: This change originally included also fixing the missing hashCode()
    and equals() in ShareAccountCharge, but that turned out to be non
    trivial, see FINERACT-827, and is thus not yet fixed by this.
2020-01-13 08:41:16 +01:00
Awasum YannickandGitHub 7420545d8f Merge pull request #690 from vorburger/FINERACT-773_fix-docker-compose
fix broken docker-compose set up (re. FINERACT-773)
2020-01-12 21:48:54 +01:00
Michael Vorburger 4e1d87f20a fix broken docker-compose set up (re. FINERACT-773)
This fixed bugs introduced in edc9e030e1
(in https://github.com/apache/fineract/pull/648) which for FINERACT-773
actually broke things more instead of adding the intended feature, cauz:

1. FINERACT_DEFAULT_TENANTDB_HOSTNAME and FINERACT_DEFAULT_TENANTDB_PORT
   were meant to be OS Environment Variables, not Java System properties
   and so need to be read via System.getenv() not System.getProperty(),
   duh!

2. The Travis CI test which was meant to ensure non-regression for this
   broke in that same change, because the "|| docker logs" introduced at
   the same time would always pass (EITHER because "http" passed OR
   if not then "docker logs" would return 0), duh again!

Both were dumb, not sure what I was thinking when I had hacked this.. ;)
2020-01-12 20:44:22 +01:00
Michael Vorburger a5c60b06e5 clean up GLAccountBuilder, following SpotBugs (FINERACT-702)
SpotBugs didn't like the original version, and the initial changes made
for SpotBugs satisfied SpotBugs, but the class was still pretty weird.
This change makes it follow the regular standard builder pattern.
2020-01-12 13:23:26 +01:00
Michael Vorburger 89b996cf58 Revert changes made to LoanReschedulingWithinCenterTest (FINERACT-702)
@awasum changed this in the SpotBugs related work, but this seems both
wrong, and, for me, makes this test now fail instead of pass (even
though for him it passed on the original PR...).

Probably related to https://issues.apache.org/jira/browse/FINERACT-820;
note that my current local time as I'm testing this is Sunday, and it
WORKS with; I'm now confused when FINERACT-820 affects us and when not.
Or perhaps this has nothing at all to do with that.
2020-01-12 13:16:42 +01:00
Awasum YannickandMichael Vorburger ⛑️ af0dd7e5f3 use SpotBugs & fix over 300 high priority rule violations (FINERACT-702)
This PR also serves as a base solution for upcoming FINERACT-712 and
FINERACT-696.  It includes using Objects.equals() to prevent NPEs, and
adding gradle check to run SpotBugs on Travis CI.

PS: SpotBugs is the successor to (and same code as) FindBugs.
2020-01-12 13:16:42 +01:00
Michael Vorburger 75f7c5947d add .project and .settings/ to .gitignore 2020-01-10 17:34:54 +01:00
Sidney WasibaniandMichael Vorburger ⛑️ 865e5a54a3 FINERACT-803 change the license comment type 2020-01-10 16:38:44 +01:00
Sidney WasibaniandMichael Vorburger ⛑️ ff702dbd19 FINERACT-803 fix exception handling for username duplication 2020-01-10 16:38:44 +01:00
Michael Vorburger a93a6b8487 Change /authentication API to pass data in request body instead of URL arguments (FINERACT-726) 2020-01-08 22:50:16 +01:00
Awasum YannickandGitHub ba6f778d85 Merge pull request #675 from apache/vorburger-travis
change .travis.yml to only run docker test if integration test passed
2019-12-16 21:27:10 +01:00
Michael Vorburger ⛑️andGitHub 5bce2422e0 change .travis.yml to only run docker test if integration test passed 2019-12-14 15:51:49 +01:00
Awasum YannickandGitHub f739f919c7 Merge pull request #672 from vorburger/fix-equals-NPE
fix potential NPE in JobParameter.equals() (FINERACT-428)
2019-12-14 13:21:20 +01:00
Michael Vorburger ⛑️ 030d9c8bd8 fix potential NPE in JobParameter.equals() (FINERACT-428) 2019-12-12 21:39:45 +00:00
Kumaranath FernandoandMichael Vorburger ⛑️ 0da4cdd412 Parallelization of Jobs: Parallelizing and paging of recalculate interest for loans (PR #524 for FINERACT-428) 2019-12-12 21:44:44 +01:00
Michael Vorburger ⛑️andGitHub cc181b5742 reset/verify all default global configurations in some integration tests (PR #671 for FINERACT-722)
Remove necessary resetting of 2 select default global configurations in FlexibleSavingsInterestPostingIntegrationTest.

Fixes issue where global configurations were affecting state between integration tests. This caused LoanReschedulingWithinCenterTest to fail on the first day of the month only because the "skip-repayment-on-first-day-of-month" configuration was modified but never reset by GlobalConfigurationTest.

Also updated other integration tests to reset and verify default global configurations.

FINERACT-722
2019-12-12 09:21:45 +01:00
andrew-dzakandMichael Vorburger ⛑️ 0474f59bcf fix overdraft account balance (PR #659 for FINERACT-753) 2019-12-11 07:59:50 +01:00
Percy Ayuk AshuandMichael Vorburger ⛑️ 26b4e0000c use dependency's versions from Spring BOM (PR #668 for FINERACT-805) 2019-12-10 06:38:41 +01:00
Mohit SinhaandGitHub d6eb3b0cf3 Merge pull request #665 from apache/revert-660-FINERACT-803
Revert "FINERACT-803: validate username uniqueness"
2019-12-08 00:39:32 +07:00
Mohit SinhaandGitHub 9674e0a718 Revert "FINERACT-803: validate username uniqueness" 2019-12-07 23:24:00 +07:00
Mohit SinhaandGitHub fb1e3d7c18 Merge pull request #660 from jamesidw/FINERACT-803
FINERACT-803: validate username uniqueness
2019-12-03 19:17:21 +07:00
Sidney Wasibani d9a0a9ac63 FINERACT-803: validate username uniqueness
FINERACT-803: treat existing username in update, to same user, as valid

FINERACT-803: skip username uniqueness validation for updates

FINERACT-803: add integration test for username uniqueness validation

FINERACT-803: change the validation error message to show the errant username

FINERACT-803: restore username uniqueness validation for updates

FINERACT-803: apply minor code clean up suggestions
2019-12-03 14:07:37 +03:00
Yemdjih Kaze NasserandMichael Vorburger ⛑️ a20f76d686 Use Spring Boot BOM to avoid maintaining version numbers in dependencies.gradle (#662 for FINERACT-797) 2019-12-02 07:44:35 -08:00
xurrorandMichael Vorburger ⛑️ 0440a36317 remove todos from XBRLBuiderTest 2019-12-01 17:12:25 -08:00
Percy Ayuk AshuandMichael Vorburger ⛑️ 451f4a6338 FINERACT-777 Use api / implementation scoped Gradle dependencies (#661)
see https://issues.apache.org/jira/browse/FINERACT-777
2019-12-01 17:08:31 -08:00
Maek TwainandMichael Vorburger ⛑️ 981bc17a60 Adding vnd.ms-excel MIME type support in BulkImportWorkbookServiceImpl (#650) 2019-11-27 18:33:17 -08:00
Awasum YannickandGitHub c6d8a49a8c Merge pull request #648 from vorburger/FINERACT-773_Dockerfile-JDBC-URL
Make it possible to customize JDBC URLs in Docker Image at run-time instead of at build (FINERACT-773)
2019-11-26 08:16:03 +01:00
Michael Vorburger edc9e030e1 Allow customizing JDBC URLs at run-time instead of during container build (FINERACT-773)
In Docker, set JAVA_OPTS instead of FINERACT_TENANTS_URL.

Because ARG/ENV in the Dockerfile can't (easily) be changed at run-time.

At first I tried to override the ENTRYPOINT with a script which sets
JAVA_OPTS based on FINERACT_TENANTS_URL and then delegates to the original
/app-entrypoint.sh; that didn't immediately work, so this seems simpler.

Including make default tenant JDBC hostname & port configurable at Docker container run instead of build time.
2019-11-26 06:06:59 +01:00
Michael Vorburger ⛑️andGitHub 01518b0f32 Delete .response.json.swp 2019-11-25 20:52:13 -08:00
Awasum YannickandGitHub 3ea8d209bb Merge pull request #655 from xurror/develop
remove TODO Auto-generated method stub
2019-11-25 09:00:51 +01:00
xurror b0bfeddc62 remove TODO Auto-generated method stub 2019-11-25 08:58:07 +01:00
Awasum YannickandGitHub d553b421bf Merge pull request #658 from vorburger/dottheia
add .theia/settings.json
2019-11-25 08:30:27 +01:00
Awasum YannickandGitHub e7868706f5 Merge pull request #657 from vorburger/log-less
reduce excessive logging causing Travis CI problems (FINERACT-800)
2019-11-25 08:12:27 +01:00
Kang BrederandMichael Vorburger ⛑️ 2770f78cc4 Corrected all Swagger documents found in the Accounting module by adding API description in anappropriate manner and the response.json file found in the swagger UI has been updated with the latest changes. 2019-11-24 23:08:59 -08:00
Kang BrederandMichael Vorburger ⛑️ 5ce86eaced Added description to Batch API swagger document in a correct manner. 2019-11-24 23:08:05 -08:00
Sidney WasibaniandMichael Vorburger ⛑️ c601856ca4 FINERACT-787 add selfServiceRoles template resource 2019-11-24 22:54:37 -08:00
Michael Vorburger ⛑️ f255a597f8 add .theia/settings.json to avoid confusing prompt on http://gitpod.io
and exclude JSON files from RAT (because they cannot contain license header comments)
2019-11-25 07:44:37 +01:00
Michael Vorburger 8c65696d49 reduce excessive logging causing Travis CI problems (FINERACT-800) 2019-11-25 07:44:37 +01:00
Michael Vorburger 2c733283c7 reduce excessive logging causing Travis CI problems (FINERACT-800) 2019-11-25 07:31:50 +01:00
Michael Vorburger ⛑️andGitHub a9858b1145 Merge pull request #653 from awasum/spring-boot-2.1.7-upgrade
upgrade Spring Framework dependencies (FINERACT-724)

reviewed on https://github.com/apache/fineract/pull/642 
and https://github.com/apache/fineract/pull/653
2019-11-24 12:11:14 -08:00
ibondarenko 347108b382 FINERACT-724 fix oauth authentication, replace DefaultPasswordEncoderFactories with standard spring security PasswordEncoderFactories 2019-11-22 18:28:10 +02:00
ibondarenko 1e0e6ca3e7 FINERACT-724 fix oauth configuration 2019-11-21 17:36:43 +02:00
ibondarenko 1d9176505b FINERACT-724 fix travis build after spring version migration 2019-11-21 12:33:24 +02:00
ibondarenko 33acc37a76 FINERACT-724 disable csrf on oauth configuration 2019-11-21 11:05:11 +02:00
ibondarenko 69f650654f Merge branch 'develop' of https://github.com/ivan333m/fineract into develop 2019-11-12 10:46:06 +02:00
ibondarenko e743fd5207 FINERACT-724 fixes after review (minor cleanup) 2019-11-12 10:36:27 +02:00
ibondarenko de77996e66 FINERACT-724 fixes after review (part2) 2019-11-12 10:36:27 +02:00
ibondarenko 377787280c FINERACT-724 fixes after review 2019-11-12 10:36:27 +02:00
ibondarenko c0383997bb implementation of FINERACT-724 properties cleanup 2019-11-12 10:36:27 +02:00
ibondarenko 43fd8618ad implementation of FINERACT-724 (Upgrade Spring Boot, Spring and Spring Security to their latest stable version) 2019-11-12 10:36:27 +02:00
Michael Vorburger 23c3f23e12 sleep 30s instead of 5s before attempting to httpie 2019-10-21 09:45:23 +02:00
Michael Vorburger 1aee1ef6a8 install httpie in .travis.yml for docker-compose test 2019-10-21 09:45:23 +02:00
Michael Vorburger a06c008cc3 Stop mysql system service before docker-compose on Travis CI 2019-10-21 09:45:23 +02:00
Michael Vorburger 479d6e0e81 docker-compose.yml version 3.3 instead of 3.7 2019-10-21 09:45:23 +02:00
Michael Vorburger 1b6c202ddc Add docker-compose non-regression test to Travis CI 2019-10-21 09:45:23 +02:00
ibondarenko 7f4df815a6 FINERACT-724 fixes after review (minor cleanup) 2019-10-16 15:02:40 +03:00
ibondarenko 01e9839ca5 FINERACT-724 fixes after review (part2) 2019-10-16 10:55:35 +03:00
ibondarenko 32e43d701b FINERACT-724 fixes after review 2019-10-16 09:43:28 +03:00
Muskan KhediaandMichael Vorburger ⛑️ 5715caf2fc Fixed Typo errors in README.md 2019-10-15 20:38:53 +02:00
Steve ConradandMichael Vorburger ⛑️ f9ab8143e4 Add healthcheck so DB is up before Fineract starts 2019-10-14 15:10:13 +02:00
Michael Vorburger 1bf357171a Minor doc improvements re. Docker in README 2019-10-14 13:19:17 +02:00
Steve ConradandGitHub 4c82b56322 Merge pull request #640 from conradsp/develop
FINERACT-794 Open Banking APIs for Interoperability layer
2019-10-12 10:02:31 -05:00
Steve ConradandGitHub 9c9266fa5a Merge pull request #643 from vorburger/docker-compose-selinux
Add Z,ro flags to Docker Compose Volume
2019-10-12 09:59:08 -05:00
Michael Vorburger 70ac0819b5 Add Z,ro flags to Docker Compose Volume
This is required on secure Linux distributions such as
Fedora/CentOS/RHEL where SELinux is enabled, where without this
the mysql container fails to start due to:

  ls: cannot open directory '/docker-entrypoint-initdb.d/': Permission denied

These Z,ro volume mount flags are (should be..) harmless and ignored
by Docker on other platforms, such as insecure ;) Linux distributions
without SELinux, or Windows and Mac.

PS: I personally don't actually use real Docker, but instead I use Podman
(see https://github.com/containers/libpod; install via `dnf install podman-docker`)
and https://github.com/containers/podman-compose/) via `pip3 install podman-compose`;
it's more secure (because it doesn't need a daemon and root to run containers).
2019-10-12 00:40:04 +02:00
ibondarenko edf6655eaf implementation of FINERACT-724 properties cleanup 2019-10-11 15:15:45 +03:00
ibondarenko 1fbe75281c implementation of FINERACT-724 (Upgrade Spring Boot, Spring and Spring Security to their latest stable version) 2019-10-11 13:39:22 +03:00
Steve Conrad e7b26a3f22 Fixes for license headers 2019-10-02 15:49:01 -04:00
Steve Conrad bbcbf944ca Merge remote-tracking branch 'marta/develop' into develop 2019-10-02 14:59:23 -04:00
Steve Conrad 4dbfcd6903 Merge remote-tracking branch 'upstream/develop' into develop 2019-10-02 14:56:16 -04:00
Awasum YannickandGitHub 608317ef52 Merge pull request #634 from vorburger/travis-skip-clean
remove clean in .travis.yml
2019-09-18 08:44:22 +01:00
Michael Vorburger.ch b059afda32 remove clean in .travis.yml 2019-09-17 20:18:22 +02:00
Marti a449958997 Openbanking - API Gateway 1.0 2019-09-17 20:06:15 +02:00
Courage AngehandGitHub 71b456c254 Merge pull request #619 from vorburger/IntegrationTest-Utils-await-health
make integrationTest await application health readyness
2019-09-07 10:08:02 -04:00
Awasum YannickandGitHub d0d4b623dd Merge pull request #635 from vorburger/develop
bump Gradle version from 5.2.1 to 5.6.1
2019-09-05 23:36:45 +01:00
Awasum YannickandGitHub d9e373e0b8 Merge pull request #633 from vorburger/travis-skip-integration-test-if-test-fails
fix .travis.yml so that integrationTest does not run if test already failed
2019-09-05 23:24:20 +01:00
Michael Vorburger.ch 06ed8468b8 fix .travis.yml so that integrationTest does not run if test already failed 2019-09-04 22:26:53 +02:00
Michael Vorburger.ch 8a40c6f40f bump Gradle version from 5.2.1 to 5.6.1
all changed/new files have been created by:

./gradlew wrapper --gradle-version=5.6.1 --distribution-type=bin
2019-09-04 22:22:48 +02:00
Michael Vorburger.ch c90888f1bb tweak .gitpod.yml and add https://gitpod.io badge to README
- add ASL header (required by ASF RAT)
- change port to 8080 (TODO what was 8005 ?)
- add commands to create DBs
- fix .gitpod.yml database creation
- refine ports in .gitpod.yml
- add port 8081 to ignore in .gitpod.yml
- use test instead of (too slow) integrationTest in .gitpod.yml
- fix .gitpod.yml
  by using https://yaml-multiline.info to fix start-up problem
  due to comment inside tasks / command; ACK Tx to @meysholdt
  for pointing out the right trick here.

see https://github.com/apache/fineract/pull/598/
2019-09-04 22:09:41 +02:00
Sven EfftingeandMichael Vorburger ⛑️ 6d26db553b added gitpod config 2019-09-04 22:09:41 +02:00
Michael Vorburger.ch 89334bdb95 make integrationTest await application health readyness
This was an idea I had when wondering if the problem we hit
during the Gradle upgrade was just that Tomcat took longer to
boot Fineract (it turned out that that wasn't the cause).

I'm not sure if gradle-tomcat-plugin already does the equivalent
(but suspect it does not), but given that integrationTests work,
not entirely clear how much value this really adds.

Given that it doesn't really hurt either, perhaps we can add it anyway.
2019-09-04 19:18:03 +02:00
Michael Vorburger.ch ea076cd5c6 put back the TZ (re. FINERACT-788)
always best to make only mininmal required change
2019-08-23 17:36:57 +02:00
Michael Vorburger ⛑️ 2fdd9d14b6 rm hardcoded system time from .travis.yml (fixes FINERACT-788) 2019-08-23 17:36:57 +02:00
Michael Vorburger ⛑️andGitHub c4301843bd link to FAQ from README 2019-08-22 09:25:29 +02:00
Courage AngehandGitHub 3d111b44bd Merge pull request #625 from Anh3h/docker-updates
Update Dockerfile to use user-provided MySQL IP
2019-07-31 19:12:12 -04:00
Anh3h 9d9ccfc76b Update Dockerfile to use user-provided MySQL IP 2019-07-29 10:23:27 -04:00
Angel CajasandGitHub 4d3d37c5e2 Merge pull request #614 from mohitsinha/new-develop
Stop creating unnecessary overdue charge when amount is 0.
2019-07-24 10:53:26 -06:00
Mohit Sinha fa6794c22c Stop creating unnecessary overdue charge when amount is 0 2019-07-24 20:26:28 +07:00
Steve ConradandGitHub 800287b48f Merge pull request #618 from vorburger/add-SpringBoot-Actuator
add spring-boot-starter-actuator dependency
2019-07-23 09:28:06 -05:00
Steve ConradandGitHub 1110df80c3 Merge pull request #624 from vorburger/FINERACT-771_Dockerfile
use multi-stage build in Dockerfile (fixes FINERACT-771)
2019-07-23 08:28:50 -05:00
Michael Vorburger.ch f13c076862 rm git & JDK from Dockerfile
Now that we separated the build and runtime containers,
we can have only a JRE but not a JDK in the runtime container
(whereas the builder container will still have a JRE).

This makes for a smaller, and more importantly,
more secure, runtime container image.

Also removing git from runtime container, as it's not used.
2019-07-23 10:17:56 +02:00
Michael Vorburger.ch 81c1468fa4 use multi-stage build in Dockerfile (fixes FINERACT-771) 2019-07-23 10:12:25 +02:00
Mohit SinhaandMichael Vorburger ⛑️ eee2841b5c FINERACT-780: Unique id for hook test 2019-07-23 09:18:58 +02:00
Awasum YannickandGitHub 908c5e3ad0 Merge pull request #608 from vorburger/bump-OpenJPA-Version
bump OpenJPA version from 2.4.1 to 2.4.3 for Java 11 compliance
2019-07-16 14:55:51 +01:00
Steve ConradandGitHub f517f53b63 Merge pull request #620 from vorburger/bval-scope-implementation
switch bval dependency from compile to implementation (see FINERACT-777)
2019-07-11 09:37:01 -05:00
Awasum YannickandGitHub b02a35c1f3 Merge pull request #621 from apache/README-DockerHub
add links to Docker Hub to README (badges & text)
2019-07-11 10:05:07 +01:00
Michael Vorburger ⛑️andGitHub c5e7ae274a add links to Docker Hub to README (badges & text)
see https://issues.apache.org/jira/browse/INFRA-18673
2019-07-11 10:14:21 +02:00
Michael Vorburger.ch 8be550d077 switch bval dependency from compile to implementation (see FINERACT-777) 2019-07-11 08:46:35 +02:00
Michael Vorburger.ch bcef09d7be upgrade OpenJPA 2.4.1 to 2.4.3
because 2.4.1 was not yet Java 11 compatible (due to an old ASM)

I'd like to upgrade to Java 11 soon-ish, and am starting to experiment with it.
2019-07-11 08:41:36 +02:00
Michael Vorburger ⛑️andGitHub 04efaca1ca Merge pull request #525 from vorburger/bump-gradle-wrapper
FINERACT-700: upgrade Gradle from 2.10 to 5.2.1
2019-07-11 08:28:54 +02:00
Michael Vorburger.ch 2fc98df21c fix ClassCircularityError: java/util/logging/LogRecord (see FINERACT-700 for details) 2019-07-10 23:47:51 +02:00
Michael Vorburger ⛑️andGitHub 9f0147d7d0 Merge branch 'develop' into bump-gradle-wrapper 2019-07-10 18:45:21 +02:00
Steve ConradandGitHub 9d286266df Merge pull request #607 from vorburger/OpenJPA-but-not_all_fatjar
use openjpa (with real dependencies) instead of shaded openjpa-all
2019-07-10 09:37:26 -05:00
Michael Vorburger.ch 46a9da6c9b silence Spring Boot Actuator Audit INFO logging (fixes FINERACT-779) 2019-07-10 10:28:21 +02:00
Michael Vorburger.ch e2b2e66610 fix integrationTest (=> runWar) which broke in Gradle upgrade
inspired by (but not exactly like) the respective section on
https://github.com/bmuschko/gradle-tomcat-plugin#faq
2019-07-09 22:09:11 +02:00
Michael Vorburger.ch 6eae392805 add spring-boot-starter-actuator dependency
see https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html
2019-07-09 21:05:53 +02:00
Michael Vorburger.ch 9a4cb83bd5 upgrade gradle-tomcat-plugin from 1.0 to 2.5 (NOK) 2019-07-09 18:18:13 +02:00
Michael Vorburger.ch b54a11da9b fix gradle createDB/dropDB/setBlankPassword
which broke during the Gradle upgrade in FINERACT-700

do not fix Flyway related migrateTenantDB & Co, as those
are proposed to be removed in FINERACT-765 anyway.  (If really
needed, some of my other WIP branches have the required changes
to make the Flyway related tasks work.)
2019-07-09 10:04:03 +02:00
Michael Vorburger.ch 6f58b30fd8 gradle.properties with -Xmx4g and disabling daemon
because the (new, upgraded) Tomcat Gradle plugin needs more memory
(and this seems to make the build a bit faster, may be less is fine),
and it does not work with the Gradle daemon; this fixes:

> Task :tomcatRunWar
Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"]
Failed to initialize connector [Connector[HTTP/1.1-8080]]
Failed to initialize end point associated with ProtocolHandler ["ajp-bio-8009"]
Failed to initialize connector [Connector[AJP/1.3-8009]]
Failed to initialize end point associated with ProtocolHandler ["http-bio-8443"]
Failed to initialize connector [Connector[HTTP/1.1-8443]]

which appears on the 2nd (only!) run of `./gradlew tomcatRunWAR`
(because the Tomcat embedded in the previous daemon-ized Gradle did not stop).
2019-07-09 10:04:03 +02:00
Michael Vorburger fd74931390 upgrade (switch) OpenJPA Gradle plugin (FINERACT-700)
from at.schmutterer.oss.gradle:gradle-openjpa
to com.radcortez.gradle:openjpa-gradle-plugin

due to https://github.com/schmutterer/gradle-openjpa/issues/8
2019-07-09 10:04:03 +02:00
Michael Vorburger 1ee141bb87 upgrade spring-boot-gradle-plugin, and deal with impacts (FINERACT-700)
because the old one previously used caused an UnsupportedOperationException
with the new Gradle, see https://issues.apache.org/jira/browse/FINERACT-700

The spring-jms and activemq-broker versions are set to what they were on before.
2019-07-09 10:02:13 +02:00
Michael Vorburger 84d57dbe5b upgrade Gradle version, and deal with impacts (FINERACT-700)
https://discuss.gradle.org/t/could-not-get-unknown-property-classesdir-for-main-classes-of-type-org-gradle-api-internal-tasks-defaultsourcesetoutput/30570

https://discuss.gradle.org/t/gradle-4-replacing-deprecated-test-testclassesdir/22822/2

https://discuss.gradle.org/t/could-not-find-method-leftshift-for-arguments-on-task-of-type-org-gradle-api-defaulttask/30614
2019-07-09 09:52:37 +02:00
Michael Vorburger.ch a87b3a0a4d use openjpa (with real dependencies) instead of shaded openjpa-all 2019-07-09 09:48:18 +02:00
Steve ConradandGitHub d22ed87276 Merge pull request #617 from vorburger/javax.validation.constraints-instead-org.apache.bval.constraints
replace Apache BVal @NotEmpty annotation by javax.validation (re. FINERACT-777)
2019-07-08 08:26:53 -05:00
Michael Vorburger.ch 8bdc134a8e replace Apache BVal @NotEmpty annotation by javax.validation (re. FINERACT-777) 2019-07-08 09:48:01 +02:00
Vishwas Babu A JandGitHub cd839953e1 Merge pull request #596 from vorburger/enable-TemplateMergeServiceTest-compileHelloTemplate
re-enable commented out TemplateMergeServiceTest.compileHelloTemplate (which actually passes)
2019-07-08 09:28:27 +05:30
Vishwas Babu A JandGitHub 624015acaa Merge pull request #613 from vorburger/FINERACT-765_rm-flyway-from-gradle
remove Flyway completely from Gradle build (fixes FINERACT-765)
2019-07-08 09:27:30 +05:30
Awasum YannickandGitHub c04851cd21 Merge pull request #597 from vorburger/rm-WebContent/META-INF/MANIFEST.MF
clean-up rm WebContent/META-INF/MANIFEST.MF
2019-07-07 22:44:39 +01:00
Awasum YannickandGitHub 41f683cfb1 Merge pull request #612 from vorburger/deactivate-FindBugs-PMD
comment out PMD & FindBugs
2019-07-07 22:43:15 +01:00
Awasum YannickandGitHub 21ba7ff75d Merge pull request #611 from vorburger/upgrade-Tomcat-minor
upgrade Apache Tomcat from 7.0.54 to 7.0.94
2019-07-07 22:41:49 +01:00
Awasum YannickandGitHub 998d8b7fbc Merge pull request #602 from vorburger/re-activate-tests
re-activate unit tests (see FINERACT-776)
2019-07-07 22:41:06 +01:00
Awasum YannickandGitHub 7ef262b5a0 Merge pull request #615 from vorburger/doc-add_Instructions-how-to-run-for-local-development_README
add "Instructions how to run for local development" to README
2019-07-07 22:39:51 +01:00
Michael Vorburger.ch 0c2b1dc6dc remove Flyway completely from Gradle build (fixes FINERACT-765)
we (of course), still, but only, run it in-App at runtime boot

This is a clean-up which removes something we don't actually need.

Most importantly, it unblocks the Gradle upgrade in FINERACT-700,
where this doesn't work anymore anyway (and while there's a fix
making it work on one of my branches, it seems simpler to just
remove it).
2019-07-04 10:39:55 +02:00
Michael Vorburger.ch db67fec6b9 add "Instructions how to run for local development" to README
hoping to change "tomcatRunWAR" to "bootRun", later (FINERACT-730/FINERACT-764)
2019-07-04 10:20:58 +02:00
Michael Vorburger.ch e960d40906 comment out PMD & FindBugs
Too slow, and nobody looked at it in years anyway.
The idea is to later re-activate, with enforcement.

see also https://issues.apache.org/jira/browse/FINERACT-712
2019-07-04 09:32:48 +02:00
Michael Vorburger.ch b0a4069da6 upgrade Apache Tomcat from 7.0.54 to 7.0.94
This fixes the following weird problem I ran into
during the Gradle & Spring Boot / OpenJPA Gradle plugins upgrades;
it's likely some Tomcat bug that got fixed between .54 and .94:

Unable to process resource element [jndi:/localhost/fineract-provider/WEB-INF/classes/org/apache/fineract/.../*.class] for annotations
2019-07-04 09:26:39 +02:00
Michael Vorburger.ch 7030f1fa4c re-activate unit tests (see FINERACT-776) 2019-07-03 23:23:12 +02:00
Michael Vorburger ⛑️ 913f018f0f clean-up rm WebContent/META-INF/MANIFEST.MF
This is ancient, and should normally not be required anymore, now.

Gradle would add it, if required.
2019-07-01 21:29:08 +02:00
Michael Vorburger ⛑️ 702e15e0f4 re-enable commented out test (which actually passes) 2019-07-01 21:23:26 +02:00
conradsp 6127219266 Set host to fineractmysql when running in docker 2019-07-01 08:36:01 -05:00
3306 changed files with 154390 additions and 82142 deletions
+7
View File
@@ -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
+1 -1
View File
@@ -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.
+36
View File
@@ -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
+18
View File
@@ -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 }}
+20
View File
@@ -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
View File
@@ -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
View File
@@ -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
+8
View File
@@ -0,0 +1,8 @@
{
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
}
}
+35 -14
View File
@@ -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
View File
@@ -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"]
+273 -52
View File
@@ -1,88 +1,244 @@
Apache Fineract: A Platform for Microfinance [![Build Status](https://travis-ci.org/apache/fineract.svg?branch=develop)](https://travis-ci.org/apache/fineract)
Apache Fineract: A Platform for Microfinance [![Build Status](https://travis-ci.org/apache/fineract.svg?branch=develop)](https://travis-ci.org/apache/fineract) [![Docker Hub](https://img.shields.io/docker/pulls/apache/fineract.svg)](https://hub.docker.com/r/apache/fineract) [![Docker Build](https://img.shields.io/docker/cloud/build/apache/fineract.svg)](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.
[![Code Now! (Gitpod)](https://gitpod.io/button/open-in-gitpod.svg)](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>.
+70
View File
@@ -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
+365
View File
@@ -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
View File
@@ -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
View File
@@ -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>
+3 -3
View File
@@ -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>
+2 -2
View File
@@ -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
@@ -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:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/fineract-provider/bin/main&quot; type=&quot;2&quot;/&gt;&#10;&lt;/resources&gt;}"/>
<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>
-12
View File
@@ -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:
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>
+97 -71
View File
@@ -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'
}
}
-108
View File
@@ -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']
}
-2
View File
@@ -18,5 +18,3 @@
#
releaseVersion=1.0.0
buildType=BUILD
Binary file not shown.
+1 -2
View File
@@ -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
Vendored Executable
+185
View File
@@ -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" "$@"
+104
View File
@@ -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
@@ -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);
}
}
}
@@ -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);
}
}
}
@@ -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;
}
@@ -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"));
}
}
@@ -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);
}
}
@@ -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");
}
}
}
@@ -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");
}
}
}
@@ -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);
}
}
@@ -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");
}
}
File diff suppressed because it is too large Load Diff
@@ -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,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);
@@ -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");
}
}
@@ -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);
}
}
@@ -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");
}
}
}
@@ -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();
@@ -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;
}
}
}
@@ -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);
}
}
@@ -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);
}
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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;
}
}
}
}
@@ -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;
}
}
}
}
@@ -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");
}
}
@@ -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;
}
}
@@ -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);
}
}
}
@@ -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);
}
}
@@ -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")
@@ -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")
@@ -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);
}
}
@@ -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")
@@ -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)));
}
}
@@ -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);
}
}
@@ -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)));
}
}
}
@@ -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)
@@ -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();
@@ -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;
}
}
}
@@ -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);
}
}
@@ -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());
}
}
@@ -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");
}
}
@@ -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);
@@ -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");
}
}
@@ -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);
}
}
}
@@ -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);
}
}
}
@@ -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"));
}
}
@@ -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");
}
}
@@ -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