1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- gretty {
- servletContainer = "tomcat10"
- contextPath = "/"
- fileLogEnabled = false
- integrationTestTask = 'integrationTest'
- httpsEnabled = true
- sslKeyStorePath = 'certs/server.p12'
- sslKeyStorePassword = 'password'
- }
- Task prepareAppServerForIntegrationTests = project.tasks.create('prepareAppServerForIntegrationTests') {
- group = 'Verification'
- description = 'Prepares the app server for integration tests'
- doFirst {
- project.gretty {
- httpPort = -1
- }
- }
- }
- project.tasks.matching { it.name == "appBeforeIntegrationTest" }.all { task ->
- task.dependsOn prepareAppServerForIntegrationTests
- }
- project.tasks.matching { it.name == "integrationTest" }.all {
- task -> task.doFirst {
- def gretty = project.gretty
- String host = project.gretty.host ?: 'localhost'
- boolean isHttps = gretty.httpsEnabled
- Integer httpPort = integrationTest.systemProperties['gretty.httpPort']
- Integer httpsPort = integrationTest.systemProperties['gretty.httpsPort']
- int port = isHttps ? httpsPort : httpPort
- String contextPath = project.gretty.contextPath
- String httpBaseUrl = "http://${host}:${httpPort}${contextPath}"
- String httpsBaseUrl = "https://${host}:${httpsPort}${contextPath}"
- String baseUrl = isHttps ? httpsBaseUrl : httpBaseUrl
- integrationTest.systemProperty 'app.port', port
- integrationTest.systemProperty 'app.httpPort', httpPort
- integrationTest.systemProperty 'app.httpsPort', httpsPort
- integrationTest.systemProperty 'app.baseURI', baseUrl
- integrationTest.systemProperty 'app.httpBaseURI', httpBaseUrl
- integrationTest.systemProperty 'app.httpsBaseURI', httpsBaseUrl
- }
- }
|