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-assembly-plugin.git
commit 68149c13b04261d4f5a7765bed50bd2e2f39a2dd Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Wed Nov 25 21:28:01 2026 +0000 Modernize Groovy IT scripts See https://github.com/apache/maven-invoker-plugin/issues/811. --- .../basic-features/ExecutionRoot/verify.groovy | 18 +- .../basic-features/add-classpath/verify.groovy | 5 +- .../formats-in-pom-win/verify.groovy | 2 +- .../projects/basic-features/formats/verify.groovy | 178 ++++---------------- .../basic-features/local-repo-interp/verify.groovy | 16 +- .../verify.groovy | 18 +- .../relative-project-paths/verify.groovy | 32 +--- src/it/projects/bugs/massembly-190/verify.groovy | 14 +- src/it/projects/bugs/massembly-583/verify.groovy | 42 +---- src/it/projects/bugs/massembly-732/verify.groovy | 41 ++--- src/it/projects/bugs/massembly-733/verify.groovy | 18 +- src/it/projects/bugs/massembly-919/verify.groovy | 1 - .../metaInf-services-aggregation/verify.groovy | 58 +------ .../metaInf-spring-aggregation/verify.groovy | 102 ++--------- .../verify.groovy | 10 +- .../dep-with-transitive-filter/verify.groovy | 14 +- .../dependency-sets/depMgmt-override/verify.groovy | 16 +- .../depSet-artifactPomPropInterp/verify.groovy | 4 +- .../depSet-byDepVersion/verify.groovy | 31 +--- .../depSet-runtimeScope/verify.groovy | 31 +--- .../depSet-unpacked-rdonly/verify.groovy | 4 +- .../dependencySet-matchScope/verify.groovy | 62 ++----- .../dependencySet-nonTransitive/verify.groovy | 62 ++----- .../dependencySet-notUnpacked/verify.groovy | 62 ++----- .../verify.groovy | 5 +- .../dependencySet-unpacked-filtered/verify.groovy | 20 +-- .../dependencySet-unpacked/verify.groovy | 62 ++----- .../verify.groovy | 72 +++----- .../verify.groovy | 90 +++------- .../verify.groovy | 18 +- .../include-project-artifact/verify.groovy | 59 ++----- .../include-project-attachments/verify.groovy | 69 ++------ .../dependency-sets/include-provided/verify.groovy | 62 ++----- .../including-pom-dependency/verify.groovy | 14 +- .../including-sar-dependency/verify.groovy | 10 +- .../dependency-sets/massembly-201/verify.groovy | 19 +-- .../dependency-sets/massembly-235/verify.groovy | 8 +- .../dependency-sets/massembly-395/verify.groovy | 10 +- .../dependency-sets/massembly-619/verify.groovy | 11 +- .../dependency-sets/massembly-675/verify.groovy | 19 +-- .../dependency-sets/massembly-955/verify.groovy | 8 +- .../dependency-sets/massembly-99/verify.groovy | 13 +- .../outputFileNameMappingWithUnpack/verify.groovy | 16 +- .../unpack-deps-correct-dir/verify.groovy | 9 +- .../using-moduleSet-implied-depSet/verify.groovy | 15 +- .../bin/jars-in-archive-root/verify.groovy | 51 ++---- .../component-descriptors-merged/verify.groovy | 2 - .../deps-unpacked-to-root-dir/verify.groovy | 3 - .../no-target-dir/verify.groovy | 58 ++----- .../multimodule-sources-copied/verify.groovy | 163 +++++++----------- .../no-target-dir-multimodule/verify.groovy | 187 ++++++++------------- .../project/no-target-dir/verify.groovy | 51 ++---- .../project/sources-copied/verify.groovy | 77 +++------ .../src/no-target-dir/verify.groovy | 51 ++---- .../src/src-dir-copied/verify.groovy | 63 +++---- .../file-sets/excludes-using-regex/verify.groovy | 71 ++------ .../filtered-module-sources/verify.groovy | 18 +- .../file-sets/filtered-multimodule/verify.groovy | 18 +- .../file-sets/include-parent-dir/verify.groovy | 4 +- .../projects/file-sets/massembly-665/verify.groovy | 20 +-- .../files/multimodule-relativePath/verify.groovy | 10 +- .../verify.groovy | 34 +--- .../verify.groovy | 42 +---- .../verify.groovy | 42 +---- .../archiver-ignorePermissions/verify.groovy | 19 +-- .../ignoreDirFormatExtensions/verify.groovy | 22 +-- .../verify.groovy | 5 +- .../manifest-with-customEntry/verify.groovy | 5 - .../mojo-configuration/massembly-291/verify.groovy | 32 +--- .../mojo-configuration/massembly-301/verify.groovy | 32 +--- .../verify.groovy | 5 +- .../skipAssemblyCLIPropertySet/verify.groovy | 7 +- .../single-in-one-project-hierarchy/verify.groovy | 2 +- .../verify.groovy | 7 +- .../verify.groovy | 7 +- .../multimodule/massembly-298/verify.groovy | 27 +-- .../multimodule/massembly-619/verify.groovy | 7 +- .../multimodule-binariesNotSource/verify.groovy | 10 +- .../multimodule-filteredFileSet/verify.groovy | 25 +-- .../multimodule-modulePomPropInterp/verify.groovy | 4 +- .../multimodule-siblingParent/parent/verify.groovy | 8 +- .../multimodule-sourceNotBinaries/verify.groovy | 8 +- .../verify.groovy | 30 +--- 83 files changed, 632 insertions(+), 2045 deletions(-) diff --git a/src/it/projects/basic-features/ExecutionRoot/verify.groovy b/src/it/projects/basic-features/ExecutionRoot/verify.groovy index 714a01e2..44eda73e 100644 --- a/src/it/projects/basic-features/ExecutionRoot/verify.groovy +++ b/src/it/projects/basic-features/ExecutionRoot/verify.groovy @@ -17,20 +17,4 @@ * under the License. */ -import java.io.*; -import java.net.*; -import java.util.jar.*; - -boolean result = true; - -try -{ - result = new File( basedir, "target/parent-1.0-src.zip" ).exists() && !new File( basedir, "child/target/child-1.0-src.zip" ).exists(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; +assert new File( basedir, "target/parent-1.0-src.zip" ).exists() && !new File( basedir, "child/target/child-1.0-src.zip" ).exists(); diff --git a/src/it/projects/basic-features/add-classpath/verify.groovy b/src/it/projects/basic-features/add-classpath/verify.groovy index e141ee55..94f26861 100644 --- a/src/it/projects/basic-features/add-classpath/verify.groovy +++ b/src/it/projects/basic-features/add-classpath/verify.groovy @@ -17,10 +17,7 @@ * under the License. */ -import java.io.*; import java.util.jar.*; -import java.util.*; -import java.net.*; File file = new File( basedir, "target/test-1.0-full.jar" ); @@ -34,4 +31,4 @@ Attributes attrs = mf.getMainAttributes(); String classPath = (String) attrs.get( Attributes.Name.CLASS_PATH ); -return classPath.contains("plexus-utils"); +assert classPath.contains("plexus-utils"); diff --git a/src/it/projects/basic-features/formats-in-pom-win/verify.groovy b/src/it/projects/basic-features/formats-in-pom-win/verify.groovy index e2f1a452..ac272f17 100644 --- a/src/it/projects/basic-features/formats-in-pom-win/verify.groovy +++ b/src/it/projects/basic-features/formats-in-pom-win/verify.groovy @@ -17,5 +17,5 @@ * under the License. */ -return !new java.io.File( basedir, "target/parent-1-src/src/main/assembly/src.xml" ).exists() && +assert !new java.io.File( basedir, "target/parent-1-src/src/main/assembly/src.xml" ).exists() && new java.io.File( basedir, "target/parent-1-src.zip" ) .exists(); diff --git a/src/it/projects/basic-features/formats/verify.groovy b/src/it/projects/basic-features/formats/verify.groovy index a7330fb5..15aa7074 100644 --- a/src/it/projects/basic-features/formats/verify.groovy +++ b/src/it/projects/basic-features/formats/verify.groovy @@ -17,155 +17,51 @@ * under the License. */ -import java.io.*; -import java.net.*; -import java.util.jar.*; +File assembly = new File( basedir, "target/assemblies/format-test-1.0" ); +assert assembly.exists(); +assert assembly.isDirectory(); +assert new File( assembly, "TODO.txt" ).exists(); -boolean result = true; +assembly = new File( basedir, "target/assemblies/format-test-1.0.zip" ); +assert assembly.exists(); +assert assembly.isFile(); -try -{ - File assembly = new File( basedir, "target/assemblies/format-test-1.0" ); - result = result && assembly.exists(); - result = result && assembly.isDirectory(); - result = result && new File( assembly, "TODO.txt" ).exists(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +assembly = new File( basedir, "target/assemblies/format-test-1.0.tar" ); +assert assembly.exists(); +assert assembly.isFile(); -try -{ - File assembly = new File( basedir, "target/assemblies/format-test-1.0.zip" ); - result = result && assembly.exists(); - result = result && assembly.isFile(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +assembly = new File( basedir, "target/assemblies/format-test-1.0.tar.gz" ); +assert assembly.exists(); +assert assembly.isFile(); -try -{ - File assembly = new File( basedir, "target/assemblies/format-test-1.0.tar" ); - result = result && assembly.exists(); - result = result && assembly.isFile(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +assembly = new File( basedir, "target/assemblies/format-test-1.0.tgz" ); +assert assembly.exists(); +assert assembly.isFile(); -try -{ - File assembly = new File( basedir, "target/assemblies/format-test-1.0.tar.gz" ); - result = result && assembly.exists(); - result = result && assembly.isFile(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +assembly = new File( basedir, "target/assemblies/format-test-1.0.tar.bz2" ); +assert assembly.exists(); +assert assembly.isFile(); -try -{ - File assembly = new File( basedir, "target/assemblies/format-test-1.0.tgz" ); - result = result && assembly.exists(); - result = result && assembly.isFile(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +assembly = new File( basedir, "target/assemblies/format-test-1.0.tbz2" ); +assert assembly.exists(); +assert assembly.isFile(); -try -{ - File assembly = new File( basedir, "target/assemblies/format-test-1.0.tar.bz2" ); - result = result && assembly.exists(); - result = result && assembly.isFile(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +assembly = new File( basedir, "target/assemblies/format-test-1.0.jar" ); +assert assembly.exists(); +assert assembly.isFile(); -try -{ - File assembly = new File( basedir, "target/assemblies/format-test-1.0.tbz2" ); - result = result && assembly.exists(); - result = result && assembly.isFile(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +assembly = new File( basedir, "target/assemblies/format-test-1.0.war" ); +assert assembly.exists(); +assert assembly.isFile(); -try -{ - File assembly = new File( basedir, "target/assemblies/format-test-1.0.jar" ); - result = result && assembly.exists(); - result = result && assembly.isFile(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +assembly = new File( basedir, "target/assemblies/format-test-1.0.tar.snappy" ); +assert assembly.exists(); +assert assembly.isFile(); -try -{ - File assembly = new File( basedir, "target/assemblies/format-test-1.0.war" ); - result = result && assembly.exists(); - result = result && assembly.isFile(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +assembly = new File( basedir, "target/assemblies/format-test-1.0.tar.xz" ); +assert assembly.exists(); +assert assembly.isFile(); -try -{ - File assembly = new File( basedir, "target/assemblies/format-test-1.0.tar.snappy" ); - result = result && assembly.exists(); - result = result && assembly.isFile(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -try -{ - File assembly = new File( basedir, "target/assemblies/format-test-1.0.tar.xz" ); - result = result && assembly.exists(); - result = result && assembly.isFile(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -try -{ - File assembly = new File( basedir, "target/assemblies/format-test-1.0.txz" ); - result = result && assembly.exists(); - result = result && assembly.isFile(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; +assembly = new File( basedir, "target/assemblies/format-test-1.0.txz" ); +assert assembly.exists(); +assert assembly.isFile(); diff --git a/src/it/projects/basic-features/local-repo-interp/verify.groovy b/src/it/projects/basic-features/local-repo-interp/verify.groovy index 4fde7327..29321633 100644 --- a/src/it/projects/basic-features/local-repo-interp/verify.groovy +++ b/src/it/projects/basic-features/local-repo-interp/verify.groovy @@ -17,21 +17,9 @@ * under the License. */ -import java.io.*; - File f = new File( basedir, "target/test-1-bin/unprefixed/maven-assembly-plugin.jar" ); File f2 = new File( basedir, "target/test-1-bin/prefixed/maven-assembly-plugin.jar" ); -if ( !f.exists() || !f.isFile() ) -{ - System.out.println( "File: " + f + " doesn't exist, or isn't a file." ); - return false; -} - -if ( !f2.exists() || !f2.isFile() ) -{ - System.out.println( "File: " + f2 + " doesn't exist, or isn't a file." ); - return false; -} +assert f.exists() && f.isFile() : "File: " + f + " doesn't exist, or isn't a file."; -return true; +assert f2.exists() && f2.isFile() : "File: " + f2 + " doesn't exist, or isn't a file."; diff --git a/src/it/projects/basic-features/outputFileNameMapping-withArtifactBaseVersion/verify.groovy b/src/it/projects/basic-features/outputFileNameMapping-withArtifactBaseVersion/verify.groovy index 93723781..17b0108e 100644 --- a/src/it/projects/basic-features/outputFileNameMapping-withArtifactBaseVersion/verify.groovy +++ b/src/it/projects/basic-features/outputFileNameMapping-withArtifactBaseVersion/verify.groovy @@ -17,20 +17,4 @@ * under the License. */ -import java.io.*; -import java.net.*; -import java.util.jar.*; - -boolean result = true; - -try -{ - result = new File( basedir, "target/outputFileNameMapping-withArtifactBaseVersion-1.0-SNAPSHOT-bin/lib/plexus-utils-3.5.1.jar" ).exists(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; +assert new File( basedir, "target/outputFileNameMapping-withArtifactBaseVersion-1.0-SNAPSHOT-bin/lib/plexus-utils-3.5.1.jar" ).exists(); diff --git a/src/it/projects/basic-features/relative-project-paths/verify.groovy b/src/it/projects/basic-features/relative-project-paths/verify.groovy index 130e385f..c592fed3 100644 --- a/src/it/projects/basic-features/relative-project-paths/verify.groovy +++ b/src/it/projects/basic-features/relative-project-paths/verify.groovy @@ -17,34 +17,12 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.jar.*; -boolean result = true; +File f = new File( basedir, "target/relative-project-paths-1.0-src.jar" ); +assert f.exists() : "jar is missing"; -try -{ - File f = new File( basedir, "target/relative-project-paths-1.0-src.jar" ); - if ( !f.exists() ) - { - System.out.println( "jar is missing" ); - return false; - } +JarFile jf = new JarFile( f ); +JarEntry je = jf.getEntry( "pom.xml" ); - JarFile jf = new JarFile( f ); - JarEntry je = jf.getEntry( "pom.xml" ); - - if ( je == null ) - { - System.out.println( "pom.xml entry in jar is missing" ); - return false; - } -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; +assert je != null : "pom.xml entry in jar is missing"; diff --git a/src/it/projects/bugs/massembly-190/verify.groovy b/src/it/projects/bugs/massembly-190/verify.groovy index 2a0d0e87..13919f46 100644 --- a/src/it/projects/bugs/massembly-190/verify.groovy +++ b/src/it/projects/bugs/massembly-190/verify.groovy @@ -17,19 +17,9 @@ * under the License. */ -import java.io.*; - File child1Codec = new File( basedir, "child-3/target/child-3-1-bin/child-1/commons-codec-1.3.jar" ); File child2Codec = new File( basedir, "child-3/target/child-3-1-bin/child-2/commons-codec-1.3.jar" ); -if ( !child1Codec.exists() ) -{ - System.out.println( "commons-codec dependency in child-1 module is either missing or is the wrong version. File missing: " + child1Codec ); -} - -if ( !child2Codec.exists() ) -{ - System.out.println( "commons-codec dependency in child-2 module is either missing or is the wrong version. File missing: " + child2Codec ); -} +assert child1Codec.exists() : "commons-codec dependency in child-1 module is either missing or is the wrong version. File missing: " + child1Codec; -return child1Codec.exists() && child2Codec.exists(); +assert child2Codec.exists() : "commons-codec dependency in child-2 module is either missing or is the wrong version. File missing: " + child2Codec; diff --git a/src/it/projects/bugs/massembly-583/verify.groovy b/src/it/projects/bugs/massembly-583/verify.groovy index 9e66ccd9..9ca18161 100644 --- a/src/it/projects/bugs/massembly-583/verify.groovy +++ b/src/it/projects/bugs/massembly-583/verify.groovy @@ -17,41 +17,15 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.zip.*; -boolean result = true; -try -{ - File zipFile = new File( basedir, "child2/target/project2-0.0.1-SNAPSHOT-deployable.zip" ); - - if ( !zipFile.exists() || zipFile.isDirectory() ) - { - System.err.println( "zip-file is missing or a directory." ); - result = false; - } - - ZipFile zf = new ZipFile( zipFile ); - - if ( zf.getEntry( "project2-0.0.1-SNAPSHOT/empty.properties" ) == null ) - { - System.err.println( "empty.properties entry is missing." ); - result = false; - } - - if ( zf.getEntry( "project2-0.0.1-SNAPSHOT/bin/start.sh" ) == null ) - { - System.err.println( "start.sh entry is missing." ); - result = false; - } - -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +File zipFile = new File( basedir, "child2/target/project2-0.0.1-SNAPSHOT-deployable.zip" ); -return result; +assert zipFile.exists() && !zipFile.isDirectory() : "zip-file is missing or a directory."; + +ZipFile zf = new ZipFile( zipFile ); + +assert zf.getEntry( "project2-0.0.1-SNAPSHOT/empty.properties" ) != null : "empty.properties entry is missing."; + +assert zf.getEntry( "project2-0.0.1-SNAPSHOT/bin/start.sh" ) != null : "start.sh entry is missing."; diff --git a/src/it/projects/bugs/massembly-732/verify.groovy b/src/it/projects/bugs/massembly-732/verify.groovy index 02ca3141..afe80ff1 100644 --- a/src/it/projects/bugs/massembly-732/verify.groovy +++ b/src/it/projects/bugs/massembly-732/verify.groovy @@ -17,38 +17,17 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.zip.*; -boolean result = true; - -try -{ - File zipFile = new File( basedir, "target/project2-0.0.1-SNAPSHOT-bin.zip" ); - - if ( !zipFile.exists() || zipFile.isDirectory() ) - { - System.err.println( "zip-file is missing or a directory." ); - result = false; - } - - ZipFile zf = new ZipFile( zipFile ); - - ZipEntry ze = zf.getEntry( "spring-0.0.1-SNAPSHOT/lib/project2-0.0.1-SNAPSHOT.jar" ); - if ( ze == null ) - { - System.err.println( "filename is incorrect" ); - result = false; - } - zf.close(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; + +File zipFile = new File( basedir, "target/project2-0.0.1-SNAPSHOT-bin.zip" ); + +assert zipFile.exists() && !zipFile.isDirectory() : "zip-file is missing or a directory."; + +ZipFile zf = new ZipFile( zipFile ); + +ZipEntry ze = zf.getEntry( "spring-0.0.1-SNAPSHOT/lib/project2-0.0.1-SNAPSHOT.jar" ); +assert ze != null : "filename is incorrect"; +zf.close(); diff --git a/src/it/projects/bugs/massembly-733/verify.groovy b/src/it/projects/bugs/massembly-733/verify.groovy index ba0162a2..89fe9075 100644 --- a/src/it/projects/bugs/massembly-733/verify.groovy +++ b/src/it/projects/bugs/massembly-733/verify.groovy @@ -17,20 +17,4 @@ * under the License. */ -import java.io.*; -import java.net.*; -import java.util.jar.*; - -boolean result = true; - -try -{ - result = new File( basedir, "target/my-final-name-bin/my-final-name/root/bin.xml" ).exists(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; +assert new File( basedir, "target/my-final-name-bin/my-final-name/root/bin.xml" ).exists(); diff --git a/src/it/projects/bugs/massembly-919/verify.groovy b/src/it/projects/bugs/massembly-919/verify.groovy index 62cb39f2..5f03243d 100644 --- a/src/it/projects/bugs/massembly-919/verify.groovy +++ b/src/it/projects/bugs/massembly-919/verify.groovy @@ -17,7 +17,6 @@ * under the License. */ -import java.net.*; import java.util.zip.*; File zipFile = new File( basedir, "bundle/target/project-bundle-0.0.1-SNAPSHOT-bin.zip" ) diff --git a/src/it/projects/container-descriptors/metaInf-services-aggregation/verify.groovy b/src/it/projects/container-descriptors/metaInf-services-aggregation/verify.groovy index 602bd6b9..7182e367 100644 --- a/src/it/projects/container-descriptors/metaInf-services-aggregation/verify.groovy +++ b/src/it/projects/container-descriptors/metaInf-services-aggregation/verify.groovy @@ -17,56 +17,14 @@ * under the License. */ -import java.io.*; import java.util.jar.*; -try -{ - boolean fooFound = false; - boolean barFound = false; - - JarFile file = new JarFile( new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ) ); - JarEntry entry = file.getEntry( "META-INF/services/test.Test" ); - if ( entry == null ) - { - return false; - } - - BufferedReader br = new BufferedReader( new InputStreamReader( file.getInputStream( entry ) ) ); - - String line = null; - while( ( line = br.readLine() ) != null ) - { - if ( line.equals( "test.Foo" ) ) - { - fooFound = true; - } - else if ( line.equals( "test.Bar" ) ) - { - barFound = true; - } - - if ( fooFound && barFound ) - { - break; - } - } - - if ( !fooFound ) - { - System.out.println( "Cannot find entry 'test.Foo' in: " + entry.getName() ); - } - - if ( !barFound ) - { - System.out.println( "Cannot find entry 'test.Bar' in: " + entry.getName() ); - } - - return fooFound && barFound; -} -catch( IOException e ) -{ - e.printStackTrace(); -} +JarFile file = new JarFile( new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ) ); +JarEntry entry = file.getEntry( "META-INF/services/test.Test" ); +assert entry != null : "Entry META-INF/services/test.Test is missing"; -return false; +List lines = file.getInputStream( entry ).withCloseable { it.readLines( "UTF-8" ) }; + +assert lines.contains( "test.Foo" ) : "Cannot find entry 'test.Foo' in: " + entry.getName(); + +assert lines.contains( "test.Bar" ) : "Cannot find entry 'test.Bar' in: " + entry.getName(); diff --git a/src/it/projects/container-descriptors/metaInf-spring-aggregation/verify.groovy b/src/it/projects/container-descriptors/metaInf-spring-aggregation/verify.groovy index 5f2cadcb..eea0aa9c 100644 --- a/src/it/projects/container-descriptors/metaInf-spring-aggregation/verify.groovy +++ b/src/it/projects/container-descriptors/metaInf-spring-aggregation/verify.groovy @@ -17,103 +17,23 @@ * under the License. */ -import java.io.*; import java.util.jar.*; -try -{ - JarFile file = new JarFile( new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ) ); - JarEntry handlerEntry = file.getEntry( "META-INF/spring.handlers" ); - if ( handlerEntry == null ) - { - return false; - } +JarFile file = new JarFile( new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ) ); +JarEntry handlerEntry = file.getEntry( "META-INF/spring.handlers" ); +assert handlerEntry != null : "Entry META-INF/spring.handlers is missing"; - BufferedReader br = new BufferedReader( new InputStreamReader( file.getInputStream( handlerEntry ) ) ); +List handlers = file.getInputStream( handlerEntry ).withCloseable { it.readLines( "UTF-8" ) }; - boolean aopFound = false; - boolean ctxFound = false; +assert handlers.any { it.endsWith( "AopNamespaceHandler1" ) } : "Cannot find entry 'AopNamespaceHandler1' in: " + handlerEntry.getName(); - String line = null; - while( ( line = br.readLine() ) != null ) - { - if ( line.endsWith( "AopNamespaceHandler1" ) ) - { - aopFound = true; - } - else if ( line.endsWith( "ContextNamespaceHandler1" ) ) - { - ctxFound = true; - } +assert handlers.any { it.endsWith( "ContextNamespaceHandler1" ) } : "Cannot find entry 'ContextNamespaceHandler1' in: " + handlerEntry.getName(); - if ( aopFound && ctxFound ) - { - break; - } - } +JarEntry schemaEntry = file.getEntry( "META-INF/spring.schemas" ); +assert schemaEntry != null : "Entry META-INF/spring.schemas is missing"; - if ( !aopFound ) - { - System.out.println( "Cannot find entry 'AopNamespaceHandler1' in: " + handlerEntry.getName() ); - return false; - } +List schemas = file.getInputStream( schemaEntry ).withCloseable { it.readLines( "UTF-8" ) }; - br.close(); - - if ( !ctxFound ) - { - System.out.println( "Cannot find entry 'ContextNamespaceHandler1' in: " + handlerEntry.getName() ); - return false; - } - - JarEntry schemaEntry = file.getEntry( "META-INF/spring.schemas" ); - if ( schemaEntry == null ) - { - return false; - } +assert schemas.any { it.endsWith( "spring-aop-3.0.xsd" ) } : "Cannot find entry 'spring-aop-3.0.xsd' in: " + schemaEntry.getName(); - br = new BufferedReader( new InputStreamReader( file.getInputStream( schemaEntry ) ) ); - - boolean found30 = false; - boolean found40 = false; - - line = null; - while( ( line = br.readLine() ) != null ) - { - if ( line.endsWith( "spring-aop-3.0.xsd" ) ) - { - found30 = true; - } - else if ( line.endsWith( "spring-aop-4.0.xsd" ) ) - { - found40 = true; - } - - if ( found30 && found40 ) - { - break; - } - } - - br.close(); - - if ( !found30 ) - { - System.out.println( "Cannot find entry 'spring-aop-3.0.xsd' in: " + schemaEntry.getName() ); - return false; - } - - if ( !found40 ) - { - System.out.println( "Cannot find entry 'spring-aop-4.0.xsd' in: " + schemaEntry.getName() ); - return false; - } - - return true; -} -catch( IOException e ) -{ - e.printStackTrace(); -} - -return false; +assert schemas.any { it.endsWith( "spring-aop-4.0.xsd" ) } : "Cannot find entry 'spring-aop-4.0.xsd' in: " + schemaEntry.getName(); diff --git a/src/it/projects/dependency-sets/dep-transfilter-wildcard-massembly544/verify.groovy b/src/it/projects/dependency-sets/dep-transfilter-wildcard-massembly544/verify.groovy index 26f19302..278e6a74 100644 --- a/src/it/projects/dependency-sets/dep-transfilter-wildcard-massembly544/verify.groovy +++ b/src/it/projects/dependency-sets/dep-transfilter-wildcard-massembly544/verify.groovy @@ -17,7 +17,6 @@ * under the License. */ -import java.io.*; File dir = new File( basedir, "target/dep-transfilter-wildcard-massembly544-1-bin/maven-libs" ); File[] files = [ @@ -27,14 +26,7 @@ File[] files = [ new File( dir, "doxia-sink-api-1.0-alpha-7.jar" ) ]; -boolean result = true; for( int i = 0; i<files.length; i++ ) { - if ( !files[i].exists() ) - { - System.out.println( "Cannot find jar: " + files[i] + " (should be included via transitive pattern)." ); - result = false; - } + assert files[i].exists() : "Cannot find jar: " + files[i] + " (should be included via transitive pattern)."; } - -return result; diff --git a/src/it/projects/dependency-sets/dep-with-transitive-filter/verify.groovy b/src/it/projects/dependency-sets/dep-with-transitive-filter/verify.groovy index ef0b5f9a..7ba40c3e 100644 --- a/src/it/projects/dependency-sets/dep-with-transitive-filter/verify.groovy +++ b/src/it/projects/dependency-sets/dep-with-transitive-filter/verify.groovy @@ -17,19 +17,9 @@ * under the License. */ -import java.io.*; - File wagonJackrabbitJar = new File( basedir, "target/project-1-bin/maven-libs/wagon-webdav-jackrabbit-1.0-beta-4.jar" ); File xercesMinimalJar = new File( basedir, "target/project-1-bin/maven-libs/xercesMinimal-1.9.6.2.jar" ); -if ( !wagonJackrabbitJar.exists() ) -{ - System.out.println( "Wagon provider jar is missing (should be included via include wildcard pattern)." ); -} - -if ( !xercesMinimalJar.exists() ) -{ - System.out.println( "Xerces minimal jar (from nekohtml, brought in by wagon jackrabbit provider) is missing (should be included via include wildcard pattern)." ); -} +assert wagonJackrabbitJar.exists() : "Wagon provider jar is missing (should be included via include wildcard pattern)."; -return wagonJackrabbitJar.exists() && xercesMinimalJar.exists(); +assert xercesMinimalJar.exists() : "Xerces minimal jar (from nekohtml, brought in by wagon jackrabbit provider) is missing (should be included via include wildcard pattern)."; diff --git a/src/it/projects/dependency-sets/depMgmt-override/verify.groovy b/src/it/projects/dependency-sets/depMgmt-override/verify.groovy index 6440a7fc..9d39bf44 100644 --- a/src/it/projects/dependency-sets/depMgmt-override/verify.groovy +++ b/src/it/projects/dependency-sets/depMgmt-override/verify.groovy @@ -17,21 +17,9 @@ * under the License. */ -import java.io.*; - File f = new File( basedir, "child/target/child-1.0-bundle/maven-plugin-api-2.2.1.jar" ); File f2 = new File( basedir, "child/target/child-1.0-bundle/maven-plugin-api-2.0.6.jar" ); -if ( !f.exists() || !f.isFile() ) -{ - System.out.println( f + " does not exist or is not a file." ); - return false; -} - -if ( f2.exists() ) -{ - System.out.println( f2 + " should NOT have been included." ); - return false; -} +assert f.exists() && f.isFile() : f + " does not exist or is not a file."; -return true; +assert !f2.exists() : f2 + " should NOT have been included."; diff --git a/src/it/projects/dependency-sets/depSet-artifactPomPropInterp/verify.groovy b/src/it/projects/dependency-sets/depSet-artifactPomPropInterp/verify.groovy index bba6e832..772e6bc6 100644 --- a/src/it/projects/dependency-sets/depSet-artifactPomPropInterp/verify.groovy +++ b/src/it/projects/dependency-sets/depSet-artifactPomPropInterp/verify.groovy @@ -17,7 +17,5 @@ * under the License. */ -import java.io.*; - File f = new File( basedir, "child2/target/child2-1-bin/bar/child1-1.jar" ); -return f.exists() && f.isFile(); +assert f.exists() && f.isFile(); diff --git a/src/it/projects/dependency-sets/depSet-byDepVersion/verify.groovy b/src/it/projects/dependency-sets/depSet-byDepVersion/verify.groovy index bffb373b..8fd5885d 100644 --- a/src/it/projects/dependency-sets/depSet-byDepVersion/verify.groovy +++ b/src/it/projects/dependency-sets/depSet-byDepVersion/verify.groovy @@ -17,31 +17,10 @@ * under the License. */ -import java.io.*; +File dir = new File( basedir, "child3/target/child3-1-bin" ); -try -{ - File dir = new File( basedir, "child3/target/child3-1-bin" ); - - File f = new File( dir, "1/child1-1.jar" ); - if ( !f.exists() || !f.isFile() ) - { - System.out.println( "Could not find dependency file: " + f ); - return false; - } - - f = new File( dir, "2/child2-2.jar" ); - if ( !f.exists() || !f.isFile() ) - { - System.out.println( "Could not find dependency file: " + f ); - return false; - } - - return true; -} -catch( IOException e ) -{ - e.printStackTrace(); -} +File f = new File( dir, "1/child1-1.jar" ); +assert f.exists() && f.isFile() : "Could not find dependency file: " + f; -return false; +f = new File( dir, "2/child2-2.jar" ); +assert f.exists() && f.isFile() : "Could not find dependency file: " + f; diff --git a/src/it/projects/dependency-sets/depSet-runtimeScope/verify.groovy b/src/it/projects/dependency-sets/depSet-runtimeScope/verify.groovy index 155a1d05..05fb1e54 100644 --- a/src/it/projects/dependency-sets/depSet-runtimeScope/verify.groovy +++ b/src/it/projects/dependency-sets/depSet-runtimeScope/verify.groovy @@ -17,31 +17,10 @@ * under the License. */ -import java.io.*; +File dir = new File( basedir, "child3/target/child3-1-bin" ); -try -{ - File dir = new File( basedir, "child3/target/child3-1-bin" ); - - File f = new File( dir, "child1-1.jar" ); - if ( !f.exists() || !f.isFile() ) - { - System.out.println( "Could not find dependency file: " + f ); - return false; - } - - f = new File( dir, "child2-2.jar" ); - if ( !f.exists() || !f.isFile() ) - { - System.out.println( "Could not find dependency file: " + f ); - return false; - } - - return true; -} -catch( IOException e ) -{ - e.printStackTrace(); -} +File f = new File( dir, "child1-1.jar" ); +assert f.exists() && f.isFile() : "Could not find dependency file: " + f; -return false; +f = new File( dir, "child2-2.jar" ); +assert f.exists() && f.isFile() : "Could not find dependency file: " + f; diff --git a/src/it/projects/dependency-sets/depSet-unpacked-rdonly/verify.groovy b/src/it/projects/dependency-sets/depSet-unpacked-rdonly/verify.groovy index 1b2a6b31..52d37151 100644 --- a/src/it/projects/dependency-sets/depSet-unpacked-rdonly/verify.groovy +++ b/src/it/projects/dependency-sets/depSet-unpacked-rdonly/verify.groovy @@ -17,7 +17,5 @@ * under the License. */ -import java.io.*; - File file = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin/child1/test.txt" ); -return file.exists() && file.canRead(); +assert file.exists() && file.canRead(); diff --git a/src/it/projects/dependency-sets/dependencySet-matchScope/verify.groovy b/src/it/projects/dependency-sets/dependencySet-matchScope/verify.groovy index 7644cd3b..3fe9119a 100644 --- a/src/it/projects/dependency-sets/dependencySet-matchScope/verify.groovy +++ b/src/it/projects/dependency-sets/dependencySet-matchScope/verify.groovy @@ -17,51 +17,25 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.jar.*; -boolean result = true; -try -{ - System.out.println( "Creating JarFile java.io.File." ); - - File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); - - System.out.println( "Checking for existence and file-ishness of: " + jarFile ); - - if ( !jarFile.exists() || jarFile.isDirectory() ) - { - System.err.println( "jar file is missing or a directory." ); - return false; - } - - System.out.println( "Creating JarFile instance." ); - - JarFile jf = new JarFile( jarFile ); - - System.out.println( "Looking for 'lib/child1.jar' jar entry." ); - - if ( jf.getEntry( "lib/child1.jar" ) == null ) - { - System.err.println( "child1 entry is missing." ); - result = false; - } - - System.out.println( "Looking for absence of 'lib/junit-jupiter-api.jar' jar entry." ); - - if ( jf.getEntry( "lib/junit-jupiter-api.jar" ) != null ) - { - System.err.println( "junit jar should not be present." ); - result = false; - } - -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +System.out.println( "Creating JarFile java.io.File." ); -return result; +File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); + +System.out.println( "Checking for existence and file-ishness of: " + jarFile ); + +assert jarFile.exists() && !jarFile.isDirectory() : "jar file is missing or a directory."; + +System.out.println( "Creating JarFile instance." ); + +JarFile jf = new JarFile( jarFile ); + +System.out.println( "Looking for 'lib/child1.jar' jar entry." ); + +assert jf.getEntry( "lib/child1.jar" ) != null : "child1 entry is missing."; + +System.out.println( "Looking for absence of 'lib/junit-jupiter-api.jar' jar entry." ); + +assert jf.getEntry( "lib/junit-jupiter-api.jar" ) == null : "junit jar should not be present."; diff --git a/src/it/projects/dependency-sets/dependencySet-nonTransitive/verify.groovy b/src/it/projects/dependency-sets/dependencySet-nonTransitive/verify.groovy index 7644cd3b..3fe9119a 100644 --- a/src/it/projects/dependency-sets/dependencySet-nonTransitive/verify.groovy +++ b/src/it/projects/dependency-sets/dependencySet-nonTransitive/verify.groovy @@ -17,51 +17,25 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.jar.*; -boolean result = true; -try -{ - System.out.println( "Creating JarFile java.io.File." ); - - File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); - - System.out.println( "Checking for existence and file-ishness of: " + jarFile ); - - if ( !jarFile.exists() || jarFile.isDirectory() ) - { - System.err.println( "jar file is missing or a directory." ); - return false; - } - - System.out.println( "Creating JarFile instance." ); - - JarFile jf = new JarFile( jarFile ); - - System.out.println( "Looking for 'lib/child1.jar' jar entry." ); - - if ( jf.getEntry( "lib/child1.jar" ) == null ) - { - System.err.println( "child1 entry is missing." ); - result = false; - } - - System.out.println( "Looking for absence of 'lib/junit-jupiter-api.jar' jar entry." ); - - if ( jf.getEntry( "lib/junit-jupiter-api.jar" ) != null ) - { - System.err.println( "junit jar should not be present." ); - result = false; - } - -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +System.out.println( "Creating JarFile java.io.File." ); -return result; +File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); + +System.out.println( "Checking for existence and file-ishness of: " + jarFile ); + +assert jarFile.exists() && !jarFile.isDirectory() : "jar file is missing or a directory."; + +System.out.println( "Creating JarFile instance." ); + +JarFile jf = new JarFile( jarFile ); + +System.out.println( "Looking for 'lib/child1.jar' jar entry." ); + +assert jf.getEntry( "lib/child1.jar" ) != null : "child1 entry is missing."; + +System.out.println( "Looking for absence of 'lib/junit-jupiter-api.jar' jar entry." ); + +assert jf.getEntry( "lib/junit-jupiter-api.jar" ) == null : "junit jar should not be present."; diff --git a/src/it/projects/dependency-sets/dependencySet-notUnpacked/verify.groovy b/src/it/projects/dependency-sets/dependencySet-notUnpacked/verify.groovy index 7644cd3b..3fe9119a 100644 --- a/src/it/projects/dependency-sets/dependencySet-notUnpacked/verify.groovy +++ b/src/it/projects/dependency-sets/dependencySet-notUnpacked/verify.groovy @@ -17,51 +17,25 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.jar.*; -boolean result = true; -try -{ - System.out.println( "Creating JarFile java.io.File." ); - - File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); - - System.out.println( "Checking for existence and file-ishness of: " + jarFile ); - - if ( !jarFile.exists() || jarFile.isDirectory() ) - { - System.err.println( "jar file is missing or a directory." ); - return false; - } - - System.out.println( "Creating JarFile instance." ); - - JarFile jf = new JarFile( jarFile ); - - System.out.println( "Looking for 'lib/child1.jar' jar entry." ); - - if ( jf.getEntry( "lib/child1.jar" ) == null ) - { - System.err.println( "child1 entry is missing." ); - result = false; - } - - System.out.println( "Looking for absence of 'lib/junit-jupiter-api.jar' jar entry." ); - - if ( jf.getEntry( "lib/junit-jupiter-api.jar" ) != null ) - { - System.err.println( "junit jar should not be present." ); - result = false; - } - -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +System.out.println( "Creating JarFile java.io.File." ); -return result; +File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); + +System.out.println( "Checking for existence and file-ishness of: " + jarFile ); + +assert jarFile.exists() && !jarFile.isDirectory() : "jar file is missing or a directory."; + +System.out.println( "Creating JarFile instance." ); + +JarFile jf = new JarFile( jarFile ); + +System.out.println( "Looking for 'lib/child1.jar' jar entry." ); + +assert jf.getEntry( "lib/child1.jar" ) != null : "child1 entry is missing."; + +System.out.println( "Looking for absence of 'lib/junit-jupiter-api.jar' jar entry." ); + +assert jf.getEntry( "lib/junit-jupiter-api.jar" ) == null : "junit jar should not be present."; diff --git a/src/it/projects/dependency-sets/dependencySet-projectArtifactNotIncluded/verify.groovy b/src/it/projects/dependency-sets/dependencySet-projectArtifactNotIncluded/verify.groovy index db95dff5..49ebf557 100644 --- a/src/it/projects/dependency-sets/dependencySet-projectArtifactNotIncluded/verify.groovy +++ b/src/it/projects/dependency-sets/dependencySet-projectArtifactNotIncluded/verify.groovy @@ -17,8 +17,6 @@ * under the License. */ -import java.io.*; - if ( !binding.hasVariable( "basedir" ) ) { basedir = new File( "." ); @@ -28,5 +26,4 @@ File depFile = new File( basedir, "target/dependencySet-projectArtifactNotInclud File projectArtifactFile = new File( basedir, "target/dependencySet-projectArtifactNotIncluded-1.0-SNAPSHOT-bin/lib/dependencySet-projectArtifactNotIncluded-1.0-SNAPSHOT.war" ); -System.out.println( "result: " + ( depFile.exists() && !projectArtifactFile.exists() ) ); -return depFile.exists() && !projectArtifactFile.exists(); +assert depFile.exists() && !projectArtifactFile.exists(); diff --git a/src/it/projects/dependency-sets/dependencySet-unpacked-filtered/verify.groovy b/src/it/projects/dependency-sets/dependencySet-unpacked-filtered/verify.groovy index 4e5b3f6a..9eef3896 100644 --- a/src/it/projects/dependency-sets/dependencySet-unpacked-filtered/verify.groovy +++ b/src/it/projects/dependency-sets/dependencySet-unpacked-filtered/verify.groovy @@ -17,21 +17,7 @@ * under the License. */ -import java.io.*; +File f = new File( basedir, "child2/target/child2-1-bin/zz/assembly-resources/test.txt" ); -try -{ - File f = new File( basedir, "child2/target/child2-1-bin/zz/assembly-resources/test.txt" ); - - BufferedReader r = new BufferedReader( new FileReader( f ) ); - if ( r.readLine().equals( "Project Version: 1" ) ) - { - return true; - } -} -catch( IOException e ) -{ - e.printStackTrace(); -} - -return false; +String line = f.withReader( "UTF-8" ) { it.readLine() }; +assert "Project Version: 1".equals( line ) : "First line of " + f + " was: " + line; diff --git a/src/it/projects/dependency-sets/dependencySet-unpacked/verify.groovy b/src/it/projects/dependency-sets/dependencySet-unpacked/verify.groovy index 1425d9ee..450d31ea 100644 --- a/src/it/projects/dependency-sets/dependencySet-unpacked/verify.groovy +++ b/src/it/projects/dependency-sets/dependencySet-unpacked/verify.groovy @@ -17,51 +17,25 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.jar.*; -boolean result = true; -try -{ - System.out.println( "Creating JarFile java.io.File." ); - - File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); - - System.out.println( "Checking for existence and file-ishness of: " + jarFile ); - - if ( !jarFile.exists() || jarFile.isDirectory() ) - { - System.err.println( "jar file is missing or a directory." ); - return false; - } - - System.out.println( "Creating JarFile instance." ); - - JarFile jf = new JarFile( jarFile ); - - System.out.println( "Looking for 'child1/' jar entry." ); - - if ( jf.getEntry( "child1/" ) == null ) - { - System.err.println( "child1 entry is missing." ); - result = false; - } - - System.out.println( "Looking for absence of 'junit/' jar entry." ); - - if ( jf.getEntry( "junit" ) != null ) - { - System.err.println( "junit jar should not be present." ); - result = false; - } - -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +System.out.println( "Creating JarFile java.io.File." ); -return result; +File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); + +System.out.println( "Checking for existence and file-ishness of: " + jarFile ); + +assert jarFile.exists() && !jarFile.isDirectory() : "jar file is missing or a directory."; + +System.out.println( "Creating JarFile instance." ); + +JarFile jf = new JarFile( jarFile ); + +System.out.println( "Looking for 'child1/' jar entry." ); + +assert jf.getEntry( "child1/" ) != null : "child1 entry is missing."; + +System.out.println( "Looking for absence of 'junit/' jar entry." ); + +assert jf.getEntry( "junit" ) == null : "junit jar should not be present."; diff --git a/src/it/projects/dependency-sets/dependencySet-unpackedExcludingMetaInf/verify.groovy b/src/it/projects/dependency-sets/dependencySet-unpackedExcludingMetaInf/verify.groovy index 6264f72f..11254e72 100644 --- a/src/it/projects/dependency-sets/dependencySet-unpackedExcludingMetaInf/verify.groovy +++ b/src/it/projects/dependency-sets/dependencySet-unpackedExcludingMetaInf/verify.groovy @@ -17,59 +17,29 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.jar.*; -boolean result = true; -try -{ - System.out.println( "Creating JarFile java.io.File." ); - - File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); - - System.out.println( "Checking for existence and file-ishness of: " + jarFile ); - - if ( !jarFile.exists() || jarFile.isDirectory() ) - { - System.err.println( "jar file is missing or a directory." ); - return false; - } - - System.out.println( "Creating JarFile instance." ); - - JarFile jf = new JarFile( jarFile ); - - System.out.println( "Looking for 'child1/' jar entry." ); - - if ( jf.getEntry( "child1/" ) == null ) - { - System.err.println( "child1 entry is missing." ); - result = false; - } +System.out.println( "Creating JarFile java.io.File." ); - System.out.println( "Looking for 'child1/META-INF' jar entry (should not exist)." ); - - if ( jf.getEntry( "child1/META-INF" ) != null ) - { - System.err.println( "child1/META-INF entry should not be present." ); - result = false; - } - - System.out.println( "Looking for absence of 'junit/' jar entry." ); - - if ( jf.getEntry( "junit" ) != null ) - { - System.err.println( "junit jar should not be present." ); - result = false; - } - -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); -return result; +System.out.println( "Checking for existence and file-ishness of: " + jarFile ); + +assert jarFile.exists() && !jarFile.isDirectory() : "jar file is missing or a directory."; + +System.out.println( "Creating JarFile instance." ); + +JarFile jf = new JarFile( jarFile ); + +System.out.println( "Looking for 'child1/' jar entry." ); + +assert jf.getEntry( "child1/" ) != null : "child1 entry is missing."; + +System.out.println( "Looking for 'child1/META-INF' jar entry (should not exist)." ); + +assert jf.getEntry( "child1/META-INF" ) == null : "child1/META-INF entry should not be present."; + +System.out.println( "Looking for absence of 'junit/' jar entry." ); + +assert jf.getEntry( "junit" ) == null : "junit jar should not be present."; diff --git a/src/it/projects/dependency-sets/dependencySet-unpackedSubsetsTwice/verify.groovy b/src/it/projects/dependency-sets/dependencySet-unpackedSubsetsTwice/verify.groovy index 5cc44934..d03ff5b0 100644 --- a/src/it/projects/dependency-sets/dependencySet-unpackedSubsetsTwice/verify.groovy +++ b/src/it/projects/dependency-sets/dependencySet-unpackedSubsetsTwice/verify.groovy @@ -17,67 +17,33 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.jar.*; -boolean result = true; - -try -{ - System.out.println( "Creating JarFile java.io.File." ); - - File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); - - System.out.println( "Checking for existence and file-ishness of: " + jarFile ); - - if ( !jarFile.exists() || jarFile.isDirectory() ) - { - System.err.println( "jar file is missing or a directory." ); - return false; - } - - System.out.println( "Creating JarFile instance." ); - - JarFile jf = new JarFile( jarFile ); - - System.out.println( "Looking for 'classes1/test/App.class' jar entry." ); - - if ( jf.getEntry( "classes1/test/App.class" ) == null ) - { - System.err.println( "classes1/test/App.class entry is missing." ); - result = false; - } - - System.out.println( "Looking for absence of 'classes1/test/App2.class' jar entry." ); - - if ( jf.getEntry( "classes1/test/App2.class" ) != null ) - { - System.err.println( "classes1/test/App2.class should not be present." ); - result = false; - } - - System.out.println( "Looking for 'classes2/test/App2.class' jar entry." ); - - if ( jf.getEntry( "classes2/test/App2.class" ) == null ) - { - System.err.println( "classes2/test/App2.class entry is missing." ); - result = false; - } - - System.out.println( "Looking for absence of 'classes2/test/App.class' jar entry." ); - - if ( jf.getEntry( "classes2/test/App.class" ) != null ) - { - System.err.println( "classes2/test/App.class should not be present." ); - result = false; - } - -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; + +System.out.println( "Creating JarFile java.io.File." ); + +File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); + +System.out.println( "Checking for existence and file-ishness of: " + jarFile ); + +assert jarFile.exists() && !jarFile.isDirectory() : "jar file is missing or a directory."; + +System.out.println( "Creating JarFile instance." ); + +JarFile jf = new JarFile( jarFile ); + +System.out.println( "Looking for 'classes1/test/App.class' jar entry." ); + +assert jf.getEntry( "classes1/test/App.class" ) != null : "classes1/test/App.class entry is missing."; + +System.out.println( "Looking for absence of 'classes1/test/App2.class' jar entry." ); + +assert jf.getEntry( "classes1/test/App2.class" ) == null : "classes1/test/App2.class should not be present."; + +System.out.println( "Looking for 'classes2/test/App2.class' jar entry." ); + +assert jf.getEntry( "classes2/test/App2.class" ) != null : "classes2/test/App2.class entry is missing."; + +System.out.println( "Looking for absence of 'classes2/test/App.class' jar entry." ); + +assert jf.getEntry( "classes2/test/App.class" ) == null : "classes2/test/App.class should not be present."; diff --git a/src/it/projects/dependency-sets/dependencySet-withExecutedProject/verify.groovy b/src/it/projects/dependency-sets/dependencySet-withExecutedProject/verify.groovy index 8f4aeba3..a7be91ee 100644 --- a/src/it/projects/dependency-sets/dependencySet-withExecutedProject/verify.groovy +++ b/src/it/projects/dependency-sets/dependencySet-withExecutedProject/verify.groovy @@ -17,20 +17,4 @@ * under the License. */ -import java.io.*; -import java.net.*; -import java.util.jar.*; - -boolean result = true; - -try -{ - result = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin/lib/child1.jar" ).exists(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; +assert new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin/lib/child1.jar" ).exists(); diff --git a/src/it/projects/dependency-sets/include-project-artifact/verify.groovy b/src/it/projects/dependency-sets/include-project-artifact/verify.groovy index 55018082..23f06341 100644 --- a/src/it/projects/dependency-sets/include-project-artifact/verify.groovy +++ b/src/it/projects/dependency-sets/include-project-artifact/verify.groovy @@ -17,47 +17,18 @@ * under the License. */ -import java.io.*; -import java.net.*; -import java.util.jar.*; - -boolean result = true; - -try -{ - File dir = new File( basedir, "target/include-project-artifact-1.0-SNAPSHOT-bin" ); - - System.out.println( "Checking for existence and file-ishness of: " + dir ); - - if ( !dir.exists() || !dir.isDirectory() ) - { - System.err.println( "assembled directory is missing or not a directory." ); - return false; - } - - File projectArtifact = new File( dir, "lib/include-project-artifact-1.0-SNAPSHOT.jar" ); - - System.out.println( "Looking for 'lib/include-project-artifact-1.0-SNAPSHOT.jar file in assembly." ); - - if ( !projectArtifact.exists() ) - { - System.err.println( "project-artifact entry is missing." ); - return false; - } - - System.out.println( "Looking for absence of 'lib/junit-jupiter-api.jar' jar entry." ); - - if ( new File( dir, "lib/junit-jupiter-api-6.0.0.jar" ).exists() ) - { - System.err.println( "junit jar should not be present." ); - return false; - } - -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; +File dir = new File( basedir, "target/include-project-artifact-1.0-SNAPSHOT-bin" ); + +System.out.println( "Checking for existence and file-ishness of: " + dir ); + +assert dir.exists() && dir.isDirectory() : "assembled directory is missing or not a directory."; + +File projectArtifact = new File( dir, "lib/include-project-artifact-1.0-SNAPSHOT.jar" ); + +System.out.println( "Looking for 'lib/include-project-artifact-1.0-SNAPSHOT.jar file in assembly." ); + +assert projectArtifact.exists() : "project-artifact entry is missing."; + +System.out.println( "Looking for absence of 'lib/junit-jupiter-api.jar' jar entry." ); + +assert !new File( dir, "lib/junit-jupiter-api-6.0.0.jar" ).exists() : "junit jar should not be present."; diff --git a/src/it/projects/dependency-sets/include-project-attachments/verify.groovy b/src/it/projects/dependency-sets/include-project-attachments/verify.groovy index cadcb784..9df1e47c 100644 --- a/src/it/projects/dependency-sets/include-project-attachments/verify.groovy +++ b/src/it/projects/dependency-sets/include-project-attachments/verify.groovy @@ -17,57 +17,24 @@ * under the License. */ -import java.io.*; -import java.net.*; -import java.util.jar.*; +File dir = new File( basedir, "target/include-project-attachments-1.0-SNAPSHOT-bin" ); -boolean result = true; +System.out.println( "Checking for existence and file-ishness of: " + dir ); -try -{ - File dir = new File( basedir, "target/include-project-attachments-1.0-SNAPSHOT-bin" ); - - System.out.println( "Checking for existence and file-ishness of: " + dir ); - - if ( !dir.exists() || !dir.isDirectory() ) - { - System.err.println( "assembled directory is missing or not a directory." ); - return false; - } - - File projectArtifact = new File( dir, "lib/include-project-attachments-1.0-SNAPSHOT.jar" ); - - System.out.println( "Looking for 'lib/include-project-attachments-1.0-SNAPSHOT.jar file in assembly." ); - - if ( !projectArtifact.exists() ) - { - System.err.println( "project-attachments entry is missing." ); - return false; - } - - File attachment = new File( dir, "lib/include-project-attachments-1.0-SNAPSHOT-src.zip" ); - - System.out.println( "Looking for 'lib/include-project-attachments-1.0-SNAPSHOT-src.zip file in assembly." ); - - if ( !attachment.exists() ) - { - System.err.println( "project attachment entry is missing." ); - return false; - } - - System.out.println( "Looking for absence of 'lib/junit-jupiter-api.jar' jar entry." ); - - if ( new File( dir, "lib/junit-jupiter-api-6.0.0.jar" ).exists() ) - { - System.err.println( "junit jar should not be present." ); - return false; - } - -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +assert dir.exists() && dir.isDirectory() : "assembled directory is missing or not a directory."; -return result; +File projectArtifact = new File( dir, "lib/include-project-attachments-1.0-SNAPSHOT.jar" ); + +System.out.println( "Looking for 'lib/include-project-attachments-1.0-SNAPSHOT.jar file in assembly." ); + +assert projectArtifact.exists() : "project-attachments entry is missing."; + +File attachment = new File( dir, "lib/include-project-attachments-1.0-SNAPSHOT-src.zip" ); + +System.out.println( "Looking for 'lib/include-project-attachments-1.0-SNAPSHOT-src.zip file in assembly." ); + +assert attachment.exists() : "project attachment entry is missing."; + +System.out.println( "Looking for absence of 'lib/junit-jupiter-api.jar' jar entry." ); + +assert !new File( dir, "lib/junit-jupiter-api-6.0.0.jar" ).exists() : "junit jar should not be present."; diff --git a/src/it/projects/dependency-sets/include-provided/verify.groovy b/src/it/projects/dependency-sets/include-provided/verify.groovy index 7644cd3b..3fe9119a 100644 --- a/src/it/projects/dependency-sets/include-provided/verify.groovy +++ b/src/it/projects/dependency-sets/include-provided/verify.groovy @@ -17,51 +17,25 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.jar.*; -boolean result = true; -try -{ - System.out.println( "Creating JarFile java.io.File." ); - - File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); - - System.out.println( "Checking for existence and file-ishness of: " + jarFile ); - - if ( !jarFile.exists() || jarFile.isDirectory() ) - { - System.err.println( "jar file is missing or a directory." ); - return false; - } - - System.out.println( "Creating JarFile instance." ); - - JarFile jf = new JarFile( jarFile ); - - System.out.println( "Looking for 'lib/child1.jar' jar entry." ); - - if ( jf.getEntry( "lib/child1.jar" ) == null ) - { - System.err.println( "child1 entry is missing." ); - result = false; - } - - System.out.println( "Looking for absence of 'lib/junit-jupiter-api.jar' jar entry." ); - - if ( jf.getEntry( "lib/junit-jupiter-api.jar" ) != null ) - { - System.err.println( "junit jar should not be present." ); - result = false; - } - -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +System.out.println( "Creating JarFile java.io.File." ); -return result; +File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.jar" ); + +System.out.println( "Checking for existence and file-ishness of: " + jarFile ); + +assert jarFile.exists() && !jarFile.isDirectory() : "jar file is missing or a directory."; + +System.out.println( "Creating JarFile instance." ); + +JarFile jf = new JarFile( jarFile ); + +System.out.println( "Looking for 'lib/child1.jar' jar entry." ); + +assert jf.getEntry( "lib/child1.jar" ) != null : "child1 entry is missing."; + +System.out.println( "Looking for absence of 'lib/junit-jupiter-api.jar' jar entry." ); + +assert jf.getEntry( "lib/junit-jupiter-api.jar" ) == null : "junit jar should not be present."; diff --git a/src/it/projects/dependency-sets/including-pom-dependency/verify.groovy b/src/it/projects/dependency-sets/including-pom-dependency/verify.groovy index bf0e3415..158f708f 100644 --- a/src/it/projects/dependency-sets/including-pom-dependency/verify.groovy +++ b/src/it/projects/dependency-sets/including-pom-dependency/verify.groovy @@ -17,19 +17,15 @@ * under the License. */ -import java.io.*; -boolean result = true; // verify that transitive deps of the POM dep were included. -result = result && new File( basedir, "target/including-pom-dependency-1.0-SNAPSHOT-bin/lib/plexus-utils" ).exists(); -result = result && new File( basedir, "target/including-pom-dependency-1.0-SNAPSHOT-bin/lib/classworlds" ).exists(); -result = result && new File( basedir, "target/including-pom-dependency-1.0-SNAPSHOT-bin/lib/junit" ).exists(); +assert new File( basedir, "target/including-pom-dependency-1.0-SNAPSHOT-bin/lib/plexus-utils" ).exists(); +assert new File( basedir, "target/including-pom-dependency-1.0-SNAPSHOT-bin/lib/classworlds" ).exists(); +assert new File( basedir, "target/including-pom-dependency-1.0-SNAPSHOT-bin/lib/junit" ).exists(); // verify that the POM dep was included without extracting. -result = result && new File( basedir, "target/including-pom-dependency-1.0-SNAPSHOT-bin/lib/plexus-container-default.pom" ).exists(); +assert new File( basedir, "target/including-pom-dependency-1.0-SNAPSHOT-bin/lib/plexus-container-default.pom" ).exists(); // verify that the jar associated with the POM dep wasn't included either. -result = result && !new File( basedir, "target/including-pom-dependency-1.0-SNAPSHOT-bin/lib/plexus-container-default" ).exists(); - -return result; +assert !new File( basedir, "target/including-pom-dependency-1.0-SNAPSHOT-bin/lib/plexus-container-default" ).exists(); diff --git a/src/it/projects/dependency-sets/including-sar-dependency/verify.groovy b/src/it/projects/dependency-sets/including-sar-dependency/verify.groovy index 9842bdff..acae2d2e 100644 --- a/src/it/projects/dependency-sets/including-sar-dependency/verify.groovy +++ b/src/it/projects/dependency-sets/including-sar-dependency/verify.groovy @@ -17,14 +17,10 @@ * under the License. */ -import java.io.*; -boolean result = true; // verify that transitive deps of the POM dep were included. -result = result && new File( basedir, "target/including-sar-dependency-1.0-SNAPSHOT-bin/lib/xmlrpc" ).exists(); -result = result && new File( basedir, "target/including-sar-dependency-1.0-SNAPSHOT-bin/lib/plexus-xmlrpc" ).exists(); +assert new File( basedir, "target/including-sar-dependency-1.0-SNAPSHOT-bin/lib/xmlrpc" ).exists(); +assert new File( basedir, "target/including-sar-dependency-1.0-SNAPSHOT-bin/lib/plexus-xmlrpc" ).exists(); -result = result && new File( basedir, "target/including-sar-dependency-1.0-SNAPSHOT-bin/lib/plexus-appserver-service-xmlrpc/lib/commons-codec-1.3.jar" ).exists(); - -return result; +assert new File( basedir, "target/including-sar-dependency-1.0-SNAPSHOT-bin/lib/plexus-appserver-service-xmlrpc/lib/commons-codec-1.3.jar" ).exists(); diff --git a/src/it/projects/dependency-sets/massembly-201/verify.groovy b/src/it/projects/dependency-sets/massembly-201/verify.groovy index a8f63920..f91e54d2 100644 --- a/src/it/projects/dependency-sets/massembly-201/verify.groovy +++ b/src/it/projects/dependency-sets/massembly-201/verify.groovy @@ -17,25 +17,12 @@ * under the License. */ -import java.io.*; - File main = new File( basedir, "target/massembly-201-1-bin/maven-model-2.0.9.jar" ); File sources = new File( basedir, "target/massembly-201-1-bin/maven-model-2.0.9-sources.jar" ); File javadocs = new File( basedir, "target/massembly-201-1-bin/maven-model-2.0.9-javadoc.jar" ); -if ( !main.exists() ) -{ - System.out.println( "Main (unclassified) dependency jar is missing: " + main ); -} - -if ( !sources.exists() ) -{ - System.out.println( "Sources dependency jar is missing: " + sources ); -} +assert main.exists() : "Main (unclassified) dependency jar is missing: " + main; -if ( !javadocs.exists() ) -{ - System.out.println( "JavaDocs dependency jar is missing: " + javadocs ); -} +assert sources.exists() : "Sources dependency jar is missing: " + sources; -return main.exists() && sources.exists() && javadocs.exists(); +assert javadocs.exists() : "JavaDocs dependency jar is missing: " + javadocs; diff --git a/src/it/projects/dependency-sets/massembly-235/verify.groovy b/src/it/projects/dependency-sets/massembly-235/verify.groovy index 45266528..0aeb7277 100644 --- a/src/it/projects/dependency-sets/massembly-235/verify.groovy +++ b/src/it/projects/dependency-sets/massembly-235/verify.groovy @@ -17,14 +17,10 @@ * under the License. */ -import java.io.*; - File dir = new File( basedir, "target/massembly235-test-1-release" ); File goodJar = new File( dir, "xmlenc-0.52.jar" ); File badJar = new File( dir, "xmlenc-0.39.jar" ); -System.out.println( "Good version of xmlenc exists? " + goodJar.exists() ); -System.out.println( "Bad version of xmlenc doesn't exist? " + (!badJar.exists()) ); - -return goodJar.exists() && !badJar.exists(); +assert goodJar.exists() : "Good version of xmlenc is missing: " + goodJar; +assert !badJar.exists() : "Bad version of xmlenc should not exist: " + badJar; diff --git a/src/it/projects/dependency-sets/massembly-395/verify.groovy b/src/it/projects/dependency-sets/massembly-395/verify.groovy index e7509044..345e1f3c 100644 --- a/src/it/projects/dependency-sets/massembly-395/verify.groovy +++ b/src/it/projects/dependency-sets/massembly-395/verify.groovy @@ -17,9 +17,6 @@ * under the License. */ -import java.io.*; -import java.util.*; -import java.util.jar.*; import java.util.zip.*; @@ -28,9 +25,4 @@ ZipFile zf = new ZipFile( f ); ZipEntry child1InclEntry = zf.getEntry( "my-app-1.0-SNAPSHOT/modules/junit-jupiter-api-" + scriptVarVersionJunit + ".jar" ); -if ( child1InclEntry == null ) -{ - System.out.println( "Expected junit.jar!" ); - return false; -} -return true; +assert child1InclEntry != null : "Expected junit.jar!"; diff --git a/src/it/projects/dependency-sets/massembly-619/verify.groovy b/src/it/projects/dependency-sets/massembly-619/verify.groovy index ba96f4fc..f158f946 100644 --- a/src/it/projects/dependency-sets/massembly-619/verify.groovy +++ b/src/it/projects/dependency-sets/massembly-619/verify.groovy @@ -17,19 +17,10 @@ * under the License. */ -import java.io.*; import java.util.zip.*; ZipFile zf = new ZipFile( new File( basedir, "target/bug-test-1.0-SNAPSHOT-deploy-zip.zip" ) ); ZipEntry child1InclEntry = zf.getEntry( "bug-test-1.0-SNAPSHOT/dir2/classworlds-1.1.jar" ); -if ( child1InclEntry != null ) -{ - System.out.println( "Unexpected file in jar !" ); - return false; -} - -return true; - - +assert child1InclEntry == null : "Unexpected file in jar !"; diff --git a/src/it/projects/dependency-sets/massembly-675/verify.groovy b/src/it/projects/dependency-sets/massembly-675/verify.groovy index f8a95abb..039ee0b9 100644 --- a/src/it/projects/dependency-sets/massembly-675/verify.groovy +++ b/src/it/projects/dependency-sets/massembly-675/verify.groovy @@ -17,19 +17,14 @@ * under the License. */ -import java.io.*; -boolean result = true; -result = result && new File( basedir, "target/massembly-675-1-bin/massembly-675-1.jar" ).exists(); -result = result && new File( basedir, "target/massembly-675-1-bin/closure-compiler-v20131014.jar" ).exists(); +assert new File( basedir, "target/massembly-675-1-bin/massembly-675-1.jar" ).exists(); +assert new File( basedir, "target/massembly-675-1-bin/closure-compiler-v20131014.jar" ).exists(); // assert that all the transitive dependencies of closure-compiler were excluded -result = result && !new File( basedir, "target/massembly-675-1-bin/args4j-2.0.16.jar" ).exists(); -result = result && !new File( basedir, "target/massembly-675-1-bin/json-20090211.jar" ).exists(); -result = result && !new File( basedir, "target/massembly-675-1-bin/protobuf-java-2.4.1.jar" ).exists(); -result = result && !new File( basedir, "target/massembly-675-1-bin/jsr305-1.3.9.jar" ).exists(); -result = result && !new File( basedir, "target/massembly-675-1-bin/guava-15.0.jar" ).exists(); - - -return result; +assert !new File( basedir, "target/massembly-675-1-bin/args4j-2.0.16.jar" ).exists(); +assert !new File( basedir, "target/massembly-675-1-bin/json-20090211.jar" ).exists(); +assert !new File( basedir, "target/massembly-675-1-bin/protobuf-java-2.4.1.jar" ).exists(); +assert !new File( basedir, "target/massembly-675-1-bin/jsr305-1.3.9.jar" ).exists(); +assert !new File( basedir, "target/massembly-675-1-bin/guava-15.0.jar" ).exists(); diff --git a/src/it/projects/dependency-sets/massembly-955/verify.groovy b/src/it/projects/dependency-sets/massembly-955/verify.groovy index 85c1233e..2360fd22 100644 --- a/src/it/projects/dependency-sets/massembly-955/verify.groovy +++ b/src/it/projects/dependency-sets/massembly-955/verify.groovy @@ -17,11 +17,7 @@ * under the License. */ -import java.io.*; -boolean result = true; -result = result && new File( basedir, "target/massembly-955-1-bin/teiid-10.0.5-jdbc.jar" ).exists(); -result = result && new File( basedir, "target/massembly-955-1-bin/jython-standalone-2.7.2.jar" ).exists(); - -return result; +assert new File( basedir, "target/massembly-955-1-bin/teiid-10.0.5-jdbc.jar" ).exists(); +assert new File( basedir, "target/massembly-955-1-bin/jython-standalone-2.7.2.jar" ).exists(); diff --git a/src/it/projects/dependency-sets/massembly-99/verify.groovy b/src/it/projects/dependency-sets/massembly-99/verify.groovy index 2731e1c8..4efd4ee8 100644 --- a/src/it/projects/dependency-sets/massembly-99/verify.groovy +++ b/src/it/projects/dependency-sets/massembly-99/verify.groovy @@ -17,15 +17,10 @@ * under the License. */ -import java.io.*; -boolean result = true; -result = result && new File( basedir, "assembly/target/assembly-1.0-SNAPSHOT-bin/lib/jdom.jar" ).exists(); -result = result && new File( basedir, "assembly/target/assembly-1.0-SNAPSHOT-bin/lib/velocity.jar" ).exists(); +assert new File( basedir, "assembly/target/assembly-1.0-SNAPSHOT-bin/lib/jdom.jar" ).exists(); +assert new File( basedir, "assembly/target/assembly-1.0-SNAPSHOT-bin/lib/velocity.jar" ).exists(); -result = result && new File( basedir, "assembly/target/assembly-1.0-SNAPSHOT-bin/modules/module-a.jar" ).exists(); -result = result && new File( basedir, "assembly/target/assembly-1.0-SNAPSHOT-bin/modules/module-b.jar" ).exists(); - - -return result; +assert new File( basedir, "assembly/target/assembly-1.0-SNAPSHOT-bin/modules/module-a.jar" ).exists(); +assert new File( basedir, "assembly/target/assembly-1.0-SNAPSHOT-bin/modules/module-b.jar" ).exists(); diff --git a/src/it/projects/dependency-sets/outputFileNameMappingWithUnpack/verify.groovy b/src/it/projects/dependency-sets/outputFileNameMappingWithUnpack/verify.groovy index 0424f518..5813a18b 100644 --- a/src/it/projects/dependency-sets/outputFileNameMappingWithUnpack/verify.groovy +++ b/src/it/projects/dependency-sets/outputFileNameMappingWithUnpack/verify.groovy @@ -17,23 +17,11 @@ * under the License. */ -import java.io.*; - // verify that the ear is created File dirWithMapping = new File( basedir, "target/project-1-bin/some_directory/junit.jar/" ); -if ( dirWithMapping.exists() ) -{ - System.out.println( "<outputFileNameMapping> should NOT be used when unpack == true." ); - return false; -} +assert !dirWithMapping.exists() : "<outputFileNameMapping> should NOT be used when unpack == true."; File dir = new File( basedir, "target/project-1-bin/some_directory/junit/framework/TestCase.class" ); -if ( !dir.exists() ) -{ - System.out.println( "Expected unpacked class does not exist in the appropriate outputDirectory within the assembly." ); - return false; -} - -return true; +assert dir.exists() : "Expected unpacked class does not exist in the appropriate outputDirectory within the assembly."; diff --git a/src/it/projects/dependency-sets/unpack-deps-correct-dir/verify.groovy b/src/it/projects/dependency-sets/unpack-deps-correct-dir/verify.groovy index e1f2927c..94ef219e 100644 --- a/src/it/projects/dependency-sets/unpack-deps-correct-dir/verify.groovy +++ b/src/it/projects/dependency-sets/unpack-deps-correct-dir/verify.groovy @@ -17,17 +17,10 @@ * under the License. */ -import java.io.*; import java.util.zip.*; ZipFile zf = new ZipFile( new File( basedir, "target/assembly-plugin-bug-demo-1.0-SNAPSHOT-my-assembly.zip" ) ); ZipEntry child1InclEntry = zf.getEntry( "assembly-plugin-bug-demo-1.0-SNAPSHOT/deps/META-INF/maven/org.apache.maven.skins/maven-default-skin/pom.xml" ); -if ( child1InclEntry == null ) -{ - System.out.println( "Incorrect path of unpacked jar file" ); - return false; -} - -return true; +assert child1InclEntry != null : "Incorrect path of unpacked jar file"; diff --git a/src/it/projects/dependency-sets/using-moduleSet-implied-depSet/verify.groovy b/src/it/projects/dependency-sets/using-moduleSet-implied-depSet/verify.groovy index 7d6db166..d9cadc14 100644 --- a/src/it/projects/dependency-sets/using-moduleSet-implied-depSet/verify.groovy +++ b/src/it/projects/dependency-sets/using-moduleSet-implied-depSet/verify.groovy @@ -17,16 +17,11 @@ * under the License. */ -import java.io.*; -boolean result = true; -result = result && new File( basedir, "module-b/target/module-b-1.0-SNAPSHOT-bin/modules/jdom-1.0.jar" ).exists(); -result = result && new File( basedir, "module-b/target/module-b-1.0-SNAPSHOT-bin/modules/velocity-1.4.jar" ).exists(); -result = result && new File( basedir, "module-b/target/module-b-1.0-SNAPSHOT-bin/modules/velocity-dep-1.4.jar" ).exists(); +assert new File( basedir, "module-b/target/module-b-1.0-SNAPSHOT-bin/modules/jdom-1.0.jar" ).exists(); +assert new File( basedir, "module-b/target/module-b-1.0-SNAPSHOT-bin/modules/velocity-1.4.jar" ).exists(); +assert new File( basedir, "module-b/target/module-b-1.0-SNAPSHOT-bin/modules/velocity-dep-1.4.jar" ).exists(); -result = result && new File( basedir, "module-b/target/module-b-1.0-SNAPSHOT-bin/modules/module-a.jar" ).exists(); -result = result && new File( basedir, "module-b/target/module-b-1.0-SNAPSHOT-bin/modules/module-b.jar" ).exists(); - - -return result; +assert new File( basedir, "module-b/target/module-b-1.0-SNAPSHOT-bin/modules/module-a.jar" ).exists(); +assert new File( basedir, "module-b/target/module-b-1.0-SNAPSHOT-bin/modules/module-b.jar" ).exists(); diff --git a/src/it/projects/descriptor-refs/bin/jars-in-archive-root/verify.groovy b/src/it/projects/descriptor-refs/bin/jars-in-archive-root/verify.groovy index 04c3438f..d43c4658 100644 --- a/src/it/projects/descriptor-refs/bin/jars-in-archive-root/verify.groovy +++ b/src/it/projects/descriptor-refs/bin/jars-in-archive-root/verify.groovy @@ -17,45 +17,24 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.zip.*; -boolean result = true; String basename = "jars-in-archive-root-1.0-SNAPSHOT"; -try -{ - File zipFile = new File( basedir, "target/" + basename + "-bin.zip" ); - - System.out.println( "Checking for existence and file-ishness of: " + zipFile ); - - if ( !zipFile.exists() || zipFile.isDirectory() ) - { - System.err.println( "zip file is missing or a directory." ); - return false; - } - - System.out.println( "Creating zipFile instance." ); - - ZipFile zf = new ZipFile( zipFile ); - - System.out.println( "Looking for project-artifact jar zip entry." ); - - ZipEntry je = zf.getEntry( basename + "/" + basename + ".jar" ); - - if ( je == null ) - { - System.out.println( "project artifact is missing from archive root dir." ); - result = false; - } +File zipFile = new File( basedir, "target/" + basename + "-bin.zip" ); + +System.out.println( "Checking for existence and file-ishness of: " + zipFile ); + +assert zipFile.exists() && !zipFile.isDirectory() : "zip file is missing or a directory."; + +System.out.println( "Creating zipFile instance." ); + +ZipFile zf = new ZipFile( zipFile ); + +System.out.println( "Looking for project-artifact jar zip entry." ); + +ZipEntry je = zf.getEntry( basename + "/" + basename + ".jar" ); + +assert je != null : "project artifact is missing from archive root dir."; -} -catch( IOException e ) -{ - e.printStackTrace( System.out ); - result = false; -} - -return result; diff --git a/src/it/projects/descriptor-refs/jar-with-dependencies/component-descriptors-merged/verify.groovy b/src/it/projects/descriptor-refs/jar-with-dependencies/component-descriptors-merged/verify.groovy index 007eee51..cb975bd3 100644 --- a/src/it/projects/descriptor-refs/jar-with-dependencies/component-descriptors-merged/verify.groovy +++ b/src/it/projects/descriptor-refs/jar-with-dependencies/component-descriptors-merged/verify.groovy @@ -17,8 +17,6 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.jar.*; System.out.println( "Creating JarFile java.io.File." ) diff --git a/src/it/projects/descriptor-refs/jar-with-dependencies/deps-unpacked-to-root-dir/verify.groovy b/src/it/projects/descriptor-refs/jar-with-dependencies/deps-unpacked-to-root-dir/verify.groovy index 6a46552d..15b3cb22 100644 --- a/src/it/projects/descriptor-refs/jar-with-dependencies/deps-unpacked-to-root-dir/verify.groovy +++ b/src/it/projects/descriptor-refs/jar-with-dependencies/deps-unpacked-to-root-dir/verify.groovy @@ -17,11 +17,8 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.jar.*; -boolean result = true; System.out.println( "Creating JarFile java.io.File." ) diff --git a/src/it/projects/descriptor-refs/jar-with-dependencies/no-target-dir/verify.groovy b/src/it/projects/descriptor-refs/jar-with-dependencies/no-target-dir/verify.groovy index 99da4a3f..6a55c3d5 100644 --- a/src/it/projects/descriptor-refs/jar-with-dependencies/no-target-dir/verify.groovy +++ b/src/it/projects/descriptor-refs/jar-with-dependencies/no-target-dir/verify.groovy @@ -17,49 +17,23 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.jar.*; -boolean result = true; -try -{ - System.out.println( "Creating JarFile java.io.File." ); - - File jarFile = new File( basedir, "target/jar-with-dependencies-no-target-dir-1.0-SNAPSHOT-jar-with-dependencies.jar" ); - - System.out.println( "Checking for existence and file-ishness of: " + jarFile ); - - if ( !jarFile.exists() || jarFile.isDirectory() ) - { - System.err.println( "jar file is missing or a directory." ); - return false; - } - - System.out.println( "Creating JarFile instance." ); - - JarFile jf = new JarFile( jarFile ); - - if ( jf.getEntry( "test/App.class" ) == null ) - { - System.err.println( "App class is missing." ); - result = false; - } - - System.out.println( "Looking for absence of 'target/classes/test/App.class' jar entry." ); - - if ( jf.getEntry( "target/classes/test/App.class" ) != null ) - { - System.err.println( "target directory should not be present." ); - result = false; - } - -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +System.out.println( "Creating JarFile java.io.File." ); -return result; +File jarFile = new File( basedir, "target/jar-with-dependencies-no-target-dir-1.0-SNAPSHOT-jar-with-dependencies.jar" ); + +System.out.println( "Checking for existence and file-ishness of: " + jarFile ); + +assert jarFile.exists() && !jarFile.isDirectory() : "jar file is missing or a directory."; + +System.out.println( "Creating JarFile instance." ); + +JarFile jf = new JarFile( jarFile ); + +assert jf.getEntry( "test/App.class" ) != null : "App class is missing."; + +System.out.println( "Looking for absence of 'target/classes/test/App.class' jar entry." ); + +assert jf.getEntry( "target/classes/test/App.class" ) == null : "target directory should not be present."; diff --git a/src/it/projects/descriptor-refs/project/multimodule-sources-copied/verify.groovy b/src/it/projects/descriptor-refs/project/multimodule-sources-copied/verify.groovy index f32b690a..10f8654d 100644 --- a/src/it/projects/descriptor-refs/project/multimodule-sources-copied/verify.groovy +++ b/src/it/projects/descriptor-refs/project/multimodule-sources-copied/verify.groovy @@ -17,118 +17,73 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.zip.*; -boolean result = true; String basename = "multimodule-sources-copied-1.0-SNAPSHOT"; -try -{ - File zipFile = new File( basedir, "target/" + basename + "-project.zip" ); - - System.out.println( "Checking for existence and file-ishness of: " + zipFile ); - - if ( !zipFile.exists() || zipFile.isDirectory() ) - { - System.err.println( "zip file is missing or a directory." ); - return false; - } - - System.out.println( "Creating zipFile instance." ); - - ZipFile zf = new ZipFile( zipFile ); - - String childPath = basename + "/child1"; - - System.out.println( "Checking child1 project files..." ); - - System.out.println( "Looking for project source file." ); - - ZipEntry je = zf.getEntry( childPath + "/src/main/java/test/App.java" ); - - if ( je == null ) - { - System.out.println( childPath + " source file missing." ); - result = false; - } +File zipFile = new File( basedir, "target/" + basename + "-project.zip" ); + +System.out.println( "Checking for existence and file-ishness of: " + zipFile ); + +assert zipFile.exists() && !zipFile.isDirectory() : "zip file is missing or a directory."; + +System.out.println( "Creating zipFile instance." ); + +ZipFile zf = new ZipFile( zipFile ); + +String childPath = basename + "/child1"; + +System.out.println( "Checking child1 project files..." ); + +System.out.println( "Looking for project source file." ); + +ZipEntry je = zf.getEntry( childPath + "/src/main/java/test/App.java" ); + +assert je != null : childPath + " source file missing."; - System.out.println( "Looking for project test-source file." ); - - je = null; - je = zf.getEntry( childPath + "/src/test/java/test/AppTest.java" ); - - if ( je == null ) - { - System.out.println( childPath + " test-source file missing." ); - result = false; - } +System.out.println( "Looking for project test-source file." ); + +je = null; +je = zf.getEntry( childPath + "/src/test/java/test/AppTest.java" ); + +assert je != null : childPath + " test-source file missing."; - System.out.println( "Looking for pom.xml file." ); - - je = null; - je = zf.getEntry( childPath + "/pom.xml" ); - - if ( je == null ) - { - System.out.println( childPath + " POM missing." ); - result = false; - } +System.out.println( "Looking for pom.xml file." ); + +je = null; +je = zf.getEntry( childPath + "/pom.xml" ); + +assert je != null : childPath + " POM missing."; - childPath = basename + "/child2"; - - System.out.println( "Checking child2 project files..." ); - - System.out.println( "Looking for project source file." ); - - je = null; - je = zf.getEntry( childPath + "/src/main/java/test/App.java" ); - - if ( je == null ) - { - System.out.println( childPath + " source file missing." ); - result = false; - } +childPath = basename + "/child2"; + +System.out.println( "Checking child2 project files..." ); + +System.out.println( "Looking for project source file." ); + +je = null; +je = zf.getEntry( childPath + "/src/main/java/test/App.java" ); + +assert je != null : childPath + " source file missing."; - System.out.println( "Looking for project test-source file." ); - - je = null; - je = zf.getEntry( childPath + "/src/test/java/test/AppTest.java" ); - - if ( je == null ) - { - System.out.println( childPath + " test-source file missing." ); - result = false; - } +System.out.println( "Looking for project test-source file." ); + +je = null; +je = zf.getEntry( childPath + "/src/test/java/test/AppTest.java" ); + +assert je != null : childPath + " test-source file missing."; - System.out.println( "Looking for pom.xml file." ); - - je = null; - je = zf.getEntry( childPath + "/pom.xml" ); - - if ( je == null ) - { - System.out.println( childPath + " POM missing." ); - result = false; - } +System.out.println( "Looking for pom.xml file." ); + +je = null; +je = zf.getEntry( childPath + "/pom.xml" ); + +assert je != null : childPath + " POM missing."; - System.out.println( "Looking for main pom.xml file." ); - - je = null; - je = zf.getEntry( basename + "/pom.xml" ); - - if ( je == null ) - { - System.out.println( "project POM missing." ); - result = false; - } -} -catch( IOException e ) -{ - e.printStackTrace( System.out ); - result = false; -} - -return result; +System.out.println( "Looking for main pom.xml file." ); + +je = null; +je = zf.getEntry( basename + "/pom.xml" ); + +assert je != null : "project POM missing."; diff --git a/src/it/projects/descriptor-refs/project/no-target-dir-multimodule/verify.groovy b/src/it/projects/descriptor-refs/project/no-target-dir-multimodule/verify.groovy index b4d76f79..730bb8d1 100644 --- a/src/it/projects/descriptor-refs/project/no-target-dir-multimodule/verify.groovy +++ b/src/it/projects/descriptor-refs/project/no-target-dir-multimodule/verify.groovy @@ -17,136 +17,83 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.zip.*; -boolean result = true; String basename = "multimodule-sources-copied-1.0-SNAPSHOT"; -try -{ - File zipFile = new File( basedir, "target/" + basename + "-project.zip" ); - - System.out.println( "Checking for existence and file-ishness of: " + zipFile ); - - if ( !zipFile.exists() || zipFile.isDirectory() ) - { - System.err.println( "zip file is missing or a directory." ); - return false; - } - - System.out.println( "Creating zipFile instance." ); - - ZipFile zf = new ZipFile( zipFile ); - - String childPath = basename + "/child1"; - - System.out.println( "Checking child1 project files..." ); - - System.out.println( "Looking for project source file." ); - - ZipEntry je = zf.getEntry( childPath + "/src/main/java/test/App.java" ); - - if ( je == null ) - { - System.out.println( childPath + " source file missing." ); - result = false; - } +File zipFile = new File( basedir, "target/" + basename + "-project.zip" ); + +System.out.println( "Checking for existence and file-ishness of: " + zipFile ); + +assert zipFile.exists() && !zipFile.isDirectory() : "zip file is missing or a directory."; + +System.out.println( "Creating zipFile instance." ); + +ZipFile zf = new ZipFile( zipFile ); + +String childPath = basename + "/child1"; + +System.out.println( "Checking child1 project files..." ); + +System.out.println( "Looking for project source file." ); + +ZipEntry je = zf.getEntry( childPath + "/src/main/java/test/App.java" ); + +assert je != null : childPath + " source file missing."; - System.out.println( "Looking for project test-source file." ); - - je = null; - je = zf.getEntry( childPath + "/src/test/java/test/AppTest.java" ); - - if ( je == null ) - { - System.out.println( childPath + " test-source file missing." ); - result = false; - } +System.out.println( "Looking for project test-source file." ); + +je = null; +je = zf.getEntry( childPath + "/src/test/java/test/AppTest.java" ); + +assert je != null : childPath + " test-source file missing."; - System.out.println( "Looking for pom.xml file." ); - - je = null; - je = zf.getEntry( childPath + "/pom.xml" ); - - if ( je == null ) - { - System.out.println( childPath + " POM missing." ); - result = false; - } +System.out.println( "Looking for pom.xml file." ); + +je = null; +je = zf.getEntry( childPath + "/pom.xml" ); + +assert je != null : childPath + " POM missing."; - je = null; - je = zf.getEntry( childPath + "/target/child1-1.0-SNAPSHOT.jar" ); - - if ( je != null ) - { - System.out.println( childPath + " target directory should not be included." ); - result = false; - } +je = null; +je = zf.getEntry( childPath + "/target/child1-1.0-SNAPSHOT.jar" ); + +assert je == null : childPath + " target directory should not be included."; - childPath = basename + "/child2"; - - System.out.println( "Checking child2 project files..." ); - - System.out.println( "Looking for project source file." ); - - je = null; - je = zf.getEntry( childPath + "/src/main/java/test/App.java" ); - - if ( je == null ) - { - System.out.println( childPath + " source file missing." ); - result = false; - } +childPath = basename + "/child2"; + +System.out.println( "Checking child2 project files..." ); + +System.out.println( "Looking for project source file." ); + +je = null; +je = zf.getEntry( childPath + "/src/main/java/test/App.java" ); + +assert je != null : childPath + " source file missing."; - System.out.println( "Looking for project test-source file." ); - - je = null; - je = zf.getEntry( childPath + "/src/test/java/test/AppTest.java" ); - - if ( je == null ) - { - System.out.println( childPath + " test-source file missing." ); - result = false; - } +System.out.println( "Looking for project test-source file." ); + +je = null; +je = zf.getEntry( childPath + "/src/test/java/test/AppTest.java" ); + +assert je != null : childPath + " test-source file missing."; - System.out.println( "Looking for pom.xml file." ); - - je = null; - je = zf.getEntry( childPath + "/pom.xml" ); - - if ( je == null ) - { - System.out.println( childPath + " POM missing." ); - result = false; - } +System.out.println( "Looking for pom.xml file." ); + +je = null; +je = zf.getEntry( childPath + "/pom.xml" ); + +assert je != null : childPath + " POM missing."; - je = null; - je = zf.getEntry( childPath + "/target/child2-1.0-SNAPSHOT.jar" ); - - if ( je != null ) - { - System.out.println( childPath + " target directory should not be included." ); - result = false; - } +je = null; +je = zf.getEntry( childPath + "/target/child2-1.0-SNAPSHOT.jar" ); + +assert je == null : childPath + " target directory should not be included."; - System.out.println( "Looking for main pom.xml file." ); - - je = null; - je = zf.getEntry( basename + "/pom.xml" ); - - if ( je == null ) - { - System.out.println( "project POM missing." ); - result = false; - } -} -catch( IOException e ) -{ - e.printStackTrace( System.out ); - result = false; -} - -return result; +System.out.println( "Looking for main pom.xml file." ); + +je = null; +je = zf.getEntry( basename + "/pom.xml" ); + +assert je != null : "project POM missing."; diff --git a/src/it/projects/descriptor-refs/project/no-target-dir/verify.groovy b/src/it/projects/descriptor-refs/project/no-target-dir/verify.groovy index 4a5d537a..a6fda104 100644 --- a/src/it/projects/descriptor-refs/project/no-target-dir/verify.groovy +++ b/src/it/projects/descriptor-refs/project/no-target-dir/verify.groovy @@ -17,44 +17,23 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.zip.*; -boolean result = true; String basename = "no-target-dir-1.0-SNAPSHOT"; -try -{ - File zipFile = new File( basedir, "target/" + basename + "-project.zip" ); - - System.out.println( "Checking for existence and file-ishness of: " + zipFile ); - - if ( !zipFile.exists() || zipFile.isDirectory() ) - { - System.err.println( "zip file is missing or a directory." ); - return false; - } - - System.out.println( "Creating zipFile instance." ); - - ZipFile zf = new ZipFile( zipFile ); - - System.out.println( "Looking for project classes." ); - - ZipEntry je = zf.getEntry( basename + "/target/classes/test/App.java" ); - - if ( je != null ) - { - System.out.println( "project classes should not be included." ); - result = false; - } -} -catch( IOException e ) -{ - e.printStackTrace( System.out ); - result = false; -} - -return result; +File zipFile = new File( basedir, "target/" + basename + "-project.zip" ); + +System.out.println( "Checking for existence and file-ishness of: " + zipFile ); + +assert zipFile.exists() && !zipFile.isDirectory() : "zip file is missing or a directory."; + +System.out.println( "Creating zipFile instance." ); + +ZipFile zf = new ZipFile( zipFile ); + +System.out.println( "Looking for project classes." ); + +ZipEntry je = zf.getEntry( basename + "/target/classes/test/App.java" ); + +assert je == null : "project classes should not be included."; diff --git a/src/it/projects/descriptor-refs/project/sources-copied/verify.groovy b/src/it/projects/descriptor-refs/project/sources-copied/verify.groovy index a2ad7a6c..0e439af9 100644 --- a/src/it/projects/descriptor-refs/project/sources-copied/verify.groovy +++ b/src/it/projects/descriptor-refs/project/sources-copied/verify.groovy @@ -17,67 +17,38 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.zip.*; -boolean result = true; String basename = "sources-copied-1.0-SNAPSHOT"; -try -{ - File zipFile = new File( basedir, "target/" + basename + "-project.zip" ); - - System.out.println( "Checking for existence and file-ishness of: " + zipFile ); - - if ( !zipFile.exists() || zipFile.isDirectory() ) - { - System.err.println( "zip file is missing or a directory." ); - return false; - } - - System.out.println( "Creating zipFile instance." ); - - ZipFile zf = new ZipFile( zipFile ); - - System.out.println( "Looking for project source file." ); - - ZipEntry je = zf.getEntry( basename + "/src/main/java/test/App.java" ); +File zipFile = new File( basedir, "target/" + basename + "-project.zip" ); - if ( je == null ) - { - System.out.println( "project source file missing." ); - result = false; - } - - System.out.println( "Looking for project test-source file." ); - - je = null; - je = zf.getEntry( basename + "/src/test/java/test/AppTest.java" ); +System.out.println( "Checking for existence and file-ishness of: " + zipFile ); + +assert zipFile.exists() && !zipFile.isDirectory() : "zip file is missing or a directory."; + +System.out.println( "Creating zipFile instance." ); + +ZipFile zf = new ZipFile( zipFile ); + +System.out.println( "Looking for project source file." ); - if ( je == null ) - { - System.out.println( "project test-source file missing." ); - result = false; - } +ZipEntry je = zf.getEntry( basename + "/src/main/java/test/App.java" ); + +assert je != null : "project source file missing."; - System.out.println( "Looking for pom.xml file." ); - - je = null; - je = zf.getEntry( basename + "/pom.xml" ); +System.out.println( "Looking for project test-source file." ); + +je = null; +je = zf.getEntry( basename + "/src/test/java/test/AppTest.java" ); - if ( je == null ) - { - System.out.println( "project POM missing." ); - result = false; - } +assert je != null : "project test-source file missing."; -} -catch( IOException e ) -{ - e.printStackTrace( System.out ); - result = false; -} +System.out.println( "Looking for pom.xml file." ); -return result; +je = null; +je = zf.getEntry( basename + "/pom.xml" ); + +assert je != null : "project POM missing."; + diff --git a/src/it/projects/descriptor-refs/src/no-target-dir/verify.groovy b/src/it/projects/descriptor-refs/src/no-target-dir/verify.groovy index fa08ffe9..1f5ce085 100644 --- a/src/it/projects/descriptor-refs/src/no-target-dir/verify.groovy +++ b/src/it/projects/descriptor-refs/src/no-target-dir/verify.groovy @@ -17,44 +17,23 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.zip.*; -boolean result = true; String basename = "no-target-dir-1.0-SNAPSHOT"; -try -{ - File zipFile = new File( basedir, "target/" + basename + "-src.zip" ); - - System.out.println( "Checking for existence and file-ishness of: " + zipFile ); - - if ( !zipFile.exists() || zipFile.isDirectory() ) - { - System.err.println( "zip file is missing or a directory." ); - return false; - } - - System.out.println( "Creating zipFile instance." ); - - ZipFile zf = new ZipFile( zipFile ); - - System.out.println( "Looking for project classes." ); - - ZipEntry je = zf.getEntry( basename + "/target/classes/test/App.class" ); - - if ( je != null ) - { - System.out.println( "project classes should not be present." ); - result = false; - } -} -catch( IOException e ) -{ - e.printStackTrace( System.out ); - result = false; -} - -return result; +File zipFile = new File( basedir, "target/" + basename + "-src.zip" ); + +System.out.println( "Checking for existence and file-ishness of: " + zipFile ); + +assert zipFile.exists() && !zipFile.isDirectory() : "zip file is missing or a directory."; + +System.out.println( "Creating zipFile instance." ); + +ZipFile zf = new ZipFile( zipFile ); + +System.out.println( "Looking for project classes." ); + +ZipEntry je = zf.getEntry( basename + "/target/classes/test/App.class" ); + +assert je == null : "project classes should not be present."; diff --git a/src/it/projects/descriptor-refs/src/src-dir-copied/verify.groovy b/src/it/projects/descriptor-refs/src/src-dir-copied/verify.groovy index f148edb6..cf043137 100644 --- a/src/it/projects/descriptor-refs/src/src-dir-copied/verify.groovy +++ b/src/it/projects/descriptor-refs/src/src-dir-copied/verify.groovy @@ -17,56 +17,31 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.zip.*; -boolean result = true; String basename = "src-dir-copied-1.0-SNAPSHOT"; -try -{ - File zipFile = new File( basedir, "target/" + basename + "-src.zip" ); - - System.out.println( "Checking for existence and file-ishness of: " + zipFile ); - - if ( !zipFile.exists() || zipFile.isDirectory() ) - { - System.err.println( "zip file is missing or a directory." ); - return false; - } - - System.out.println( "Creating zipFile instance." ); - - ZipFile zf = new ZipFile( zipFile ); - - System.out.println( "Looking for project source file." ); - - ZipEntry je = zf.getEntry( basename + "/src/main/java/test/App.java" ); +File zipFile = new File( basedir, "target/" + basename + "-src.zip" ); - if ( je == null ) - { - System.out.println( "project source file missing." ); - result = false; - } - - System.out.println( "Looking for project test-source file." ); - - je = null; - je = zf.getEntry( basename + "/src/test/java/test/AppTest.java" ); +System.out.println( "Checking for existence and file-ishness of: " + zipFile ); + +assert zipFile.exists() && !zipFile.isDirectory() : "zip file is missing or a directory."; + +System.out.println( "Creating zipFile instance." ); + +ZipFile zf = new ZipFile( zipFile ); - if ( je == null ) - { - System.out.println( "project test-source file missing." ); - result = false; - } +System.out.println( "Looking for project source file." ); + +ZipEntry je = zf.getEntry( basename + "/src/main/java/test/App.java" ); + +assert je != null : "project source file missing."; -} -catch( IOException e ) -{ - e.printStackTrace( System.out ); - result = false; -} +System.out.println( "Looking for project test-source file." ); -return result; +je = null; +je = zf.getEntry( basename + "/src/test/java/test/AppTest.java" ); + +assert je != null : "project test-source file missing."; + diff --git a/src/it/projects/file-sets/excludes-using-regex/verify.groovy b/src/it/projects/file-sets/excludes-using-regex/verify.groovy index c606d16e..99c39769 100644 --- a/src/it/projects/file-sets/excludes-using-regex/verify.groovy +++ b/src/it/projects/file-sets/excludes-using-regex/verify.groovy @@ -17,74 +17,33 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.jar.*; -boolean result = true; -try -{ - File f = new File( basedir, "target/parent-1.0-src.jar" ); - if ( !f.exists() ) - { - System.out.println( "jar is missing" ); - return false; - } +File f = new File( basedir, "target/parent-1.0-src.jar" ); +assert f.exists() : "jar is missing"; - JarFile jf = new JarFile( f ); - JarEntry je = jf.getEntry( "parent-1.0/src/main/java/org/test/target/file.properties" ); +JarFile jf = new JarFile( f ); +JarEntry je = jf.getEntry( "parent-1.0/src/main/java/org/test/target/file.properties" ); - if ( je == null ) - { - System.out.println( "sources for org.test.target package in parent project are missing from jar" ); - return false; - } +assert je != null : "sources for org.test.target package in parent project are missing from jar"; - je = jf.getEntry( "parent-1.0/child/src/main/resources/target/file.txt" ); +je = jf.getEntry( "parent-1.0/child/src/main/resources/target/file.txt" ); - if ( je == null ) - { - System.out.println( "target/file.txt in child resources is missing from the jar." ); - return false; - } +assert je != null : "target/file.txt in child resources is missing from the jar."; - je = jf.getEntry( "parent-1.0/target/omit.txt" ); +je = jf.getEntry( "parent-1.0/target/omit.txt" ); - if ( je != null ) - { - System.out.println( "target/omit.txt in parent project was included the jar." ); - return false; - } +assert je == null : "target/omit.txt in parent project was included the jar."; - je = jf.getEntry( "parent-1.0/child/target/omit.txt" ); +je = jf.getEntry( "parent-1.0/child/target/omit.txt" ); - if ( je != null ) - { - System.out.println( "target/omit.txt in child project was included the jar." ); - return false; - } +assert je == null : "target/omit.txt in child project was included the jar."; - je = jf.getEntry( "parent-1.0/target/classes/src/omit.txt" ); +je = jf.getEntry( "parent-1.0/target/classes/src/omit.txt" ); - if ( je != null ) - { - System.out.println( "target/classes/src/omit.txt in parent project was included the jar." ); - return false; - } +assert je == null : "target/classes/src/omit.txt in parent project was included the jar."; - je = jf.getEntry( "parent-1.0/child/target/classes/src/omit.txt" ); +je = jf.getEntry( "parent-1.0/child/target/classes/src/omit.txt" ); - if ( je != null ) - { - System.out.println( "target/classes/src/omit.txt in child project was included the jar." ); - return false; - } -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; +assert je == null : "target/classes/src/omit.txt in child project was included the jar."; diff --git a/src/it/projects/file-sets/filtered-module-sources/verify.groovy b/src/it/projects/file-sets/filtered-module-sources/verify.groovy index 72898917..73f82e0c 100644 --- a/src/it/projects/file-sets/filtered-module-sources/verify.groovy +++ b/src/it/projects/file-sets/filtered-module-sources/verify.groovy @@ -17,22 +17,10 @@ * under the License. */ -import java.io.*; - File f = new File( basedir, "target/parent-1-src/child/test.txt" ); -if ( !f.exists() ) -{ - System.out.println( "Filtered file from file-set: " + f + " is missing." ); - return false; -} - -String line = null; - -BufferedReader reader = new BufferedReader( new FileReader( f ) ); -line = reader.readLine(); -reader.close(); +assert f.exists() : "Filtered file from file-set: " + f + " is missing."; -System.out.println( "First line of test.txt: '" + line + "' should equal the project version: '1'." ); +String line = f.withReader( "UTF-8" ) { it.readLine() }; -return "1".equals( line.trim() ); +assert "1".equals( line.trim() ) : "First line of test.txt: '" + line + "' should equal the project version: '1'."; diff --git a/src/it/projects/file-sets/filtered-multimodule/verify.groovy b/src/it/projects/file-sets/filtered-multimodule/verify.groovy index 7a100ed2..336d2e09 100644 --- a/src/it/projects/file-sets/filtered-multimodule/verify.groovy +++ b/src/it/projects/file-sets/filtered-multimodule/verify.groovy @@ -17,22 +17,10 @@ * under the License. */ -import java.io.*; - File f = new File( basedir, "child/target/child-1-src/test.txt" ); -if ( !f.exists() ) -{ - System.out.println( "Filtered file from file-set: " + f + " is missing." ); - return false; -} - -String line = null; - -BufferedReader reader = new BufferedReader( new FileReader( f ) ); -line = reader.readLine(); -reader.close(); +assert f.exists() : "Filtered file from file-set: " + f + " is missing."; -System.out.println( "First line of test.txt: '" + line + "' should equal the project version: '1'." ); +String line = f.withReader( "UTF-8" ) { it.readLine() }; -return "1".equals( line.trim() ); +assert "1".equals( line.trim() ) : "First line of test.txt: '" + line + "' should equal the project version: '1'."; diff --git a/src/it/projects/file-sets/include-parent-dir/verify.groovy b/src/it/projects/file-sets/include-parent-dir/verify.groovy index fe42f246..5656f10b 100644 --- a/src/it/projects/file-sets/include-parent-dir/verify.groovy +++ b/src/it/projects/file-sets/include-parent-dir/verify.groovy @@ -17,6 +17,4 @@ * under the License. */ -import java.io.*; - -return new File( basedir, "child/target/child-1.0-SNAPSHOT-parent/child/pom.xml" ).exists(); +assert new File( basedir, "child/target/child-1.0-SNAPSHOT-parent/child/pom.xml" ).exists(); diff --git a/src/it/projects/file-sets/massembly-665/verify.groovy b/src/it/projects/file-sets/massembly-665/verify.groovy index b189bf65..fc69ac9e 100644 --- a/src/it/projects/file-sets/massembly-665/verify.groovy +++ b/src/it/projects/file-sets/massembly-665/verify.groovy @@ -17,21 +17,5 @@ * under the License. */ -import java.io.*; -import java.net.*; -import java.util.jar.*; - -boolean result = true; - -try -{ - result = new File( basedir, "target/massembly-665-1.0-SNAPSHOT-src/bin/aFile.txt" ).exists() && - !new File( basedir, "target/massembly-665-1.0-SNAPSHOT-src/conf/aFile.txt" ).exists(); -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; +assert new File( basedir, "target/massembly-665-1.0-SNAPSHOT-src/bin/aFile.txt" ).exists() +assert !new File( basedir, "target/massembly-665-1.0-SNAPSHOT-src/conf/aFile.txt" ).exists() diff --git a/src/it/projects/files/multimodule-relativePath/verify.groovy b/src/it/projects/files/multimodule-relativePath/verify.groovy index feec5749..ae0447d6 100644 --- a/src/it/projects/files/multimodule-relativePath/verify.groovy +++ b/src/it/projects/files/multimodule-relativePath/verify.groovy @@ -17,14 +17,6 @@ * under the License. */ -import java.io.*; - File a = new File( basedir, "child/target/child-1.0-bin/a/file.txt"); -if ( !a.exists() || !a.isFile() ) -{ - System.out.println( "Missing test file: " + a ); - return false; -} - -return true; +assert a.exists() && a.isFile() : "Missing test file: " + a; diff --git a/src/it/projects/filtering-feature/filtersDefinedInAssemblyPluginConfig/verify.groovy b/src/it/projects/filtering-feature/filtersDefinedInAssemblyPluginConfig/verify.groovy index 2f0d936f..3f2e0a09 100644 --- a/src/it/projects/filtering-feature/filtersDefinedInAssemblyPluginConfig/verify.groovy +++ b/src/it/projects/filtering-feature/filtersDefinedInAssemblyPluginConfig/verify.groovy @@ -17,33 +17,7 @@ * under the License. */ -import java.io.*; -import java.net.*; -import java.util.jar.*; - -boolean result = true; - -try -{ - File file = new File( basedir, "target/parent-1.0-filtered-assembly/file.txt"); - if(result) { - BufferedReader r = new BufferedReader(new FileReader(file)); - String s = r.readLine(); - result = s.equals("foo"); - if(result) { - s = r.readLine(); - if(!s.contains("\\")) - { - System.out.println("file.txt escaped filtering"); - return false; - } - } - } -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; +File file = new File( basedir, "target/parent-1.0-filtered-assembly/file.txt"); +List lines = file.readLines( "UTF-8" ); +assert lines[0].equals( "foo" ); +assert lines[1].contains( "\\" ) : "file.txt escaped filtering"; diff --git a/src/it/projects/forking-tests/assembly-assembly-with-module-binaries/verify.groovy b/src/it/projects/forking-tests/assembly-assembly-with-module-binaries/verify.groovy index 9e140c0c..448668f7 100644 --- a/src/it/projects/forking-tests/assembly-assembly-with-module-binaries/verify.groovy +++ b/src/it/projects/forking-tests/assembly-assembly-with-module-binaries/verify.groovy @@ -17,41 +17,15 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.zip.*; -boolean result = true; -try -{ - File zipFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.zip" ); - - if ( !zipFile.exists() || zipFile.isDirectory() ) - { - System.err.println( "zip-file is missing or a directory." ); - result = false; - } - - ZipFile zf = new ZipFile( zipFile ); - - if ( zf.getEntry( "child2-1.0-SNAPSHOT/modules/child1.jar" ) == null ) - { - System.err.println( "child1 entry is missing." ); - result = false; - } - - if ( zf.getEntry( "child2-1.0-SNAPSHOT/modules/child2.jar" ) == null ) - { - System.err.println( "child2 entry is missing." ); - result = false; - } - -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +File zipFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.zip" ); -return result; +assert zipFile.exists() && !zipFile.isDirectory() : "zip-file is missing or a directory."; + +ZipFile zf = new ZipFile( zipFile ); + +assert zf.getEntry( "child2-1.0-SNAPSHOT/modules/child1.jar" ) != null : "child1 entry is missing."; + +assert zf.getEntry( "child2-1.0-SNAPSHOT/modules/child2.jar" ) != null : "child2 entry is missing."; diff --git a/src/it/projects/forking-tests/assembly-attached-with-module-binaries/verify.groovy b/src/it/projects/forking-tests/assembly-attached-with-module-binaries/verify.groovy index 9e140c0c..448668f7 100644 --- a/src/it/projects/forking-tests/assembly-attached-with-module-binaries/verify.groovy +++ b/src/it/projects/forking-tests/assembly-attached-with-module-binaries/verify.groovy @@ -17,41 +17,15 @@ * under the License. */ -import java.io.*; -import java.net.*; import java.util.zip.*; -boolean result = true; -try -{ - File zipFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.zip" ); - - if ( !zipFile.exists() || zipFile.isDirectory() ) - { - System.err.println( "zip-file is missing or a directory." ); - result = false; - } - - ZipFile zf = new ZipFile( zipFile ); - - if ( zf.getEntry( "child2-1.0-SNAPSHOT/modules/child1.jar" ) == null ) - { - System.err.println( "child1 entry is missing." ); - result = false; - } - - if ( zf.getEntry( "child2-1.0-SNAPSHOT/modules/child2.jar" ) == null ) - { - System.err.println( "child2 entry is missing." ); - result = false; - } - -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} +File zipFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin.zip" ); -return result; +assert zipFile.exists() && !zipFile.isDirectory() : "zip-file is missing or a directory."; + +ZipFile zf = new ZipFile( zipFile ); + +assert zf.getEntry( "child2-1.0-SNAPSHOT/modules/child1.jar" ) != null : "child1 entry is missing."; + +assert zf.getEntry( "child2-1.0-SNAPSHOT/modules/child2.jar" ) != null : "child2 entry is missing."; diff --git a/src/it/projects/mojo-configuration/archiver-ignorePermissions/verify.groovy b/src/it/projects/mojo-configuration/archiver-ignorePermissions/verify.groovy index 228b0fa2..7c4ac6b5 100644 --- a/src/it/projects/mojo-configuration/archiver-ignorePermissions/verify.groovy +++ b/src/it/projects/mojo-configuration/archiver-ignorePermissions/verify.groovy @@ -17,25 +17,10 @@ * under the License. */ -import java.io.*; -import java.util.jar.*; -import java.util.*; -import java.net.*; - // minimal tests; the big thing here is that ignoring permissions doesn't stop the assembly from running... File pom = new File( basedir, "target/parent-1-bin/parent-1/pom.xml" ); -if ( !pom.exists() || !pom.isFile() ) -{ - System.out.println( "POM was not included in assembly." ); - return false; -} +assert pom.exists() && pom.isFile() : "POM was not included in assembly."; File junitJar = new File( basedir, "target/parent-1-bin/parent-1/lib/junit-jupiter-api-" + scriptVarVersionJunit + ".jar" ); -if ( !junitJar.exists() && !junitJar.isFile() ) -{ - System.out.println( "JUnit jar was not included in assembly." ); - return false; -} - -return true; +assert junitJar.exists() || junitJar.isFile() : "JUnit jar was not included in assembly."; diff --git a/src/it/projects/mojo-configuration/ignoreDirFormatExtensions/verify.groovy b/src/it/projects/mojo-configuration/ignoreDirFormatExtensions/verify.groovy index 625474af..52710e1a 100644 --- a/src/it/projects/mojo-configuration/ignoreDirFormatExtensions/verify.groovy +++ b/src/it/projects/mojo-configuration/ignoreDirFormatExtensions/verify.groovy @@ -17,27 +17,9 @@ * under the License. */ -import java.io.*; - File src = new File( basedir, "target/ignoreDirFormatExtensions-1-src/pom.xml" ); File src2 = new File( basedir, "target/ignoreDirFormatExtensions-1-src2.dir/pom.xml" ); -{ - File f = src; - - if ( !f.exists() ) - { - System.out.println( "Project assembly directory is missing. Check-file was: " + f ); - } -} - -{ - File f = src2; - - if ( !f.exists() ) - { - System.out.println( "Project assembly directory is missing. Check-file was: " + f ); - } -} +assert src.exists() : "Project assembly directory is missing. Check-file was: " + src; -return src.exists() && src2.exists(); +assert src2.exists() : "Project assembly directory is missing. Check-file was: " + src2; diff --git a/src/it/projects/mojo-configuration/manifest-with-customEntry-manifest-file/verify.groovy b/src/it/projects/mojo-configuration/manifest-with-customEntry-manifest-file/verify.groovy index 8d76d6eb..c42ab1fa 100644 --- a/src/it/projects/mojo-configuration/manifest-with-customEntry-manifest-file/verify.groovy +++ b/src/it/projects/mojo-configuration/manifest-with-customEntry-manifest-file/verify.groovy @@ -17,10 +17,7 @@ * under the License. */ -import java.io.*; import java.util.jar.*; -import java.util.*; -import java.net.*; File file = new File( basedir, "target/manifest-with-customEntry-manifest-file-1-webbundle.jar" ); @@ -34,4 +31,4 @@ Attributes attrs = mf.getMainAttributes(); String foo = (String) attrs.get( new Attributes.Name( "foo" ) ); -return "beer".equals( foo ); +assert "beer".equals( foo ); diff --git a/src/it/projects/mojo-configuration/manifest-with-customEntry/verify.groovy b/src/it/projects/mojo-configuration/manifest-with-customEntry/verify.groovy index 5c50c1c9..552b3a15 100644 --- a/src/it/projects/mojo-configuration/manifest-with-customEntry/verify.groovy +++ b/src/it/projects/mojo-configuration/manifest-with-customEntry/verify.groovy @@ -17,10 +17,7 @@ * under the License. */ -import java.io.*; import java.util.jar.*; -import java.util.*; -import java.net.*; File file = new File( basedir, "target/manifest-with-customEntry-1-jar-with-dependencies.jar" ); @@ -43,5 +40,3 @@ String mainClass = (String) attrs.get( Attributes.Name.MAIN_CLASS ); System.out.println( "Got Main-Class: " + mainClass ); assert "test.App".equals( mainClass ) : "Manifest Main-Class: " + mainClass; - -return true; diff --git a/src/it/projects/mojo-configuration/massembly-291/verify.groovy b/src/it/projects/mojo-configuration/massembly-291/verify.groovy index f546db04..56424717 100644 --- a/src/it/projects/mojo-configuration/massembly-291/verify.groovy +++ b/src/it/projects/mojo-configuration/massembly-291/verify.groovy @@ -22,34 +22,8 @@ File pom = new File( basedir, base + ".pom" ); File zip = new File( basedir, base + ".zip" ); File tgz = new File( basedir, base + ".tar.gz" ); -{ - File f = pom; - String type = "POM"; +assert pom.exists() : "Project POM is missing in deployment repository. File was: " + pom; - if ( !f.exists() ) - { - System.out.println( "Project " + type + " is missing in deployment repository. File was: " + f ); - } -} +assert zip.exists() : "Project sources zip is missing in deployment repository. File was: " + zip; -{ - File f = zip; - String type = "sources zip"; - - if ( !f.exists() ) - { - System.out.println( "Project " + type + " is missing in deployment repository. File was: " + f ); - } -} - -{ - File f = tgz; - String type = "sources tar.gz"; - - if ( !f.exists() ) - { - System.out.println( "Project " + type + " is missing in deployment repository. File was: " + f ); - } -} - -return pom.exists() && zip.exists() && tgz.exists(); +assert tgz.exists() : "Project sources tar.gz is missing in deployment repository. File was: " + tgz; diff --git a/src/it/projects/mojo-configuration/massembly-301/verify.groovy b/src/it/projects/mojo-configuration/massembly-301/verify.groovy index 450f2a77..6499ac17 100644 --- a/src/it/projects/mojo-configuration/massembly-301/verify.groovy +++ b/src/it/projects/mojo-configuration/massembly-301/verify.groovy @@ -23,34 +23,8 @@ File jar = new File( basedir, base + ".jar" ); File zip = new File( basedir, base + ".zip" ); File tgz = new File( basedir, base + ".tar.gz" ); -{ - File f = jar; - String type = "main jar"; +assert jar.exists() : "Project main jar is missing in deployment repository. File was: " + jar; - if ( !f.exists() ) - { - System.out.println( "Project " + type + " is missing in deployment repository. File was: " + f ); - } -} +assert zip.exists() : "Project sources zip is missing in deployment repository. File was: " + zip; -{ - File f = zip; - String type = "sources zip"; - - if ( !f.exists() ) - { - System.out.println( "Project " + type + " is missing in deployment repository. File was: " + f ); - } -} - -{ - File f = tgz; - String type = "sources tar.gz"; - - if ( !f.exists() ) - { - System.out.println( "Project " + type + " is missing in deployment repository. File was: " + f ); - } -} - -return jar.exists() && zip.exists() && tgz.exists(); +assert tgz.exists() : "Project sources tar.gz is missing in deployment repository. File was: " + tgz; diff --git a/src/it/projects/mojo-configuration/no-appendAssemblyId-no-classifier/verify.groovy b/src/it/projects/mojo-configuration/no-appendAssemblyId-no-classifier/verify.groovy index 5fcbd9d4..673469de 100644 --- a/src/it/projects/mojo-configuration/no-appendAssemblyId-no-classifier/verify.groovy +++ b/src/it/projects/mojo-configuration/no-appendAssemblyId-no-classifier/verify.groovy @@ -17,10 +17,7 @@ * under the License. */ -import java.io.*; import java.util.jar.*; -import java.util.*; -import java.net.*; File file = new File( basedir, "target/no-appendAssemblyId-no-classifier-1.jar" ); @@ -30,4 +27,4 @@ JarFile jarFile = new JarFile( file ); JarEntry entry = jarFile.getEntry( "org/apache/maven/plugins/assembly/mojos/AbstractAssemblyMojo.class" ); -return entry != null; +assert entry != null; diff --git a/src/it/projects/mojo-configuration/skipAssemblyCLIPropertySet/verify.groovy b/src/it/projects/mojo-configuration/skipAssemblyCLIPropertySet/verify.groovy index 831a7f99..1c350287 100644 --- a/src/it/projects/mojo-configuration/skipAssemblyCLIPropertySet/verify.groovy +++ b/src/it/projects/mojo-configuration/skipAssemblyCLIPropertySet/verify.groovy @@ -17,11 +17,6 @@ * under the License. */ -import java.io.*; -import java.util.jar.*; -import java.util.*; -import java.net.*; - File file = new File( basedir, "target/skipAssemblyCLIPropertySet-1.zip" ); -return !file.exists(); +assert !file.exists(); diff --git a/src/it/projects/mojo-tests/single-in-one-project-hierarchy/verify.groovy b/src/it/projects/mojo-tests/single-in-one-project-hierarchy/verify.groovy index 0ec5c89a..6e550487 100644 --- a/src/it/projects/mojo-tests/single-in-one-project-hierarchy/verify.groovy +++ b/src/it/projects/mojo-tests/single-in-one-project-hierarchy/verify.groovy @@ -19,4 +19,4 @@ import java.io.File; -return new File( basedir, "target/single-in-one-project-hierarchy-1.0-SNAPSHOT-bin/lib/junit-jupiter-api.jar" ).exists(); +assert new File( basedir, "target/single-in-one-project-hierarchy-1.0-SNAPSHOT-bin/lib/junit-jupiter-api.jar" ).exists(); diff --git a/src/it/projects/mojo-tests/single-twice-in-multimodule-hierarchy/verify.groovy b/src/it/projects/mojo-tests/single-twice-in-multimodule-hierarchy/verify.groovy index 9538a9c2..e194d0c5 100644 --- a/src/it/projects/mojo-tests/single-twice-in-multimodule-hierarchy/verify.groovy +++ b/src/it/projects/mojo-tests/single-twice-in-multimodule-hierarchy/verify.groovy @@ -19,9 +19,6 @@ import java.io.File; -boolean result = true; -result = result && new File( basedir, "child1/target/child1-1.0-SNAPSHOT-bin/lib/junit-jupiter-api.jar" ).exists(); -result = result && new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin/lib/junit-jupiter-api.jar" ).exists(); - -return result; +assert new File( basedir, "child1/target/child1-1.0-SNAPSHOT-bin/lib/junit-jupiter-api.jar" ).exists(); +assert new File( basedir, "child2/target/child2-1.0-SNAPSHOT-bin/lib/junit-jupiter-api.jar" ).exists(); diff --git a/src/it/projects/mojo-tests/single-twice-in-one-project-hierarchy/verify.groovy b/src/it/projects/mojo-tests/single-twice-in-one-project-hierarchy/verify.groovy index c3d04375..a9c829a6 100644 --- a/src/it/projects/mojo-tests/single-twice-in-one-project-hierarchy/verify.groovy +++ b/src/it/projects/mojo-tests/single-twice-in-one-project-hierarchy/verify.groovy @@ -19,9 +19,6 @@ import java.io.File; -boolean result = true; -result = result && new File( basedir, "target/first-bin/lib/junit-jupiter-api.jar" ).exists(); -result = result && new File( basedir, "target/second-bin/lib/junit-jupiter-api.jar" ).exists(); - -return result; +assert new File( basedir, "target/first-bin/lib/junit-jupiter-api.jar" ).exists(); +assert new File( basedir, "target/second-bin/lib/junit-jupiter-api.jar" ).exists(); diff --git a/src/it/projects/multimodule/massembly-298/verify.groovy b/src/it/projects/multimodule/massembly-298/verify.groovy index cdf81abb..a93d70bc 100644 --- a/src/it/projects/multimodule/massembly-298/verify.groovy +++ b/src/it/projects/multimodule/massembly-298/verify.groovy @@ -17,41 +17,22 @@ * under the License. */ -import java.io.*; import java.util.zip.*; ZipFile zf = new ZipFile( new File( basedir, "assembly/target/assembly-1-bin.zip" ) ); ZipEntry child1InclEntry = zf.getEntry( "child1/org/test/child1/App2.class" ); -if ( child1InclEntry == null ) -{ - System.out.println( "Included file from child1 not found." ); - return false; -} +assert child1InclEntry != null : "Included file from child1 not found."; ZipEntry child1ExclEntry = zf.getEntry( "child1/org/test/child1/App.class" ); -if ( child1ExclEntry != null ) -{ - System.out.println( "Non-included file from child1 should not be present, but was found." ); - return false; -} +assert child1ExclEntry == null : "Non-included file from child1 should not be present, but was found."; ZipEntry child2InclEntry = zf.getEntry( "child2/org/test/child2/App.class" ); -if ( child2InclEntry == null ) -{ - System.out.println( "Included file from child2 not found." ); - return false; -} +assert child2InclEntry != null : "Included file from child2 not found."; ZipEntry child2ExclEntry = zf.getEntry( "child2/org/test/other/App.class" ); -if ( child2ExclEntry != null ) -{ - System.out.println( "Non-included file from child2 should not be present, but was found." ); - return false; -} - -return true; +assert child2ExclEntry == null : "Non-included file from child2 should not be present, but was found."; diff --git a/src/it/projects/multimodule/massembly-619/verify.groovy b/src/it/projects/multimodule/massembly-619/verify.groovy index 64d79c8b..9ca00870 100644 --- a/src/it/projects/multimodule/massembly-619/verify.groovy +++ b/src/it/projects/multimodule/massembly-619/verify.groovy @@ -17,11 +17,6 @@ * under the License. */ -import java.io.*; -import java.util.zip.*; - File f = new File( basedir, "descriptor/target/distribution-0.0.1-SNAPSHOT-client/dir2/classworlds-1.1.jar" ); -return !f.exists(); - - +assert !f.exists(); diff --git a/src/it/projects/multimodule/multimodule-binariesNotSource/verify.groovy b/src/it/projects/multimodule/multimodule-binariesNotSource/verify.groovy index fe626245..f7ee684d 100644 --- a/src/it/projects/multimodule/multimodule-binariesNotSource/verify.groovy +++ b/src/it/projects/multimodule/multimodule-binariesNotSource/verify.groovy @@ -17,13 +17,9 @@ * under the License. */ -import java.io.*; -boolean result = true; -result = result && new File( basedir, "assembly/target/assembly-1.0-bin/lib/child1.jar" ).exists(); -result = result && new File( basedir, "assembly/target/assembly-1.0-bin/lib/child3.jar" ).exists(); +assert new File( basedir, "assembly/target/assembly-1.0-bin/lib/child1.jar" ).exists(); +assert new File( basedir, "assembly/target/assembly-1.0-bin/lib/child3.jar" ).exists(); -result = result && !new File( basedir, "assembly/target/assembly-1.0-bin/lib/child2.jar" ).exists(); - -return result; +assert !new File( basedir, "assembly/target/assembly-1.0-bin/lib/child2.jar" ).exists(); diff --git a/src/it/projects/multimodule/multimodule-filteredFileSet/verify.groovy b/src/it/projects/multimodule/multimodule-filteredFileSet/verify.groovy index 920aa802..89bff29f 100644 --- a/src/it/projects/multimodule/multimodule-filteredFileSet/verify.groovy +++ b/src/it/projects/multimodule/multimodule-filteredFileSet/verify.groovy @@ -17,25 +17,8 @@ * under the License. */ -import java.io.*; +String osVersion = System.getProperty( "os.version" ); +File a = new File( basedir, "target/parent-1.0-bin/child/a/filtered.txt"); -try -{ - String osVersion = System.getProperty( "os.version" ); - File a = new File( basedir, "target/parent-1.0-bin/child/a/filtered.txt"); - - BufferedReader r = new BufferedReader(new FileReader(a)); - String line = r.readLine(); - if ( ! line.endsWith( osVersion ) ) - { - System.out.println( "Expected OS version: " + osVersion ); - System.out.println( "Line was: " + line ); - return false; - } -} -catch( IOException e ) -{ - e.printStackTrace(); -} - -return true; +String line = a.withReader( "UTF-8" ) { it.readLine() }; +assert line.endsWith( osVersion ) : "Expected OS version: " + osVersion + "\nLine was: " + line; diff --git a/src/it/projects/multimodule/multimodule-modulePomPropInterp/verify.groovy b/src/it/projects/multimodule/multimodule-modulePomPropInterp/verify.groovy index a8452443..4585e3f9 100644 --- a/src/it/projects/multimodule/multimodule-modulePomPropInterp/verify.groovy +++ b/src/it/projects/multimodule/multimodule-modulePomPropInterp/verify.groovy @@ -17,7 +17,5 @@ * under the License. */ -import java.io.*; - File f = new File( basedir, "child2/target/child2-1-bin/bar/child1" ); -return f.exists() && f.isDirectory(); +assert f.exists() && f.isDirectory(); diff --git a/src/it/projects/multimodule/multimodule-siblingParent/parent/verify.groovy b/src/it/projects/multimodule/multimodule-siblingParent/parent/verify.groovy index 1a8ac93d..b2bd802b 100644 --- a/src/it/projects/multimodule/multimodule-siblingParent/parent/verify.groovy +++ b/src/it/projects/multimodule/multimodule-siblingParent/parent/verify.groovy @@ -17,12 +17,8 @@ * under the License. */ -import java.io.*; -boolean result = true; -result = result && new File( basedir, "target/parent-1-src/sources/child1/pom.xml" ).exists(); +assert new File( basedir, "target/parent-1-src/sources/child1/pom.xml" ).exists(); -result = result && new File( basedir, "target/parent-1-src/sources/child2/pom.xml" ).exists(); - -return result; +assert new File( basedir, "target/parent-1-src/sources/child2/pom.xml" ).exists(); diff --git a/src/it/projects/multimodule/multimodule-sourceNotBinaries/verify.groovy b/src/it/projects/multimodule/multimodule-sourceNotBinaries/verify.groovy index 2ee5ee0f..bf04df14 100644 --- a/src/it/projects/multimodule/multimodule-sourceNotBinaries/verify.groovy +++ b/src/it/projects/multimodule/multimodule-sourceNotBinaries/verify.groovy @@ -17,12 +17,8 @@ * under the License. */ -import java.io.*; -boolean result = true; -result = result && new File( basedir, "target/parent-1.0-src/sources/child1/pom.xml" ).exists(); +assert new File( basedir, "target/parent-1.0-src/sources/child1/pom.xml" ).exists(); -result = result && !new File( basedir, "target/parent-1.0-src/sources/child2/pom.xml" ).exists(); - -return result; +assert !new File( basedir, "target/parent-1.0-src/sources/child2/pom.xml" ).exists(); diff --git a/src/it/projects/multimodule/multimodule-wholeReactorFromChild/verify.groovy b/src/it/projects/multimodule/multimodule-wholeReactorFromChild/verify.groovy index 199c64e6..ba114f90 100644 --- a/src/it/projects/multimodule/multimodule-wholeReactorFromChild/verify.groovy +++ b/src/it/projects/multimodule/multimodule-wholeReactorFromChild/verify.groovy @@ -17,37 +17,15 @@ * under the License. */ -import java.io.*; import java.util.Arrays; -boolean result = true; +assert new File( basedir, "child4/target/child4-1.0-bin/lib/child1.jar" ).exists() : "Child-1 jar is NOT in output!"; -if ( !new File( basedir, "child4/target/child4-1.0-bin/lib/child1.jar" ).exists() ) -{ - System.out.println( "Child-1 jar is NOT in output!" ); - result = false; -} +assert new File( basedir, "child4/target/child4-1.0-bin/lib/child3.jar" ).exists() : "Child-3 jar is NOT in output!"; -if ( !new File( basedir, "child4/target/child4-1.0-bin/lib/child3.jar" ).exists() ) -{ - System.out.println( "Child-3 jar is NOT in output!" ); - result = false; -} - -if ( new File( basedir, "child4/target/child4-1.0-bin/lib/child2.jar" ).exists() ) -{ - System.out.println( "Child-2 jar SHOULD NOT BE in output!" ); - result = false; -} +assert !new File( basedir, "child4/target/child4-1.0-bin/lib/child2.jar" ).exists() : "Child-2 jar SHOULD NOT BE in output!"; File libDirectory = new File( basedir, "child4/target/child4-1.0-bin/lib" ); File[] includedArtifacts = libDirectory.listFiles(); -if ( includedArtifacts == null || includedArtifacts.length != 2 ) -{ - System.out.println( "Only the two selected module artifacts should be present when includeDependencies=false." ); - System.out.println( "Files found: " + Arrays.toString( includedArtifacts ) ); - result = false; -} - -return result; +assert includedArtifacts != null && includedArtifacts.length == 2 : "Only the two selected module artifacts should be present when includeDependencies=false.\nFiles found: " + Arrays.toString( includedArtifacts );
