314 lines
9.8 KiB
Groovy
314 lines
9.8 KiB
Groovy
plugins {
|
|
// Apply the java plugin to add support for Java
|
|
id 'java-library'
|
|
|
|
// 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 {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'com.google.guava:guava:31.1-jre'
|
|
implementation 'com.google.inject:guice:5.1.0'
|
|
implementation 'commons-cli:commons-cli:1.5.0'
|
|
|
|
implementation 'org.apache.logging.log4j:log4j-api:2.20.0'
|
|
implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.20.0'
|
|
implementation 'org.apache.logging.log4j:log4j-1.2-api:2.20.0'
|
|
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
|
|
|
|
implementation 'org.apache.olingo:odata-client-api:4.9.0'
|
|
implementation 'org.apache.olingo:odata-commons-core:4.9.0'
|
|
implementation 'org.apache.olingo:odata-client-core:4.9.0'
|
|
|
|
implementation 'org.apache.poi:poi:5.2.2'
|
|
implementation 'org.apache.poi:poi-ooxml:5.2.2'
|
|
|
|
implementation 'io.rest-assured:rest-assured:5.1.1'
|
|
implementation 'io.rest-assured:json-path:5.1.1'
|
|
implementation 'io.rest-assured:json-schema-validator:5.1.1'
|
|
|
|
implementation 'io.cucumber:cucumber-java8:7.1.0'
|
|
implementation 'io.cucumber:cucumber-java:7.1.0'
|
|
implementation 'io.cucumber:cucumber-junit:7.1.0'
|
|
implementation 'io.cucumber:cucumber-guice:7.1.0'
|
|
implementation 'io.cucumber:cucumber-core:7.1.0'
|
|
|
|
//TODO: choose one schema validator between this and rest-assured
|
|
implementation 'com.networknt:json-schema-validator:1.0.70'
|
|
implementation 'com.google.code.gson:gson:2.9.0'
|
|
implementation 'org.apache.commons:commons-text:1.9'
|
|
|
|
}
|
|
|
|
configurations {
|
|
cucumberRuntime {
|
|
extendsFrom implementation
|
|
}
|
|
}
|
|
|
|
jar {
|
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
|
|
|
manifest {
|
|
attributes "Main-Class": mainClassName
|
|
attributes "Multi-Release": true
|
|
}
|
|
|
|
from {
|
|
configurations.runtimeClasspath.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).configureEach {
|
|
options.compilerArgs << '-Xlint:unchecked'
|
|
options.deprecation = true
|
|
}
|
|
|
|
String pathToMetadata = null,
|
|
pathToRESOScript = null,
|
|
certFileName = null
|
|
|
|
final String certOutputDir = 'build' + File.separator + 'certification',
|
|
cucumberJsonPath = certOutputDir + File.separator + 'cucumberJson',
|
|
certReportsDir = certOutputDir + File.separator + 'reports',
|
|
certResultsDir = certOutputDir + File.separator + 'results'
|
|
|
|
tasks.register('prepareCertificationEnvironment') {
|
|
doLast {
|
|
def folder = new File(certOutputDir)
|
|
if (folder.exists()) {
|
|
delete certOutputDir
|
|
}
|
|
|
|
mkdir certOutputDir
|
|
mkdir cucumberJsonPath
|
|
mkdir certReportsDir
|
|
mkdir certResultsDir
|
|
}
|
|
}
|
|
|
|
tasks.register('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, prepareCertificationEnvironment
|
|
doLast {
|
|
javaexec {
|
|
mainClass = "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'
|
|
]
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register('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, prepareCertificationEnvironment
|
|
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('.'))
|
|
}
|
|
|
|
def argsArray = []
|
|
|
|
def prettyPrint = System.getProperty('pretty', null)
|
|
|
|
if (prettyPrint) {
|
|
argsArray.add('--plugin')
|
|
argsArray.add('pretty')
|
|
}
|
|
|
|
argsArray.addAll(
|
|
'--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'
|
|
)
|
|
|
|
if (systemProperties.hasProperty('cucumber.filter.tags')) {
|
|
argsArray.add('--tags')
|
|
argsArray.add(systemProperties.get('cucumber.filter.tags').toString())
|
|
}
|
|
|
|
args = argsArray
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register('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 {
|
|
mainClass = "io.cucumber.core.cli.Main"
|
|
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
|
|
systemProperties = System.getProperties()
|
|
|
|
def argsArray = []
|
|
|
|
def prettyPrint = System.getProperty('pretty', null)
|
|
|
|
if (prettyPrint) {
|
|
argsArray.add('--plugin')
|
|
argsArray.add('pretty')
|
|
}
|
|
|
|
argsArray.addAll(
|
|
'--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'
|
|
)
|
|
|
|
args = argsArray
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register('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 {
|
|
mainClass = "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'
|
|
]
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register('testDataDictionaryReferenceMetadata_1_7') {
|
|
description = 'Runs Data Dictionary tests against reference metadata'
|
|
dependsOn jar
|
|
doLast {
|
|
javaexec {
|
|
mainClass = "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 = [
|
|
'--glue',
|
|
'org.reso.certification.stepdefs#DataDictionary',
|
|
'src/main/java/org/reso/certification/features/data-dictionary/v1-7-0'
|
|
]
|
|
|
|
if (System.hasProperty("pretty")) {
|
|
args.add("--plugin", "pretty")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//used for internal Commander Web API acceptance testing
|
|
test {
|
|
dependsOn assemble, compileTestJava, testDataDictionaryReferenceMetadata_1_7
|
|
doLast {
|
|
javaexec {
|
|
mainClass = "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'
|
|
]
|
|
}
|
|
}
|
|
}
|