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-invoker-plugin.git
commit 5c4a5dd8643bfa455aa17ee36a73a3eb95e7eded Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Wed Nov 25 23:24:09 2026 +0000 Format Groovy IT scripts Formatting only: the CONVERSION-phase AST of every file is unchanged. See https://github.com/apache/maven-invoker-plugin/issues/811. --- src/it/MINVOKER-288-failed-setup-run/verify.groovy | 10 +-- .../MINVOKER-288-failed-setup-verify/verify.groovy | 10 +-- src/it/MINVOKER-289/verify.groovy | 20 ++--- src/it/clone-maven-plugin-packaging/verify.groovy | 2 +- src/it/exec-timeout-invoker-level/verify.groovy | 2 +- src/it/exec-timeout-mojo-level/verify.groovy | 2 +- .../verify.groovy | 14 ++-- src/it/fail-build-with-verify/verify.groovy | 4 +- src/it/fail-build/verify.groovy | 4 +- src/it/fail-postbuild/verify.groovy | 4 +- src/it/fail-prebuild/verify.groovy | 4 +- src/it/fail-run-postbuild/verify.groovy | 4 +- src/it/install-extra-artifacts/verify.groovy | 39 +++++----- src/it/integration-test-never-fails/verify.groovy | 4 +- .../invocation-environmentvariable/verify.groovy | 8 +- src/it/invocation-group-properties/verify.groovy | 2 +- src/it/invocation-multiple/verify.groovy | 16 ++-- src/it/invocation-offline/verify.groovy | 4 +- src/it/invocation-project/verify.groovy | 24 ++---- src/it/invocation-spaces/verify.groovy | 22 +++--- src/it/invoker-report/verify.groovy | 16 ++-- src/it/local-repo-default/verify.groovy | 14 ++-- src/it/local-repo-isolated/verify.groovy | 6 +- src/it/local-repo-path/verify.groovy | 4 +- src/it/not-clone-not-plugin/verify.groovy | 6 +- src/it/pom-filtering-reactor/verify.groovy | 40 +++++----- src/it/pom-less-invocation/verify.groovy | 12 +-- src/it/project-cloning-reactor/verify.groovy | 4 +- src/it/project-cloning/setup.groovy | 6 +- src/it/project-cloning/verify.groovy | 23 +++--- src/it/rerun-build-invoker-test/verify.groovy | 2 +- src/it/script-classpath-duplicates/verify.groovy | 17 ++--- src/it/script-errors/verify.groovy | 10 +-- src/it/script-interpreter-detection/verify.groovy | 17 ++--- src/it/script-target-bytecode/verify.groovy | 2 +- src/it/script-verify-xml/verify.groovy | 34 ++++++--- src/it/selector-scripts/setup.groovy | 10 +-- src/it/selector-scripts/verify.groovy | 72 ++++++++--------- src/it/spaces-should-work_non-windows/setup.groovy | 8 +- src/it/spaces-should-work_windows/setup.groovy | 10 +-- src/it/special-characters-should-work/setup.groovy | 8 +- .../staging-dependencies-test-scope/verify.groovy | 37 +++++---- src/it/staging-dependencies/verify.groovy | 89 +++++++++++----------- src/it/staging-pom/verify.groovy | 21 +++-- src/it/staging-reactor/verify.groovy | 47 ++++++------ src/it/updateOnly/verify.groovy | 4 +- 46 files changed, 350 insertions(+), 368 deletions(-) diff --git a/src/it/MINVOKER-288-failed-setup-run/verify.groovy b/src/it/MINVOKER-288-failed-setup-run/verify.groovy index edc0858..6bac42e 100644 --- a/src/it/MINVOKER-288-failed-setup-run/verify.groovy +++ b/src/it/MINVOKER-288-failed-setup-run/verify.groovy @@ -18,23 +18,23 @@ */ import groovy.xml.XmlSlurper -File invokerReports = new File( new File(basedir, 'target'), 'invoker-reports-test' ) +File invokerReports = new File(new File(basedir, 'target'), 'invoker-reports-test') assert invokerReports.exists() -def build1 = new XmlSlurper().parse( new File( invokerReports, 'BUILD-project1.xml' ) ) +def build1 = new XmlSlurper().parse(new File(invokerReports, 'BUILD-project1.xml')) assert [email protected]() == 'failure-build' assert [email protected]() == 'setup' -def build2 = new XmlSlurper().parse( new File( invokerReports, 'BUILD-project2.xml' ) ) +def build2 = new XmlSlurper().parse(new File(invokerReports, 'BUILD-project2.xml')) assert [email protected]() == 'skipped' assert build2.failureMessage.text() == 'Skipped due to setup job(s) failure' -def testsuite = new XmlSlurper().parse( new File( invokerReports, 'TEST-project2.xml' ) ) +def testsuite = new XmlSlurper().parse(new File(invokerReports, 'TEST-project2.xml')) assert [email protected]() == '1' assert testsuite.testcase.skipped.text() == 'Skipped due to setup job(s) failure' -def buildLog = new File( basedir, 'build.log' ).text +def buildLog = new File(basedir, 'build.log').text assert buildLog.contains('[INFO] Passed: 0, Failed: 1, Errors: 0, Skipped: 1') diff --git a/src/it/MINVOKER-288-failed-setup-verify/verify.groovy b/src/it/MINVOKER-288-failed-setup-verify/verify.groovy index 2e769ad..1ea735c 100644 --- a/src/it/MINVOKER-288-failed-setup-verify/verify.groovy +++ b/src/it/MINVOKER-288-failed-setup-verify/verify.groovy @@ -18,23 +18,23 @@ */ import groovy.xml.XmlSlurper -File invokerReports = new File( new File(basedir, "target"), 'invoker-reports-test' ) +File invokerReports = new File(new File(basedir, "target"), 'invoker-reports-test') assert invokerReports.exists() -def build1 = new XmlSlurper().parse( new File( invokerReports, "BUILD-project1.xml" ) ) +def build1 = new XmlSlurper().parse(new File(invokerReports, "BUILD-project1.xml")) assert [email protected]() == "failure-build" assert [email protected]() == "setup" -def build2 = new XmlSlurper().parse( new File( invokerReports, "BUILD-project2.xml" ) ) +def build2 = new XmlSlurper().parse(new File(invokerReports, "BUILD-project2.xml")) assert [email protected]() == "skipped" assert build2.failureMessage.text() == "Skipped due to setup job(s) failure" -def testsuite = new XmlSlurper().parse( new File( invokerReports, "TEST-project2.xml" ) ) +def testsuite = new XmlSlurper().parse(new File(invokerReports, "TEST-project2.xml")) assert [email protected]() == "1" assert testsuite.testcase.skipped.text() == "Skipped due to setup job(s) failure" -def buildLog = new File( basedir, 'build.log' ).text +def buildLog = new File(basedir, 'build.log').text assert buildLog.contains('[INFO] Passed: 0, Failed: 1, Errors: 0, Skipped: 1') diff --git a/src/it/MINVOKER-289/verify.groovy b/src/it/MINVOKER-289/verify.groovy index 04220d2..4eceede 100644 --- a/src/it/MINVOKER-289/verify.groovy +++ b/src/it/MINVOKER-289/verify.groovy @@ -17,17 +17,17 @@ * under the License. */ -assert new File( basedir, 'target/it/project/touch.txt' ).exists() +assert new File(basedir, 'target/it/project/touch.txt').exists() -File buildLog = new File( basedir, 'build.log' ) +File buildLog = new File(basedir, 'build.log') String executionString = "Executing:" -int mavenCommandIndex = buildLog.text.indexOf( executionString ) -String commandLine = buildLog.text.substring( mavenCommandIndex, buildLog.text.indexOf( System.lineSeparator(), - mavenCommandIndex ) ) -commandLine = commandLine.substring(commandLine.indexOf("mvn")); +int mavenCommandIndex = buildLog.text.indexOf(executionString) +String commandLine = buildLog.text.substring(mavenCommandIndex, buildLog.text.indexOf(System.lineSeparator(), + mavenCommandIndex)) +commandLine = commandLine.substring(commandLine.indexOf("mvn")) -assert Arrays.stream( commandLine.split( '\\s' ) ) - .map( f -> f.replaceAll('\'', '')) - .filter(f -> f == '-U') - .count() > 0 +assert Arrays.stream(commandLine.split('\\s')) +.map(f -> f.replaceAll('\'', '')) +.filter(f -> f == '-U') +.count() > 0 diff --git a/src/it/clone-maven-plugin-packaging/verify.groovy b/src/it/clone-maven-plugin-packaging/verify.groovy index c1e93a9..ccb2750 100644 --- a/src/it/clone-maven-plugin-packaging/verify.groovy +++ b/src/it/clone-maven-plugin-packaging/verify.groovy @@ -17,5 +17,5 @@ * under the License. */ -File itRoot = new File( basedir, "target/it/clone-clean" ); +File itRoot = new File(basedir, "target/it/clone-clean") assert itRoot.exists() diff --git a/src/it/exec-timeout-invoker-level/verify.groovy b/src/it/exec-timeout-invoker-level/verify.groovy index 10a8d90..fde1e56 100644 --- a/src/it/exec-timeout-invoker-level/verify.groovy +++ b/src/it/exec-timeout-invoker-level/verify.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -def buildLog = new File( basedir, 'target/it/basic/build.log' ) +def buildLog = new File(basedir, 'target/it/basic/build.log') assert !buildLog.text.contains('Total time: ') assert !buildLog.text.contains('Finished at: ') \ No newline at end of file diff --git a/src/it/exec-timeout-mojo-level/verify.groovy b/src/it/exec-timeout-mojo-level/verify.groovy index 10a8d90..fde1e56 100644 --- a/src/it/exec-timeout-mojo-level/verify.groovy +++ b/src/it/exec-timeout-mojo-level/verify.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -def buildLog = new File( basedir, 'target/it/basic/build.log' ) +def buildLog = new File(basedir, 'target/it/basic/build.log') assert !buildLog.text.contains('Total time: ') assert !buildLog.text.contains('Finished at: ') \ No newline at end of file diff --git a/src/it/fail-build-with-verify-streamLogsOnFailures/verify.groovy b/src/it/fail-build-with-verify-streamLogsOnFailures/verify.groovy index 7d5bdd1..5ee9d43 100644 --- a/src/it/fail-build-with-verify-streamLogsOnFailures/verify.groovy +++ b/src/it/fail-build-with-verify-streamLogsOnFailures/verify.groovy @@ -18,14 +18,14 @@ */ def FS = File.separator -def buildLogOfProject = new File( basedir, 'target/it/project/build.log' ).text +def buildLogOfProject = new File(basedir, 'target/it/project/build.log').text -def buildLog = new File( basedir, 'build.log' ).text +def buildLog = new File(basedir, 'build.log').text -assert buildLog.contains( '*** begin build.log for: project' + FS + 'pom.xml ***' ) -assert buildLog.contains( buildLogOfProject ) -assert buildLog.contains( '*** end build.log for: project' + FS + 'pom.xml ***' ) +assert buildLog.contains('*** begin build.log for: project' + FS + 'pom.xml ***') +assert buildLog.contains(buildLogOfProject) +assert buildLog.contains('*** end build.log for: project' + FS + 'pom.xml ***') -assert buildLog.contains( 'maven-invoker-plugin:' + projectVersion + ':integration-test' ) -assert buildLog.contains( '[ERROR] Failed to execute goal org.apache.maven.plugins:maven-invoker-plugin:' + projectVersion + ':verify' ) +assert buildLog.contains('maven-invoker-plugin:' + projectVersion + ':integration-test') +assert buildLog.contains('[ERROR] Failed to execute goal org.apache.maven.plugins:maven-invoker-plugin:' + projectVersion + ':verify') diff --git a/src/it/fail-build-with-verify/verify.groovy b/src/it/fail-build-with-verify/verify.groovy index 77d475a..df2fb45 100644 --- a/src/it/fail-build-with-verify/verify.groovy +++ b/src/it/fail-build-with-verify/verify.groovy @@ -18,6 +18,6 @@ */ // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else -File touchFile = new File( basedir, "target/it/project/touch.txt" ); -System.out.println( "Checking for existence of touch file: " + touchFile ); +File touchFile = new File(basedir, "target/it/project/touch.txt") +System.out.println("Checking for existence of touch file: " + touchFile) assert touchFile.exists() diff --git a/src/it/fail-build/verify.groovy b/src/it/fail-build/verify.groovy index 77d475a..df2fb45 100644 --- a/src/it/fail-build/verify.groovy +++ b/src/it/fail-build/verify.groovy @@ -18,6 +18,6 @@ */ // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else -File touchFile = new File( basedir, "target/it/project/touch.txt" ); -System.out.println( "Checking for existence of touch file: " + touchFile ); +File touchFile = new File(basedir, "target/it/project/touch.txt") +System.out.println("Checking for existence of touch file: " + touchFile) assert touchFile.exists() diff --git a/src/it/fail-postbuild/verify.groovy b/src/it/fail-postbuild/verify.groovy index 77d475a..df2fb45 100644 --- a/src/it/fail-postbuild/verify.groovy +++ b/src/it/fail-postbuild/verify.groovy @@ -18,6 +18,6 @@ */ // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else -File touchFile = new File( basedir, "target/it/project/touch.txt" ); -System.out.println( "Checking for existence of touch file: " + touchFile ); +File touchFile = new File(basedir, "target/it/project/touch.txt") +System.out.println("Checking for existence of touch file: " + touchFile) assert touchFile.exists() diff --git a/src/it/fail-prebuild/verify.groovy b/src/it/fail-prebuild/verify.groovy index 77d475a..df2fb45 100644 --- a/src/it/fail-prebuild/verify.groovy +++ b/src/it/fail-prebuild/verify.groovy @@ -18,6 +18,6 @@ */ // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else -File touchFile = new File( basedir, "target/it/project/touch.txt" ); -System.out.println( "Checking for existence of touch file: " + touchFile ); +File touchFile = new File(basedir, "target/it/project/touch.txt") +System.out.println("Checking for existence of touch file: " + touchFile) assert touchFile.exists() diff --git a/src/it/fail-run-postbuild/verify.groovy b/src/it/fail-run-postbuild/verify.groovy index 77d475a..df2fb45 100644 --- a/src/it/fail-run-postbuild/verify.groovy +++ b/src/it/fail-run-postbuild/verify.groovy @@ -18,6 +18,6 @@ */ // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else -File touchFile = new File( basedir, "target/it/project/touch.txt" ); -System.out.println( "Checking for existence of touch file: " + touchFile ); +File touchFile = new File(basedir, "target/it/project/touch.txt") +System.out.println("Checking for existence of touch file: " + touchFile) assert touchFile.exists() diff --git a/src/it/install-extra-artifacts/verify.groovy b/src/it/install-extra-artifacts/verify.groovy index a79c62d..8df78f4 100644 --- a/src/it/install-extra-artifacts/verify.groovy +++ b/src/it/install-extra-artifacts/verify.groovy @@ -17,29 +17,28 @@ * under the License. */ -File itRepoDir = new File( basedir, "target/it-repo" ); +File itRepoDir = new File(basedir, "target/it-repo") assert itRepoDir.isDirectory() : "IT local repository missing: " + itRepoDir String[] files = -[ - "org/apache/maven/plugins/maven-clean-plugin/2.4/maven-clean-plugin-2.4.jar", - "org/apache/maven/plugins/maven-clean-plugin/2.4/maven-clean-plugin-2.4.pom", - "org/apache/maven/plugins/maven-clean-plugin/2.4/maven-clean-plugin-2.4-javadoc.jar", - "org/apache/maven/plugins/maven-plugins/16/maven-plugins-16.pom", - "org/apache/maven/maven-parent/15/maven-parent-15.pom", - "org/apache/apache/6/apache-6.pom", - "org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar", - "org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.pom", - "junit/junit/3.8.2/junit-3.8.2.jar", - "junit/junit/3.8.2/junit-3.8.2.pom", - "jdom/jdom/1.1/jdom-1.1.pom", - "org/jdom/jdom/1.1/jdom-1.1.pom", - "org/jdom/jdom/1.1/jdom-1.1.jar", -]; -for ( String file : files ) -{ - File stagedFile = new File( itRepoDir, file ); - System.out.println( "Checking for existence of: " + stagedFile ); + [ + "org/apache/maven/plugins/maven-clean-plugin/2.4/maven-clean-plugin-2.4.jar", + "org/apache/maven/plugins/maven-clean-plugin/2.4/maven-clean-plugin-2.4.pom", + "org/apache/maven/plugins/maven-clean-plugin/2.4/maven-clean-plugin-2.4-javadoc.jar", + "org/apache/maven/plugins/maven-plugins/16/maven-plugins-16.pom", + "org/apache/maven/maven-parent/15/maven-parent-15.pom", + "org/apache/apache/6/apache-6.pom", + "org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar", + "org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.pom", + "junit/junit/3.8.2/junit-3.8.2.jar", + "junit/junit/3.8.2/junit-3.8.2.pom", + "jdom/jdom/1.1/jdom-1.1.pom", + "org/jdom/jdom/1.1/jdom-1.1.pom", + "org/jdom/jdom/1.1/jdom-1.1.jar", + ] +for ( String file : files ) { + File stagedFile = new File( itRepoDir, file ) + System.out.println( "Checking for existence of: " + stagedFile ) assert stagedFile.isFile() : "Missing: " + stagedFile assert !( file.endsWith( "jdom-1.1.jar" ) && stagedFile.length() < 1024 * 10 ) : "Corrupt: " + stagedFile } diff --git a/src/it/integration-test-never-fails/verify.groovy b/src/it/integration-test-never-fails/verify.groovy index 77d475a..df2fb45 100644 --- a/src/it/integration-test-never-fails/verify.groovy +++ b/src/it/integration-test-never-fails/verify.groovy @@ -18,6 +18,6 @@ */ // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else -File touchFile = new File( basedir, "target/it/project/touch.txt" ); -System.out.println( "Checking for existence of touch file: " + touchFile ); +File touchFile = new File(basedir, "target/it/project/touch.txt") +System.out.println("Checking for existence of touch file: " + touchFile) assert touchFile.exists() diff --git a/src/it/invocation-environmentvariable/verify.groovy b/src/it/invocation-environmentvariable/verify.groovy index f89cb94..a6c3ce8 100644 --- a/src/it/invocation-environmentvariable/verify.groovy +++ b/src/it/invocation-environmentvariable/verify.groovy @@ -17,10 +17,10 @@ * under the License. */ -def buildLog = new File( basedir, 'build.log' ).text +def buildLog = new File(basedir, 'build.log').text assert buildLog.contains('[INFO] BUILD SUCCESS') -def buildLod273 = new File( basedir, 'src/it/minvoker-273/build.log' ).text +def buildLod273 = new File(basedir, 'src/it/minvoker-273/build.log').text // MINVOKER273_PROPERTIES1 is present in system environment and should be removed assert !buildLod273.contains('MINVOKER273_PROPERTIES1') @@ -34,10 +34,10 @@ assert !buildLod273.contains('MINVOKER273_PROPERTIES3') // MINVOKER-372: MAVEN_ARGS=-Dleaked.arg=true is set on this outer build's own environment (see // invoker.properties) but must not leak into the forked invocation of minvoker-372; if it did, the // "leaked" profile would activate and fail that build. -def buildLog372 = new File( basedir, 'src/it/minvoker-372/build.log' ).text +def buildLog372 = new File(basedir, 'src/it/minvoker-372/build.log').text assert buildLog372.contains('] BUILD SUCCESS') // MINVOKER-172: every forked invocation gets MAVEN_SKIP_RC=1 so ~/.mavenrc/etc cannot override MAVEN_OPTS. -def buildLog172 = new File( basedir, 'src/it/minvoker-172/build.log' ).text +def buildLog172 = new File(basedir, 'src/it/minvoker-172/build.log').text assert buildLog172.contains('] BUILD SUCCESS') diff --git a/src/it/invocation-group-properties/verify.groovy b/src/it/invocation-group-properties/verify.groovy index 7ba59ce..370eab6 100644 --- a/src/it/invocation-group-properties/verify.groovy +++ b/src/it/invocation-group-properties/verify.groovy @@ -16,5 +16,5 @@ * specific language governing permissions and limitations * under the License. */ - + return true \ No newline at end of file diff --git a/src/it/invocation-multiple/verify.groovy b/src/it/invocation-multiple/verify.groovy index 190a83d..328e931 100644 --- a/src/it/invocation-multiple/verify.groovy +++ b/src/it/invocation-multiple/verify.groovy @@ -17,18 +17,18 @@ * under the License. */ -File test0File = new File( basedir, "target/it/project/target/test0.txt" ); -System.out.println( "Checking for existence of first test file: " + test0File ); +File test0File = new File(basedir, "target/it/project/target/test0.txt") +System.out.println("Checking for existence of first test file: " + test0File) assert test0File.exists() -String test0 = test0File.getText( 'UTF-8' ).trim(); -System.out.println( "Checking contents of first test file: " + test0 ); +String test0 = test0File.getText('UTF-8').trim() +System.out.println("Checking contents of first test file: " + test0) assert "ISO-8859-1" == test0 -File test1File = new File( basedir, "target/it/project/target/test1.txt" ); -System.out.println( "Checking for existence of second test file: " + test1File ); +File test1File = new File(basedir, "target/it/project/target/test1.txt") +System.out.println("Checking for existence of second test file: " + test1File) assert test1File.exists() -String test1 = test1File.getText( 'UTF-8' ).trim(); -System.out.println( "Checking contents of second test file: " + test1 ); +String test1 = test1File.getText('UTF-8').trim() +System.out.println("Checking contents of second test file: " + test1) assert "UTF-8" == test1 diff --git a/src/it/invocation-offline/verify.groovy b/src/it/invocation-offline/verify.groovy index aaf127d..c8bd7b5 100644 --- a/src/it/invocation-offline/verify.groovy +++ b/src/it/invocation-offline/verify.groovy @@ -18,6 +18,6 @@ */ // sanity check to make sure the builds were actually run -File repoDir = new File( basedir, "target/it-repo" ); -System.out.println( "Checking for existence of test repo: " + repoDir ); +File repoDir = new File(basedir, "target/it-repo") +System.out.println("Checking for existence of test repo: " + repoDir) assert repoDir.exists() : "Missing repository directory: " + repoDir diff --git a/src/it/invocation-project/verify.groovy b/src/it/invocation-project/verify.groovy index a1fe94e..78cb314 100644 --- a/src/it/invocation-project/verify.groovy +++ b/src/it/invocation-project/verify.groovy @@ -18,27 +18,19 @@ */ String[] unexpectedPaths = -[ - "sub-1/target", - "sub-3/target", -]; + ["sub-1/target", "sub-3/target",] -for ( String path : unexpectedPaths ) -{ - File file = new File( new File( basedir, "target/it/project" ), path); - System.out.println( "Checking for absence of: " + file ); +for (String path : unexpectedPaths) { + File file = new File(new File(basedir, "target/it/project"), path) + System.out.println("Checking for absence of: " + file) assert !file.exists() : "Unexpected path found: " + file } String[] expectedPaths = -[ - "target", - "sub-2/target", -]; + ["target", "sub-2/target",] -for ( String path : expectedPaths ) -{ - File file = new File( new File( basedir, "target/it/project" ), path); - System.out.println( "Checking for existence of: " + file ); +for (String path : expectedPaths) { + File file = new File(new File(basedir, "target/it/project"), path) + System.out.println("Checking for existence of: " + file) assert file.exists() : "Expected path not found: " + file } diff --git a/src/it/invocation-spaces/verify.groovy b/src/it/invocation-spaces/verify.groovy index a60b23b..09f6e0d 100644 --- a/src/it/invocation-spaces/verify.groovy +++ b/src/it/invocation-spaces/verify.groovy @@ -17,24 +17,20 @@ * under the License. */ -File testFile = new File( basedir, "target/it projects/project/target/classes/test.txt" ); -System.out.println( "Checking for existence of test file: " + testFile ); +File testFile = new File(basedir, "target/it projects/project/target/classes/test.txt") +System.out.println("Checking for existence of test file: " + testFile) assert testFile.exists() -String[] values = [ - "value with spaces from settings", - "value with spaces from cli", -]; +String[] values = ["value with spaces from settings", "value with spaces from cli",] -testFile.withReader( 'UTF-8' ) { reader -> - for ( String value : values ) - { - String line = reader.readLine(); - System.out.println( "Checking for occurrence of: " + value ); +testFile.withReader('UTF-8') { reader -> + for (String value : values) { + String line = reader.readLine() + System.out.println("Checking for occurrence of: " + value) assert value == line } } -File installedFile = new File( basedir, "target/it repo/test/spacy-pom/0.1-SNAPSHOT/spacy-pom-0.1-SNAPSHOT.jar" ); -System.out.println( "Checking for existence of installed file: " + installedFile ); +File installedFile = new File(basedir, "target/it repo/test/spacy-pom/0.1-SNAPSHOT/spacy-pom-0.1-SNAPSHOT.jar") +System.out.println("Checking for existence of installed file: " + installedFile) assert installedFile.exists() diff --git a/src/it/invoker-report/verify.groovy b/src/it/invoker-report/verify.groovy index 8e6f7b7..4c797c0 100644 --- a/src/it/invoker-report/verify.groovy +++ b/src/it/invoker-report/verify.groovy @@ -17,20 +17,24 @@ * under the License. */ -File reportFile = new File( basedir, "target/site/invoker.html"); +File reportFile = new File(basedir, "target/site/invoker.html") -System.out.println( "Checking for existence of report file: " + reportFile ); +System.out.println("Checking for existence of report file: " + reportFile) assert reportFile.exists() : "Report file missing: " + reportFile allWarningLines = new File( basedir, "build.log" ).readLines().findAll { it.contains( "[WARNING] Incomplete job name-description" ) } -missingNameLinesCount = allWarningLines.count { it.contains( "name is missing" ) }; -missingDescriptionLinesCount = allWarningLines.count { it.contains( "description is missing" ) }; +missingNameLinesCount = allWarningLines.count { + it.contains( "name is missing" ) +} +missingDescriptionLinesCount = allWarningLines.count { + it.contains( "description is missing" ) +} -expectedMissingNames = 4; +expectedMissingNames = 4 assert expectedMissingNames == missingNameLinesCount : "Current missingNameLinesCount: " + missingNameLinesCount + " but expecting: " + expectedMissingNames -expectedMissingDescriptions = 1; +expectedMissingDescriptions = 1 assert expectedMissingDescriptions == missingDescriptionLinesCount : "Current missingDescriptionLinesCount: " + missingDescriptionLinesCount + " but expecting: " + expectedMissingDescriptions diff --git a/src/it/local-repo-default/verify.groovy b/src/it/local-repo-default/verify.groovy index 68a7929..ccc5185 100644 --- a/src/it/local-repo-default/verify.groovy +++ b/src/it/local-repo-default/verify.groovy @@ -17,19 +17,19 @@ * under the License. */ -File badRepoDir = new File( basedir, "target/bad-repo" ); +File badRepoDir = new File(basedir, "target/bad-repo") assert !badRepoDir.exists() : "Sub build used wrong local repository (from its settings.xml): " + badRepoDir /* * NOTE: This relies heavily on the Invoker Plugin's configuration of our parent build, not nice but until MINVOKER-49 * is available here, we have no other way of getting the path. */ -File localRepoPathOfThisBuild = new File( basedir.getParentFile().getParentFile(), "local-repo" ); -System.out.println("Local repository of this build: " + localRepoPathOfThisBuild); +File localRepoPathOfThisBuild = new File( basedir.getParentFile().getParentFile(), "local-repo" ) +System.out.println("Local repository of this build: " + localRepoPathOfThisBuild) -File textFile = new File( basedir, "target/its/project/target/local-repo-path.txt" ); -File localRepoPathOfSubBuild = new File( textFile.readLines( 'UTF-8' )[0] ); -System.out.println("Local repository of sub build: " + localRepoPathOfSubBuild); +File textFile = new File( basedir, "target/its/project/target/local-repo-path.txt" ) +File localRepoPathOfSubBuild = new File( textFile.readLines( 'UTF-8' )[0] ) +System.out.println("Local repository of sub build: " + localRepoPathOfSubBuild) /* * This is partly a sanity check of the Maven core (i.e. its MavenSettingsBuilder) which should ensure @@ -39,5 +39,5 @@ System.out.println("Local repository of sub build: " + localRepoPathOfSubBuild); */ assert localRepoPathOfThisBuild.getCanonicalPath() == localRepoPathOfSubBuild.getCanonicalPath() : "Sub build used wrong local repository: " + localRepoPathOfSubBuild -File installedFile = new File( localRepoPathOfThisBuild, "test/local-repo-default/0.1-SNAPSHOT/local-repo-default-0.1-SNAPSHOT.pom" ); +File installedFile = new File( localRepoPathOfThisBuild, "test/local-repo-default/0.1-SNAPSHOT/local-repo-default-0.1-SNAPSHOT.pom" ) assert installedFile.isFile() : "Installed file missing in local repo: " + installedFile diff --git a/src/it/local-repo-isolated/verify.groovy b/src/it/local-repo-isolated/verify.groovy index 45c0594..1882f2f 100644 --- a/src/it/local-repo-isolated/verify.groovy +++ b/src/it/local-repo-isolated/verify.groovy @@ -17,11 +17,11 @@ * under the License. */ -File badRepoDir = new File( basedir, "target/bad-repo" ); +File badRepoDir = new File(basedir, "target/bad-repo") assert !badRepoDir.exists() : "IT used wrong local repository: " + badRepoDir -File itRepoDir = new File( basedir, "target/it-repo" ); +File itRepoDir = new File( basedir, "target/it-repo" ) assert itRepoDir.isDirectory() : "IT local repository missing: " + itRepoDir -File installedFile = new File( itRepoDir, "test/local-repo-isolated/0.1-SNAPSHOT/local-repo-isolated-0.1-SNAPSHOT.pom" ); +File installedFile = new File( itRepoDir, "test/local-repo-isolated/0.1-SNAPSHOT/local-repo-isolated-0.1-SNAPSHOT.pom" ) assert installedFile.isFile() : "Installed file missing in local repo: " + installedFile diff --git a/src/it/local-repo-path/verify.groovy b/src/it/local-repo-path/verify.groovy index aaf127d..c8bd7b5 100644 --- a/src/it/local-repo-path/verify.groovy +++ b/src/it/local-repo-path/verify.groovy @@ -18,6 +18,6 @@ */ // sanity check to make sure the builds were actually run -File repoDir = new File( basedir, "target/it-repo" ); -System.out.println( "Checking for existence of test repo: " + repoDir ); +File repoDir = new File(basedir, "target/it-repo") +System.out.println("Checking for existence of test repo: " + repoDir) assert repoDir.exists() : "Missing repository directory: " + repoDir diff --git a/src/it/not-clone-not-plugin/verify.groovy b/src/it/not-clone-not-plugin/verify.groovy index 8876bf8..5f6c7eb 100644 --- a/src/it/not-clone-not-plugin/verify.groovy +++ b/src/it/not-clone-not-plugin/verify.groovy @@ -19,8 +19,8 @@ // the project is not a maven-plugin, so cloning is off: no clone directory, neither the one the // plugin would use by default for plugin projects nor the one other ITs configure -assert !new File( basedir, "target/its" ).exists() -assert !new File( basedir, "target/it" ).exists() +assert !new File(basedir, "target/its").exists() +assert !new File(basedir, "target/it").exists() // and the nested project was built in place -assert new File( basedir, "src/it/clone-clean/build.log" ).isFile() +assert new File(basedir, "src/it/clone-clean/build.log").isFile() diff --git a/src/it/pom-filtering-reactor/verify.groovy b/src/it/pom-filtering-reactor/verify.groovy index 865ad52..abf38b6 100644 --- a/src/it/pom-filtering-reactor/verify.groovy +++ b/src/it/pom-filtering-reactor/verify.groovy @@ -17,33 +17,27 @@ * under the License. */ -boolean check( String project, boolean filtered ) -{ - File pomFile = new File( basedir, "target/it/" + project + "/pom.xml" ); - System.out.println( "Checking for existence of " + ( filtered ? "" : "un" ) + "filtered POM: " + pomFile ); - if ( !pomFile.exists() ) - { - System.out.println( "FAILED!" ); - return false; +boolean check(String project, boolean filtered) { + File pomFile = new File(basedir, "target/it/" + project + "/pom.xml") + System.out.println("Checking for existence of " + (filtered ? "" : "un") + "filtered POM: " + pomFile) + if (!pomFile.exists()) { + System.out.println("FAILED!") + return false } - String xml = pomFile.getText( 'UTF-8' ); + String xml = pomFile.getText('UTF-8') - String[] values = [ - "<prop0>pom-filtering-reactor</prop0>", - ]; - for ( String value : values ) - { - System.out.println( "Checking for " + ( filtered ? "occurrence" : "absence" ) + " of: " + value ); - if ( ( filtered && xml.indexOf( value ) < 0 ) || ( !filtered && xml.indexOf( value ) >= 0 ) ) - { - System.out.println( "FAILED!" ); - return false; + String[] values = ["<prop0>pom-filtering-reactor</prop0>",] + for (String value : values) { + System.out.println("Checking for " + (filtered ? "occurrence" : "absence") + " of: " + value) + if ((filtered && xml.indexOf(value) < 0) || (!filtered && xml.indexOf(value) >= 0)) { + System.out.println("FAILED!") + return false } } - return true; + return true } -assert check( "mod2-parent", true ) && check( "mod2-parent/mod2", true ) && check( "mod2-parent/mod1-parent", true ) && - check( "mod2-parent/mod1", true ) && check( "mod2-parent/mod3", true) && - check( "mod2-parent/mod1/src/it", false ) +assert check("mod2-parent", true) && check("mod2-parent/mod2", true) && check("mod2-parent/mod1-parent", true) && +check("mod2-parent/mod1", true) && check("mod2-parent/mod3", true) && +check("mod2-parent/mod1/src/it", false) diff --git a/src/it/pom-less-invocation/verify.groovy b/src/it/pom-less-invocation/verify.groovy index 478e5d4..80bcf1b 100644 --- a/src/it/pom-less-invocation/verify.groovy +++ b/src/it/pom-less-invocation/verify.groovy @@ -17,15 +17,11 @@ * under the License. */ -File itDir = new File( basedir, "target/it" ); +File itDir = new File(basedir, "target/it") assert itDir.isDirectory() : "IT directory not existent: " + itDir -String[] paths = [ - "no-pom", - "no-pom/build.log", -]; -for ( String path : paths ) -{ - File file = new File( itDir, path ); +String[] paths = ["no-pom", "no-pom/build.log",] +for ( String path : paths ) { + File file = new File( itDir, path ) assert file.exists() : "Expected file/directory not existent: " + file } diff --git a/src/it/project-cloning-reactor/verify.groovy b/src/it/project-cloning-reactor/verify.groovy index 0f73188..dd90cd3 100644 --- a/src/it/project-cloning-reactor/verify.groovy +++ b/src/it/project-cloning-reactor/verify.groovy @@ -18,6 +18,6 @@ */ // sanity check to make sure the builds were actually run -File itDir = new File( basedir, "target/it" ); -System.out.println( "Checking for existence of clones: " + itDir ); +File itDir = new File(basedir, "target/it") +System.out.println("Checking for existence of clones: " + itDir) assert itDir.exists() : "Missing IT directory: " + itDir diff --git a/src/it/project-cloning/setup.groovy b/src/it/project-cloning/setup.groovy index b890f60..6c61d07 100644 --- a/src/it/project-cloning/setup.groovy +++ b/src/it/project-cloning/setup.groovy @@ -17,7 +17,7 @@ * under the License. */ -File emptyDir = new File( basedir, "src/it/module-1/empty-dir" ); -emptyDir.mkdirs(); +File emptyDir = new File(basedir, "src/it/module-1/empty-dir") +emptyDir.mkdirs() -return true; +return true diff --git a/src/it/project-cloning/verify.groovy b/src/it/project-cloning/verify.groovy index 4d2e5d5..466d1a4 100644 --- a/src/it/project-cloning/verify.groovy +++ b/src/it/project-cloning/verify.groovy @@ -17,21 +17,20 @@ * under the License. */ -File itDir = new File( basedir, "target/it" ); +File itDir = new File(basedir, "target/it") assert itDir.isDirectory() : "IT directory not existent: " + itDir // NOTE: It is part of the test design that "module" is a prefix of "module-1" String[] paths = [ - "module", - "module/pom.xml", - "module-1", - "module-1/pom.xml", - "module-1/empty-dir", - "module-1/sub-module", - "module-1/sub-module/pom.xml", -]; -for ( String path : paths ) -{ - File file = new File( itDir, path ); + "module", + "module/pom.xml", + "module-1", + "module-1/pom.xml", + "module-1/empty-dir", + "module-1/sub-module", + "module-1/sub-module/pom.xml", +] +for ( String path : paths ) { + File file = new File( itDir, path ) assert file.exists() : "Cloned file/directory not existent: " + file } diff --git a/src/it/rerun-build-invoker-test/verify.groovy b/src/it/rerun-build-invoker-test/verify.groovy index 69c739c..d41654c 100644 --- a/src/it/rerun-build-invoker-test/verify.groovy +++ b/src/it/rerun-build-invoker-test/verify.groovy @@ -22,7 +22,7 @@ def buildLog = new File(basedir, 'build.log').text String header = '[INFO] Building rerun-build-invoker-test 1.0-SNAPSHOT' int second = buildLog.indexOf(header, buildLog.indexOf(header) + 1) -assert second > 0 : 'build.log has only one invocation' +assert second> 0 : 'build.log has only one invocation' // invoker.test given as user property: the selected project was executed only once - no rerun def userPropertyLog = buildLog.substring(0, second) diff --git a/src/it/script-classpath-duplicates/verify.groovy b/src/it/script-classpath-duplicates/verify.groovy index 4c8c967..f9a9612 100644 --- a/src/it/script-classpath-duplicates/verify.groovy +++ b/src/it/script-classpath-duplicates/verify.groovy @@ -18,14 +18,13 @@ */ String[] files = [ - "target/it/beanshell/target/created-by-prebuild.bsh", - "target/it/beanshell/target/created-by-postbuild.bsh", - "target/it/groovy/target/created-by-prebuild.groovy", - "target/it/groovy/target/created-by-postbuild.groovy", - ]; -for ( String file : files ) -{ - File touchFile = new File( basedir, file ); - System.out.println( "Checking for existence of: " + touchFile ); + "target/it/beanshell/target/created-by-prebuild.bsh", + "target/it/beanshell/target/created-by-postbuild.bsh", + "target/it/groovy/target/created-by-prebuild.groovy", + "target/it/groovy/target/created-by-postbuild.groovy", +] +for (String file : files) { + File touchFile = new File(basedir, file) + System.out.println("Checking for existence of: " + touchFile) assert touchFile.isFile() } diff --git a/src/it/script-errors/verify.groovy b/src/it/script-errors/verify.groovy index d02aa85..38cdd81 100644 --- a/src/it/script-errors/verify.groovy +++ b/src/it/script-errors/verify.groovy @@ -18,12 +18,12 @@ */ // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else -File touchFile; +File touchFile -touchFile = new File( basedir, "target/its/beanshell/touch.txt" ); -System.out.println( "Checking for existence of touch file: " + touchFile ); +touchFile = new File(basedir, "target/its/beanshell/touch.txt") +System.out.println("Checking for existence of touch file: " + touchFile) assert touchFile.exists() : "Did not find marker file: " + touchFile -touchFile = new File( basedir, "target/its/groovy/touch.txt" ); -System.out.println( "Checking for existence of touch file: " + touchFile ); +touchFile = new File( basedir, "target/its/groovy/touch.txt" ) +System.out.println( "Checking for existence of touch file: " + touchFile ) assert touchFile.exists() : "Did not find marker file: " + touchFile diff --git a/src/it/script-interpreter-detection/verify.groovy b/src/it/script-interpreter-detection/verify.groovy index d1d42d1..777649e 100644 --- a/src/it/script-interpreter-detection/verify.groovy +++ b/src/it/script-interpreter-detection/verify.groovy @@ -18,14 +18,13 @@ */ String[] files = [ - "target/its/beanshell/target/prebuild.bsh", - "target/its/beanshell/target/postbuild.bsh", - "target/its/groovy/target/prebuild.groovy", - "target/its/groovy/target/postbuild.groovy", - ]; -for ( String file : files ) -{ - File touchFile = new File( basedir, file ); - System.out.println( "Checking for existence of: " + touchFile ); + "target/its/beanshell/target/prebuild.bsh", + "target/its/beanshell/target/postbuild.bsh", + "target/its/groovy/target/prebuild.groovy", + "target/its/groovy/target/postbuild.groovy", +] +for (String file : files) { + File touchFile = new File(basedir, file) + System.out.println("Checking for existence of: " + touchFile) assert touchFile.isFile() } diff --git a/src/it/script-target-bytecode/verify.groovy b/src/it/script-target-bytecode/verify.groovy index ce689a7..4d192ef 100644 --- a/src/it/script-target-bytecode/verify.groovy +++ b/src/it/script-target-bytecode/verify.groovy @@ -19,6 +19,6 @@ // the outer project sets maven.compiler.release=8, so the hook script must not have been compiled to a level with // native records, whatever JDK runs this build -File result = new File( basedir, "target/its/project/record-superclass.txt" ) +File result = new File(basedir, "target/its/project/record-superclass.txt") assert result.exists() : "the post-build hook script did not run" assert result.text == "java.lang.Object" diff --git a/src/it/script-verify-xml/verify.groovy b/src/it/script-verify-xml/verify.groovy index be3f550..e159cfe 100644 --- a/src/it/script-verify-xml/verify.groovy +++ b/src/it/script-verify-xml/verify.groovy @@ -20,10 +20,10 @@ import groovy.xml.XmlSlurper // from http://groovy-lang.org/processing-xml.html -// A lot of examples covering xml assertions +// A lot of examples covering xml assertions class XmlExamples { - static def CAR_RECORDS = ''' + static def CAR_RECORDS = ''' <records> <car name='HSV Maloo' make='Holden' year='2006'> <country>Australia</country> @@ -54,16 +54,32 @@ assert carsWith_e_InMake.size() == 2 // alternative way to find cars with 'e' in make assert 2 == records.car.findAll{ it.@make =~ '.*e.*' }.size() // makes of cars that have an 's' followed by an 'a' in the country -assert ['Holden', 'Peel'] == records.car.findAll{ it.country =~ '.*s.*a.*' }[email protected]{ it.text() } +assert ['Holden', 'Peel'] == records.car.findAll{ + it.country =~ '.*s.*a.*' +}[email protected]{ + it.text() +} def expectedRecordTypes = ['speed', 'size', 'price'] -assert expectedRecordTypes == records.depthFirst().grep{ it.@type != '' }.'@type'*.text() -assert expectedRecordTypes == records.'**'.grep{ it.@type != '' }.'@type'*.text() +assert expectedRecordTypes == records.depthFirst().grep{ + it.@type != '' +}.'@type'*.text() +assert expectedRecordTypes == records.'**'.grep{ + it.@type != '' +}.'@type'*.text() def countryOne = records.car[1].country assert 'Peel' == countryOne.parent()[email protected]() assert 'Peel' == countryOne.'..'[email protected]() // names of cars with records sorted by year -def sortedNames = records.car.list().sort{ [email protected]() }.'@name'*.text() +def sortedNames = records.car.list().sort{ + [email protected]() +}.'@name'*.text() assert ['Royale', 'P50', 'HSV Maloo'] == sortedNames -assert ['Australia', 'Isle of Man'] == records.'**'.grep{ it.@type =~ 's.*' }*.parent().country*.text() -assert 'co-re-co-re-co-re' == records.car.children().collect{ it.name()[0..1] }.join('-') -assert 'co-re-co-re-co-re' == records.car.'*'.collect{ it.name()[0..1] }.join('-') +assert ['Australia', 'Isle of Man'] == records.'**'.grep{ + it.@type =~ 's.*' +}*.parent().country*.text() +assert 'co-re-co-re-co-re' == records.car.children().collect{ + it.name()[0..1] +}.join('-') +assert 'co-re-co-re-co-re' == records.car.'*'.collect{ + it.name()[0..1] +}.join('-') diff --git a/src/it/selector-scripts/setup.groovy b/src/it/selector-scripts/setup.groovy index 12f9aa8..aa8216b 100644 --- a/src/it/selector-scripts/setup.groovy +++ b/src/it/selector-scripts/setup.groovy @@ -18,8 +18,8 @@ */ // Previous potential target 'content' has impact on IT execution -// (Some new file should be created by verify.sh) -new File( basedir, "target/invoker-reports-test" ).deleteDir() -new File( basedir, "src/it/script-ret-quiet/target" ).deleteDir() -new File( basedir, "src/it/script-ret-true/target" ).deleteDir() -return true; +// (Some new file should be created by verify.sh) +new File(basedir, "target/invoker-reports-test").deleteDir() +new File(basedir, "src/it/script-ret-quiet/target").deleteDir() +new File(basedir, "src/it/script-ret-true/target").deleteDir() +return true diff --git a/src/it/selector-scripts/verify.groovy b/src/it/selector-scripts/verify.groovy index ff64c46..99e030e 100644 --- a/src/it/selector-scripts/verify.groovy +++ b/src/it/selector-scripts/verify.groovy @@ -17,60 +17,50 @@ * under the License. */ -String[] expected = [ - "target/its/script-ret-true/target/touch.txt", - "target/its/script-ret-quiet/target/touch.txt", - ]; -for ( String file : expected ) -{ - File touchFile = new File( basedir, file ); - System.out.println( "Checking for existence of: " + touchFile ); +String[] expected = ["target/its/script-ret-true/target/touch.txt", "target/its/script-ret-quiet/target/touch.txt",] +for (String file : expected) { + File touchFile = new File(basedir, file) + System.out.println("Checking for existence of: " + touchFile) assert touchFile.isFile() } String[] unexpected = [ - "target/its/script-ret-false/target/touch.txt", - "target/its/script-ret-other/target/touch.txt", - "target/its/script-throws/target/touch.txt", - ]; -for ( String file : unexpected ) -{ - File touchFile = new File( basedir, file ); - System.out.println( "Checking for absence of: " + touchFile ); - assert !touchFile.exists() : file + " should not be here -> FAILED!" + "target/its/script-ret-false/target/touch.txt", + "target/its/script-ret-other/target/touch.txt", + "target/its/script-throws/target/touch.txt", +] +for (String file : unexpected) { + File touchFile = new File(basedir, file) + System.out.println("Checking for absence of: " + touchFile) + assert !touchFile.exists() : file + " should not be here -> FAILED!" } String[] success = [ - "target/invoker-reports-test/BUILD-script-ret-true.xml", - "target/invoker-reports-test/BUILD-script-ret-quiet.xml", - ]; -for ( String file : success ) -{ - File resultFile = new File( basedir, file ); - System.out.println( "Checking build result: " + resultFile ); - String xml = resultFile.getText( 'UTF-8' ); + "target/invoker-reports-test/BUILD-script-ret-true.xml", + "target/invoker-reports-test/BUILD-script-ret-quiet.xml", +] +for (String file : success) { + File resultFile = new File(basedir, file) + System.out.println("Checking build result: " + resultFile) + String xml = resultFile.getText('UTF-8') assert xml.indexOf("result=\"success\"") >= 0 || xml.indexOf("result='success'") >= 0 : resultFile + " not success -> FAILED!" } String[] skipped = [ - "target/invoker-reports-test/BUILD-script-ret-false.xml", - "target/invoker-reports-test/BUILD-script-ret-other.xml", - ]; -for ( String file : skipped ) -{ - File resultFile = new File( basedir, file ); - System.out.println( "Checking build result: " + resultFile ); - String xml = resultFile.getText( 'UTF-8' ); + "target/invoker-reports-test/BUILD-script-ret-false.xml", + "target/invoker-reports-test/BUILD-script-ret-other.xml", +] +for (String file : skipped) { + File resultFile = new File(basedir, file) + System.out.println("Checking build result: " + resultFile) + String xml = resultFile.getText('UTF-8') assert xml.indexOf("result=\"skipped\"") >= 0 || xml.indexOf("result='skipped'") >= 0 : resultFile + " not skipped -> FAILED!" } -String[] inerror = [ - "target/invoker-reports-test/BUILD-script-throw.xml", - ]; -for ( String file : inerror ) -{ - File resultFile = new File( basedir, file ); - System.out.println( "Checking build result: " + resultFile ); - String xml = resultFile.getText( 'UTF-8' ); +String[] inerror = ["target/invoker-reports-test/BUILD-script-throw.xml",] +for (String file : inerror) { + File resultFile = new File(basedir, file) + System.out.println("Checking build result: " + resultFile) + String xml = resultFile.getText('UTF-8') assert xml.indexOf("result=\"error\"") >= 0 || xml.indexOf("result='error'") >= 0 : resultFile + " not failed -> FAILED!" } diff --git a/src/it/spaces-should-work_non-windows/setup.groovy b/src/it/spaces-should-work_non-windows/setup.groovy index 5dda424..db7fffc 100644 --- a/src/it/spaces-should-work_non-windows/setup.groovy +++ b/src/it/spaces-should-work_non-windows/setup.groovy @@ -19,9 +19,9 @@ import org.apache.commons.io.FileUtils -File srcIt = new File (basedir, "src/it"); -File originalFolder = new File (srcIt, "minvoker-test"); -File destinationFolder = new File(srcIt, "test-\u00c9\u00e9\u00ea- & -\u00c9\u00e9\u00ea-test"); -FileUtils.deleteQuietly(destinationFolder); +File srcIt = new File(basedir, "src/it") +File originalFolder = new File(srcIt, "minvoker-test") +File destinationFolder = new File(srcIt, "test-\u00c9\u00e9\u00ea- & -\u00c9\u00e9\u00ea-test") +FileUtils.deleteQuietly(destinationFolder) // rename old one into new one with special characters. assert originalFolder.renameTo(destinationFolder) : "Rename didn't work." diff --git a/src/it/spaces-should-work_windows/setup.groovy b/src/it/spaces-should-work_windows/setup.groovy index 829476f..858157d 100644 --- a/src/it/spaces-should-work_windows/setup.groovy +++ b/src/it/spaces-should-work_windows/setup.groovy @@ -22,11 +22,11 @@ import java.util.* import java.util.regex.* import org.apache.commons.io.FileUtils -File srcIt = new File (basedir, "src/it"); -File originalFolder = new File (srcIt, "minvoker-test"); -File destinationFolder = new File(srcIt, "test-\u00c9\u00e9\u00ea- & -\u00c9\u00e9\u00ea-test"); -FileUtils.deleteQuietly(destinationFolder); +File srcIt = new File(basedir, "src/it") +File originalFolder = new File(srcIt, "minvoker-test") +File destinationFolder = new File(srcIt, "test-\u00c9\u00e9\u00ea- & -\u00c9\u00e9\u00ea-test") +FileUtils.deleteQuietly(destinationFolder) // rename old one into new one with special characters. if (!originalFolder.renameTo(destinationFolder)) { - throw new IOException("Rename didn't work.") + throw new IOException("Rename didn't work.") } diff --git a/src/it/special-characters-should-work/setup.groovy b/src/it/special-characters-should-work/setup.groovy index 1b895f2..758929b 100644 --- a/src/it/special-characters-should-work/setup.groovy +++ b/src/it/special-characters-should-work/setup.groovy @@ -19,9 +19,9 @@ import org.apache.commons.io.FileUtils -File srcIt = new File (basedir, "src/it"); -File originalFolder = new File (srcIt, "minvoker-test"); -File destinationFolder = new File(srcIt, "test-\u00c9\u00e9\u00ea-more-\u00c9\u00e9\u00ea-test"); -FileUtils.deleteQuietly(destinationFolder); +File srcIt = new File(basedir, "src/it") +File originalFolder = new File(srcIt, "minvoker-test") +File destinationFolder = new File(srcIt, "test-\u00c9\u00e9\u00ea-more-\u00c9\u00e9\u00ea-test") +FileUtils.deleteQuietly(destinationFolder) // rename old one into new one with special characters. assert originalFolder.renameTo(destinationFolder) : "Rename didn't work." diff --git a/src/it/staging-dependencies-test-scope/verify.groovy b/src/it/staging-dependencies-test-scope/verify.groovy index eb54ae8..417985d 100644 --- a/src/it/staging-dependencies-test-scope/verify.groovy +++ b/src/it/staging-dependencies-test-scope/verify.groovy @@ -17,28 +17,27 @@ * under the License. */ -import org.codehaus.plexus.util.*; -import org.codehaus.plexus.util.xml.*; +import org.codehaus.plexus.util.* +import org.codehaus.plexus.util.xml.* -File itRepoDir = new File( basedir, "target/it-repo" ); -System.out.println( "Checking for existence of: " + itRepoDir ); +File itRepoDir = new File(basedir, "target/it-repo") +System.out.println("Checking for existence of: " + itRepoDir) assert itRepoDir.isDirectory() String[] files = [ - "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar", - "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.pom", - "org/slf4j/slf4j-api/maven-metadata-local.xml", - "org/slf4j/slf4j-parent/1.7.36/slf4j-parent-1.7.36.pom", - "org/slf4j/slf4j-parent/maven-metadata-local.xml", - "org/slf4j/slf4j-simple/1.7.36/slf4j-simple-1.7.36.jar", - "org/slf4j/slf4j-simple/1.7.36/slf4j-simple-1.7.36.pom", - "org/slf4j/slf4j-simple/maven-metadata-local.xml", - "test/staging-dependencies-test-scope/1.0-SNAPSHOT/staging-dependencies-test-scope-1.0-SNAPSHOT.pom", - "test/staging-dependencies-test-scope/1.0-SNAPSHOT/staging-dependencies-test-scope-1.0-SNAPSHOT.jar" - ]; -for ( String file : files ) -{ - File stagedFile = new File( itRepoDir, file ); - System.out.println( "Checking for existence of: " + stagedFile ); + "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar", + "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.pom", + "org/slf4j/slf4j-api/maven-metadata-local.xml", + "org/slf4j/slf4j-parent/1.7.36/slf4j-parent-1.7.36.pom", + "org/slf4j/slf4j-parent/maven-metadata-local.xml", + "org/slf4j/slf4j-simple/1.7.36/slf4j-simple-1.7.36.jar", + "org/slf4j/slf4j-simple/1.7.36/slf4j-simple-1.7.36.pom", + "org/slf4j/slf4j-simple/maven-metadata-local.xml", + "test/staging-dependencies-test-scope/1.0-SNAPSHOT/staging-dependencies-test-scope-1.0-SNAPSHOT.pom", + "test/staging-dependencies-test-scope/1.0-SNAPSHOT/staging-dependencies-test-scope-1.0-SNAPSHOT.jar" +] +for (String file : files) { + File stagedFile = new File(itRepoDir, file) + System.out.println("Checking for existence of: " + stagedFile) assert stagedFile.isFile() : "Missing: " + stagedFile } diff --git a/src/it/staging-dependencies/verify.groovy b/src/it/staging-dependencies/verify.groovy index 5b6ae1c..f425332 100644 --- a/src/it/staging-dependencies/verify.groovy +++ b/src/it/staging-dependencies/verify.groovy @@ -17,59 +17,60 @@ * under the License. */ -import org.codehaus.plexus.util.*; -import org.codehaus.plexus.util.xml.*; +import org.codehaus.plexus.util.* +import org.codehaus.plexus.util.xml.* -File itRepoDir = new File( basedir, "target/it-repo" ); -System.out.println( "Checking for existence of: " + itRepoDir ); +File itRepoDir = new File(basedir, "target/it-repo") +System.out.println("Checking for existence of: " + itRepoDir) assert itRepoDir.isDirectory() String[] files = [ - "junit/junit/4.13.1/junit-4.13.1.pom", - "junit/junit/4.13.1/junit-4.13.1.jar", - "junit/junit/maven-metadata-local.xml", - "org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-SNAPSHOT.pom", - "org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-SNAPSHOT.jar", - "org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/maven-metadata-local.xml", - "org/apache/maven/its/minvoker-70/maven-metadata-local.xml", - "org/apache/maven/its/parent-b/0.1-SNAPSHOT/parent-b-0.1-SNAPSHOT.pom", - "org/apache/maven/its/parent-b/0.1-SNAPSHOT/maven-metadata-local.xml", - "org/apache/maven/its/parent-b/maven-metadata-local.xml", - "org/apache/maven/its/parent-a/0.1-SNAPSHOT/parent-a-0.1-SNAPSHOT.pom", - "org/apache/maven/its/parent-a/0.1-SNAPSHOT/maven-metadata-local.xml", - "org/apache/maven/its/parent-a/maven-metadata-local.xml", - "org/apache/maven/its/pom/0.3-SNAPSHOT/pom-0.3-SNAPSHOT.pom", - "org/apache/maven/its/pom/0.3-SNAPSHOT/maven-metadata-local.xml", - "org/apache/maven/its/pom/maven-metadata-local.xml", - "org/apache/maven/its/dep/1.0/dep-1.0.pom", - "org/apache/maven/its/dep/1.0/dep-1.0-tests.jar", - "org/apache/maven/its/dep/2.0/dep-2.0.pom", - "org/apache/maven/its/dep/2.0/dep-2.0.jar", - "org/apache/maven/its/dep/maven-metadata-local.xml", - "test/staging-dependencies/1.0-SNAPSHOT/staging-dependencies-1.0-SNAPSHOT.jar", - "test/staging-dependencies/1.0-SNAPSHOT/staging-dependencies-1.0-SNAPSHOT.pom", - "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.pom", - "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar", - "org/slf4j/slf4j-parent/1.7.36/slf4j-parent-1.7.36.pom" - ]; -for ( String file : files ) -{ - File stagedFile = new File( itRepoDir, file ); - System.out.println( "Checking for existence of: " + stagedFile ); + "junit/junit/4.13.1/junit-4.13.1.pom", + "junit/junit/4.13.1/junit-4.13.1.jar", + "junit/junit/maven-metadata-local.xml", + "org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-SNAPSHOT.pom", + "org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-SNAPSHOT.jar", + "org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/maven-metadata-local.xml", + "org/apache/maven/its/minvoker-70/maven-metadata-local.xml", + "org/apache/maven/its/parent-b/0.1-SNAPSHOT/parent-b-0.1-SNAPSHOT.pom", + "org/apache/maven/its/parent-b/0.1-SNAPSHOT/maven-metadata-local.xml", + "org/apache/maven/its/parent-b/maven-metadata-local.xml", + "org/apache/maven/its/parent-a/0.1-SNAPSHOT/parent-a-0.1-SNAPSHOT.pom", + "org/apache/maven/its/parent-a/0.1-SNAPSHOT/maven-metadata-local.xml", + "org/apache/maven/its/parent-a/maven-metadata-local.xml", + "org/apache/maven/its/pom/0.3-SNAPSHOT/pom-0.3-SNAPSHOT.pom", + "org/apache/maven/its/pom/0.3-SNAPSHOT/maven-metadata-local.xml", + "org/apache/maven/its/pom/maven-metadata-local.xml", + "org/apache/maven/its/dep/1.0/dep-1.0.pom", + "org/apache/maven/its/dep/1.0/dep-1.0-tests.jar", + "org/apache/maven/its/dep/2.0/dep-2.0.pom", + "org/apache/maven/its/dep/2.0/dep-2.0.jar", + "org/apache/maven/its/dep/maven-metadata-local.xml", + "test/staging-dependencies/1.0-SNAPSHOT/staging-dependencies-1.0-SNAPSHOT.jar", + "test/staging-dependencies/1.0-SNAPSHOT/staging-dependencies-1.0-SNAPSHOT.pom", + "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.pom", + "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar", + "org/slf4j/slf4j-parent/1.7.36/slf4j-parent-1.7.36.pom" +] +for (String file : files) { + File stagedFile = new File(itRepoDir, file) + System.out.println("Checking for existence of: " + stagedFile) assert stagedFile.isFile() : "Missing: " + stagedFile } -File stagedTestScope = new File(itRepoDir, "org/slf4j/slf4j-simple"); +File stagedTestScope = new File(itRepoDir, "org/slf4j/slf4j-simple") assert !stagedTestScope.exists() : "Test scope dependencies should not exists" -Reader reader = ReaderFactory.newXmlReader( new File( itRepoDir, "org/apache/maven/its/dep/maven-metadata-local.xml" ) ); -Xpp3Dom dom = Xpp3DomBuilder.build( reader ); -IOUtil.close( reader ); +Reader reader = ReaderFactory.newXmlReader( new File( itRepoDir, "org/apache/maven/its/dep/maven-metadata-local.xml" ) ) +Xpp3Dom dom = Xpp3DomBuilder.build( reader ) +IOUtil.close( reader ) assert dom.getChild( "versioning" ).getChild( "versions" ).getChildCount() == 2 : "Invalid version number count in metadata" -List versions = new ArrayList(); -versions.add( dom.getChild( "versioning" ).getChild( "versions" ).getChild( 0 ).getValue() ); -versions.add( dom.getChild( "versioning" ).getChild( "versions" ).getChild( 1 ).getValue() ); -Collections.sort( versions ); -assert versions.equals( Arrays.asList( new String[] { "1.0", "2.0" } ) ) : "Invalid version numbers in metadata: " + versions +List versions = new ArrayList() +versions.add( dom.getChild( "versioning" ).getChild( "versions" ).getChild( 0 ).getValue() ) +versions.add( dom.getChild( "versioning" ).getChild( "versions" ).getChild( 1 ).getValue() ) +Collections.sort( versions ) +assert versions.equals( Arrays.asList( new String[] { + "1.0", "2.0" +} ) ) : "Invalid version numbers in metadata: " + versions diff --git a/src/it/staging-pom/verify.groovy b/src/it/staging-pom/verify.groovy index 0793e20..2ca93b0 100644 --- a/src/it/staging-pom/verify.groovy +++ b/src/it/staging-pom/verify.groovy @@ -17,19 +17,18 @@ * under the License. */ -File itRepoDir = new File( basedir, "target/it-repo" ); -System.out.println( "Checking for existence of: " + itRepoDir ); +File itRepoDir = new File(basedir, "target/it-repo") +System.out.println("Checking for existence of: " + itRepoDir) assert itRepoDir.isDirectory() String[] files = [ - "test/pom-packaging/1.0-SNAPSHOT/pom-packaging-1.0-SNAPSHOT.pom", - "org/apache/maven/plugins/maven-plugins/39/maven-plugins-39.pom", - "org/apache/maven/maven-parent/39/maven-parent-39.pom", - "org/apache/apache/29/apache-29.pom" - ]; -for ( String file : files ) -{ - File stagedFile = new File( itRepoDir, file ); - System.out.println( "Checking for existence of: " + stagedFile ); + "test/pom-packaging/1.0-SNAPSHOT/pom-packaging-1.0-SNAPSHOT.pom", + "org/apache/maven/plugins/maven-plugins/39/maven-plugins-39.pom", + "org/apache/maven/maven-parent/39/maven-parent-39.pom", + "org/apache/apache/29/apache-29.pom" +] +for (String file : files) { + File stagedFile = new File(itRepoDir, file) + System.out.println("Checking for existence of: " + stagedFile) assert stagedFile.isFile() } diff --git a/src/it/staging-reactor/verify.groovy b/src/it/staging-reactor/verify.groovy index c7b6beb..9a634c0 100644 --- a/src/it/staging-reactor/verify.groovy +++ b/src/it/staging-reactor/verify.groovy @@ -17,33 +17,32 @@ * under the License. */ -File itRepoDir = new File( basedir, "mod1/target/it-repo" ); -System.out.println( "Checking for existence of: " + itRepoDir ); +File itRepoDir = new File(basedir, "mod1/target/it-repo") +System.out.println("Checking for existence of: " + itRepoDir) assert itRepoDir.isDirectory() // NOTE: Checking the metadata is included to guard against regression of MINVOKER-43 String[] files = [ - "test/mod1/maven-metadata-local.xml", - "test/mod1/1.0-SNAPSHOT/maven-metadata-local.xml", - "test/mod1/1.0-SNAPSHOT/mod1-1.0-SNAPSHOT.pom", - "test/mod1/1.0-SNAPSHOT/mod1-1.0-SNAPSHOT.jar", - "test/mod1-parent/maven-metadata-local.xml", - "test/mod1-parent/1.0-SNAPSHOT/maven-metadata-local.xml", - "test/mod1-parent/1.0-SNAPSHOT/mod1-parent-1.0-SNAPSHOT.pom", - "test/mod2/maven-metadata-local.xml", - "test/mod2/1.0-SNAPSHOT/maven-metadata-local.xml", - "test/mod2/1.0-SNAPSHOT/mod2-1.0-SNAPSHOT.pom", - "test/mod2/1.0-SNAPSHOT/mod2-1.0-SNAPSHOT.jar", - "test/mod3/1.0-SNAPSHOT/maven-metadata-local.xml", - "test/mod3/1.0-SNAPSHOT/mod3-1.0-SNAPSHOT.pom", - "test/mod3/1.0-SNAPSHOT/mod3-1.0-SNAPSHOT.jar", - "test/mod2-parent/maven-metadata-local.xml", - "test/mod2-parent/1.0-SNAPSHOT/maven-metadata-local.xml", - "test/mod2-parent/1.0-SNAPSHOT/mod2-parent-1.0-SNAPSHOT.pom", - ]; -for ( String file : files ) -{ - File stagedFile = new File( itRepoDir, file ); - System.out.println( "Checking for existence of: " + stagedFile ); + "test/mod1/maven-metadata-local.xml", + "test/mod1/1.0-SNAPSHOT/maven-metadata-local.xml", + "test/mod1/1.0-SNAPSHOT/mod1-1.0-SNAPSHOT.pom", + "test/mod1/1.0-SNAPSHOT/mod1-1.0-SNAPSHOT.jar", + "test/mod1-parent/maven-metadata-local.xml", + "test/mod1-parent/1.0-SNAPSHOT/maven-metadata-local.xml", + "test/mod1-parent/1.0-SNAPSHOT/mod1-parent-1.0-SNAPSHOT.pom", + "test/mod2/maven-metadata-local.xml", + "test/mod2/1.0-SNAPSHOT/maven-metadata-local.xml", + "test/mod2/1.0-SNAPSHOT/mod2-1.0-SNAPSHOT.pom", + "test/mod2/1.0-SNAPSHOT/mod2-1.0-SNAPSHOT.jar", + "test/mod3/1.0-SNAPSHOT/maven-metadata-local.xml", + "test/mod3/1.0-SNAPSHOT/mod3-1.0-SNAPSHOT.pom", + "test/mod3/1.0-SNAPSHOT/mod3-1.0-SNAPSHOT.jar", + "test/mod2-parent/maven-metadata-local.xml", + "test/mod2-parent/1.0-SNAPSHOT/maven-metadata-local.xml", + "test/mod2-parent/1.0-SNAPSHOT/mod2-parent-1.0-SNAPSHOT.pom", +] +for (String file : files) { + File stagedFile = new File(itRepoDir, file) + System.out.println("Checking for existence of: " + stagedFile) assert stagedFile.isFile() } diff --git a/src/it/updateOnly/verify.groovy b/src/it/updateOnly/verify.groovy index 77de758..4043482 100644 --- a/src/it/updateOnly/verify.groovy +++ b/src/it/updateOnly/verify.groovy @@ -17,8 +17,8 @@ * under the License. */ -File marker = new File( basedir, "target/it/project/target/marker.txt" ); +File marker = new File(basedir, "target/it/project/target/marker.txt") assert marker.exists() : "Marker file should have been created in setup: " + marker -File archive = new File( basedir, "target/it/project/target/project-0.1-SNAPSHOT.jar" ); +File archive = new File( basedir, "target/it/project/target/project-0.1-SNAPSHOT.jar" ) assert !archive.exists() : "Target file creation should have been skipped: " + archive
