web-api-commander/build.gradle

276 lines
8.7 KiB
Groovy

plugins {
// Apply the java plugin to add support for Java
id 'java'
// Apply the application plugin to add support for building an application
id 'application'
}
// Define the main class for the application
mainClassName = 'org.reso.commander.App'
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
dependencies {
compile 'com.google.guava:guava:30.1.1-jre'
compile 'com.google.inject:guice:5.0.1'
compile 'commons-cli:commons-cli:1.5.0'
compile 'org.apache.logging.log4j:log4j-api:2.17.0'
compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.17.0'
compile 'org.apache.logging.log4j:log4j-1.2-api:2.17.0'
compile 'org.apache.logging.log4j:log4j-core:2.17.0'
compile 'org.apache.olingo:odata-client-api:4.8.0'
compile 'org.apache.olingo:odata-commons-core:4.8.0'
compile 'org.apache.olingo:odata-client-core:4.8.0'
compile 'org.apache.poi:poi:5.0.0'
compile 'org.apache.poi:poi-ooxml:5.0.0'
compile 'io.rest-assured:rest-assured:4.4.0'
compile 'io.rest-assured:json-path:4.4.0'
compile 'io.rest-assured:json-schema-validator:4.4.0'
compile 'io.cucumber:cucumber-java8:7.1.0'
compile 'io.cucumber:cucumber-java:7.1.0'
compile 'io.cucumber:cucumber-junit:7.1.0'
compile 'io.cucumber:cucumber-guice:7.1.0'
compile 'io.cucumber:cucumber-core:7.1.0'
//TODO: choose one schema validator between this and rest-assured
compile 'com.networknt:json-schema-validator:1.0.63'
compile 'com.google.code.gson:gson:2.8.9'
compile 'org.apache.commons:commons-text:1.9'
}
configurations {
cucumberRuntime {
extendsFrom compile
}
}
jar {
manifest {
attributes "Main-Class": mainClassName
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
exclude 'META-INF/*.RSA'
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
}
// don't suppress warnings or deprecation notices
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked'
options.deprecation = true
}
String pathToMetadata = null,
pathToRESOScript = null,
certFileName = null
final String certOutputDir = 'build/certification',
cucumberJsonPath = certOutputDir + '/cucumberJson',
certReportsDir = certOutputDir + '/reports'
task testWebApiCore_2_0_0() {
group = 'RESO Certification'
description = 'Web API Core 2.0.0 Acceptance Tests' +
'\nExample: ' +
'\n ./gradlew testWebApiCore_2_0_0 -DpathToRESOScript=/path/to/web-api-core-2.0.0.resoscript -DshowResponses=true' +
'\n\nNote: by default the Web API tests assume Collection(Edm.EnumType).' +
'\nPass -DuseCollections=false if using OData IsFlags.' +
'\n\n[Report location: ' + certReportsDir + ']' +
'\n\n'
String reportName = 'web-api-server.core.2.0.0'
dependsOn jar
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
systemProperties = System.getProperties()
args = [
'--plugin',
'pretty',
'--plugin',
'json:' + cucumberJsonPath + '/' + reportName + '.json',
'--plugin',
'html:' + certReportsDir + '/' + reportName + '.html',
'--glue',
'org.reso.certification.stepdefs#WebAPIServerCore',
'src/main/java/org/reso/certification/features/web-api',
'--tags',
'@core-endorsement'
]
}
}
}
task testDataDictionary_1_7() {
group = 'RESO Certification'
description = 'Data Dictionary 1.7 Acceptance Tests' +
'\nRESOScript Example:' +
'\n ./gradlew testDataDictionary_1_7 -DpathToRESOScript=/path/to/dd17.resoscript -DshowResponses=true -Dstrict=true' +
'\n\nMetadata File Example:' +
'\n ./gradlew testDataDictionary_1_7 -DpathToMetadata=/path/to/RESODataDictionary-1.7.xml' +
'\n\nTo disable strict mode, remove the -Dstrict=true parameter. All applicants MUST pass strict mode tests to be certified!' +
'\n\n[Report location: ' + certReportsDir + ']' +
'\n\n'
String reportName = 'data-dictionary-1.7'
dependsOn jar
doLast {
javaexec {
main = 'io.cucumber.core.cli.Main'
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
systemProperties = System.getProperties()
pathToMetadata = System.getProperty('pathToMetadata', null)
pathToRESOScript = System.getProperty('pathToRESOScript', null)
if (pathToMetadata != null) {
certFileName = pathToMetadata
.substring(Math.max(pathToMetadata.lastIndexOf(File.separator) + 1, 0), pathToMetadata.lastIndexOf('.'))
} else if (pathToRESOScript != null) {
certFileName = pathToRESOScript
.substring(Math.max(pathToRESOScript.lastIndexOf(File.separator) + 1, 0), pathToRESOScript.lastIndexOf('.'))
}
args = [
'--plugin',
'pretty',
'--plugin',
'json:' + cucumberJsonPath + '/' + reportName + '.json',
'--plugin',
'html:' + certReportsDir + '/' + reportName + '.html',
'--glue',
'org.reso.certification.stepdefs#DataDictionary',
'src/main/java/org/reso/certification/features/data-dictionary/v1-7-0',
'--tags',
(systemProperties.get('cucumber.filter.tags', '').toString().trim().length() > 0
? systemProperties.get('cucumber.filter.tags') : '')
]
}
}
}
task testDataAvailability_1_7() {
group = 'RESO Certification'
description = 'Data Dictionary 1.7 Data Availability Tests' +
'\nExample:' +
'\n ./gradlew testDataAvailability_1_7 -DpathToRESOScript=/path/to/web-api-core-2.0.0.resoscript' +
'\n\n[Report location: ' + certReportsDir + ']' +
'\n\n'
String reportName = 'data-availability.dd-1.7'
dependsOn jar
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
systemProperties = System.getProperties()
args = [
'--plugin',
'pretty',
'--plugin',
'json:' + cucumberJsonPath + '/' + reportName + '.json',
'--plugin',
'html:' + certReportsDir + '/' + reportName + '.html',
'--glue',
'org.reso.certification.stepdefs#DataAvailability',
'src/main/java/org/reso/certification/features/payloads/data-availability.feature'
]
}
}
}
task testIdxPayload_1_7() {
group = 'RESO Certification'
description = 'Data Dictionary 1.7 Payloads Sampling Tests' +
'\nExample:' +
'\n ./gradlew testIdxPayload_1_7 -DpathToRESOScript=/path/to/web-api-core-2.0.0.resoscript' +
'\n\n[Report location: ' + certReportsDir + ']' +
'\n\n'
String reportName = 'idx-payload.dd-1.7'
dependsOn jar
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
systemProperties = System.getProperties()
args = [
'--plugin',
'pretty',
'--plugin',
'json:' + cucumberJsonPath + '/' + reportName + '.json',
'--plugin',
'html:' + certReportsDir + '/' + reportName + '.html',
'--glue',
'org.reso.certification.stepdefs#IdxPayload',
'src/main/java/org/reso/certification/features/payloads/idx-payload.feature'
]
}
}
}
task testDataDictionaryReferenceMetadata_1_7() {
description = 'Runs Data Dictionary tests against reference metadata'
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
System.setProperty('pathToMetadata', 'src/main/resources/RESODataDictionary-1.7.xml')
systemProperties = System.getProperties()
args = [
'--plugin',
'pretty',
'--glue',
'org.reso.certification.stepdefs#DataDictionary',
'src/main/java/org/reso/certification/features/data-dictionary/v1-7-0'
]
}
}
}
//used for internal Commander Web API acceptance testing
test {
dependsOn assemble, compileTestJava, testDataDictionaryReferenceMetadata_1_7
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = [
'--plugin',
'pretty',
'--glue',
'org.reso.commander.test.stepdefs',
'src/test/java/org/reso/commander/test/features'
]
}
}
}