Skip to content

Commit

Permalink
fixup of integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-serjey committed May 27, 2024
1 parent 204a1a3 commit 7f36888
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
18 changes: 11 additions & 7 deletions integrationTests/gradle-java-toolchain/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
# spring-boot-simple
# gradle-java-toolchain

Spring-boot webapp with gretty.
Simple gretty servlet application powered by gradle java toolchain.

## How to run

```bash
cd examples/spring-boot-simple
cd integrationTests/gradle-java-toolchain
gradle appRun
```


## How to test

```bash
cd examples/spring-boot-simple
gradle integrationTest
cd integrationTests/gradle-java-toolchain
gradle integrationTest -PgeckoDriverPlatform=linux64 -PtoolchainJavaVersion=21
```
or
```bash
./docker_gradlew.sh --java 21 --java 11 --gradle 7 --working-dir integrationTests/gradle-java-toolchain -PtoolchainJavaVersion=21 -Pspock_version=2.3-groovy-3.0 -PgebVersion=5.1 integrationTest
```

## How to build a product


```bash
cd examples/spring-boot-simple
cd integrationTests/gradle-java-toolchain
gradle buildProduct
```

14 changes: 10 additions & 4 deletions integrationTests/gradle-java-toolchain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ defineAsJavaToolchainAwareIntegrationTest()
defineIntegrationTest()
testAll.dependsOn defineIntegrationTestAllContainers(['jetty8', 'jetty9', 'jetty10', 'tomcat85', 'tomcat9'])

tasks.withType(Test).configureEach {
if(project.findProperty('toolchainJavaVersion')) {
systemProperty 'toolchainJavaVersion', project.findProperty('toolchainJavaVersion')
//typical toolchain DSL
java {
toolchain {
languageVersion = JavaLanguageVersion.of("${project.javaVersion.majorVersion}")
}
}
}

//toolchain aware integration test
tasks.withType(Test).configureEach {
systemProperty 'toolchainJavaVersion', "${project.javaVersion.majorVersion}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PageSpec extends GebReportingSpec {

void setupSpec() {
baseURI = System.getProperty('gretty.baseURI')
toolchainJavaVersion = System.getProperty('toolchainJavaVersion') ?: System.getProperty('java.vm.version')
toolchainJavaVersion = Objects.requireNonNull(System.getProperty('toolchainJavaVersion'))
}

def 'should get expected static page'() {
Expand Down

0 comments on commit 7f36888

Please sign in to comment.