Added checks for presence of groovy contracts in the produced jars
This commit is contained in:
@@ -9,9 +9,10 @@ import spock.lang.Specification
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.util.zip.ZipException
|
||||
import java.util.zip.ZipFile
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8
|
||||
|
||||
/**
|
||||
* @author Olga Maciaszek-Sharma
|
||||
* @author Denis Stepanov
|
||||
@@ -116,4 +117,24 @@ abstract class AccurestIntegrationSpec extends Specification {
|
||||
return new File('build.gradle', testProjectDir)
|
||||
}
|
||||
|
||||
protected boolean jarContainsAccurestContracts(String path) {
|
||||
assert fileExists(path)
|
||||
File rootFile = file(path)
|
||||
boolean containsGroovyFiles = false
|
||||
rootFile.eachFileRecurse { File file ->
|
||||
try {
|
||||
if (file.isFile() && file.name.endsWith('jar')) {
|
||||
new ZipFile(file).entries().each {
|
||||
if (it.name.endsWith('.groovy')) {
|
||||
containsGroovyFiles = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (ZipException zipEx) {
|
||||
println "Unable to open file ${file.name}"
|
||||
}
|
||||
}
|
||||
return containsGroovyFiles
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ class MessagingProjectSpec extends AccurestIntegrationSpec {
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
jarContainsAccurestContracts('build/libs')
|
||||
}
|
||||
|
||||
def "should pass basic flow for JUnit"() {
|
||||
@@ -24,6 +25,7 @@ class MessagingProjectSpec extends AccurestIntegrationSpec {
|
||||
expect:
|
||||
switchToJunitTestFramework('io.codearte.accurest.samples.book.MessagingBaseSpec', 'io.codearte.accurest.samples.book.MessagingBaseTest')
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
jarContainsAccurestContracts('build/libs')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ class SampleJerseyProjectSpec extends AccurestIntegrationSpec {
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
jarContainsAccurestContracts('fraudDetectionService/build/libs')
|
||||
}
|
||||
|
||||
def "should pass basic flow for JUnit"() {
|
||||
@@ -23,6 +24,7 @@ class SampleJerseyProjectSpec extends AccurestIntegrationSpec {
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
jarContainsAccurestContracts('fraudDetectionService/build/libs')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ class SampleProjectSpec extends AccurestIntegrationSpec {
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
jarContainsAccurestContracts('fraudDetectionService/build/libs')
|
||||
}
|
||||
|
||||
def "should pass basic flow for JUnit"() {
|
||||
@@ -23,6 +24,7 @@ class SampleProjectSpec extends AccurestIntegrationSpec {
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
jarContainsAccurestContracts('fraudDetectionService/build/libs')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ class ScenarioProjectSpec extends AccurestIntegrationSpec {
|
||||
assert fileExists('build.gradle')
|
||||
expect:
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
jarContainsAccurestContracts('fraudDetectionService/build/libs')
|
||||
}
|
||||
|
||||
def "should pass basic flow for JUnit"() {
|
||||
@@ -23,6 +24,7 @@ class ScenarioProjectSpec extends AccurestIntegrationSpec {
|
||||
expect:
|
||||
switchToJunitTestFramework()
|
||||
runTasksSuccessfully('check', "publishToMavenLocal")
|
||||
jarContainsAccurestContracts('fraudDetectionService/build/libs')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user