diff --git a/.travis.yml b/.travis.yml
index 244228b4d..497c01138 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -74,6 +74,11 @@ script:
# 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
# NOTE: Sleep after docker-compose increased to 60 seconds as often Travis would fail to get Docker up in 30 seconds
- - ./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 ))
+ - ./gradlew --console=plain -PautomatedBuild=true -q licenseMain licenseTest licenseIntegrationTest check && ./gradlew --console=plain -PautomatedBuild=true integrationTest --fail-fast && sudo service mysql stop && docker-compose build && docker-compose up -d && sleep 60s && 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)
+
+ # Generate and Build Swagger Code
+ - ls
+ - ./gradlew generateSwaggerCode
+ - cd build/swagger-code-fineract && mvn test
diff --git a/Dockerfile b/Dockerfile
index 4b411643b..bfc5350b6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -22,7 +22,7 @@ RUN apt-get update -qq && apt-get install -y wget
COPY . fineract
WORKDIR /fineract
-RUN ./gradlew --no-daemon -x rat -x test bootJar
+RUN ./gradlew -PautomatedBuild=true --no-daemon -q -x rat -x test bootJar
WORKDIR /fineract/target
RUN jar -xf /fineract/build/libs/fineract-provider.jar
@@ -33,7 +33,7 @@ RUN jar -xf /fineract/build/libs/fineract-provider.jar
# 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
+RUN wget -q https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.20/mysql-connector-java-8.0.20.jar
# =========================================
diff --git a/README.md b/README.md
index 4c93bd0c5..d387a8c81 100644
--- a/README.md
+++ b/README.md
@@ -249,9 +249,11 @@ 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 Full API Matrix and can be viewed [here](https://demo.fineract.dev/fineract-provider/api-docs/apiLive.htm "API Documentation").
+The API for Fineract is documented in [apiLive.htm](fineract-provider/src/main/resources/static/api-docs/apiLive.htm), and the [apiLive.htm can be viewed on Fineract.dev](https://demo.fineract.dev/fineract-provider/api-docs/apiLive.htm "API Documentation"). If you have your own Fineract instance running, you can find this documentation under [/fineract-provider/api-docs/apiLive.htm](https://localhost:8443/fineract-provider/api-docs/apiLive.htm).
-If you have your own Fineract instance running, you can find the same documentation under '(your host:port)/fineract-provider/api-docs/apiLive.htm' under your. The Swagger documentation (work in progress) can be accessed under '(your host:port)/fineract-provider/swagger-ui/index.html'
+The Swagger documentation (work in progress; see [FINERACT-733](https://issues.apache.org/jira/browse/FINERACT-733)) can be accessed under [/fineract-provider/swagger-ui/index.html](https://localhost:8443/fineract-provider/swagger-ui/index.html) and [live Swagger UI here on Fineract.dev](https://demo.fineract.dev/fineract-provider/swagger-ui/index.html).
+
+Apache Fineract supports client code generation using [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) based on the [OpenAPI Specification](https://swagger.io/specification/). For more instructions on how to generate the client code, check [docs/developers/swagger/client.md](docs/developers/swagger/client.md).
API clients (Web UIs, Mobile, etc.)
diff --git a/config/fineractdev-formatter.xml b/config/fineractdev-formatter.xml
index 0a412cb1e..05b6ad355 100644
--- a/config/fineractdev-formatter.xml
+++ b/config/fineractdev-formatter.xml
@@ -79,7 +79,7 @@
-
+
diff --git a/docs/developers/swagger/client.md b/docs/developers/swagger/client.md
new file mode 100644
index 000000000..c854340be
--- /dev/null
+++ b/docs/developers/swagger/client.md
@@ -0,0 +1,26 @@
+Generate Apache Fineract API Client
+============
+
+Apache Fineract supports client code generation using [Swagger Codegen](https://github.com/swagger-api/swagger-codegen). Project supports [all clients](https://github.com/swagger-api/swagger-codegen#overview) supported by Swagger Codegen. It uses [OpenAPI Specification Version 3.0.3](https://swagger.io/specification/).
+
+## Generate API Client
+
+In root directory of the project:
+
+- Run `./gradlew build`
+- Run `./gradlew generateSwaggerCode`
+
+The client code will be generated under `build/swagger-code-fineract`
+
+## Build API Client:
+
+- Run `cd build/swagger-code-fineract`
+- Run `./gradlew build`
+
+## Customize Code Generator:
+
+Swagger Codegen provides several options to customize the generated code. [Here](https://openapi-generator.tech/docs/generators/java/) are the options available for customization.
+
+- Open `fineract-provider/config/swagger/config.json`
+- Customize options
+- Build the project again as mentioned in **Generate API Client Code** section
\ No newline at end of file
diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle
index ef2c5da15..c54a3d608 100644
--- a/fineract-provider/build.gradle
+++ b/fineract-provider/build.gradle
@@ -20,10 +20,17 @@ description = '''\
Run as:
gradle clean bootRun'''
+group = 'org.apache.fineract'
+buildDir = new File(rootProject.projectDir, "../build")
+
+repositories {
+ jcenter()
+ mavenCentral()
+}
+
project.ext.jerseyVersion = '1.19.4'
ext["groovy.version"] = '3.0.3'
-
buildscript {
ext {
jacocoVersion = '0.8.5'
@@ -35,28 +42,28 @@ buildscript {
}
dependencies {
- classpath 'io.spring.gradle:dependency-management-plugin:1.0.9.RELEASE'
- classpath 'com.bmuschko:gradle-cargo-plugin:2.7.1',
- 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0',
- 'org.zeroturnaround:gradle-jrebel-plugin:1.1.10',
- 'org.springframework.boot:spring-boot-gradle-plugin:2.2.7.RELEASE'
- // below
- classpath 'org.apache.openjpa:openjpa:3.1.1' // when upgrading, also change OpenJPA version repeated below in dependencyManagement!
+ classpath 'io.spring.gradle:dependency-management-plugin:1.0.10.RELEASE'
+ classpath 'com.bmuschko:gradle-cargo-plugin:2.7.1'
+ classpath 'org.zeroturnaround:gradle-jrebel-plugin:1.1.10'
+ classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.3.2.RELEASE'
+ classpath 'gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.15.0'
+ classpath 'org.apache.openjpa:openjpa:3.1.2' // when upgrading, also change OpenJPA version repeated below in dependencyManagement!
classpath 'com.radcortez.gradle:openjpa-gradle-plugin:3.1.0'
classpath 'org.nosphere.apache:creadur-rat-gradle:0.7.0'
- classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.4.1"
+ classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.5.0"
classpath "gradle.plugin.com.github.andygoossens:gradle-modernizer-plugin:1.3.0"
- classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:2.2.2"
+ classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:2.2.3"
classpath "net.ltgt.gradle:gradle-errorprone-plugin:1.2.1"
- classpath "com.diffplug.spotless:spotless-plugin-gradle:4.4.0"
- classpath "io.swagger.core.v3:swagger-gradle-plugin:2.1.2"
+ classpath "com.diffplug.spotless:spotless-plugin-gradle:5.1.1"
+ classpath "io.swagger.core.v3:swagger-gradle-plugin:2.1.4"
+ classpath "gradle.plugin.org.hidetake:gradle-swagger-generator-plugin:2.18.2"
}
}
apply plugin: 'io.spring.dependency-management'
apply plugin: "org.nosphere.apache.rat"
apply plugin: 'rebel'
-apply plugin: 'license'
+apply plugin: 'com.github.hierynomus.license'
apply plugin: 'war'
apply plugin: 'org.springframework.boot'
apply plugin: 'eclipse'
@@ -71,8 +78,9 @@ apply plugin: 'com.github.andygoossens.gradle-modernizer-plugin'
apply plugin: 'jacoco'
apply plugin: "com.gorylenko.gradle-git-properties"
apply plugin: "net.ltgt.errorprone"
-apply plugin: "com.diffplug.gradle.spotless"
+apply plugin: "com.diffplug.spotless"
apply plugin: "io.swagger.core.v3.swagger-gradle-plugin"
+apply plugin: "org.hidetake.swagger.generator"
dependencyManagement {
imports {
@@ -80,44 +88,46 @@ dependencyManagement {
}
dependencies {
- // As much as possible, we avoid fixed versions, and prefer inheriting them from the Spring BOM, thus NOT listing versions here.
- // (The :+ seems to mean latest available version available on Maven Central, which we should also avoid, as it's not isolated?)
+ // We use fixed versions, instead of inheriting them from the Spring BOM, to be able to be on more recent ones.
+ // We do not use :+ to get the latest available version available on Maven Central, as that could suddenly break things.
+ // We use the Renovate Bot to automatically propose Pull Requests (PRs) when upgrades for all of these versions are available.
dependency 'org.springframework.security.oauth:spring-security-oauth2:2.5.0.RELEASE'
- dependency "org.apache.openjpa:openjpa:3.1.1" // when upgrading, also change OpenJPA version repeated above in buildscript!
+ dependency 'org.apache.openjpa:openjpa:3.1.2' // when upgrading, also change OpenJPA version repeated above in buildscript!
dependency 'com.squareup.retrofit:retrofit:1.9.0'
dependency 'com.squareup.okhttp:okhttp:2.7.5'
dependency 'com.squareup.okhttp:okhttp-urlconnection:2.7.5'
+ dependency 'com.google.guava:guava:29.0-jre'
dependency 'com.google.code.gson:gson:2.8.6'
dependency 'org.apache.commons:commons-email:1.5'
dependency 'commons-io:commons-io:2.7'
dependency 'org.drizzle.jdbc:drizzle-jdbc:1.4'
- dependency 'com.github.librepdf:openpdf:1.3.19'
+ dependency 'com.github.librepdf:openpdf:1.3.20'
dependency 'org.mnode.ical4j:ical4j:3.0.19'
- dependency 'org.flywaydb:flyway-core:6.4.4'
+ dependency 'org.flywaydb:flyway-core:6.5.4'
dependency 'org.quartz-scheduler:quartz:2.3.2'
- dependency 'com.amazonaws:aws-java-sdk-s3:1.11.804'
+ dependency 'com.amazonaws:aws-java-sdk-s3:1.11.832'
dependency 'org.ehcache:ehcache:3.8.1'
dependency 'com.github.spullara.mustache.java:compiler:0.9.6'
dependency 'com.jayway.jsonpath:json-path:2.4.0'
dependency 'org.apache.tika:tika-core:1.24.1'
dependency 'org.apache.httpcomponents:httpclient:4.5.12'
- dependency 'io.swagger:swagger-jersey-jaxrs:1.6.1'
+ dependency 'io.swagger.core.v3:swagger-annotations:2.1.4'
dependency 'jakarta.management.j2ee:jakarta.management.j2ee-api:1.1.4'
dependency 'jakarta.jms:jakarta.jms-api:2.0.3'
dependency 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3'
- dependency 'org.apache.activemq:activemq-broker:5.15.13'
- dependency 'org.apache.bval:org.apache.bval.bundle:2.0.3'
- dependency 'org.mockito:mockito-core:3.3.3'
- dependency 'org.mockito:mockito-junit-jupiter:3.3.3'
- dependency 'io.github.classgraph:classgraph:4.8.86'
+ dependency 'jakarta.validation:jakarta.validation-api:3.0.0'
+ dependency 'org.apache.activemq:activemq-broker:5.16.0'
+ dependency 'org.apache.bval:org.apache.bval.bundle:2.0.4'
+ dependency 'org.mockito:mockito-core:3.4.6'
+ dependency 'org.mockito:mockito-junit-jupiter:3.4.6'
+ dependency 'io.github.classgraph:classgraph:4.8.87'
dependency 'org.awaitility:awaitility:4.0.3'
- dependency 'com.github.spotbugs:spotbugs-annotations:4.0.4'
+ dependency 'com.github.spotbugs:spotbugs-annotations:4.1.1'
dependency 'javax.cache:cache-api:1.1.1'
- dependency 'org.mock-server:mockserver-junit-jupiter:5.10'
-
- // If this is upgraded, you need to change path in WebFrontEndConfiguration
- dependency 'org.webjars.npm:swagger-ui-dist:3.27.0'
+ dependency 'org.mock-server:mockserver-junit-jupiter:5.11.0'
+ dependency 'org.webjars.npm:swagger-ui-dist:3.31.1'
+ dependency 'org.webjars:webjars-locator-core:0.46'
dependency ('org.dom4j:dom4j:2.1.3') {
exclude 'relaxngDatatype:relaxngDatatype' // already in com.sun.xml.bind:jaxb-osgi:2.3.0.1
@@ -155,16 +165,6 @@ sourceCompatibility = JavaVersion.VERSION_11
/* define binary compatibility version */
targetCompatibility = JavaVersion.VERSION_11
-project.ext.mysqlUser='root'
-project.ext.mysqlPassword='mysql'
-
-group = 'org.apache.fineract'
-buildDir = new File(rootProject.projectDir, "../build")
-repositories {
- jcenter()
- // mavenLocal() // useful for local dev using MariaDB4j SNAPSHOTs (not needed for real-world non-SNAPHOT builds)
-}
-
// 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')
@@ -179,8 +179,15 @@ eclipse
}
}
+// Configuration for the OpenJPA enhance task
+// https://github.com/radcortez/openjpa-gradle-plugin
+System.setProperty("openjpa.Log", "commons")
+
openjpa {
- includes = ['**/AbstractPersistableCustom.class', '**/domain/*.class']
+ includes = [
+ '**/AbstractPersistableCustom.class',
+ '**/domain/*.class'
+ ]
enhance {
enforcePropertyRestrictions true
}
@@ -189,11 +196,13 @@ openjpa {
// Configuration for Swagger documentation generation task
// https://github.com/swagger-api/swagger-core/tree/master/modules/swagger-gradle-plugin
resolve {
+ logging.captureStandardOutput LogLevel.INFO
outputFileName = 'fineract'
- outputFormat = 'JSON'
+ outputFormat = 'YAML'
prettyPrint = 'TRUE'
classpath = sourceSets.main.runtimeClasspath
outputDir = file("${buildDir}/classes/java/main/static/swagger-ui")
+ openApiFile = file("config/swagger/fineract-input.yaml")
}
// Configuration for JaCoCo code coverage task
@@ -201,36 +210,45 @@ resolve {
jacoco {
toolVersion = jacocoVersion
reportsDir = file("$buildDir/reports/jacoco")
-
}
-jacocoTestReport{
- reports{
+jacocoTestReport {
+ reports {
html.enabled=true
xml.enabled=true
html.destination file("${buildDir}/code-coverage")
}
}
+// Configuration for the spotless plugin
+// https://github.com/diffplug/spotless/tree/main/plugin-gradle
spotless {
- format 'misc', {
- target '**/*.md', '**/*.properties', '**/*.gradle', '**/.gitignore', '**/*.yml', '**/*.xml', '**/**.json', '**/*.sql'
- targetExclude '**/build/**', '**/bin/**', '**/.settings/**'
- indentWithSpaces(4)
- endWithNewline()
- trimTrailingWhitespace()
- }
+ format 'misc', {
+ target '**/*.md', '**/*.properties', '**/.gitignore', '**/*.yml', '**/*.xml', '**/**.json', '**/*.sql'
+ targetExclude '**/build/**', '**/bin/**', '**/.settings/**','**/.idea/**'
+ indentWithSpaces(4)
+ endWithNewline()
+ trimTrailingWhitespace()
+ }
- java {
- importOrder() //sort imports alphabetically
- removeUnusedImports()
- eclipse().configFile '../config/fineractdev-formatter.xml'
- endWithNewline()
- trimTrailingWhitespace()
+ groovyGradle {
+ target '*.gradle', '**/*.gradle'
+ greclipse()
+ indentWithSpaces(4)
+ endWithNewline()
+ trimTrailingWhitespace()
+ }
- // Enforce style modifier order
- custom 'Modifier ordering', {
- def modifierRanking = [
+ java {
+ importOrder() //sort imports alphabetically
+ removeUnusedImports()
+ eclipse().configFile '../config/fineractdev-formatter.xml'
+ endWithNewline()
+ trimTrailingWhitespace()
+
+ // Enforce style modifier order
+ custom 'Modifier ordering', {
+ def modifierRanking = [
public : 1,
protected : 2,
private : 3,
@@ -243,20 +261,19 @@ spotless {
synchronized: 10,
native : 11,
strictfp : 12]
- // Find any instance of multiple modifiers. Lead with a non-word character to avoid
- // accidental matching against for instance, "an alternative default value"
- it.replaceAll(/\W(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, {
- // Do not replace the leading non-word character. Identify the modifiers
- it.replaceAll(/(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, {
- // Sort the modifiers according to the ranking above
- it.split().sort({ modifierRanking[it] }).join(' ') + ' '
- }
- )
+ // Find any instance of multiple modifiers. Lead with a non-word character to avoid
+ // accidental matching against for instance, "an alternative default value"
+ it.replaceAll(/\W(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, {
+ // Do not replace the leading non-word character. Identify the modifiers
+ it.replaceAll(/(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, {
+ // Sort the modifiers according to the ranking above
+ it.split().sort({ modifierRanking[it] }).join(' ') + ' '
+ }
+ )
+ }
+ )
}
- )
- }
-
- }
+ }
lineEndings 'UNIX'
}
@@ -289,7 +306,7 @@ rat {
'**/.gitignore',
'**/.gitkeep',
'**/*.iml',
- //Notice files
+ // Notice files
'**/NOTICE_RELEASE',
'**/NOTICE_SOURCE',
// Swagger License
@@ -304,8 +321,7 @@ rat {
'**/native/**',
'**/wrapper/**',
'**/build/**',
-
- //Api Docs
+ // Api Docs
'**/api-docs/*.*',
'**/docs/system-architecture/.htaccess',
'**/docs/system-architecture/404.html',
@@ -313,14 +329,11 @@ rat {
'**/docs/system-architecture/**/*.xml',
'**/bootstrap-3.0.0/assets/application.js',
'**/system-architecture/js/plugins.js',
-
- //Apache License
+ // Apache License
'**/bootstrap-3.0.0/assets/less.js',
'**/css/bootstrap-3.0.0/**/*.*',
-
- //Public Domain See http://www.JSON.org/js.html
+ // Public Domain See http://www.JSON.org/js.html
'**/bootstrap-3.0.0/assets/json2.js.htm',
-
// MIT License
'**/modernizr-2.6.2.min.js',
'**/css/normalize.css',
@@ -335,12 +348,10 @@ rat {
'**/system-architecture/js/vendor/toc-0.1.2/jquery.toc.min.js',
'**/assets/respond.min.js',
'**/assets/html5shiv.js',
-
- //BSD License
+ // BSD License
'**/assets/uglify.js',
- //Ignore out folder
+ // Ignore out folder
'**/out/**',
-
// Git build info
"**/git.properties",
]
@@ -369,13 +380,34 @@ configurations {
}
tasks.withType(JavaCompile) {
- options.compilerArgs += ["-Xlint:unchecked","-Xlint:cast","-Xlint:auxiliaryclass","-Xlint:deprecation",
- "-Xlint:dep-ann","-Xlint:divzero","-Xlint:empty","-Xlint:exports","-Xlint:fallthrough",
- "-Xlint:finally","-Xlint:module","-Xlint:opens","-Xlint:options","-Xlint:overloads",
- "-Xlint:overrides","-Xlint:path","-Xlint:processing","-Xlint:removal",
- "-Xlint:requires-automatic","-Xlint:requires-transitive-automatic","-Xlint:try",
- "-Xlint:varargs","-Xlint:preview","-Xlint:static","-Werror"]
- // TODO FINERACT-959 (gradually) enable -Xlint:all (see "javac -help -X")
+ options.compilerArgs += [
+ "-Xlint:unchecked",
+ "-Xlint:cast",
+ "-Xlint:auxiliaryclass",
+ "-Xlint:deprecation",
+ "-Xlint:dep-ann",
+ "-Xlint:divzero",
+ "-Xlint:empty",
+ "-Xlint:exports",
+ "-Xlint:fallthrough",
+ "-Xlint:finally",
+ "-Xlint:module",
+ "-Xlint:opens",
+ "-Xlint:options",
+ "-Xlint:overloads",
+ "-Xlint:overrides",
+ "-Xlint:path",
+ "-Xlint:processing",
+ "-Xlint:removal",
+ "-Xlint:requires-automatic",
+ "-Xlint:requires-transitive-automatic",
+ "-Xlint:try",
+ "-Xlint:varargs",
+ "-Xlint:preview",
+ "-Xlint:static",
+ "-Werror"
+ ]
+ // TODO FINERACT-959 (gradually) enable -Xlint:all (see "javac -help -X")
options.deprecation = true
options.errorprone {
@@ -383,28 +415,15 @@ tasks.withType(JavaCompile) {
//Todo Remove necessary checks from this list
disable(
"UnusedVariable",
- "SameNameButDifferent",
- "UnusedMethod",
- "ModifiedButNotUsed",
"TypeParameterUnusedInFormals",
- "UnusedNestedClass",
- "UndefinedEquals",
"JdkObsolete",
"EmptyBlockTag",
"MissingSummary",
- "MutablePublicArray",
"InvalidParam",
"ReturnFromVoid",
"AlmostJavadoc",
- "PublicConstructorForAbstractClass",
- "ProtectedMembersInFinalClass",
- "StaticAssignmentInConstructor",
- "UnescapedEntity",
"InvalidBlockTag",
- "ModifyCollectionInEnhancedForLoop",
- "NonCanonicalType",
- "InvalidInlineTag",
- )
+ )
//TODO gradually enable these checks
error(
"DefaultCharset",
@@ -429,6 +448,7 @@ tasks.withType(JavaCompile) {
"StreamResourceLeak",
"TruthIncompatibleType",
"ByteBufferBackingArray",
+ "SameNameButDifferent",
"OrphanedFormatString",
"CatchAndPrintStackTrace",
"ObjectToString",
@@ -456,35 +476,52 @@ tasks.withType(JavaCompile) {
"NarrowingCompoundAssignment",
"MissingCasesInEnumSwitch",
"ReferenceEquality",
+ "UndefinedEquals",
+ "PublicConstructorForAbstractClass",
+ "UnescapedEntity",
+ "ModifyCollectionInEnhancedForLoop",
+ "NonCanonicalType",
+ "InvalidInlineTag",
+ "MutablePublicArray",
+ "StaticAssignmentInConstructor",
+ "ProtectedMembersInFinalClass",
"OperatorPrecedence",
"EqualsGetClass",
"EqualsUnsafeCast",
"DoubleBraceInitialization",
"UnnecessaryDefaultInEnumSwitch",
+ "UnusedNestedClass",
+ "UnusedMethod",
+ "ModifiedButNotUsed",
"InconsistentCapitalization",
"MissingOverride",
-// "InvalidBlockTag",
-// "InconsistentOverloads",
-// "MethodCanBeStatic",
-// "Var",
-// "ConstantField",
-// "UnnecessaryDefaultInEnumSwitch",
-// "FieldCanBeFinal"
- )
+ // "InvalidBlockTag",
+ // "InconsistentOverloads",
+ // "MethodCanBeStatic",
+ // "Var",
+ // "ConstantField",
+ // "UnnecessaryDefaultInEnumSwitch",
+ // "FieldCanBeFinal"
+ )
}
- options.compilerArgs +=["-Xmaxwarns",1500,"-Xmaxerrs",1500]
+ options.compilerArgs +=[
+ "-Xmaxwarns",
+ 1500,
+ "-Xmaxerrs",
+ 1500
+ ]
}
apply from: 'dependencies.gradle'
/* TODO https://issues.apache.org/jira/browse/FINERACT-939 (dev-dependencies.gradle has been removed, as totally broken)
-// Pick up dependencies based on the environment, defaults to production
-if (project.hasProperty('env') && project.getProperty('env') == 'dev') {
- apply from: 'dev-dependencies.gradle'
-} else {
- apply from: 'dependencies.gradle'
-}
-*/
+ // Pick up dependencies based on the environment, defaults to production
+ if (project.hasProperty('env') && project.getProperty('env') == 'dev') {
+ apply from: 'dev-dependencies.gradle'
+ } else {
+ apply from: 'dependencies.gradle'
+ }
+ */
/* Enable Oauth2 authentication based on environment, default to HTTP basic auth */
if (project.hasProperty('security') && project.getProperty('security') == 'oauth') {
@@ -517,6 +554,8 @@ if (project.hasProperty('security') && project.getProperty('security') == 'oauth
}
}
+// Configuration for the modernizer plugin
+// https://github.com/andygoossens/gradle-modernizer-plugin
modernizer {
includeTestClasses = true
failOnViolations = true
@@ -534,41 +573,47 @@ modernizer {
exclusions = []
exclusionPatterns = [
- // To be removed when https://issues.apache.org/jira/browse/FINERACT-826 is fixed
+ // To be removed when https://issues.apache.org/jira/browse/FINERACT-826 is fixed
'org/joda/time/.*'
]
}
-compileJava{
+compileJava {
dependsOn rat
- dependsOn spotlessCheck
finalizedBy resolve
+
+ if (project.hasProperty("automatedBuild")) {
+ dependsOn(spotlessCheck)
+ } else {
+ dependsOn(spotlessApply)
+ }
}
-/*
-pmd {
- sourceSets = [sourceSets.main]
-}
-*/
war {
- from('../licenses/binary/') { // notice the parens
+ from('../licenses/binary/') {
+ // notice the parens
into "WEB-INF/licenses/binary/" // no leading slash
}
- from('../LICENSE_RELEASE') { // notice the parens
+ from('../LICENSE_RELEASE') {
+ // notice the parens
into "WEB-INF/" // no leading slash
}
- from('../NOTICE_RELEASE') { // notice the parens
+ from('../NOTICE_RELEASE') {
+ // notice the parens
into "WEB-INF/" // no leading slash
}
rename ('LICENSE_RELEASE', 'LICENSE')
rename ('NOTICE_RELEASE', 'NOTICE')
- from('../DISCLAIMER') { // notice the parens
+ from('../DISCLAIMER') {
+ // notice the parens
into "WEB-INF/" // no leading slash
}
war.finalizedBy(bootWar)
}
+// Configuration for Gradle license plug-in
+// https://github.com/hierynomus/license-gradle-plugin
license {
header rootProject.file('../APACHE_LICENSETEXT.md')
excludes([
@@ -584,48 +629,58 @@ license {
}
task licenseFormatBuildScripts (type:nl.javadude.gradle.plugins.license.License) {
- source = fileTree(dir: '../', includes: ['**/*.bat', '**/*.sh', '**/*.sql'])
+ source = fileTree(dir: '../', includes: [
+ '**/*.bat',
+ '**/*.sh',
+ '**/*.sql'
+ ])
}
licenseFormat.dependsOn licenseFormatBuildScripts
-configurations
-{
- tomcat
-}
-
-dependencies {
- tomcat "org.apache.tomcat:tomcat:9.0.36@zip"
-}
-
+// Configuration for the errorprone plugin
+// https://github.com/tbroyer/gradle-errorprone-plugin
dependencies {
errorprone "com.google.errorprone:error_prone_core:2.4.0"
}
-cargo {
- containerId "tomcat9x"
- local {
- installer {
- installConfiguration = configurations.tomcat
- downloadDir = file("$buildDir/download")
- extractDir = file("$buildDir/tomcat")
+// Configuration for the Gradle Cargo plugin
+// https://github.com/bmuschko/gradle-cargo-plugin
+configurations
+{
+ tomcat
+}
+
+dependencies {
+ tomcat "org.apache.tomcat:tomcat:9.0.37@zip"
+}
+
+cargo {
+ containerId "tomcat9x"
+
+ local {
+ installer {
+ installConfiguration = configurations.tomcat
+ downloadDir = file("$buildDir/download")
+ extractDir = file("$buildDir/tomcat")
+ }
+ startStopTimeout = 240000
+ containerProperties {
+ property 'cargo.tomcat.connector.keystoreFile', file('src/main/resources/keystore.jks')
+ property 'cargo.tomcat.connector.keystorePass', 'openmf'
+ property 'cargo.tomcat.httpSecure', true
+ property 'cargo.tomcat.connector.sslProtocol', 'TLS'
+ property 'cargo.tomcat.connector.clientAuth', false
+ property 'cargo.protocol', 'https'
+ property 'cargo.servlet.port', 8443
+ }
}
- startStopTimeout = 240000
- containerProperties {
- property 'cargo.tomcat.connector.keystoreFile', file('src/main/resources/keystore.jks')
- property 'cargo.tomcat.connector.keystorePass', 'openmf'
- property 'cargo.tomcat.httpSecure', true
- property 'cargo.tomcat.connector.sslProtocol', 'TLS'
- property 'cargo.tomcat.connector.clientAuth', false
- property 'cargo.protocol', 'https'
- property 'cargo.servlet.port', 8443
- }
- }
}
cargoRunLocal.dependsOn bootWar
cargoStartLocal.dependsOn bootWar
cargoStartLocal.mustRunAfter "integrationTestClasses"
cargoStartLocal.mustRunAfter "enhance"
+cargoStartLocal.mustRunAfter "resolve"
/* http://stackoverflow.com/questions/19653311/jpa-repository-works-in-idea-and-production-but-not-in-gradle */
sourceSets.main.output.resourcesDir = sourceSets.main.java.outputDir
@@ -649,7 +704,7 @@ if (!(project.hasProperty('env') && project.getProperty('env') == 'dev')) {
}
sourceSets {
- integrationTest {
+ integrationTest {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
@@ -671,7 +726,8 @@ task integrationTest(type:Test) {
integrationTest {
useJUnitPlatform()
- testLogging { // FINERACT-927
+ testLogging {
+ // FINERACT-927
events "skipped", "failed"
showStandardStreams = false
exceptionFormat "full"
@@ -679,26 +735,33 @@ integrationTest {
}
test {
useJUnitPlatform()
- testLogging { // FINERACT-927
+ testLogging {
+ // FINERACT-927
events "skipped", "failed"
showStandardStreams = false
exceptionFormat "full"
}
}
+// Configuration for the Checkstyle plugin
+// https://docs.gradle.org/current/userguide/checkstyle_plugin.html
+dependencies {
+ checkstyle 'com.puppycrawl.tools:checkstyle:8.35'
+ checkstyle 'com.github.sevntu-checkstyle:sevntu-checks:1.37.1'
+}
+// Configuration for SQL tasks
+// https://docs.groovy-lang.org/latest/html/api/groovy/sql/Sql.html
import groovy.sql.Sql
-repositories {
- mavenCentral()
-}
+project.ext.mysqlUser='root'
+project.ext.mysqlPassword='mysql'
+
configurations {
driver
}
dependencies {
driver 'org.drizzle.jdbc:drizzle-jdbc:1.4'
- checkstyle 'com.puppycrawl.tools:checkstyle:8.33'
- checkstyle 'com.github.sevntu-checkstyle:sevntu-checks:1.37.1'
}
URLClassLoader loader = GroovyObject.class.classLoader
@@ -742,6 +805,9 @@ bootJar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
+// Configuration for spotbugs plugin
+// https://github.com/spotbugs/spotbugs-gradle-plugin
+
// To generate an HTML report instead of XML
spotbugs {
reportLevel = 'high'
@@ -773,6 +839,8 @@ spotbugsIntegrationTest {
}
}
+// Configuration for git properties gradle plugin
+// https://github.com/n0mer/gradle-git-properties
gitProperties {
gitPropertiesResourceDir = "$buildDir/classes/java/main/resources"
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
@@ -782,3 +850,18 @@ gitProperties {
// make sure the generateGitProperties task always executes (even when git.properties is not changed)
generateGitProperties.outputs.upToDateWhen { false }
+
+//This is for swagger code generation
+dependencies {
+ swaggerCodegen 'io.swagger.codegen.v3:swagger-codegen-cli:3.0.18'
+}
+
+swaggerSources {
+ fineract {
+ inputFile = file('../build/classes/java/main/static/swagger-ui/fineract.yaml')
+ code {
+ language = 'java'
+ configFile = file('config/swagger/config.json')
+ }
+ }
+}
diff --git a/fineract-provider/config/checkstyle/checkstyle.xml b/fineract-provider/config/checkstyle/checkstyle.xml
index 5720b78a5..6e96d2d19 100644
--- a/fineract-provider/config/checkstyle/checkstyle.xml
+++ b/fineract-provider/config/checkstyle/checkstyle.xml
@@ -46,10 +46,16 @@
+
+
+
+
+
@@ -160,6 +166,11 @@
+
+
+
+
@@ -174,6 +185,15 @@
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/fineract-provider/src/main/resources/sql/migrations/core_db/V359__remove_fied_from_address.sql b/fineract-provider/src/main/resources/sql/migrations/core_db/V359__remove_fied_from_address.sql
new file mode 100644
index 000000000..60836047f
--- /dev/null
+++ b/fineract-provider/src/main/resources/sql/migrations/core_db/V359__remove_fied_from_address.sql
@@ -0,0 +1,20 @@
+--
+-- 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.
+--
+
+DELETE FROM `m_field_configuration` WHERE field = 'street';
diff --git a/fineract-provider/src/main/resources/static/swagger-ui/index.html b/fineract-provider/src/main/resources/static/swagger-ui/index.html
index 7bc89131c..b5a6fe02b 100644
--- a/fineract-provider/src/main/resources/static/swagger-ui/index.html
+++ b/fineract-provider/src/main/resources/static/swagger-ui/index.html
@@ -39,9 +39,10 @@
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
- url: "response.json",
+ url: "fineract.yaml",
dom_id: '#swagger-ui',
deepLinking: true,
+ filter: '',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
@@ -49,11 +50,15 @@
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
- layout: "StandaloneLayout"
+ layout: "BaseLayout",
+ onComplete: function() {
+ ui.preauthorizeBasic("basicAuth", "mifos", "password");
+ ui.preauthorizeApiKey("tenantid", "default");
+ }
})
// End Swagger UI call region
-
window.ui = ui
+
}