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-source-plugin.git
commit 8dd9860dec5d2234c693e1bfb5c79a8e6d3c3c36 Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Wed Nov 25 21:55:55 2026 +0000 Modernize Groovy IT scripts See https://github.com/apache/maven-invoker-plugin/issues/811. --- src/it/MSOURCES-62/verify.groovy | 44 ++----- src/it/jar-attached/verify.groovy | 34 +----- src/it/jar-classifier/verify.groovy | 69 ++++------- src/it/jar-includes-excludes/verify.groovy | 128 ++++++++------------- src/it/jar-no-fork/verify.groovy | 67 ++++------- src/it/jar-with-archive-config/verify.groovy | 79 ++++--------- src/it/jar-without-descriptor-config/verify.groovy | 68 ++++------- src/it/jar/verify.groovy | 69 ++++------- src/it/manifest-content/verify.groovy | 33 +----- src/it/project-without-sources/verify.groovy | 36 +----- src/it/test-jar-classifier/verify.groovy | 69 ++++------- src/it/test-jar-generated/verify.groovy | 71 ++++-------- src/it/test-jar-no-fork/verify.groovy | 67 ++++------- src/it/test-jar/verify.groovy | 69 ++++------- 14 files changed, 271 insertions(+), 632 deletions(-) diff --git a/src/it/MSOURCES-62/verify.groovy b/src/it/MSOURCES-62/verify.groovy index 77259b6..cc7480f 100644 --- a/src/it/MSOURCES-62/verify.groovy +++ b/src/it/MSOURCES-62/verify.groovy @@ -18,44 +18,18 @@ * under the License. */ -import java.io.*; -import java.util.*; import java.util.jar.*; -boolean result = true; +File target = new File( basedir, "target" ); +assert target.exists() && target.isDirectory() : "target file is missing or not a directory." -try -{ - File target = new File( basedir, "target" ); - if ( !target.exists() || !target.isDirectory() ) - { - System.err.println( "target file is missing or not a directory." ); - return false; - } +File artifact = new File( target, "MSOURCES-62-1.0-SNAPSHOT-sources.jar" ); +assert artifact.exists() && !artifact.isDirectory() : "artifact file is missing or a directory." - File artifact = new File( target, "MSOURCES-62-1.0-SNAPSHOT-sources.jar" ); - if ( !artifact.exists() || artifact.isDirectory() ) - { - System.err.println( "artifact file is missing or a directory." ); - return false; - } +JarFile jar = new JarFile( artifact ); - JarFile jar = new JarFile( artifact ); +Attributes manifest = jar.getManifest().getMainAttributes(); - Attributes manifest = jar.getManifest().getMainAttributes(); - - String val = manifest.getValue( new Attributes.Name( "An-Entry" ) ); - System.out.println("An-Entry:'"+val+"'"); - if ( !"Some Value".equals( val) ) - { - System.err.println( "An-Entry manifest entry" + " not equals Some Value" ); - return false; - } -} -catch( Throwable e ) -{ - e.printStackTrace(); - result = false; -} - -return result; +String val = manifest.getValue( new Attributes.Name( "An-Entry" ) ); +System.out.println("An-Entry:'"+val+"'"); +assert "Some Value".equals( val ) diff --git a/src/it/jar-attached/verify.groovy b/src/it/jar-attached/verify.groovy index 1b3a09b..5cfbe22 100644 --- a/src/it/jar-attached/verify.groovy +++ b/src/it/jar-attached/verify.groovy @@ -17,32 +17,10 @@ * under the License. */ -import java.io.*; -import java.util.*; -import java.util.regex.*; +File jarFile = new File( basedir, "target/jar-attached-1.0-SNAPSHOT-sources.jar" ); +System.out.println( "Checking for existence of " + jarFile ); +assert jarFile.isFile() -try -{ - File jarFile = new File( basedir, "target/jar-attached-1.0-SNAPSHOT-sources.jar" ); - System.out.println( "Checking for existence of " + jarFile ); - if ( !jarFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } - - File attachedFile = new File( localRepositoryPath, "org/apache/maven/its/ejb/jar-attached/1.0-SNAPSHOT/jar-attached-1.0-SNAPSHOT-sources.jar" ); - System.out.println( "Checking for existence of " + attachedFile ); - if ( !attachedFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } -} -catch( Throwable t ) -{ - t.printStackTrace(); - return false; -} - -return true; +File attachedFile = new File( localRepositoryPath, "org/apache/maven/its/ejb/jar-attached/1.0-SNAPSHOT/jar-attached-1.0-SNAPSHOT-sources.jar" ); +System.out.println( "Checking for existence of " + attachedFile ); +assert attachedFile.isFile() diff --git a/src/it/jar-classifier/verify.groovy b/src/it/jar-classifier/verify.groovy index a185814..dce1f7a 100644 --- a/src/it/jar-classifier/verify.groovy +++ b/src/it/jar-classifier/verify.groovy @@ -17,57 +17,32 @@ * under the License. */ -import java.io.*; -import java.util.*; import java.util.jar.*; -import java.util.regex.*; -try -{ - File jarFile = new File( basedir, "target/jar-classifier-1.0-SNAPSHOT-foo.jar" ); - System.out.println( "Checking for existence of " + jarFile ); - if ( !jarFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } - - JarFile jar = new JarFile( jarFile ); +File jarFile = new File( basedir, "target/jar-classifier-1.0-SNAPSHOT-foo.jar" ); +System.out.println( "Checking for existence of " + jarFile ); +assert jarFile.isFile() - String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyClass.java", - "main.properties", - "generated.properties", - ]; - for ( String included : includedEntries ) - { - System.out.println( "Checking for existence of " + included ); - if ( jar.getEntry( included ) == null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +JarFile jar = new JarFile( jarFile ); - String[] excludedEntries = [ - "MyTest.java", - "test.properties", - ]; - for ( String excluded : excludedEntries ) - { - System.out.println( "Checking for absence of " + excluded ); - if ( jar.getEntry( excluded ) != null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } -} -catch( Throwable t ) +String[] includedEntries = [ + "META-INF/MANIFEST.MF", + "MyClass.java", + "main.properties", + "generated.properties", +]; +for ( String included : includedEntries ) { - t.printStackTrace(); - return false; + System.out.println( "Checking for existence of " + included ); + assert jar.getEntry( included ) != null } -return true; +String[] excludedEntries = [ + "MyTest.java", + "test.properties", +]; +for ( String excluded : excludedEntries ) +{ + System.out.println( "Checking for absence of " + excluded ); + assert jar.getEntry( excluded ) == null +} diff --git a/src/it/jar-includes-excludes/verify.groovy b/src/it/jar-includes-excludes/verify.groovy index fe3b743..82c43da 100644 --- a/src/it/jar-includes-excludes/verify.groovy +++ b/src/it/jar-includes-excludes/verify.groovy @@ -17,98 +17,60 @@ * under the License. */ -import java.io.*; -import java.util.*; import java.util.jar.*; -import java.util.regex.*; -try -{ - File jarFile = new File( basedir, "target/jar-includes-excludes-1.0-SNAPSHOT-sources.jar" ); - System.out.println( "Checking for existence of " + jarFile ); - if ( !jarFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } - - JarFile jar = new JarFile( jarFile ); - - String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyClass2.java" - ]; - for ( String included : includedEntries ) - { - System.out.println( "Checking for existence of " + included ); - if ( jar.getEntry( included ) == null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +File jarFile = new File( basedir, "target/jar-includes-excludes-1.0-SNAPSHOT-sources.jar" ); +System.out.println( "Checking for existence of " + jarFile ); +assert jarFile.isFile() - String[] excludedEntries = [ - "MyTest.java", - "test.properties", - "MyClass.java", - "main.properties", - ]; - for ( String excluded : excludedEntries ) - { - System.out.println( "Checking for absence of " + excluded ); - if ( jar.getEntry( excluded ) != null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +JarFile jar = new JarFile( jarFile ); +String[] includedEntries = [ + "META-INF/MANIFEST.MF", + "MyClass2.java" +]; +for ( String included : includedEntries ) +{ + System.out.println( "Checking for existence of " + included ); + assert jar.getEntry( included ) != null +} - jarFile = new File( basedir, "target/jar-includes-excludes-1.0-SNAPSHOT-test-sources.jar" ); - System.out.println( "Checking for existence of " + jarFile ); - if ( !jarFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } +String[] excludedEntries = [ + "MyTest.java", + "test.properties", + "MyClass.java", + "main.properties", +]; +for ( String excluded : excludedEntries ) +{ + System.out.println( "Checking for absence of " + excluded ); + assert jar.getEntry( excluded ) == null +} - jar = new JarFile( jarFile ); - includedEntries = [ - "META-INF/MANIFEST.MF", - "MyTest.java", - "test.properties", - ]; - for ( String included : includedEntries ) - { - System.out.println( "Checking for existence of " + included ); - if ( jar.getEntry( included ) == null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +jarFile = new File( basedir, "target/jar-includes-excludes-1.0-SNAPSHOT-test-sources.jar" ); +System.out.println( "Checking for existence of " + jarFile ); +assert jarFile.isFile() - excludedEntries = [ - "MyTest2.java", - "MyClass.java" - ]; - for ( String excluded : excludedEntries ) - { - System.out.println( "Checking for absence of " + excluded ); - if ( jar.getEntry( excluded ) != null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +jar = new JarFile( jarFile ); -} -catch( Throwable t ) +includedEntries = [ + "META-INF/MANIFEST.MF", + "MyTest.java", + "test.properties", +]; +for ( String included : includedEntries ) { - t.printStackTrace(); - return false; + System.out.println( "Checking for existence of " + included ); + assert jar.getEntry( included ) != null } -return true; +excludedEntries = [ + "MyTest2.java", + "MyClass.java" +]; +for ( String excluded : excludedEntries ) +{ + System.out.println( "Checking for absence of " + excluded ); + assert jar.getEntry( excluded ) == null +} diff --git a/src/it/jar-no-fork/verify.groovy b/src/it/jar-no-fork/verify.groovy index d108361..d804886 100644 --- a/src/it/jar-no-fork/verify.groovy +++ b/src/it/jar-no-fork/verify.groovy @@ -17,56 +17,31 @@ * under the License. */ -import java.io.*; -import java.util.*; import java.util.jar.*; -import java.util.regex.*; -try -{ - File jarFile = new File( basedir, "target/jar-no-fork-1.0-SNAPSHOT-sources.jar" ); - System.out.println( "Checking for existence of " + jarFile ); - if ( !jarFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } - - JarFile jar = new JarFile( jarFile ); +File jarFile = new File( basedir, "target/jar-no-fork-1.0-SNAPSHOT-sources.jar" ); +System.out.println( "Checking for existence of " + jarFile ); +assert jarFile.isFile() - String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyClass.java", - "main.properties", - ]; - for ( String included : includedEntries ) - { - System.out.println( "Checking for existence of " + included ); - if ( jar.getEntry( included ) == null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +JarFile jar = new JarFile( jarFile ); - String[] excludedEntries = [ - "MyTest.java", - "test.properties", - ]; - for ( String excluded : excludedEntries ) - { - System.out.println( "Checking for absence of " + excluded ); - if ( jar.getEntry( excluded ) != null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } -} -catch( Throwable t ) +String[] includedEntries = [ + "META-INF/MANIFEST.MF", + "MyClass.java", + "main.properties", +]; +for ( String included : includedEntries ) { - t.printStackTrace(); - return false; + System.out.println( "Checking for existence of " + included ); + assert jar.getEntry( included ) != null } -return true; +String[] excludedEntries = [ + "MyTest.java", + "test.properties", +]; +for ( String excluded : excludedEntries ) +{ + System.out.println( "Checking for absence of " + excluded ); + assert jar.getEntry( excluded ) == null +} diff --git a/src/it/jar-with-archive-config/verify.groovy b/src/it/jar-with-archive-config/verify.groovy index b8e5798..ad090f3 100644 --- a/src/it/jar-with-archive-config/verify.groovy +++ b/src/it/jar-with-archive-config/verify.groovy @@ -17,65 +17,36 @@ * under the License. */ -import java.io.*; -import java.util.*; import java.util.jar.*; -import java.util.regex.*; -try -{ - File jarFile = new File( basedir, "target/jar-with-archive-config-1.0-SNAPSHOT-sources.jar" ); - System.out.println( "Checking for existence of " + jarFile ); - if ( !jarFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } - - JarFile jar = new JarFile( jarFile ); - - String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyClass.java", - "main.properties", - ]; - for ( String included : includedEntries ) - { - System.out.println( "Checking for existence of " + included ); - if ( jar.getEntry( included ) == null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +File jarFile = new File( basedir, "target/jar-with-archive-config-1.0-SNAPSHOT-sources.jar" ); +System.out.println( "Checking for existence of " + jarFile ); +assert jarFile.isFile() - String[] excludedEntries = [ - "MyTest.java", - "test.properties", - ]; - for ( String excluded : excludedEntries ) - { - System.out.println( "Checking for absence of " + excluded ); - if ( jar.getEntry( excluded ) != null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +JarFile jar = new JarFile( jarFile ); - System.out.println( "Checking manifest for attribute: Implementation-Version " ); - Map manifestAttributes = jar.getManifest().getMainAttributes(); - String implVersion = manifestAttributes.getValue( "Implementation-Version" ); - if ( implVersion == null ) - { - System.out.println( "FAILURE!" ); - return false; - } +String[] includedEntries = [ + "META-INF/MANIFEST.MF", + "MyClass.java", + "main.properties", +]; +for ( String included : includedEntries ) +{ + System.out.println( "Checking for existence of " + included ); + assert jar.getEntry( included ) != null } -catch( Throwable t ) + +String[] excludedEntries = [ + "MyTest.java", + "test.properties", +]; +for ( String excluded : excludedEntries ) { - t.printStackTrace(); - return false; + System.out.println( "Checking for absence of " + excluded ); + assert jar.getEntry( excluded ) == null } -return true; +System.out.println( "Checking manifest for attribute: Implementation-Version " ); +Map manifestAttributes = jar.getManifest().getMainAttributes(); +String implVersion = manifestAttributes.getValue( "Implementation-Version" ); +assert implVersion != null diff --git a/src/it/jar-without-descriptor-config/verify.groovy b/src/it/jar-without-descriptor-config/verify.groovy index aef9da2..77035bb 100644 --- a/src/it/jar-without-descriptor-config/verify.groovy +++ b/src/it/jar-without-descriptor-config/verify.groovy @@ -17,57 +17,31 @@ * under the License. */ -import java.io.*; -import java.util.*; import java.util.jar.*; -import java.util.regex.*; -try -{ - File jarFile = new File( basedir, "target/jar-without-descriptor-config-1.0-SNAPSHOT-sources.jar" ); - System.out.println( "Checking for existence of " + jarFile ); - if ( !jarFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } - - JarFile jar = new JarFile( jarFile ); - - String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyClass.java", - "main.properties", - ]; - for ( String included : includedEntries ) - { - System.out.println( "Checking for existence of " + included ); - if ( jar.getEntry( included ) == null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +File jarFile = new File( basedir, "target/jar-without-descriptor-config-1.0-SNAPSHOT-sources.jar" ); +System.out.println( "Checking for existence of " + jarFile ); +assert jarFile.isFile() - String[] excludedEntries = [ - "MyTest.java", - "test.properties", - ]; - for ( String excluded : excludedEntries ) - { - System.out.println( "Checking for absence of " + excluded ); - if ( jar.getEntry( excluded ) != null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +JarFile jar = new JarFile( jarFile ); -} -catch( Throwable t ) +String[] includedEntries = [ + "META-INF/MANIFEST.MF", + "MyClass.java", + "main.properties", +]; +for ( String included : includedEntries ) { - t.printStackTrace(); - return false; + System.out.println( "Checking for existence of " + included ); + assert jar.getEntry( included ) != null } -return true; +String[] excludedEntries = [ + "MyTest.java", + "test.properties", +]; +for ( String excluded : excludedEntries ) +{ + System.out.println( "Checking for absence of " + excluded ); + assert jar.getEntry( excluded ) == null +} diff --git a/src/it/jar/verify.groovy b/src/it/jar/verify.groovy index cf1d9d2..4793936 100644 --- a/src/it/jar/verify.groovy +++ b/src/it/jar/verify.groovy @@ -17,57 +17,32 @@ * under the License. */ -import java.io.*; -import java.util.*; import java.util.jar.*; -import java.util.regex.*; -try -{ - File jarFile = new File( basedir, "target/jar-1.0-SNAPSHOT-sources.jar" ); - System.out.println( "Checking for existence of " + jarFile ); - if ( !jarFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } - - JarFile jar = new JarFile( jarFile ); +File jarFile = new File( basedir, "target/jar-1.0-SNAPSHOT-sources.jar" ); +System.out.println( "Checking for existence of " + jarFile ); +assert jarFile.isFile() - String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyClass.java", - "main.properties", - "generated.properties", - ]; - for ( String included : includedEntries ) - { - System.out.println( "Checking for existence of " + included ); - if ( jar.getEntry( included ) == null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +JarFile jar = new JarFile( jarFile ); - String[] excludedEntries = [ - "MyTest.java", - "test.properties", - ]; - for ( String excluded : excludedEntries ) - { - System.out.println( "Checking for absence of " + excluded ); - if ( jar.getEntry( excluded ) != null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } -} -catch( Throwable t ) +String[] includedEntries = [ + "META-INF/MANIFEST.MF", + "MyClass.java", + "main.properties", + "generated.properties", +]; +for ( String included : includedEntries ) { - t.printStackTrace(); - return false; + System.out.println( "Checking for existence of " + included ); + assert jar.getEntry( included ) != null } -return true; +String[] excludedEntries = [ + "MyTest.java", + "test.properties", +]; +for ( String excluded : excludedEntries ) +{ + System.out.println( "Checking for absence of " + excluded ); + assert jar.getEntry( excluded ) == null +} diff --git a/src/it/manifest-content/verify.groovy b/src/it/manifest-content/verify.groovy index f6b340f..9614c9f 100644 --- a/src/it/manifest-content/verify.groovy +++ b/src/it/manifest-content/verify.groovy @@ -18,35 +18,14 @@ * under the License. */ -import java.io.*; -import java.util.*; import java.util.jar.*; -boolean result = true; +File target = new File( basedir, "target" ); +assert target.exists() && target.isDirectory() : "target file is missing or not a directory." -try -{ - File target = new File( basedir, "target" ); - if ( !target.exists() || !target.isDirectory() ) - { - System.err.println( "target file is missing or not a directory." ); - return false; - } +File artifact = new File( target, "manifest-content-1.0-SNAPSHOT-sources.jar" ); +assert artifact.exists() && !artifact.isDirectory() : "artifact file is missing or a directory." - File artifact = new File( target, "manifest-content-1.0-SNAPSHOT-sources.jar" ); - if ( !artifact.exists() || artifact.isDirectory() ) - { - System.err.println( "artifact file is missing or a directory." ); - return false; - } +JarFile jar = new JarFile( artifact ); - JarFile jar = new JarFile( artifact ); - -} -catch( Throwable e ) -{ - e.printStackTrace(); - result = false; -} - -return result; +return true diff --git a/src/it/project-without-sources/verify.groovy b/src/it/project-without-sources/verify.groovy index 5f16c74..ab6a060 100755 --- a/src/it/project-without-sources/verify.groovy +++ b/src/it/project-without-sources/verify.groovy @@ -17,34 +17,10 @@ * under the License. */ -import java.io.*; -import java.util.*; -import java.util.jar.*; -import java.util.regex.*; +File jarFile = new File( basedir, "target/project-without-sources-1.0-SNAPSHOT-sources.jar" ); +System.out.println( "Checking for non-existence of " + jarFile ); +assert !jarFile.isFile() -try -{ - File jarFile = new File( basedir, "target/project-without-sources-1.0-SNAPSHOT-sources.jar" ); - System.out.println( "Checking for non-existence of " + jarFile ); - if ( jarFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } - - File testJarFile = new File( basedir, "target/project-without-sources-1.0-SNAPSHOT-test-sources.jar" ); - System.out.println( "Checking for non-existence of " + testJarFile ); - if ( testJarFile.exists() ) - { - System.out.println( "FAILURE!" ); - return false; - } - -} -catch( Throwable t ) -{ - t.printStackTrace(); - return false; -} - -return true; +File testJarFile = new File( basedir, "target/project-without-sources-1.0-SNAPSHOT-test-sources.jar" ); +System.out.println( "Checking for non-existence of " + testJarFile ); +assert !testJarFile.exists() diff --git a/src/it/test-jar-classifier/verify.groovy b/src/it/test-jar-classifier/verify.groovy index cbfb3d6..0b17d1c 100644 --- a/src/it/test-jar-classifier/verify.groovy +++ b/src/it/test-jar-classifier/verify.groovy @@ -17,57 +17,32 @@ * under the License. */ -import java.io.*; -import java.util.*; import java.util.jar.*; -import java.util.regex.*; -try -{ - File jarFile = new File( basedir, "target/test-jar-classifier-1.0-SNAPSHOT-bar.jar" ); - System.out.println( "Checking for existence of " + jarFile ); - if ( !jarFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } - - JarFile jar = new JarFile( jarFile ); +File jarFile = new File( basedir, "target/test-jar-classifier-1.0-SNAPSHOT-bar.jar" ); +System.out.println( "Checking for existence of " + jarFile ); +assert jarFile.isFile() - String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyTest.java", - "test.properties", - "generated.properties", - ]; - for ( String included : includedEntries ) - { - System.out.println( "Checking for existence of " + included ); - if ( jar.getEntry( included ) == null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +JarFile jar = new JarFile( jarFile ); - String[] excludedEntries = [ - "MyClass.java", - "main.properties", - ]; - for ( String excluded : excludedEntries ) - { - System.out.println( "Checking for absence of " + excluded ); - if ( jar.getEntry( excluded ) != null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } -} -catch( Throwable t ) +String[] includedEntries = [ + "META-INF/MANIFEST.MF", + "MyTest.java", + "test.properties", + "generated.properties", +]; +for ( String included : includedEntries ) { - t.printStackTrace(); - return false; + System.out.println( "Checking for existence of " + included ); + assert jar.getEntry( included ) != null } -return true; +String[] excludedEntries = [ + "MyClass.java", + "main.properties", +]; +for ( String excluded : excludedEntries ) +{ + System.out.println( "Checking for absence of " + excluded ); + assert jar.getEntry( excluded ) == null +} diff --git a/src/it/test-jar-generated/verify.groovy b/src/it/test-jar-generated/verify.groovy index 9e36840..97c3346 100644 --- a/src/it/test-jar-generated/verify.groovy +++ b/src/it/test-jar-generated/verify.groovy @@ -17,58 +17,33 @@ * under the License. */ -import java.io.*; -import java.util.*; import java.util.jar.*; -import java.util.regex.*; -try -{ - File jarFile = new File( basedir, "target/test-jar-generated-1.0-SNAPSHOT-test-sources.jar" ); - System.out.println( "Checking for existence of " + jarFile ); - if ( !jarFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } - - JarFile jar = new JarFile( jarFile ); +File jarFile = new File( basedir, "target/test-jar-generated-1.0-SNAPSHOT-test-sources.jar" ); +System.out.println( "Checking for existence of " + jarFile ); +assert jarFile.isFile() - String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyTest.java", - "test.properties", - "generated.properties", - "generate-test-sources.properties" - ]; - for ( String included : includedEntries ) - { - System.out.println( "Checking for existence of " + included ); - if ( jar.getEntry( included ) == null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +JarFile jar = new JarFile( jarFile ); - String[] excludedEntries = [ - "MyClass.java", - "main.properties", - ]; - for ( String excluded : excludedEntries ) - { - System.out.println( "Checking for absence of " + excluded ); - if ( jar.getEntry( excluded ) != null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } -} -catch( Throwable t ) +String[] includedEntries = [ + "META-INF/MANIFEST.MF", + "MyTest.java", + "test.properties", + "generated.properties", + "generate-test-sources.properties" +]; +for ( String included : includedEntries ) { - t.printStackTrace(); - return false; + System.out.println( "Checking for existence of " + included ); + assert jar.getEntry( included ) != null } -return true; +String[] excludedEntries = [ + "MyClass.java", + "main.properties", +]; +for ( String excluded : excludedEntries ) +{ + System.out.println( "Checking for absence of " + excluded ); + assert jar.getEntry( excluded ) == null +} diff --git a/src/it/test-jar-no-fork/verify.groovy b/src/it/test-jar-no-fork/verify.groovy index 8889e38..5922542 100644 --- a/src/it/test-jar-no-fork/verify.groovy +++ b/src/it/test-jar-no-fork/verify.groovy @@ -17,56 +17,31 @@ * under the License. */ -import java.io.*; -import java.util.*; import java.util.jar.*; -import java.util.regex.*; -try -{ - File jarFile = new File( basedir, "target/test-jar-no-fork-1.0-SNAPSHOT-test-sources.jar" ); - System.out.println( "Checking for existence of " + jarFile ); - if ( !jarFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } - - JarFile jar = new JarFile( jarFile ); +File jarFile = new File( basedir, "target/test-jar-no-fork-1.0-SNAPSHOT-test-sources.jar" ); +System.out.println( "Checking for existence of " + jarFile ); +assert jarFile.isFile() - String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyTest.java", - "test.properties", - ]; - for ( String included : includedEntries ) - { - System.out.println( "Checking for existence of " + included ); - if ( jar.getEntry( included ) == null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +JarFile jar = new JarFile( jarFile ); - String[] excludedEntries = [ - "MyClass.java", - "main.properties", - ]; - for ( String excluded : excludedEntries ) - { - System.out.println( "Checking for absence of " + excluded ); - if ( jar.getEntry( excluded ) != null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } -} -catch( Throwable t ) +String[] includedEntries = [ + "META-INF/MANIFEST.MF", + "MyTest.java", + "test.properties", +]; +for ( String included : includedEntries ) { - t.printStackTrace(); - return false; + System.out.println( "Checking for existence of " + included ); + assert jar.getEntry( included ) != null } -return true; +String[] excludedEntries = [ + "MyClass.java", + "main.properties", +]; +for ( String excluded : excludedEntries ) +{ + System.out.println( "Checking for absence of " + excluded ); + assert jar.getEntry( excluded ) == null +} diff --git a/src/it/test-jar/verify.groovy b/src/it/test-jar/verify.groovy index eadf0ce..84f9d47 100644 --- a/src/it/test-jar/verify.groovy +++ b/src/it/test-jar/verify.groovy @@ -17,57 +17,32 @@ * under the License. */ -import java.io.*; -import java.util.*; import java.util.jar.*; -import java.util.regex.*; -try -{ - File jarFile = new File( basedir, "target/test-jar-1.0-SNAPSHOT-test-sources.jar" ); - System.out.println( "Checking for existence of " + jarFile ); - if ( !jarFile.isFile() ) - { - System.out.println( "FAILURE!" ); - return false; - } - - JarFile jar = new JarFile( jarFile ); +File jarFile = new File( basedir, "target/test-jar-1.0-SNAPSHOT-test-sources.jar" ); +System.out.println( "Checking for existence of " + jarFile ); +assert jarFile.isFile() - String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyTest.java", - "test.properties", - "generated.properties", - ]; - for ( String included : includedEntries ) - { - System.out.println( "Checking for existence of " + included ); - if ( jar.getEntry( included ) == null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } +JarFile jar = new JarFile( jarFile ); - String[] excludedEntries = [ - "MyClass.java", - "main.properties", - ]; - for ( String excluded : excludedEntries ) - { - System.out.println( "Checking for absence of " + excluded ); - if ( jar.getEntry( excluded ) != null ) - { - System.out.println( "FAILURE!" ); - return false; - } - } -} -catch( Throwable t ) +String[] includedEntries = [ + "META-INF/MANIFEST.MF", + "MyTest.java", + "test.properties", + "generated.properties", +]; +for ( String included : includedEntries ) { - t.printStackTrace(); - return false; + System.out.println( "Checking for existence of " + included ); + assert jar.getEntry( included ) != null } -return true; +String[] excludedEntries = [ + "MyClass.java", + "main.properties", +]; +for ( String excluded : excludedEntries ) +{ + System.out.println( "Checking for absence of " + excluded ); + assert jar.getEntry( excluded ) == null +}
