This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch feat/WW-5864-struts-maven-plugin-watch in repository https://gitbox.apache.org/repos/asf/struts.git
commit 59ca0eedc40d1fe6f8dc10d73154f757d3f995fb Author: Lukasz Lenart <[email protected]> AuthorDate: Sat Nov 14 08:59:24 2026 +0100 WW-5864 test(tools): gate the IT edit on the watch loop having started Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --- tools/struts-maven-plugin/src/it/watch-pushes-change/pom.xml | 2 +- .../src/it/watch-pushes-change/prebuild.groovy | 11 +++++++++-- .../src/it/watch-pushes-change/verify.groovy | 5 ++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/struts-maven-plugin/src/it/watch-pushes-change/pom.xml b/tools/struts-maven-plugin/src/it/watch-pushes-change/pom.xml index e84e8d441..9436fff2c 100644 --- a/tools/struts-maven-plugin/src/it/watch-pushes-change/pom.xml +++ b/tools/struts-maven-plugin/src/it/watch-pushes-change/pom.xml @@ -45,7 +45,7 @@ <artifactId>@project.artifactId@</artifactId> <version>@project.version@</version> <configuration> - <timeout>20</timeout> + <timeout>30</timeout> <pollInterval>200</pollInterval> </configuration> </plugin> diff --git a/tools/struts-maven-plugin/src/it/watch-pushes-change/prebuild.groovy b/tools/struts-maven-plugin/src/it/watch-pushes-change/prebuild.groovy index 6c10bb2e1..ab1e39b00 100644 --- a/tools/struts-maven-plugin/src/it/watch-pushes-change/prebuild.groovy +++ b/tools/struts-maven-plugin/src/it/watch-pushes-change/prebuild.groovy @@ -18,9 +18,16 @@ */ def messages = new File(basedir, 'src/main/resources/messages.properties') +def buildLog = new File(basedir, 'build.log') def editor = new Thread({ - Thread.sleep(8000) - messages.text = messages.text.replace('-v1', '-v2\n') + long giveUp = System.nanoTime() + 60_000_000_000L + while (System.nanoTime() < giveUp) { + if (buildLog.exists() && buildLog.text.contains('Watching 1 resource root(s)')) { + messages.text = messages.text.replace('-v1', '-v2\n') + return + } + Thread.sleep(100) + } }) editor.setDaemon(true) editor.start() diff --git a/tools/struts-maven-plugin/src/it/watch-pushes-change/verify.groovy b/tools/struts-maven-plugin/src/it/watch-pushes-change/verify.groovy index ce2aba6c3..a65f083f8 100644 --- a/tools/struts-maven-plugin/src/it/watch-pushes-change/verify.groovy +++ b/tools/struts-maven-plugin/src/it/watch-pushes-change/verify.groovy @@ -19,4 +19,7 @@ def classes = new File(basedir, 'target/classes/messages.properties') assert classes.text.contains('msg=hi-v2') : "filtered v2 missing: ${classes.text}" -assert new File(basedir, 'build.log').text.contains('pushed messages.properties') +def log = new File(basedir, 'build.log').text +int watching = log.indexOf('Watching 1 resource root(s)') +assert watching >= 0 +assert log.indexOf('pushed messages.properties', watching) > watching : 'no push after the watch loop started'
