Fixed the way contracts are copied
This commit is contained in:
@@ -35,17 +35,14 @@ abstract class AccurestIntegrationSpec extends Specification {
|
||||
|
||||
protected void setupForProject(String projectRoot) {
|
||||
copyResourcesToRoot(projectRoot)
|
||||
|
||||
def pluginClasspathResource = getClass().classLoader.findResource("plugin-classpath.txt")
|
||||
if (pluginClasspathResource == null) {
|
||||
throw new IllegalStateException("Did not find 'plugin-classpath.txt'")
|
||||
}
|
||||
|
||||
String pluginClasspath = pluginClasspathResource.readLines()
|
||||
.collect { it.replace('\\', '\\\\') } // escape backslashes in Windows paths
|
||||
.collect { "'$it'" }
|
||||
.join(", ")
|
||||
|
||||
buildFile << """
|
||||
buildscript {
|
||||
dependencies {
|
||||
@@ -53,7 +50,6 @@ abstract class AccurestIntegrationSpec extends Specification {
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
// Extending buildscript is required when 'apply' is used.
|
||||
// 'GradleRunner#withPluginClasspath' can be used when plugin is added using 'plugins { id...'
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class BasicFunctionalSpec extends AccurestIntegrationSpec {
|
||||
|
||||
def "should pass basic flow"() {
|
||||
when:
|
||||
BuildResult result = run("check")
|
||||
BuildResult result = run("check", "publishToMavenLocal")
|
||||
then:
|
||||
result.task(":generateWireMockClientStubs").outcome == SUCCESS
|
||||
result.task(":generateAccurest").outcome == SUCCESS
|
||||
|
||||
@@ -14,7 +14,7 @@ class MessagingProjectSpec extends AccurestIntegrationSpec {
|
||||
given:
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
runTasksSuccessfully('check')
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
}
|
||||
|
||||
def "should pass basic flow for JUnit"() {
|
||||
@@ -23,7 +23,7 @@ class MessagingProjectSpec extends AccurestIntegrationSpec {
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
switchToJunitTestFramework('io.codearte.accurest.samples.book.MessagingBaseSpec', 'io.codearte.accurest.samples.book.MessagingBaseTest')
|
||||
runTasksSuccessfully('check')
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class SampleJerseyProjectSpec extends AccurestIntegrationSpec {
|
||||
given:
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
runTasksSuccessfully('check')
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
}
|
||||
|
||||
def "should pass basic flow for JUnit"() {
|
||||
@@ -22,7 +22,7 @@ class SampleJerseyProjectSpec extends AccurestIntegrationSpec {
|
||||
switchToJunitTestFramework()
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
runTasksSuccessfully('check')
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class SampleProjectSpec extends AccurestIntegrationSpec {
|
||||
given:
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
runTasksSuccessfully('check')
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
}
|
||||
|
||||
def "should pass basic flow for JUnit"() {
|
||||
@@ -22,7 +22,7 @@ class SampleProjectSpec extends AccurestIntegrationSpec {
|
||||
switchToJunitTestFramework()
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
runTasksSuccessfully('check')
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class ScenarioProjectSpec extends AccurestIntegrationSpec {
|
||||
given:
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
runTasksSuccessfully('check')
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
}
|
||||
|
||||
def "should pass basic flow for JUnit"() {
|
||||
@@ -22,7 +22,7 @@ class ScenarioProjectSpec extends AccurestIntegrationSpec {
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
switchToJunitTestFramework()
|
||||
runTasksSuccessfully('check')
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,11 +8,13 @@ apply plugin: 'groovy'
|
||||
apply plugin: 'accurest'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
group = 'io.codearte.accurest.testprojects'
|
||||
|
||||
ext {
|
||||
contractsDir = file("${project.rootDir}/repository/mappings/")
|
||||
contractsDir = file("repository/mappings")
|
||||
stubsOutputDirRoot = file("${project.buildDir}/production/${project.name}-stubs/")
|
||||
wireMockStubsOutputDir = new File(stubsOutputDirRoot, 'repository/mappings/')
|
||||
contractsOutputDir = new File(stubsOutputDirRoot, 'repository/accurest/')
|
||||
wireMockStubsOutputDir = file(new File(stubsOutputDirRoot, 'repository/mappings/'))
|
||||
contractsOutputDir = file(new File(stubsOutputDirRoot, 'repository/accurest/'))
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -71,11 +73,13 @@ wrapper {
|
||||
|
||||
task copyContracts(type: Copy) {
|
||||
from contractsDir
|
||||
include '**/*.groovy'
|
||||
into contractsOutputDir
|
||||
}
|
||||
|
||||
task stubsJar(type: Jar, dependsOn: ["generateWireMockClientStubs", copyContracts]) {
|
||||
baseName = "${project.name}-stubs"
|
||||
baseName = "${project.name}"
|
||||
classifier = "stubs"
|
||||
from stubsOutputDirRoot
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,10 @@ apply plugin: 'groovy'
|
||||
apply plugin: 'accurest'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
group = 'io.codearte.accurest.testprojects'
|
||||
|
||||
ext {
|
||||
contractsDir = file("${project.rootDir}/repository/mappings/")
|
||||
contractsDir = file("repository/mappings")
|
||||
stubsOutputDirRoot = file("${project.buildDir}/production/${project.name}-stubs/")
|
||||
wireMockStubsOutputDir = new File(stubsOutputDirRoot, 'repository/mappings/')
|
||||
contractsOutputDir = new File(stubsOutputDirRoot, 'repository/accurest/')
|
||||
@@ -84,11 +86,13 @@ wrapper {
|
||||
|
||||
task copyContracts(type: Copy) {
|
||||
from contractsDir
|
||||
include '**/*.groovy'
|
||||
into contractsOutputDir
|
||||
}
|
||||
|
||||
task stubsJar(type: Jar, dependsOn: ["generateWireMockClientStubs", copyContracts]) {
|
||||
baseName = "${project.name}-stubs"
|
||||
baseName = "${project.name}"
|
||||
classifier = "stubs"
|
||||
from stubsOutputDirRoot
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
group = 'io.codearte.accurest.testprojects'
|
||||
|
||||
ext {
|
||||
restAssuredVersion = '2.5.0'
|
||||
spockVersion = '1.0-groovy-2.4'
|
||||
@@ -38,10 +40,10 @@ configure([project(':fraudDetectionService'), project(':loanApplicationService')
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
ext {
|
||||
contractsDir = file("${project.rootDir}/repository/mappings/")
|
||||
contractsDir = file("mappings")
|
||||
stubsOutputDirRoot = file("${project.buildDir}/production/${project.name}-stubs/")
|
||||
wireMockStubsOutputDir = new File(stubsOutputDirRoot, 'repository/mappings/')
|
||||
contractsOutputDir = new File(stubsOutputDirRoot, 'repository/accurest/')
|
||||
wireMockStubsOutputDir = file(new File(stubsOutputDirRoot, 'repository/mappings/'))
|
||||
contractsOutputDir = file(new File(stubsOutputDirRoot, 'repository/accurest/'))
|
||||
}
|
||||
|
||||
accurest {
|
||||
@@ -80,11 +82,13 @@ configure([project(':fraudDetectionService'), project(':loanApplicationService')
|
||||
|
||||
task copyContracts(type: Copy) {
|
||||
from contractsDir
|
||||
include '**/*.groovy'
|
||||
into contractsOutputDir
|
||||
}
|
||||
|
||||
task stubsJar(type: Jar, dependsOn: ["generateWireMockClientStubs", copyContracts]) {
|
||||
baseName = "${project.name}-stubs"
|
||||
baseName = "${project.name}"
|
||||
classifier = "stubs"
|
||||
from stubsOutputDirRoot
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ ext {
|
||||
accurestStubsBaseDirectory = 'src/test/resources/stubs'
|
||||
}
|
||||
|
||||
group = 'io.codearte.accurest.testprojects'
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'groovy'
|
||||
|
||||
@@ -38,10 +40,10 @@ configure([project(':fraudDetectionService'), project(':loanApplicationService')
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
ext {
|
||||
contractsDir = file("${project.rootDir}/repository/mappings/")
|
||||
contractsDir = file("mappings")
|
||||
stubsOutputDirRoot = file("${project.buildDir}/production/${project.name}-stubs/")
|
||||
wireMockStubsOutputDir = new File(stubsOutputDirRoot, 'repository/mappings/')
|
||||
contractsOutputDir = new File(stubsOutputDirRoot, 'repository/accurest/')
|
||||
wireMockStubsOutputDir = file(new File(stubsOutputDirRoot, 'repository/mappings/'))
|
||||
contractsOutputDir = file(new File(stubsOutputDirRoot, 'repository/accurest/'))
|
||||
}
|
||||
|
||||
accurest {
|
||||
@@ -79,10 +81,12 @@ configure([project(':fraudDetectionService'), project(':loanApplicationService')
|
||||
task copyContracts(type: Copy) {
|
||||
from contractsDir
|
||||
into contractsOutputDir
|
||||
includeEmptyDirs = true
|
||||
}
|
||||
|
||||
task stubsJar(type: Jar, dependsOn: ["generateWireMockClientStubs", copyContracts]) {
|
||||
baseName = "${project.name}-stubs"
|
||||
baseName = "${project.name}"
|
||||
classifier = "stubs"
|
||||
from stubsOutputDirRoot
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ ext {
|
||||
accurestStubsBaseDirectory = 'src/test/resources/stubs'
|
||||
}
|
||||
|
||||
group = 'io.codearte.accurest.testprojects'
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'groovy'
|
||||
apply plugin: 'maven-publish'
|
||||
@@ -38,10 +40,10 @@ configure([project(':fraudDetectionService'), project(':loanApplicationService')
|
||||
apply plugin: 'accurest'
|
||||
|
||||
ext {
|
||||
contractsDir = file("${project.rootDir}/repository/mappings/")
|
||||
contractsDir = file("mappings")
|
||||
stubsOutputDirRoot = file("${project.buildDir}/production/${project.name}-stubs/")
|
||||
wireMockStubsOutputDir = new File(stubsOutputDirRoot, 'repository/mappings/')
|
||||
contractsOutputDir = new File(stubsOutputDirRoot, 'repository/accurest/')
|
||||
wireMockStubsOutputDir = file(new File(stubsOutputDirRoot, 'repository/mappings/'))
|
||||
contractsOutputDir = file(new File(stubsOutputDirRoot, 'repository/accurest/'))
|
||||
}
|
||||
|
||||
accurest {
|
||||
@@ -80,11 +82,13 @@ configure([project(':fraudDetectionService'), project(':loanApplicationService')
|
||||
|
||||
task copyContracts(type: Copy) {
|
||||
from contractsDir
|
||||
include '**/*.groovy'
|
||||
into contractsOutputDir
|
||||
}
|
||||
|
||||
task stubsJar(type: Jar, dependsOn: ["generateWireMockClientStubs", copyContracts]) {
|
||||
baseName = "${project.name}-stubs"
|
||||
baseName = "${project.name}"
|
||||
classifier = "stubs"
|
||||
from stubsOutputDirRoot
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user