This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-changelog-plugin.git
commit 5809831bb4fcbc89f58f976f0ce4a8845be146cf Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Wed Nov 25 22:34:17 2026 +0000 Modernize Groovy IT scripts See https://github.com/apache/maven-invoker-plugin/issues/811. --- src/it/minimal-pom-output-encoding/verify.groovy | 50 ++++++---------------- src/it/minimal-pom/verify.groovy | 50 ++++++---------------- .../verify.groovy | 50 ++++++---------------- 3 files changed, 36 insertions(+), 114 deletions(-) diff --git a/src/it/minimal-pom-output-encoding/verify.groovy b/src/it/minimal-pom-output-encoding/verify.groovy index 24781f9..39776f7 100644 --- a/src/it/minimal-pom-output-encoding/verify.groovy +++ b/src/it/minimal-pom-output-encoding/verify.groovy @@ -18,45 +18,19 @@ * under the License. */ -import java.io.*; -import java.util.*; -import java.util.regex.*; -import org.codehaus.plexus.util.FileUtils; +File outputXML = new File( basedir, "target/changelog.xml" ); +System.out.println( "Checking for existence of xml file: " + outputXML ); +String content = outputXML.getText( "ISO-8859-1" ); +assert content.indexOf( "encoding=\"ISO-8859-1\"" ) >= 0 : "Wrong encoding attribute in content." -try -{ - File outputXML = new File( basedir, "target/changelog.xml" ); - System.out.println( "Checking for existence of xml file: " + outputXML ); - String content = FileUtils.fileRead( outputXML, "ISO-8859-1" ); - if ( content.indexOf( "encoding=\"ISO-8859-1\"" ) < 0 ) - { - throw new IOException( "Wrong encoding attribute in content." ); - } - - File siteDir = new File( basedir, "target/site" ); - System.out.println( "Checking for existence of site directory: " + siteDir ); - if ( !siteDir.isDirectory() ) - { - System.out.println( "FAILED" ); - return false; - } +File siteDir = new File( basedir, "target/site" ); +System.out.println( "Checking for existence of site directory: " + siteDir ); +assert siteDir.isDirectory() - String[] reports = [ "changelog", "dev-activity", "file-activity" ]; - for ( String report : reports ) - { - File reportFile = new File( siteDir, report + ".html" ); - System.out.println( "Checking for existence of report: " + reportFile ); - if ( !reportFile.isFile() ) - { - System.out.println( "FAILED" ); - return false; - } - } -} -catch( Throwable t ) +String[] reports = [ "changelog", "dev-activity", "file-activity" ]; +for ( String report : reports ) { - t.printStackTrace(); - return false; + File reportFile = new File( siteDir, report + ".html" ); + System.out.println( "Checking for existence of report: " + reportFile ); + assert reportFile.isFile() } - -return true; diff --git a/src/it/minimal-pom/verify.groovy b/src/it/minimal-pom/verify.groovy index 41903a5..0ae0547 100644 --- a/src/it/minimal-pom/verify.groovy +++ b/src/it/minimal-pom/verify.groovy @@ -18,45 +18,19 @@ * under the License. */ -import java.io.*; -import java.util.*; -import java.util.regex.*; -import org.codehaus.plexus.util.FileUtils; +File outputXML = new File( basedir, "target/changelog.xml" ); +System.out.println( "Checking for existence of xml file: " + outputXML ); +String content = outputXML.getText( "UTF-8" ); +assert content.indexOf( "encoding=\"UTF-8\"" ) >= 0 : "Wrong encoding attribute in content." -try -{ - File outputXML = new File( basedir, "target/changelog.xml" ); - System.out.println( "Checking for existence of xml file: " + outputXML ); - String content = FileUtils.fileRead( outputXML, "UTF-8" ); - if ( content.indexOf( "encoding=\"UTF-8\"" ) < 0 ) - { - throw new IOException( "Wrong encoding attribute in content." ); - } - - File siteDir = new File( basedir, "target/site" ); - System.out.println( "Checking for existence of site directory: " + siteDir ); - if ( !siteDir.isDirectory() ) - { - System.out.println( "FAILED" ); - return false; - } +File siteDir = new File( basedir, "target/site" ); +System.out.println( "Checking for existence of site directory: " + siteDir ); +assert siteDir.isDirectory() - String[] reports = [ "changelog", "dev-activity", "file-activity" ]; - for ( String report : reports ) - { - File reportFile = new File( siteDir, report + ".html" ); - System.out.println( "Checking for existence of report: " + reportFile ); - if ( !reportFile.isFile() ) - { - System.out.println( "FAILED" ); - return false; - } - } -} -catch( Throwable t ) +String[] reports = [ "changelog", "dev-activity", "file-activity" ]; +for ( String report : reports ) { - t.printStackTrace(); - return false; + File reportFile = new File( siteDir, report + ".html" ); + System.out.println( "Checking for existence of report: " + reportFile ); + assert reportFile.isFile() } - -return true; diff --git a/src/it/project-reporting-output-encoding/verify.groovy b/src/it/project-reporting-output-encoding/verify.groovy index 24781f9..39776f7 100644 --- a/src/it/project-reporting-output-encoding/verify.groovy +++ b/src/it/project-reporting-output-encoding/verify.groovy @@ -18,45 +18,19 @@ * under the License. */ -import java.io.*; -import java.util.*; -import java.util.regex.*; -import org.codehaus.plexus.util.FileUtils; +File outputXML = new File( basedir, "target/changelog.xml" ); +System.out.println( "Checking for existence of xml file: " + outputXML ); +String content = outputXML.getText( "ISO-8859-1" ); +assert content.indexOf( "encoding=\"ISO-8859-1\"" ) >= 0 : "Wrong encoding attribute in content." -try -{ - File outputXML = new File( basedir, "target/changelog.xml" ); - System.out.println( "Checking for existence of xml file: " + outputXML ); - String content = FileUtils.fileRead( outputXML, "ISO-8859-1" ); - if ( content.indexOf( "encoding=\"ISO-8859-1\"" ) < 0 ) - { - throw new IOException( "Wrong encoding attribute in content." ); - } - - File siteDir = new File( basedir, "target/site" ); - System.out.println( "Checking for existence of site directory: " + siteDir ); - if ( !siteDir.isDirectory() ) - { - System.out.println( "FAILED" ); - return false; - } +File siteDir = new File( basedir, "target/site" ); +System.out.println( "Checking for existence of site directory: " + siteDir ); +assert siteDir.isDirectory() - String[] reports = [ "changelog", "dev-activity", "file-activity" ]; - for ( String report : reports ) - { - File reportFile = new File( siteDir, report + ".html" ); - System.out.println( "Checking for existence of report: " + reportFile ); - if ( !reportFile.isFile() ) - { - System.out.println( "FAILED" ); - return false; - } - } -} -catch( Throwable t ) +String[] reports = [ "changelog", "dev-activity", "file-activity" ]; +for ( String report : reports ) { - t.printStackTrace(); - return false; + File reportFile = new File( siteDir, report + ".html" ); + System.out.println( "Checking for existence of report: " + reportFile ); + assert reportFile.isFile() } - -return true;
