Skip to content

Commit

Permalink
chore: run itests with gradle 2.4, 3.5 and 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tschulte committed Jun 16, 2017
1 parent d524573 commit 26a2105
Show file tree
Hide file tree
Showing 10 changed files with 434 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ import spock.lang.Unroll
@Unroll
class AbstractJnlpIntegrationSpec extends IntegrationSpec {

final static gradleVersions = ["2.4", "3.5", "4.0"]


def setup() {
classpathFilter = { url -> !url.path.contains("spock")}
buildFile << '''\
apply plugin: 'de.gliderpilot.jnlp'
repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import nebula.test.IntegrationSpec
import nebula.test.functional.ExecutionResult
import spock.lang.Unroll

@Unroll
class JnlpWithHrefIntegrationSpec extends AbstractJnlpIntegrationSpec {

def setup() {
Expand All @@ -41,7 +40,11 @@ class JnlpWithHrefIntegrationSpec extends AbstractJnlpIntegrationSpec {
writeHelloWorld('de.gliderpilot.jnlp.test')
}

def 'target folder does only contain one jnlp after version change'() {
@Unroll
def '[gradle #gv] target folder does only contain one jnlp after version change'() {
given:
gradleVersion = gv

when:
runTasksSuccessfully('generateJnlp')
version = '1.1'
Expand All @@ -50,6 +53,9 @@ class JnlpWithHrefIntegrationSpec extends AbstractJnlpIntegrationSpec {
then:
!fileExists('build/jnlp/launch_v1.0.jnlp')
fileExists('build/jnlp/launch_v1.1.jnlp')

where:
gv << gradleVersions
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package de.gliderpilot.gradle.jnlp
import nebula.test.functional.ExecutionResult
import spock.lang.Unroll

@Unroll
class JnlpWithPack200IntegrationSpecification extends AbstractJnlpIntegrationSpec {

def jnlp
Expand All @@ -45,26 +44,54 @@ class JnlpWithPack200IntegrationSpecification extends AbstractJnlpIntegrationSpe
jnlp = jnlp()
}

def 'generateJnlp task is executed'() {
@Unroll
def '[gradle #gv] generateJnlp task is executed'() {
given:
gradleVersion = gv

expect:
executionResult.wasExecuted(':generateJnlp')

where:
gv << gradleVersions
}

def 'signJars task is executed'() {
@Unroll
def '[gradle #gv] signJars task is executed'() {
given:
gradleVersion = gv

expect:
executionResult.wasExecuted(':signJars')

where:
gv << gradleVersions
}

def 'property jnlp.packEnabled is set to true'() {
@Unroll
def '[gradle #gv] property jnlp.packEnabled is set to true'() {
given:
gradleVersion = gv

when:
def property = jnlp.resources.property.find { it.@name == 'jnlp.packEnabled' }

then:
property.@value.text() == 'true'

where:
gv << gradleVersions
}

def 'jar file is packed with pack200'() {
@Unroll
def '[gradle #gv] jar file is packed with pack200'() {
given:
gradleVersion = gv

expect:
directory("build/jnlp/lib").list().sort() == ['jxlayer__V3.0.4-myalias.jar.pack.gz', "${moduleName}__V1.0-myalias.jar.pack.gz"].sort()

where:
gv << gradleVersions
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package de.gliderpilot.gradle.jnlp
import nebula.test.functional.ExecutionResult
import spock.lang.Unroll

@Unroll
class JnlpWithVersionsIntegrationSpecification extends AbstractJnlpIntegrationSpec {

def jnlp
Expand Down Expand Up @@ -51,54 +50,100 @@ class JnlpWithVersionsIntegrationSpecification extends AbstractJnlpIntegrationSp
jnlp = jnlp()
}

def 'generateJnlp task is executed'() {
@Unroll
def '[gradle #gv] generateJnlp task is executed'() {
given:
gradleVersion = gv

expect:
executionResult.wasExecuted(':generateJnlp')

where:
gv << gradleVersions
}

def 'copyJars task is executed'() {
@Unroll
def '[gradle #gv] copyJars task is executed'() {
given:
gradleVersion = gv

expect:
executionResult.wasExecuted(':copyJars')

where:
gv << gradleVersions
}

def 'jars entry is not empty'() {
@Unroll
def '[gradle #gv] jars entry is not empty'() {
given:
gradleVersion = gv

when:
def jars = jnlp.resources.jar

then:
!jars.isEmpty()

where:
gv << gradleVersions
}

def 'mandatory fields in information block are filled in the jnlp'() {
@Unroll
def '[gradle #gv] mandatory fields in information block are filled in the jnlp'() {
given:
gradleVersion = gv

expect:
jnlp.information.title.text() == moduleName
jnlp.information.vendor.text() == moduleName

where:
gv << gradleVersions
}

def 'jar groovy-all has version 2.3.1'() {
@Unroll
def '[gradle #gv] jar groovy-all has version 2.3.1'() {
given:
gradleVersion = gv

and:
def jar = jnlp.resources.jar.find { it.@href =~ /groovy-all/ }

expect:
jar.@version.text() == '2.3.1'

and:
jar.@href.text() == "lib/groovy-all.jar"

where:
gv << gradleVersions
}

def 'jar of project has version 1.0'() {
@Unroll
def '[gradle #gv] jar of project has version 1.0'() {
given:
gradleVersion = gv

and:
def jar = jnlp.resources.jar.find { it.@href =~ /$moduleName/ }

expect:
jar.@version.text() == '1.0'

and:
jar.@href.text() == "lib/${moduleName}.jar"

where:
gv << gradleVersions
}

def 'jar of project with SNAPSHOT version'() {
@Unroll
def '[gradle #gv] jar of project with SNAPSHOT version'() {
given:
gradleVersion = gv

and:
version = "1.0-SNAPSHOT"
runTasksSuccessfully(':generateJnlp', ':copyJars')
jnlp = jnlp()
Expand All @@ -111,50 +156,87 @@ class JnlpWithVersionsIntegrationSpecification extends AbstractJnlpIntegrationSp

and:
jar.@href.text() == "lib/${moduleName}__V1.0-SNAPSHOT.jar"

where:
gv << gradleVersions
}

def 'jar of subproject with SNAPSHOT version'() {
@Unroll
def '[gradle #gv] jar of subproject with SNAPSHOT version'() {
given:
gradleVersion = gv

and:
addSubproject("subproject")
buildFile << "dependencies { compile project(':subproject') }"
version = "1.0-SNAPSHOT"
runTasksSuccessfully(':generateJnlp', ':copyJars')
jnlp = jnlp()

when:
def jar = jnlp.resources.jar.find { it.@href =~ 'subproject' }
def jar = jnlp.resources.jar.find { it.@href.text().startsWith('lib/subproject') }

then:
jar.@version.text() == ''

and:
jar.@href.text() == "lib/subproject__V1.0-SNAPSHOT.jar"

where:
gv << gradleVersions
}

def 'property jnlp.versionEnabled is set to true'() {
@Unroll
def '[gradle #gv] property jnlp.versionEnabled is set to true'() {
given:
gradleVersion = gv

when:
def property = jnlp.resources.property.find { it.@name == 'jnlp.versionEnabled' }

then:
property.@value.text() == 'true'

where:
gv << gradleVersions
}

def 'jars are copied'() {
@Unroll
def '[gradle #gv] jars are copied'() {
given:
gradleVersion = gv

expect:
directory('build/jnlp/lib').list { file, name -> name.endsWith '.jar' }.sort() == [
'groovy-all__V2.3.1.jar',
"${moduleName}__V1.0.jar"
]
].sort()

where:
gv << gradleVersions
}

def 'main-class is set'() {
@Unroll
def '[gradle #gv] main-class is set'() {
given:
gradleVersion = gv

expect:
jnlp.'application-desc'.@'main-class'.text() == 'de.gliderpilot.jnlp.test.HelloWorld'

where:
gv << gradleVersions
}

def 'main-jar is marked'() {
@Unroll
def '[gradle #gv] main-jar is marked'() {
given:
gradleVersion = gv

expect:
jnlp.resources.jar.find { it.@href =~ "$moduleName" }.@main.text() == 'true'

where:
gv << gradleVersions
}
}
Loading

0 comments on commit 26a2105

Please sign in to comment.