From 240039f9790dbb37c48873d89b2a3d5f0a2da73e Mon Sep 17 00:00:00 2001 From: Janos Haber Date: Mon, 15 May 2023 12:43:07 +0200 Subject: [PATCH] - [x] Create fineract-core module - used to common cross module classes and interfaces - [x] Create fineract-investor module for build - [x] modify tenant liquibase loader to using module based liquibase processing - [x] sample liquibase into the fineract-investor module - [x] Move NewCommandSourceHandler and dependencies to the fineract-core --- build.gradle | 9 +- .../event/externalevent/dependencies.gradle | 1 + custom/acme/event/starter/dependencies.gradle | 1 + custom/acme/loan/cob/dependencies.gradle | 1 + custom/acme/loan/job/dependencies.gradle | 1 + .../acme/loan/processor/dependencies.gradle | 1 + custom/acme/loan/starter/dependencies.gradle | 1 + custom/acme/note/service/dependencies.gradle | 1 + custom/acme/note/starter/dependencies.gradle | 1 + fineract-core/build.gradle | 72 +++++++++++ fineract-core/dependencies.gradle | 117 ++++++++++++++++++ .../commands/annotation/CommandType.java | 0 .../handler/NewCommandSourceHandler.java | 0 .../infrastructure/core/api/JsonCommand.java | 0 .../core/data/ApiErrorMessageArg.java | 0 .../core/data/ApiParameterError.java | 0 .../core/data/CommandProcessingResult.java | 0 .../core/data/DataValidatorBuilder.java | 0 .../core/domain/ExternalId.java | 0 .../exception/AbstractPlatformException.java | 0 .../core/exception/InvalidJsonException.java | 0 .../PlatformApiDataValidationException.java | 0 .../PlatformInternalServerException.java | 0 .../UnsupportedParameterException.java | 0 .../core/serialization/FromJsonHelper.java | 0 .../core/serialization/JsonParserHelper.java | 0 .../BasicPasswordEncodablePlatformUser.java | 0 .../security/domain/PlatformUser.java | 0 .../service/PlatformPasswordEncoder.java | 0 fineract-core/src/test/java/.gitkeep | 0 fineract-core/src/test/resources/.gitkeep | 0 fineract-investor/build.gradle | 89 +++++++++++++ fineract-investor/dependencies.gradle | 46 +++++++ .../investor/module-changelog-master.xml | 26 ++++ .../investor/parts/0001_initial_schema.xml | 29 +++++ fineract-investor/src/test/java/.gitkeep | 0 fineract-investor/src/test/resources/.gitkeep | 0 fineract-provider/build.gradle | 1 + fineract-provider/dependencies.gradle | 2 + .../migration/TenantModuleRootFilter.java | 29 +++++ .../db/changelog/db.changelog-master.xml | 1 + fineract-war/build.gradle | 2 + integration-tests/dependencies.gradle | 2 + settings.gradle | 2 + 44 files changed, 433 insertions(+), 2 deletions(-) create mode 100644 fineract-core/build.gradle create mode 100644 fineract-core/dependencies.gradle rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/commands/annotation/CommandType.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/commands/handler/NewCommandSourceHandler.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/core/data/ApiErrorMessageArg.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/core/data/ApiParameterError.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/core/data/CommandProcessingResult.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/core/domain/ExternalId.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/core/exception/AbstractPlatformException.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/core/exception/InvalidJsonException.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/core/exception/PlatformApiDataValidationException.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/core/exception/PlatformInternalServerException.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/core/exception/UnsupportedParameterException.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/core/serialization/FromJsonHelper.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/core/serialization/JsonParserHelper.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/security/domain/BasicPasswordEncodablePlatformUser.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/security/domain/PlatformUser.java (100%) rename {fineract-provider => fineract-core}/src/main/java/org/apache/fineract/infrastructure/security/service/PlatformPasswordEncoder.java (100%) create mode 100644 fineract-core/src/test/java/.gitkeep create mode 100644 fineract-core/src/test/resources/.gitkeep create mode 100644 fineract-investor/build.gradle create mode 100644 fineract-investor/dependencies.gradle create mode 100644 fineract-investor/src/main/resources/db/changelog/tenant/module/investor/module-changelog-master.xml create mode 100644 fineract-investor/src/main/resources/db/changelog/tenant/module/investor/parts/0001_initial_schema.xml create mode 100644 fineract-investor/src/test/java/.gitkeep create mode 100644 fineract-investor/src/test/resources/.gitkeep create mode 100644 fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/migration/TenantModuleRootFilter.java diff --git a/build.gradle b/build.gradle index 24bfd31c8..856217886 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,9 @@ buildscript { fineractJavaProjects = subprojects.findAll{ [ 'fineract-api', + 'fineract-core', 'fineract-provider', + 'fineract-investor', 'integration-tests', 'twofactor-tests', 'oauth2-tests', @@ -39,7 +41,8 @@ buildscript { [ 'fineract-avro-schemas', 'fineract-client', - 'fineract-provider' + 'fineract-provider', + 'fineract-investor' ].contains(it.name) } npmRepository = 'https://npm.pkg.github.com' @@ -301,7 +304,9 @@ configure(project.fineractJavaProjects) { implementation.setCanBeResolved(true) api.setCanBeResolved(true) } - + tasks.withType(Copy) { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } tasks.withType(JavaCompile) { options.compilerArgs += [ "-Xlint:unchecked", diff --git a/custom/acme/event/externalevent/dependencies.gradle b/custom/acme/event/externalevent/dependencies.gradle index 364f7d772..b020fa967 100644 --- a/custom/acme/event/externalevent/dependencies.gradle +++ b/custom/acme/event/externalevent/dependencies.gradle @@ -18,6 +18,7 @@ */ dependencies { + implementation(project(':fineract-core')) implementation(project(':fineract-provider')) implementation('org.springframework.boot:spring-boot-starter-data-jpa') } diff --git a/custom/acme/event/starter/dependencies.gradle b/custom/acme/event/starter/dependencies.gradle index 30b090b9f..d377d574a 100644 --- a/custom/acme/event/starter/dependencies.gradle +++ b/custom/acme/event/starter/dependencies.gradle @@ -18,6 +18,7 @@ */ dependencies { + implementation(project(':fineract-core')) implementation(project(':fineract-provider')) implementation('org.springframework.boot:spring-boot-starter') } diff --git a/custom/acme/loan/cob/dependencies.gradle b/custom/acme/loan/cob/dependencies.gradle index 364f7d772..b020fa967 100644 --- a/custom/acme/loan/cob/dependencies.gradle +++ b/custom/acme/loan/cob/dependencies.gradle @@ -18,6 +18,7 @@ */ dependencies { + implementation(project(':fineract-core')) implementation(project(':fineract-provider')) implementation('org.springframework.boot:spring-boot-starter-data-jpa') } diff --git a/custom/acme/loan/job/dependencies.gradle b/custom/acme/loan/job/dependencies.gradle index fd2f26643..b77475517 100644 --- a/custom/acme/loan/job/dependencies.gradle +++ b/custom/acme/loan/job/dependencies.gradle @@ -18,6 +18,7 @@ */ dependencies { + implementation(project(':fineract-core')) implementation(project(':fineract-provider')) implementation('org.springframework.batch:spring-batch-integration') implementation('org.springframework.boot:spring-boot-starter-data-jpa') diff --git a/custom/acme/loan/processor/dependencies.gradle b/custom/acme/loan/processor/dependencies.gradle index 59d668289..edd2e139b 100644 --- a/custom/acme/loan/processor/dependencies.gradle +++ b/custom/acme/loan/processor/dependencies.gradle @@ -18,5 +18,6 @@ */ dependencies { + implementation(project(':fineract-core')) implementation(project(':fineract-provider')) } diff --git a/custom/acme/loan/starter/dependencies.gradle b/custom/acme/loan/starter/dependencies.gradle index 11225f482..1f134d647 100644 --- a/custom/acme/loan/starter/dependencies.gradle +++ b/custom/acme/loan/starter/dependencies.gradle @@ -18,6 +18,7 @@ */ dependencies { + implementation(project(':fineract-core')) implementation(project(':fineract-provider')) implementation(project(':custom:acme:loan:cob')) implementation(project(':custom:acme:loan:processor')) diff --git a/custom/acme/note/service/dependencies.gradle b/custom/acme/note/service/dependencies.gradle index a81ef21a1..9bea53177 100644 --- a/custom/acme/note/service/dependencies.gradle +++ b/custom/acme/note/service/dependencies.gradle @@ -18,6 +18,7 @@ */ dependencies { + implementation(project(':fineract-core')) implementation(project(':fineract-provider')) compileOnly('org.springframework.boot:spring-boot-autoconfigure') } diff --git a/custom/acme/note/starter/dependencies.gradle b/custom/acme/note/starter/dependencies.gradle index 3fd62233d..7cf50805b 100644 --- a/custom/acme/note/starter/dependencies.gradle +++ b/custom/acme/note/starter/dependencies.gradle @@ -20,6 +20,7 @@ dependencies { implementation(project(':custom:acme:note:service')) implementation('org.springframework.boot:spring-boot-starter') + testImplementation(project(':fineract-core')) testImplementation(project(':fineract-provider')) testImplementation('org.springframework.boot:spring-boot-starter-jdbc') testImplementation('org.springframework.boot:spring-boot-starter-data-jpa') diff --git a/fineract-core/build.gradle b/fineract-core/build.gradle new file mode 100644 index 000000000..f725dc284 --- /dev/null +++ b/fineract-core/build.gradle @@ -0,0 +1,72 @@ +/** + * 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. + */ +description = 'Fineract Core' + +apply plugin: 'java' +apply plugin: 'eclipse' +check.dependsOn('cucumber') + +configurations { + providedRuntime // needed for Spring Boot executable WAR + providedCompile + compile() { + exclude module: 'hibernate-entitymanager' + exclude module: 'hibernate-validator' + exclude module: 'activation' + exclude module: 'bcmail-jdk14' + exclude module: 'bcprov-jdk14' + exclude module: 'bctsp-jdk14' + exclude module: 'c3p0' + exclude module: 'stax-api' + exclude module: 'jaxb-api' + exclude module: 'jaxb-impl' + exclude module: 'jboss-logging' + exclude module: 'itext-rtf' + exclude module: 'classworlds' + } + runtime +} + +apply from: 'dependencies.gradle' + +// Configuration for the modernizer plugin +// https://github.com/andygoossens/gradle-modernizer-plugin +modernizer { + ignoreClassNamePatterns = [ + '.*AbstractPersistableCustom', + '.*EntityTables', + '.*domain.*' + ] +} + +// If we are running Gradle within Eclipse to enhance classes with OpenJPA, +// set the classes directory to point to Eclipse's default build directory +if (project.hasProperty('env') && project.getProperty('env') == 'eclipse') { + sourceSets.main.java.outputDir = new File(rootProject.projectDir, "fineract-core/bin/main") +} + +if (!(project.hasProperty('env') && project.getProperty('env') == 'dev')) { + sourceSets { + test { + java { + exclude '**/core/boot/tests/**' + } + } + } +} diff --git a/fineract-core/dependencies.gradle b/fineract-core/dependencies.gradle new file mode 100644 index 000000000..1c41c9971 --- /dev/null +++ b/fineract-core/dependencies.gradle @@ -0,0 +1,117 @@ +/** + * 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 { + + // 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'. + + // implementation dependencies are directly used (compiled against) in src/main (and src/test) + // + implementation( + 'org.springframework.boot:spring-boot-starter-web', + 'org.springframework.boot:spring-boot-starter-security', + 'jakarta.ws.rs:jakarta.ws.rs-api', + 'org.glassfish.jersey.media:jersey-media-multipart', + + 'com.google.guava:guava', + 'com.google.code.gson:gson', + + 'org.apache.commons:commons-lang3', + 'org.liquibase:liquibase-core', + + 'com.jayway.jsonpath:json-path', + + 'com.github.spotbugs:spotbugs-annotations', + 'io.swagger.core.v3:swagger-annotations', + + 'com.squareup.retrofit2:converter-gson', + + 'org.springdoc:springdoc-openapi-security', + 'org.mapstruct:mapstruct', + + 'io.github.resilience4j:resilience4j-spring-boot2', + ) + + implementation('org.springframework.boot:spring-boot-starter-jersey') { + exclude group: 'org.glassfish.hk2.external', module: 'aopalliance-repackaged' + exclude group: 'org.glassfish.hk2', module: 'hk2-runlevel' + exclude group: 'org.hibernate.validator', module: 'hibernate-validator' + exclude group: 'jakarta.activation', module: 'jakarta.activation-api' + } + implementation('org.dom4j:dom4j') { + exclude group: 'javax.xml.bind' + } + implementation ('jakarta.xml.bind:jakarta.xml.bind-api') { + exclude group: 'jakarta.activation' + } + implementation ('org.springframework.boot:spring-boot-starter-data-jpa') { + exclude group: 'org.hibernate' + } + implementation('org.eclipse.persistence:org.eclipse.persistence.jpa') { + exclude group: 'org.eclipse.persistence', module: 'jakarta.persistence' + } + runtimeOnly('org.glassfish.jaxb:jaxb-runtime') { + exclude group: 'com.sun.activation' + } + + // 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', + + // 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' + ) + + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' + annotationProcessor 'org.mapstruct:mapstruct-processor' + + implementation 'ch.qos.logback.contrib:logback-json-classic' + implementation 'ch.qos.logback.contrib:logback-jackson' + implementation 'org.codehaus.janino:janino' + + implementation 'org.apache.commons:commons-math3' + + implementation 'io.github.classgraph:classgraph' + // testCompile dependencies are ONLY used in src/test, not src/main. + // Do NOT repeat dependencies which are ALREADY in implementation or runtimeOnly! + // + testImplementation( 'io.cucumber:cucumber-spring', + 'io.github.classgraph:classgraph', + ) + 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' + exclude group: 'jakarta.activation' + exclude group: 'javax.activation' + exclude group: 'org.skyscreamer' + } + implementation ('org.mnode.ical4j:ical4j') { + exclude group: 'commons-logging' + exclude group: 'javax.activation' + exclude group: 'com.sun.mail', module: 'javax.mail' + } + implementation ('org.quartz-scheduler:quartz') { + exclude group: 'com.zaxxer', module: 'HikariCP-java7' + } + testImplementation ('org.mockito:mockito-inline') +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/annotation/CommandType.java b/fineract-core/src/main/java/org/apache/fineract/commands/annotation/CommandType.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/commands/annotation/CommandType.java rename to fineract-core/src/main/java/org/apache/fineract/commands/annotation/CommandType.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/handler/NewCommandSourceHandler.java b/fineract-core/src/main/java/org/apache/fineract/commands/handler/NewCommandSourceHandler.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/commands/handler/NewCommandSourceHandler.java rename to fineract-core/src/main/java/org/apache/fineract/commands/handler/NewCommandSourceHandler.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/ApiErrorMessageArg.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/data/ApiErrorMessageArg.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/ApiErrorMessageArg.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/data/ApiErrorMessageArg.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/ApiParameterError.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/data/ApiParameterError.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/ApiParameterError.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/data/ApiParameterError.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/CommandProcessingResult.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/data/CommandProcessingResult.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/CommandProcessingResult.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/data/CommandProcessingResult.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/ExternalId.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/domain/ExternalId.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/ExternalId.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/domain/ExternalId.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/AbstractPlatformException.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/exception/AbstractPlatformException.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/AbstractPlatformException.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/exception/AbstractPlatformException.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/InvalidJsonException.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/exception/InvalidJsonException.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/InvalidJsonException.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/exception/InvalidJsonException.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/PlatformApiDataValidationException.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/exception/PlatformApiDataValidationException.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/PlatformApiDataValidationException.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/exception/PlatformApiDataValidationException.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/PlatformInternalServerException.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/exception/PlatformInternalServerException.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/PlatformInternalServerException.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/exception/PlatformInternalServerException.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/UnsupportedParameterException.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/exception/UnsupportedParameterException.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/UnsupportedParameterException.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/exception/UnsupportedParameterException.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/FromJsonHelper.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/FromJsonHelper.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/FromJsonHelper.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/FromJsonHelper.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/JsonParserHelper.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/JsonParserHelper.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/JsonParserHelper.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/JsonParserHelper.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/domain/BasicPasswordEncodablePlatformUser.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/security/domain/BasicPasswordEncodablePlatformUser.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/domain/BasicPasswordEncodablePlatformUser.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/security/domain/BasicPasswordEncodablePlatformUser.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/domain/PlatformUser.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/security/domain/PlatformUser.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/domain/PlatformUser.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/security/domain/PlatformUser.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/PlatformPasswordEncoder.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/security/service/PlatformPasswordEncoder.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/PlatformPasswordEncoder.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/security/service/PlatformPasswordEncoder.java diff --git a/fineract-core/src/test/java/.gitkeep b/fineract-core/src/test/java/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/fineract-core/src/test/resources/.gitkeep b/fineract-core/src/test/resources/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/fineract-investor/build.gradle b/fineract-investor/build.gradle new file mode 100644 index 000000000..3d5d695d5 --- /dev/null +++ b/fineract-investor/build.gradle @@ -0,0 +1,89 @@ +/** + * 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. + */ +description = 'Fineract Investor' + +apply plugin: 'java' +apply plugin: 'eclipse' + +check.dependsOn('cucumber') + +// Configuration for Swagger documentation generation task +// https://github.com/swagger-api/swagger-core/tree/master/modules/swagger-gradle-plugin +import org.apache.tools.ant.filters.ReplaceTokens + + + +configurations { + providedRuntime // needed for Spring Boot executable WAR + providedCompile + compile() { + exclude module: 'hibernate-entitymanager' + exclude module: 'hibernate-validator' + exclude module: 'activation' + exclude module: 'bcmail-jdk14' + exclude module: 'bcprov-jdk14' + exclude module: 'bctsp-jdk14' + exclude module: 'c3p0' + exclude module: 'stax-api' + exclude module: 'jaxb-api' + exclude module: 'jaxb-impl' + exclude module: 'jboss-logging' + exclude module: 'itext-rtf' + exclude module: 'classworlds' + } + runtime +} + +apply from: 'dependencies.gradle' + +// Configuration for the modernizer plugin +// https://github.com/andygoossens/gradle-modernizer-plugin +modernizer { + ignoreClassNamePatterns = [ + '.*AbstractPersistableCustom', + '.*EntityTables', + '.*domain.*' + ] +} + +// If we are running Gradle within Eclipse to enhance classes with OpenJPA, +// set the classes directory to point to Eclipse's default build directory +if (project.hasProperty('env') && project.getProperty('env') == 'eclipse') { + sourceSets.main.java.outputDir = new File(rootProject.projectDir, "fineract-core/bin/main") +} + +eclipse { + project { + buildCommand([ LaunchConfigHandle: "/.externalToolBuilders/OpenJPA Enhance Builder.launch" ], 'org.eclipse.ui.externaltools.ExternalToolBuilder') + } +} + +/* http://stackoverflow.com/questions/19653311/jpa-repository-works-in-idea-and-production-but-not-in-gradle */ +sourceSets.main.output.resourcesDir = sourceSets.main.java.outputDir +sourceSets.test.output.resourcesDir = sourceSets.test.java.outputDir + +if (!(project.hasProperty('env') && project.getProperty('env') == 'dev')) { + sourceSets { + test { + java { + exclude '**/core/boot/tests/**' + } + } + } +} diff --git a/fineract-investor/dependencies.gradle b/fineract-investor/dependencies.gradle new file mode 100644 index 000000000..d6f93f2c3 --- /dev/null +++ b/fineract-investor/dependencies.gradle @@ -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. + */ + +dependencies { + // 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'. + + // implementation dependencies are directly used (compiled against) in src/main (and src/test) + // + api(project(path: ':fineract-core')) + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' + annotationProcessor 'org.mapstruct:mapstruct-processor' + + // testCompile dependencies are ONLY used in src/test, not src/main. + // Do NOT repeat dependencies which are ALREADY in implementation or runtimeOnly! + // + testImplementation( 'io.cucumber:cucumber-spring', + 'io.github.classgraph:classgraph', + ) + 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' + exclude group: 'jakarta.activation' + exclude group: 'javax.activation' + exclude group: 'org.skyscreamer' + } + testImplementation ('org.mockito:mockito-inline') +} diff --git a/fineract-investor/src/main/resources/db/changelog/tenant/module/investor/module-changelog-master.xml b/fineract-investor/src/main/resources/db/changelog/tenant/module/investor/module-changelog-master.xml new file mode 100644 index 000000000..065386811 --- /dev/null +++ b/fineract-investor/src/main/resources/db/changelog/tenant/module/investor/module-changelog-master.xml @@ -0,0 +1,26 @@ + + + + + diff --git a/fineract-investor/src/main/resources/db/changelog/tenant/module/investor/parts/0001_initial_schema.xml b/fineract-investor/src/main/resources/db/changelog/tenant/module/investor/parts/0001_initial_schema.xml new file mode 100644 index 000000000..306eb1e3a --- /dev/null +++ b/fineract-investor/src/main/resources/db/changelog/tenant/module/investor/parts/0001_initial_schema.xml @@ -0,0 +1,29 @@ + + + + + Executed asset externalization + + + diff --git a/fineract-investor/src/test/java/.gitkeep b/fineract-investor/src/test/java/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/fineract-investor/src/test/resources/.gitkeep b/fineract-investor/src/test/resources/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle index 924b44829..83dbb36eb 100644 --- a/fineract-provider/build.gradle +++ b/fineract-provider/build.gradle @@ -25,6 +25,7 @@ apply plugin: 'org.springframework.boot' apply plugin: 'com.gorylenko.gradle-git-properties' apply plugin: 'io.swagger.core.v3.swagger-gradle-plugin' apply plugin: 'com.google.cloud.tools.jib' +apply plugin: 'org.springframework.boot' check.dependsOn('cucumber') diff --git a/fineract-provider/dependencies.gradle b/fineract-provider/dependencies.gradle index 352e51d4c..d2cd3244a 100644 --- a/fineract-provider/dependencies.gradle +++ b/fineract-provider/dependencies.gradle @@ -18,6 +18,8 @@ */ dependencies { + implementation(project(path: ':fineract-core')) + implementation(project(path: ':fineract-investor')) providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") // Never use "compile" scope, but make all dependencies either 'implementation', 'runtimeOnly' or 'testCompile'. diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/migration/TenantModuleRootFilter.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/migration/TenantModuleRootFilter.java new file mode 100644 index 000000000..9a71322c7 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/migration/TenantModuleRootFilter.java @@ -0,0 +1,29 @@ +/** + * 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.infrastructure.core.service.migration; + +import liquibase.changelog.IncludeAllFilter; + +public class TenantModuleRootFilter implements IncludeAllFilter { + + @Override + public boolean include(String changeLogPath) { + return changeLogPath.endsWith("module-changelog-master.xml"); + } +} diff --git a/fineract-provider/src/main/resources/db/changelog/db.changelog-master.xml b/fineract-provider/src/main/resources/db/changelog/db.changelog-master.xml index 6d7a0bd16..4edca24bf 100644 --- a/fineract-provider/src/main/resources/db/changelog/db.changelog-master.xml +++ b/fineract-provider/src/main/resources/db/changelog/db.changelog-master.xml @@ -31,5 +31,6 @@ + diff --git a/fineract-war/build.gradle b/fineract-war/build.gradle index 263947d71..82ec98556 100644 --- a/fineract-war/build.gradle +++ b/fineract-war/build.gradle @@ -48,6 +48,8 @@ war { } dependencies { + implementation project(':fineract-core') + implementation project(':fineract-investor') implementation project(':fineract-provider') } diff --git a/integration-tests/dependencies.gradle b/integration-tests/dependencies.gradle index 1aa178779..64223fa74 100644 --- a/integration-tests/dependencies.gradle +++ b/integration-tests/dependencies.gradle @@ -22,6 +22,8 @@ dependencies { // tomcat 'org.apache.tomcat:tomcat:9.0.69@zip' testImplementation( files("$rootDir/fineract-provider/build/classes/java/main/"), + project(path: ':fineract-core', configuration: 'runtimeElements'), + project(path: ':fineract-investor', configuration: 'runtimeElements'), project(path: ':fineract-provider', configuration: 'runtimeElements'), project(path: ':fineract-avro-schemas', configuration: 'runtimeElements'), project(path: ':fineract-client', configuration: 'runtimeElements'), diff --git a/settings.gradle b/settings.gradle index 6d87daf20..85f504611 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,7 +17,9 @@ * under the License. */ rootProject.name='fineract' +include ':fineract-core' include ':fineract-provider' +include ':fineract-investor' include ':fineract-war' include ':integration-tests' include ':twofactor-tests'