You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by ja...@apache.org on 2026/08/03 22:35:40 UTC
(grails-core) 05/05: perf: broaden AppBench matrix across grails-test-examples
This is an automated email from the ASF dual-hosted git repository.
jamesfredley pushed a commit to branch perf/indy-vs-callsite-g6
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 2bf4dff27bdb8658e8593cda9c4032a18da76c8b
Author: James Fredley <ja...@users.noreply.github.com>
AuthorDate: Mon Aug 3 18:34:44 2026 -0400
perf: broaden AppBench matrix across grails-test-examples
Add gated AppBench integration specs for demo33, issue-11102, hyphenated,
jetty, undertow, cache, namespaces, views JSON, app1 misc, and hibernate7
app1, plus run-app-matrix.ps1 orchestrator. Specs are IgnoreIf unless
-PappBench=true so normal CI is unchanged.
---
grails-benchmarks/scripts/run-app-matrix.ps1 | 104 +++++++++++++++++++++
.../groovy/functionaltests/AppBenchMiscSpec.groovy | 41 ++++++++
grails-test-examples/cache/build.gradle | 3 +-
.../demo/AppBenchBasicCachingServiceSpec.groovy | 41 ++++++++
grails-test-examples/demo33/build.gradle | 3 +-
.../groovy/demo/AppBenchHelloSpec.groovy | 41 ++++++++
grails-test-examples/hibernate7/app1/build.gradle | 1 +
.../groovy/functionaltests/AppBenchMiscSpec.groovy | 41 ++++++++
grails-test-examples/hyphenated/build.gradle | 4 +-
.../groovy/hyphenated/AppBenchFooBarSpec.groovy | 41 ++++++++
grails-test-examples/issue-11102/build.gradle | 3 +-
.../groovy/issue11102/AppBenchGet1Spec.groovy | 41 ++++++++
grails-test-examples/jetty/build.gradle | 2 +
.../issue12688/AppBenchSessionIndexSpec.groovy | 41 ++++++++
grails-test-examples/namespaces/build.gradle | 4 +-
.../namespaces/AppBenchImplicitViewSpec.groovy | 41 ++++++++
grails-test-examples/undertow/build.gradle | 2 +
.../undertowapp/AppBenchSessionIndexSpec.groovy | 41 ++++++++
.../views-functional-tests/build.gradle | 3 +-
.../tests/AppBenchRespondJsonSpec.groovy | 41 ++++++++
20 files changed, 533 insertions(+), 6 deletions(-)
diff --git a/grails-benchmarks/scripts/run-app-matrix.ps1 b/grails-benchmarks/scripts/run-app-matrix.ps1
new file mode 100644
index 0000000000..a45d1e9cd7
--- /dev/null
+++ b/grails-benchmarks/scripts/run-app-matrix.ps1
@@ -0,0 +1,104 @@
+# Broad app-bench matrix: non-indy then indy for each gated AppBench spec.
+param(
+ [int]$Warmup = 100,
+ [int]$Samples = 400,
+ [int]$Forks = 2,
+ [string]$Mode = 'both' # both | false | true
+)
+
+$ErrorActionPreference = 'Continue'
+$root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
+Set-Location -LiteralPath $root
+$outDir = Join-Path $root 'build\app-bench-wide'
+New-Item -ItemType Directory -Force -Path $outDir | Out-Null
+$log = Join-Path $outDir 'matrix-run.log'
+"start $(Get-Date -Format o)" | Set-Content -LiteralPath $log
+
+$jobs = @(
+ @{ Name='latency'; Project=':grails-test-examples-latency'; Tests='latencyapp.AppBenchFastPingSpec' },
+ @{ Name='app1-interceptor'; Project=':grails-test-examples-app1'; Tests='functionaltests.AppBenchInterceptorDemoSpec' },
+ @{ Name='app1-misc'; Project=':grails-test-examples-app1'; Tests='functionaltests.AppBenchMiscSpec' },
+ @{ Name='gsp-layout'; Project=':grails-test-examples-gsp-layout'; Tests='org.example.grails.layout.AppBenchDemoRenderTextSpec' },
+ @{ Name='demo33'; Project=':grails-test-examples-demo33'; Tests='demo.AppBenchHelloSpec' },
+ @{ Name='issue-11102'; Project=':grails-test-examples-issue-11102'; Tests='issue11102.AppBenchGet1Spec' },
+ @{ Name='hyphenated'; Project=':grails-test-examples-hyphenated'; Tests='hyphenated.AppBenchFooBarSpec' },
+ @{ Name='jetty'; Project=':grails-test-examples-jetty'; Tests='issue12688.AppBenchSessionIndexSpec' },
+ @{ Name='undertow'; Project=':grails-test-examples-undertow'; Tests='undertowapp.AppBenchSessionIndexSpec' },
+ @{ Name='cache'; Project=':grails-test-examples-cache'; Tests='com.demo.AppBenchBasicCachingServiceSpec' },
+ @{ Name='namespaces'; Project=':grails-test-examples-namespaces'; Tests='namespaces.AppBenchImplicitViewSpec' },
+ @{ Name='views-json'; Project=':grails-test-examples-views-functional-tests'; Tests='functional.tests.AppBenchRespondJsonSpec' },
+ @{ Name='h7-app1-misc'; Project=':grails-test-examples-hibernate7-app1'; Tests='functionaltests.AppBenchMiscSpec' }
+)
+
+$modes = @()
+if ($Mode -eq 'both' -or $Mode -eq 'false') { $modes += 'false' }
+if ($Mode -eq 'both' -or $Mode -eq 'true') { $modes += 'true' }
+
+$summary = @()
+foreach ($job in $jobs) {
+ foreach ($indy in $modes) {
+ $label = if ($indy -eq 'true') { 'indy' } else { 'noindy' }
+ $outFile = Join-Path $outDir "$($job.Name)-$label.json"
+ if (Test-Path $outFile) { Remove-Item -LiteralPath $outFile -Force }
+ $msg = "=== $($job.Name) indy=$indy ==="
+ Write-Host $msg
+ Add-Content -LiteralPath $log -Value $msg
+ $outArg = ($outFile -replace '\\','/')
+ & "$root\gradlew.bat" "$($job.Project):integrationTest" `
+ "-PgrailsIndy=$indy" `
+ '-PappBench=true' `
+ "-PappBenchWarmup=$Warmup" `
+ "-PappBenchSamples=$Samples" `
+ "-PappBenchForks=$Forks" `
+ "-PappBenchOut=$outArg" `
+ '--tests' $job.Tests
+ $code = $LASTEXITCODE
+ $ok = ($code -eq 0) -and (Test-Path -LiteralPath $outFile)
+ $line = "$($job.Name),$label,exit=$code,ok=$ok,out=$outFile"
+ Add-Content -LiteralPath $log -Value $line
+ $summary += [pscustomobject]@{ App=$job.Name; Mode=$label; Exit=$code; Ok=$ok; File=$outFile }
+ if (-not $ok) {
+ Write-Host "FAILED $line"
+ }
+ }
+}
+
+# Per-app compares where both modes ok
+foreach ($job in $jobs) {
+ $base = Join-Path $outDir "$($job.Name)-noindy.json"
+ $head = Join-Path $outDir "$($job.Name)-indy.json"
+ $report = Join-Path $outDir "$($job.Name)-indy-vs-noindy.md"
+ if ((Test-Path $base) -and (Test-Path $head)) {
+ & "$root\gradlew.bat" '-q' ':grails-benchmarks:jmhCompare' `
+ "--args=--base $($base -replace '\\','/') --head $($head -replace '\\','/') --output $($report -replace '\\','/')"
+ }
+}
+
+# Merge all successful
+$allNo = [System.Collections.Generic.List[object]]::new()
+$allYes = [System.Collections.Generic.List[object]]::new()
+foreach ($job in $jobs) {
+ $base = Join-Path $outDir "$($job.Name)-noindy.json"
+ $head = Join-Path $outDir "$($job.Name)-indy.json"
+ if (Test-Path $base) {
+ $j = Get-Content -LiteralPath $base -Raw | ConvertFrom-Json
+ if ($j -is [System.Array]) { foreach ($e in $j) { $allNo.Add($e) } } else { $allNo.Add($j) }
+ }
+ if (Test-Path $head) {
+ $j = Get-Content -LiteralPath $head -Raw | ConvertFrom-Json
+ if ($j -is [System.Array]) { foreach ($e in $j) { $allYes.Add($e) } } else { $allYes.Add($j) }
+ }
+}
+$mergedNo = Join-Path $outDir 'ALL-noindy.json'
+$mergedYes = Join-Path $outDir 'ALL-indy.json'
+($allNo | ConvertTo-Json -Depth 30) | Set-Content -LiteralPath $mergedNo -Encoding utf8
+($allYes | ConvertTo-Json -Depth 30) | Set-Content -LiteralPath $mergedYes -Encoding utf8
+if ($allNo.Count -gt 0 -and $allYes.Count -gt 0) {
+ & "$root\gradlew.bat" '-q' ':grails-benchmarks:jmhCompare' `
+ "--args=--base $($mergedNo -replace '\\','/') --head $($mergedYes -replace '\\','/') --output $((Join-Path $outDir 'ALL-indy-vs-noindy.md') -replace '\\','/')"
+}
+
+$summary | Format-Table -AutoSize | Out-String | Add-Content -LiteralPath $log
+"done $(Get-Date -Format o)" | Add-Content -LiteralPath $log
+Write-Host "Done. See $outDir"
+$summary | Format-Table -AutoSize
diff --git a/grails-test-examples/app1/src/integration-test/groovy/functionaltests/AppBenchMiscSpec.groovy b/grails-test-examples/app1/src/integration-test/groovy/functionaltests/AppBenchMiscSpec.groovy
new file mode 100644
index 0000000000..345d126e87
--- /dev/null
+++ b/grails-test-examples/app1/src/integration-test/groovy/functionaltests/AppBenchMiscSpec.groovy
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package functionaltests
+
+import spock.lang.IgnoreIf
+import spock.lang.Specification
+
+import grails.testing.mixin.integration.Integration
+import org.apache.grails.testing.http.client.HttpClientSupport
+import org.apache.grails.testing.http.client.bench.AppHttpBench
+
+@Integration
+@IgnoreIf({ !AppHttpBench.enabled() })
+class AppBenchMiscSpec extends Specification implements HttpClientSupport {
+
+ void 'bench GET /misc/placeHolderConfig'() {
+ when:
+ AppHttpBench.measureAndWrite('appbench.app1.MiscPlaceholderConfig.httpGet', AppHttpBench.outputPath('app1-appbench.json')) {
+ http('/misc/placeHolderConfig').assertStatus(200)
+ }
+
+ then:
+ noExceptionThrown()
+ }
+}
diff --git a/grails-test-examples/cache/build.gradle b/grails-test-examples/cache/build.gradle
index 4f5de325fb..110744bad7 100644
--- a/grails-test-examples/cache/build.gradle
+++ b/grails-test-examples/cache/build.gradle
@@ -73,4 +73,5 @@ dependencies {
apply {
from rootProject.layout.projectDirectory.file('gradle/functional-test-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle')
-}
\ No newline at end of file
+ from rootProject.layout.projectDirectory.file('gradle/app-bench-config.gradle')
+}
diff --git a/grails-test-examples/cache/src/integration-test/groovy/com/demo/AppBenchBasicCachingServiceSpec.groovy b/grails-test-examples/cache/src/integration-test/groovy/com/demo/AppBenchBasicCachingServiceSpec.groovy
new file mode 100644
index 0000000000..e9e08a92ec
--- /dev/null
+++ b/grails-test-examples/cache/src/integration-test/groovy/com/demo/AppBenchBasicCachingServiceSpec.groovy
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.demo
+
+import spock.lang.IgnoreIf
+import spock.lang.Specification
+
+import grails.testing.mixin.integration.Integration
+import org.apache.grails.testing.http.client.HttpClientSupport
+import org.apache.grails.testing.http.client.bench.AppHttpBench
+
+@Integration
+@IgnoreIf({ !AppHttpBench.enabled() })
+class AppBenchBasicCachingServiceSpec extends Specification implements HttpClientSupport {
+
+ void 'bench GET /demo/basicCachingService'() {
+ when:
+ AppHttpBench.measureAndWrite('appbench.cache.BasicCachingService.httpGet', AppHttpBench.outputPath('cache-appbench.json')) {
+ http('/demo/basicCachingService').assertContains(200, 'Hello World!')
+ }
+
+ then:
+ noExceptionThrown()
+ }
+}
diff --git a/grails-test-examples/demo33/build.gradle b/grails-test-examples/demo33/build.gradle
index 22351e3464..17247e0600 100644
--- a/grails-test-examples/demo33/build.gradle
+++ b/grails-test-examples/demo33/build.gradle
@@ -79,4 +79,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/functional-test-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-webjar-asset-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle')
-}
\ No newline at end of file
+ from rootProject.layout.projectDirectory.file('gradle/app-bench-config.gradle')
+}
diff --git a/grails-test-examples/demo33/src/integration-test/groovy/demo/AppBenchHelloSpec.groovy b/grails-test-examples/demo33/src/integration-test/groovy/demo/AppBenchHelloSpec.groovy
new file mode 100644
index 0000000000..896de1e057
--- /dev/null
+++ b/grails-test-examples/demo33/src/integration-test/groovy/demo/AppBenchHelloSpec.groovy
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo
+
+import spock.lang.IgnoreIf
+import spock.lang.Specification
+
+import grails.testing.mixin.integration.Integration
+import org.apache.grails.testing.http.client.HttpClientSupport
+import org.apache.grails.testing.http.client.bench.AppHttpBench
+
+@Integration
+@IgnoreIf({ !AppHttpBench.enabled() })
+class AppBenchHelloSpec extends Specification implements HttpClientSupport {
+
+ void 'bench GET /demo/hello'() {
+ when:
+ AppHttpBench.measureAndWrite('appbench.demo33.Hello.httpGet', AppHttpBench.outputPath('demo33-appbench.json')) {
+ http('/demo/hello').assertEquals(200, 'Hello, World!')
+ }
+
+ then:
+ noExceptionThrown()
+ }
+}
diff --git a/grails-test-examples/hibernate7/app1/build.gradle b/grails-test-examples/hibernate7/app1/build.gradle
index 040370fea6..d6d99450e9 100644
--- a/grails-test-examples/hibernate7/app1/build.gradle
+++ b/grails-test-examples/hibernate7/app1/build.gradle
@@ -91,4 +91,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/functional-test-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-webjar-asset-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/app-bench-config.gradle')
}
diff --git a/grails-test-examples/hibernate7/app1/src/integration-test/groovy/functionaltests/AppBenchMiscSpec.groovy b/grails-test-examples/hibernate7/app1/src/integration-test/groovy/functionaltests/AppBenchMiscSpec.groovy
new file mode 100644
index 0000000000..4eb106a98b
--- /dev/null
+++ b/grails-test-examples/hibernate7/app1/src/integration-test/groovy/functionaltests/AppBenchMiscSpec.groovy
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package functionaltests
+
+import spock.lang.IgnoreIf
+import spock.lang.Specification
+
+import grails.testing.mixin.integration.Integration
+import org.apache.grails.testing.http.client.HttpClientSupport
+import org.apache.grails.testing.http.client.bench.AppHttpBench
+
+@Integration
+@IgnoreIf({ !AppHttpBench.enabled() })
+class AppBenchMiscSpec extends Specification implements HttpClientSupport {
+
+ void 'bench GET /misc/placeHolderConfig'() {
+ when:
+ AppHttpBench.measureAndWrite('appbench.hibernate7app1.MiscPlaceholderConfig.httpGet', AppHttpBench.outputPath('hibernate7-app1-appbench.json')) {
+ http('/misc/placeHolderConfig').assertStatus(200)
+ }
+
+ then:
+ noExceptionThrown()
+ }
+}
diff --git a/grails-test-examples/hyphenated/build.gradle b/grails-test-examples/hyphenated/build.gradle
index b4ea82debf..4190d44494 100644
--- a/grails-test-examples/hyphenated/build.gradle
+++ b/grails-test-examples/hyphenated/build.gradle
@@ -70,10 +70,12 @@ dependencies {
integrationTestImplementation testFixtures('org.apache.grails:grails-geb')
+ integrationTestImplementation 'org.apache.grails:grails-testing-support-http-client'
}
apply {
from rootProject.layout.projectDirectory.file('gradle/functional-test-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-webjar-asset-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle')
-}
\ No newline at end of file
+ from rootProject.layout.projectDirectory.file('gradle/app-bench-config.gradle')
+}
diff --git a/grails-test-examples/hyphenated/src/integration-test/groovy/hyphenated/AppBenchFooBarSpec.groovy b/grails-test-examples/hyphenated/src/integration-test/groovy/hyphenated/AppBenchFooBarSpec.groovy
new file mode 100644
index 0000000000..a069b9279a
--- /dev/null
+++ b/grails-test-examples/hyphenated/src/integration-test/groovy/hyphenated/AppBenchFooBarSpec.groovy
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package hyphenated
+
+import spock.lang.IgnoreIf
+import spock.lang.Specification
+
+import grails.testing.mixin.integration.Integration
+import org.apache.grails.testing.http.client.HttpClientSupport
+import org.apache.grails.testing.http.client.bench.AppHttpBench
+
+@Integration
+@IgnoreIf({ !AppHttpBench.enabled() })
+class AppBenchFooBarSpec extends Specification implements HttpClientSupport {
+
+ void 'bench GET /fooBar/barFoo'() {
+ when:
+ AppHttpBench.measureAndWrite('appbench.hyphenated.FooBar.httpGet', AppHttpBench.outputPath('hyphenated-appbench.json')) {
+ http('/fooBar/barFoo').assertContains(200, 'default action')
+ }
+
+ then:
+ noExceptionThrown()
+ }
+}
diff --git a/grails-test-examples/issue-11102/build.gradle b/grails-test-examples/issue-11102/build.gradle
index a692dfae49..ea7b3cabde 100644
--- a/grails-test-examples/issue-11102/build.gradle
+++ b/grails-test-examples/issue-11102/build.gradle
@@ -91,4 +91,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/functional-test-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-webjar-asset-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle')
-}
\ No newline at end of file
+ from rootProject.layout.projectDirectory.file('gradle/app-bench-config.gradle')
+}
diff --git a/grails-test-examples/issue-11102/src/integration-test/groovy/issue11102/AppBenchGet1Spec.groovy b/grails-test-examples/issue-11102/src/integration-test/groovy/issue11102/AppBenchGet1Spec.groovy
new file mode 100644
index 0000000000..f2a7fc304c
--- /dev/null
+++ b/grails-test-examples/issue-11102/src/integration-test/groovy/issue11102/AppBenchGet1Spec.groovy
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package issue11102
+
+import spock.lang.IgnoreIf
+import spock.lang.Specification
+
+import grails.testing.mixin.integration.Integration
+import org.apache.grails.testing.http.client.HttpClientSupport
+import org.apache.grails.testing.http.client.bench.AppHttpBench
+
+@Integration
+@IgnoreIf({ !AppHttpBench.enabled() })
+class AppBenchGet1Spec extends Specification implements HttpClientSupport {
+
+ void 'bench GET /get1'() {
+ when:
+ AppHttpBench.measureAndWrite('appbench.issue11102.Get1.httpGet', AppHttpBench.outputPath('issue-11102-appbench.json')) {
+ http('/get1').assertEquals(200, 'GET1')
+ }
+
+ then:
+ noExceptionThrown()
+ }
+}
diff --git a/grails-test-examples/jetty/build.gradle b/grails-test-examples/jetty/build.gradle
index 9e7136fc6d..8a339e7a84 100644
--- a/grails-test-examples/jetty/build.gradle
+++ b/grails-test-examples/jetty/build.gradle
@@ -58,10 +58,12 @@ dependencies {
runtimeOnly 'cloud.wondrify:asset-pipeline-grails'
integrationTestImplementation testFixtures('org.apache.grails:grails-geb')
+ integrationTestImplementation 'org.apache.grails:grails-testing-support-http-client'
}
apply {
from rootProject.layout.projectDirectory.file('gradle/functional-test-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-webjar-asset-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/app-bench-config.gradle')
}
diff --git a/grails-test-examples/jetty/src/integration-test/groovy/issue12688/AppBenchSessionIndexSpec.groovy b/grails-test-examples/jetty/src/integration-test/groovy/issue12688/AppBenchSessionIndexSpec.groovy
new file mode 100644
index 0000000000..b31866473e
--- /dev/null
+++ b/grails-test-examples/jetty/src/integration-test/groovy/issue12688/AppBenchSessionIndexSpec.groovy
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package issue12688
+
+import spock.lang.IgnoreIf
+import spock.lang.Specification
+
+import grails.testing.mixin.integration.Integration
+import org.apache.grails.testing.http.client.HttpClientSupport
+import org.apache.grails.testing.http.client.bench.AppHttpBench
+
+@Integration
+@IgnoreIf({ !AppHttpBench.enabled() })
+class AppBenchSessionIndexSpec extends Specification implements HttpClientSupport {
+
+ void 'bench GET /session/index'() {
+ when:
+ AppHttpBench.measureAndWrite('appbench.jetty.SessionIndex.httpGet', AppHttpBench.outputPath('jetty-appbench.json')) {
+ http('/session/index').assertStatus(200)
+ }
+
+ then:
+ noExceptionThrown()
+ }
+}
diff --git a/grails-test-examples/namespaces/build.gradle b/grails-test-examples/namespaces/build.gradle
index 9e34eb7479..76d31e35a5 100644
--- a/grails-test-examples/namespaces/build.gradle
+++ b/grails-test-examples/namespaces/build.gradle
@@ -61,10 +61,12 @@ dependencies {
integrationTestImplementation testFixtures('org.apache.grails:grails-geb')
+ integrationTestImplementation 'org.apache.grails:grails-testing-support-http-client'
}
apply {
from rootProject.layout.projectDirectory.file('gradle/functional-test-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-webjar-asset-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle')
-}
\ No newline at end of file
+ from rootProject.layout.projectDirectory.file('gradle/app-bench-config.gradle')
+}
diff --git a/grails-test-examples/namespaces/src/integration-test/groovy/namespaces/AppBenchImplicitViewSpec.groovy b/grails-test-examples/namespaces/src/integration-test/groovy/namespaces/AppBenchImplicitViewSpec.groovy
new file mode 100644
index 0000000000..538e9b3913
--- /dev/null
+++ b/grails-test-examples/namespaces/src/integration-test/groovy/namespaces/AppBenchImplicitViewSpec.groovy
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package namespaces
+
+import spock.lang.IgnoreIf
+import spock.lang.Specification
+
+import grails.testing.mixin.integration.Integration
+import org.apache.grails.testing.http.client.HttpClientSupport
+import org.apache.grails.testing.http.client.bench.AppHttpBench
+
+@Integration
+@IgnoreIf({ !AppHttpBench.enabled() })
+class AppBenchImplicitViewSpec extends Specification implements HttpClientSupport {
+
+ void 'bench GET /myAppTest/test/implicitView'() {
+ when:
+ AppHttpBench.measureAndWrite('appbench.namespaces.ImplicitView.httpGet', AppHttpBench.outputPath('namespaces-appbench.json')) {
+ http('/myAppTest/test/implicitView').assertContains(200, 'Implicit View Rendered!')
+ }
+
+ then:
+ noExceptionThrown()
+ }
+}
diff --git a/grails-test-examples/undertow/build.gradle b/grails-test-examples/undertow/build.gradle
index 2685b55e43..d3fdb06c94 100644
--- a/grails-test-examples/undertow/build.gradle
+++ b/grails-test-examples/undertow/build.gradle
@@ -58,10 +58,12 @@ dependencies {
runtimeOnly 'cloud.wondrify:asset-pipeline-grails'
integrationTestImplementation testFixtures('org.apache.grails:grails-geb')
+ integrationTestImplementation 'org.apache.grails:grails-testing-support-http-client'
}
apply {
from rootProject.layout.projectDirectory.file('gradle/functional-test-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-webjar-asset-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/app-bench-config.gradle')
}
diff --git a/grails-test-examples/undertow/src/integration-test/groovy/undertowapp/AppBenchSessionIndexSpec.groovy b/grails-test-examples/undertow/src/integration-test/groovy/undertowapp/AppBenchSessionIndexSpec.groovy
new file mode 100644
index 0000000000..83b96a38c1
--- /dev/null
+++ b/grails-test-examples/undertow/src/integration-test/groovy/undertowapp/AppBenchSessionIndexSpec.groovy
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package undertowapp
+
+import spock.lang.IgnoreIf
+import spock.lang.Specification
+
+import grails.testing.mixin.integration.Integration
+import org.apache.grails.testing.http.client.HttpClientSupport
+import org.apache.grails.testing.http.client.bench.AppHttpBench
+
+@Integration
+@IgnoreIf({ !AppHttpBench.enabled() })
+class AppBenchSessionIndexSpec extends Specification implements HttpClientSupport {
+
+ void 'bench GET /session/index'() {
+ when:
+ AppHttpBench.measureAndWrite('appbench.undertow.SessionIndex.httpGet', AppHttpBench.outputPath('undertow-appbench.json')) {
+ http('/session/index').assertStatus(200)
+ }
+
+ then:
+ noExceptionThrown()
+ }
+}
diff --git a/grails-test-examples/views-functional-tests/build.gradle b/grails-test-examples/views-functional-tests/build.gradle
index 88b7381c77..ba7a28dfef 100644
--- a/grails-test-examples/views-functional-tests/build.gradle
+++ b/grails-test-examples/views-functional-tests/build.gradle
@@ -80,4 +80,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/functional-test-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-webjar-asset-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle')
-}
\ No newline at end of file
+ from rootProject.layout.projectDirectory.file('gradle/app-bench-config.gradle')
+}
diff --git a/grails-test-examples/views-functional-tests/src/integration-test/groovy/functional/tests/AppBenchRespondJsonSpec.groovy b/grails-test-examples/views-functional-tests/src/integration-test/groovy/functional/tests/AppBenchRespondJsonSpec.groovy
new file mode 100644
index 0000000000..747a698e92
--- /dev/null
+++ b/grails-test-examples/views-functional-tests/src/integration-test/groovy/functional/tests/AppBenchRespondJsonSpec.groovy
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package functional.tests
+
+import spock.lang.IgnoreIf
+import spock.lang.Specification
+
+import grails.testing.mixin.integration.Integration
+import org.apache.grails.testing.http.client.HttpClientSupport
+import org.apache.grails.testing.http.client.bench.AppHttpBench
+
+@Integration
+@IgnoreIf({ !AppHttpBench.enabled() })
+class AppBenchRespondJsonSpec extends Specification implements HttpClientSupport {
+
+ void 'bench GET /respond/index with JSON accepted'() {
+ when:
+ AppHttpBench.measureAndWrite('appbench.views.RespondJson.httpGet', AppHttpBench.outputPath('views-functional-tests-appbench.json')) {
+ http('/respond/index', 'Accept': 'application/json').assertStatus(200)
+ }
+
+ then:
+ noExceptionThrown()
+ }
+}