FINERACT-1209: Integration Tests using new Swagger Client API
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
1e7f1f5847
commit
578e098670
+1
-1
@@ -72,6 +72,6 @@ script:
|
||||
# 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 -PautomatedBuild=true licenseMain licenseTest licenseIntegrationTest check && ./gradlew --console=plain -PautomatedBuild=true build integrationTest --fail-fast && sudo service mysql stop && docker-compose build && docker-compose up -d && sleep 60s && curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/health && (( $(curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/info | wc --chars) > 100 ))
|
||||
- ./gradlew --console=plain -PautomatedBuild=true licenseMain licenseTest check -x test && ./gradlew --console=plain -PautomatedBuild=true build test --fail-fast && sudo service mysql stop && docker-compose build && docker-compose up -d && sleep 60s && curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/health && (( $(curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 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 fancy /actuator/info test makes sure that has more than 100 characters of JSON to test that the git.properties worked (see FINERACT-983)
|
||||
|
||||
+9
-19
@@ -19,7 +19,7 @@
|
||||
// TODO: this is work in progress, please follow FINERACT-1171
|
||||
buildscript {
|
||||
ext {
|
||||
jacocoVersion = '0.8.5'
|
||||
jacocoVersion = '0.8.6'
|
||||
retrofitVersion = '2.9.0'
|
||||
okhttpVersion = '4.7.2'
|
||||
oltuVersion = '1.0.1'
|
||||
@@ -27,6 +27,7 @@ buildscript {
|
||||
[
|
||||
'fineract-api',
|
||||
'fineract-provider',
|
||||
'integration-tests',
|
||||
'fineract-client'
|
||||
].contains(it.name)
|
||||
}
|
||||
@@ -88,6 +89,8 @@ allprojects {
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom 'org.springframework:spring-framework-bom:5.3.0'
|
||||
mavenBom 'org.springframework.boot:spring-boot-dependencies:2.3.4.RELEASE'
|
||||
mavenBom 'org.junit:junit-bom:5.7.0'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -359,19 +362,9 @@ configure(project.fineractJavaProjects) {
|
||||
sourceSets.main.output.resourcesDir = sourceSets.main.java.outputDir
|
||||
sourceSets.test.output.resourcesDir = sourceSets.test.java.outputDir
|
||||
|
||||
sourceSets {
|
||||
integrationTest {
|
||||
compileClasspath += main.output + test.output
|
||||
runtimeClasspath += main.output + test.output
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
implementation.setCanBeResolved(true)
|
||||
api.setCanBeResolved(true)
|
||||
|
||||
integrationTestCompile.extendsFrom testImplementation
|
||||
integrationTestRuntime.extendsFrom testRuntime
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
@@ -416,6 +409,11 @@ configure(project.fineractJavaProjects) {
|
||||
|
||||
// Configuration for the spotless plugin
|
||||
// https://github.com/diffplug/spotless/tree/main/plugin-gradle
|
||||
dependencies {
|
||||
spotbugsPlugins 'jp.skypencil.findbugs.slf4j:bug-pattern:1.5.0@jar'
|
||||
spotbugs 'com.github.spotbugs:spotbugs:4.1.4'
|
||||
}
|
||||
|
||||
spotless {
|
||||
java {
|
||||
targetExclude '**/build/**', '**/bin/**', '**/out/**'
|
||||
@@ -632,14 +630,6 @@ configure(project.fineractJavaProjects) {
|
||||
}
|
||||
}
|
||||
}
|
||||
spotbugsIntegrationTest {
|
||||
reports {
|
||||
html {
|
||||
enabled = true
|
||||
stylesheet = 'fancy-hist.xsl'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Configuration for the modernizer plugin
|
||||
// https://github.com/andygoossens/gradle-modernizer-plugin
|
||||
|
||||
@@ -27,4 +27,6 @@
|
||||
|
||||
<suppressions>
|
||||
<suppress files="[/\\]build[/\\]generated[/\\]" checks=".*"/>
|
||||
<!-- TODO: fix integration test formatting -->
|
||||
<suppress files="[/\\]integration-tests[/\\]src[/\\]test[/\\]main[/\\]" checks=".*"/>
|
||||
</suppressions>
|
||||
|
||||
@@ -21,10 +21,9 @@ description = 'Fineract Provider'
|
||||
apply plugin: 'rebel'
|
||||
apply plugin: 'war'
|
||||
apply plugin: 'org.springframework.boot'
|
||||
apply plugin: 'com.bmuschko.cargo'
|
||||
apply plugin: 'openjpa'
|
||||
apply plugin: "com.gorylenko.gradle-git-properties"
|
||||
apply plugin: "io.swagger.core.v3.swagger-gradle-plugin"
|
||||
apply plugin: 'com.gorylenko.gradle-git-properties'
|
||||
apply plugin: 'io.swagger.core.v3.swagger-gradle-plugin'
|
||||
apply plugin: 'distribution'
|
||||
apply plugin: 'signing'
|
||||
|
||||
@@ -176,51 +175,6 @@ war {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
// Configuration for the Gradle Cargo plugin
|
||||
// https://github.com/bmuschko/gradle-cargo-plugin
|
||||
configurations
|
||||
{
|
||||
tomcat
|
||||
}
|
||||
|
||||
dependencies {
|
||||
tomcat "org.apache.tomcat:tomcat:9.0.39@zip"
|
||||
}
|
||||
|
||||
cargo {
|
||||
containerId "tomcat9x"
|
||||
|
||||
// looks like Cargo doesn't detect the WAR file automatically in the multi-module setup
|
||||
deployable {
|
||||
file = file("${buildDir}/libs/fineract-provider.war")
|
||||
context = 'fineract-provider'
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cargoRunLocal.dependsOn war
|
||||
cargoStartLocal.dependsOn war
|
||||
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
|
||||
sourceSets.test.output.resourcesDir = sourceSets.test.java.outputDir
|
||||
@@ -242,25 +196,6 @@ if (!(project.hasProperty('env') && project.getProperty('env') == 'dev')) {
|
||||
}
|
||||
}
|
||||
|
||||
task integrationTest(type:Test) {
|
||||
description = "Run integration tests (located in src/integrationTest/java). Starts Tomcat in daemon mode before executing the tests (and stops it after)."
|
||||
dependsOn cargoStartLocal
|
||||
finalizedBy cargoStopLocal
|
||||
|
||||
testClassesDirs = project.sourceSets.integrationTest.output.classesDirs
|
||||
classpath = project.sourceSets.integrationTest.runtimeClasspath
|
||||
}
|
||||
|
||||
integrationTest {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
// FINERACT-927
|
||||
events "skipped", "failed"
|
||||
showStandardStreams = false
|
||||
exceptionFormat "full"
|
||||
}
|
||||
}
|
||||
|
||||
// Configuration for SQL tasks
|
||||
// https://docs.groovy-lang.org/latest/html/api/groovy/sql/Sql.html
|
||||
import groovy.sql.Sql
|
||||
|
||||
@@ -19,9 +19,6 @@
|
||||
dependencies {
|
||||
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
|
||||
|
||||
spotbugsPlugins "jp.skypencil.findbugs.slf4j:bug-pattern:1.5.0@jar"
|
||||
spotbugs 'com.github.spotbugs:spotbugs:4.1.4'
|
||||
|
||||
// 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'.
|
||||
@@ -118,7 +115,7 @@ dependencies {
|
||||
'org.apache.httpcomponents:httpclient',
|
||||
)
|
||||
|
||||
// testCompile dependencies are ONLY used in src/test and/or src/integrationTest, not src/main.
|
||||
// testCompile dependencies are ONLY used in src/test, not src/main.
|
||||
// Do NOT repeat dependencies which are ALREADY in implementation or runtimeOnly!
|
||||
//
|
||||
testImplementation( 'org.mockito:mockito-core',
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* 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 Integration Tests'
|
||||
|
||||
apply plugin: 'com.bmuschko.cargo'
|
||||
|
||||
// Configuration for the Gradle Cargo plugin
|
||||
// https://github.com/bmuschko/gradle-cargo-plugin
|
||||
configurations {
|
||||
tomcat
|
||||
}
|
||||
|
||||
apply from: 'dependencies.gradle'
|
||||
|
||||
cargo {
|
||||
containerId "tomcat9x"
|
||||
|
||||
// looks like Cargo doesn't detect the WAR file automatically in the multi-module setup
|
||||
deployable {
|
||||
file = file("$rootDir/fineract-provider/build/libs/fineract-provider.war")
|
||||
context = 'fineract-provider'
|
||||
}
|
||||
|
||||
local {
|
||||
installer {
|
||||
installConfiguration = configurations.tomcat
|
||||
downloadDir = file("$buildDir/download")
|
||||
extractDir = file("$buildDir/tomcat")
|
||||
}
|
||||
startStopTimeout = 240000
|
||||
containerProperties {
|
||||
property 'cargo.tomcat.connector.keystoreFile', file("$rootDir/fineract-provider/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 ':fineract-provider:war'
|
||||
cargoStartLocal.dependsOn ':fineract-provider:war'
|
||||
cargoStartLocal.mustRunAfter 'testClasses'
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
// FINERACT-927
|
||||
events 'skipped', 'failed'
|
||||
showStandardStreams = false
|
||||
exceptionFormat 'full'
|
||||
}
|
||||
dependsOn cargoStartLocal
|
||||
finalizedBy cargoStopLocal
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* 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 {
|
||||
// testCompile dependencies are ONLY used in src/test, not src/main.
|
||||
// Do NOT repeat dependencies which are ALREADY in implementation or runtimeOnly!
|
||||
//
|
||||
tomcat 'org.apache.tomcat:tomcat:9.0.39@zip'
|
||||
testImplementation( files("$rootDir/fineract-provider/build/classes/java/main/"),
|
||||
project(path: ':fineract-provider', configuration: 'runtimeElements'),
|
||||
'org.junit.jupiter:junit-jupiter-api:5.7.0',
|
||||
'com.google.truth:truth:1.0.1',
|
||||
'com.google.truth.extensions:truth-java8-extension:1.0.1',
|
||||
'org.awaitility:awaitility',
|
||||
// 'com.google.code.gson:gson',
|
||||
)
|
||||
testImplementation ('org.mock-server:mockserver-junit-jupiter') {
|
||||
exclude group: 'com.sun.mail', module: 'mailapi'
|
||||
exclude group: 'javax.servlet', module: 'javax.servlet-api'
|
||||
exclude group: 'javax.validation'
|
||||
}
|
||||
testImplementation ('io.rest-assured:rest-assured') {
|
||||
exclude group: 'commons-logging'
|
||||
exclude group: 'org.apache.sling'
|
||||
exclude group: 'com.sun.xml.bind'
|
||||
}
|
||||
testRuntimeOnly(
|
||||
'org.junit.jupiter:junit-jupiter-engine:5.7.0'
|
||||
)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user