You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2019/01/18 12:21:48 UTC
[maven-jmod-plugin] 06/06: MJMOD-20: reorganize groovy script
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch JMOD-20
in repository https://gitbox.apache.org/repos/asf/maven-jmod-plugin.git
commit abed495c62e2df9315be97a18c547f961eaaa52b
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Jan 18 13:21:34 2019 +0100
MJMOD-20: reorganize groovy script
---
src/it/mjmod-20-set-main-class/verify.groovy | 62 ++++++++++++++--------------
1 file changed, 31 insertions(+), 31 deletions(-)
diff --git a/src/it/mjmod-20-set-main-class/verify.groovy b/src/it/mjmod-20-set-main-class/verify.groovy
index 1b74c30..83a0cc7 100644
--- a/src/it/mjmod-20-set-main-class/verify.groovy
+++ b/src/it/mjmod-20-set-main-class/verify.groovy
@@ -20,37 +20,6 @@
import java.util.jar.JarEntry
import java.util.jar.JarFile
-def validateArtifact( String module, List<String> artifactNames )
-{
- println( "Checking if ${basedir}/${module}/target exists." )
- File target = new File( basedir, "/${module}/target" )
- assert target.isDirectory()
-
- File artifact = new File( target, "/jmods/myproject.${module}.jmod" )
- assert artifact.isFile()
-
- Set contents = new HashSet()
-
- JarFile jar = new JarFile( artifact )
- Enumeration jarEntries = jar.entries()
- while ( jarEntries.hasMoreElements() )
- {
- JarEntry entry = (JarEntry) jarEntries.nextElement()
- println( "Current entry: ${entry}" )
- if ( !entry.isDirectory() )
- {
- // Only compare files
- contents.add( entry.getName() )
- }
- }
-
- assert artifactNames.size() == contents.size()
-
- artifactNames.each{ artifactName ->
- assert contents.contains( artifactName )
- }
-}
-
validateArtifact( "world", [ "classes/module-info.class", "classes/myproject/world/World.class" ] )
validateArtifact( "greetings", [ "classes/module-info.class", "classes/myproject/greetings/Main.class" ] )
@@ -95,4 +64,35 @@ else
+ "${target}/jmods/myproject.greetings.jmod'" )
System.err.println( serr )
return false
+}
+
+def validateArtifact( String module, List<String> artifactNames )
+{
+ println( "Checking if ${basedir}/${module}/target exists." )
+ File target = new File( basedir, "/${module}/target" )
+ assert target.isDirectory()
+
+ File artifact = new File( target, "/jmods/myproject.${module}.jmod" )
+ assert artifact.isFile()
+
+ Set contents = new HashSet()
+
+ JarFile jar = new JarFile( artifact )
+ Enumeration jarEntries = jar.entries()
+ while ( jarEntries.hasMoreElements() )
+ {
+ JarEntry entry = (JarEntry) jarEntries.nextElement()
+ println( "Current entry: ${entry}" )
+ if ( !entry.isDirectory() )
+ {
+ // Only compare files
+ contents.add( entry.getName() )
+ }
+ }
+
+ assert artifactNames.size() == contents.size()
+
+ artifactNames.each{ artifactName ->
+ assert contents.contains( artifactName )
+ }
}
\ No newline at end of file