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 2018/12/25 21:45:11 UTC
[maven-assembly-plugin] branch stabilize_ITs updated: Rewrite
verify.bsh to verify.groovy for better feedback to console
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch stabilize_ITs
in repository https://gitbox.apache.org/repos/asf/maven-assembly-plugin.git
The following commit(s) were added to refs/heads/stabilize_ITs by this push:
new 236a7ab Rewrite verify.bsh to verify.groovy for better feedback to console
236a7ab is described below
commit 236a7ab5f26f5e5e89c366db5ccb7f091a5b6ea0
Author: rfscholte <rf...@apache.org>
AuthorDate: Tue Dec 25 22:45:06 2018 +0100
Rewrite verify.bsh to verify.groovy for better feedback to console
---
.../component-descriptors-merged/verify.bsh | 79 ----------------------
.../component-descriptors-merged/verify.groovy | 56 +++++++++++++++
.../deps-unpacked-to-root-dir/verify.bsh | 73 --------------------
.../deps-unpacked-to-root-dir/verify.groovy} | 25 +++++--
.../{verify.bsh => verify.groovy} | 20 +-----
.../{verify.bsh => verify.groovy} | 14 ++--
.../{verify.bsh => verify.groovy} | 18 ++---
7 files changed, 85 insertions(+), 200 deletions(-)
diff --git a/src/it/projects/descriptor-refs/jar-with-dependencies/component-descriptors-merged/verify.bsh b/src/it/projects/descriptor-refs/jar-with-dependencies/component-descriptors-merged/verify.bsh
deleted file mode 100644
index b6a03dd..0000000
--- a/src/it/projects/descriptor-refs/jar-with-dependencies/component-descriptors-merged/verify.bsh
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * 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-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 );
-
- System.out.println( "Looking for component descriptor jar entry." );
-
- JarEntry je = jf.getEntry( "META-INF/plexus/components.xml" );
-
- if ( je == null )
- {
- System.err.println( "component descriptor is missing." );
- result = false;
- }
- else
- {
- InputStream instream = jf.getInputStream( je );
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] buf = new byte[16];
- int read = -1;
-
- while( ( read = instream.read( buf ) ) > -1 )
- {
- baos.write( buf, 0, read );
- }
-
- String test = new String( baos.toByteArray() );
- System.out.println( test );
-
- result = test.indexOf( "one" ) > -1 && test.indexOf( "two" ) > -1;
- }
-
-}
-catch( IOException e )
-{
- e.printStackTrace();
- 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
new file mode 100644
index 0000000..007eee5
--- /dev/null
+++ b/src/it/projects/descriptor-refs/jar-with-dependencies/component-descriptors-merged/verify.groovy
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.*;
+import java.net.*;
+import java.util.jar.*;
+
+System.out.println( "Creating JarFile java.io.File." )
+
+File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-jar-with-dependencies.jar" )
+
+System.out.println( "Checking for existence and file-ishness of: " + jarFile )
+
+assert ( jarFile.isFile() ) : "jar file is missing or a directory."
+
+System.out.println( "Creating JarFile instance." )
+
+JarFile jf = new JarFile( jarFile )
+
+System.out.println( "Looking for component descriptor jar entry." )
+
+JarEntry je = jf.getEntry( "META-INF/plexus/components.xml" )
+
+assert ( je != null ) : "component descriptor is missing."
+
+InputStream instream = jf.getInputStream( je )
+
+ByteArrayOutputStream baos = new ByteArrayOutputStream()
+byte[] buf = new byte[16]
+int read = -1
+
+while( ( read = instream.read( buf ) ) > -1 )
+{
+ baos.write( buf, 0, read )
+}
+
+String test = new String( baos.toByteArray() )
+System.out.println( test )
+
+assert ( test.indexOf( "one" ) > -1 && test.indexOf( "two" ) > -1 )
diff --git a/src/it/projects/descriptor-refs/jar-with-dependencies/deps-unpacked-to-root-dir/verify.bsh b/src/it/projects/descriptor-refs/jar-with-dependencies/deps-unpacked-to-root-dir/verify.bsh
deleted file mode 100644
index 2369dc9..0000000
--- a/src/it/projects/descriptor-refs/jar-with-dependencies/deps-unpacked-to-root-dir/verify.bsh
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * 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-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 );
-
- System.out.println( "Looking for 'test/AppChild1.class' jar entry." );
-
- if ( jf.getEntry( "test/AppChild1.class" ) == null )
- {
- System.err.println( "child1 class is missing." );
- result = false;
- }
-
- if ( jf.getEntry( "test/App.class" ) == null )
- {
- System.err.println( "child2 class is missing." );
- result = false;
- }
-
- System.out.println( "Looking for absence of 'junit/' jar entry." );
-
- if ( jf.getEntry( "junit/framework/TestCase.class" ) != null )
- {
- System.err.println( "junit jar should not be present." );
- result = false;
- }
-
-}
-catch( IOException e )
-{
- e.printStackTrace();
- result = false;
-}
-
-return result;
diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/verify.bsh b/src/it/projects/descriptor-refs/jar-with-dependencies/deps-unpacked-to-root-dir/verify.groovy
similarity index 52%
copy from src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/verify.bsh
copy to src/it/projects/descriptor-refs/jar-with-dependencies/deps-unpacked-to-root-dir/verify.groovy
index 013812f..6a46552 100644
--- a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/verify.bsh
+++ b/src/it/projects/descriptor-refs/jar-with-dependencies/deps-unpacked-to-root-dir/verify.groovy
@@ -23,13 +23,24 @@ import java.util.jar.*;
boolean result = true;
-String finalName = "assembly/target/assembly-1.0-SNAPSHOT-src/assembly-1.0-SNAPSHOT";
-String rootDir = finalName + "/modules/";
+System.out.println( "Creating JarFile java.io.File." )
+
+File jarFile = new File( basedir, "child2/target/child2-1.0-SNAPSHOT-jar-with-dependencies.jar" )
+
+System.out.println( "Checking for existence and file-ishness of: " + jarFile )
+
+assert ( jarFile.isFile() ) : "jar file is missing or a directory."
+
+System.out.println( "Creating JarFile instance." )
+
+JarFile jf = new JarFile( jarFile )
+
+System.out.println( "Looking for 'test/AppChild1.class' jar entry." )
-result = result && new File( basedir, rootDir + "child-level1-project1/pom.xml" ).exists();
+assert ( jf.getEntry( "test/AppChild1.class" ) != null ) : "child1 class is missing."
-result = result && new File( basedir, rootDir + "child-level1-project2/pom.xml" ).exists();
+assert ( jf.getEntry( "test/App.class" ) != null ) : "child2 class is missing."
-result = result && new File( basedir, rootDir + "child-level2-project1/pom.xml" ).exists();
-
-return result;
+System.out.println( "Looking for absence of 'junit/' jar entry." );
+
+assert ( jf.getEntry( "junit/framework/TestCase.class" ) == null ) : "junit jar should not be present."
diff --git a/src/it/projects/multimodule/two-level-multimodule/verify.bsh b/src/it/projects/multimodule/two-level-multimodule/verify.groovy
similarity index 63%
rename from src/it/projects/multimodule/two-level-multimodule/verify.bsh
rename to src/it/projects/multimodule/two-level-multimodule/verify.groovy
index d036088..91f657b 100644
--- a/src/it/projects/multimodule/two-level-multimodule/verify.bsh
+++ b/src/it/projects/multimodule/two-level-multimodule/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, "assembly/target/assembly-1.0-SNAPSHOT-bin/modules/child-level1-project1-1.0-SNAPSHOT.jar" ).exists();
- result = result && new File( basedir, "assembly/target/assembly-1.0-SNAPSHOT-bin/modules/child-level2-project1-1.0-SNAPSHOT.jar" ).exists();
-}
-catch( IOException e )
-{
- e.printStackTrace();
- result = false;
-}
-
-return result;
+assert new File( basedir, "assembly/target/assembly-1.0-SNAPSHOT-bin/modules/child-level1-project1-1.0-SNAPSHOT.jar" ).exists()
+assert new File( basedir, "assembly/target/assembly-1.0-SNAPSHOT-bin/modules/child-level2-project1-1.0-SNAPSHOT.jar" ).exists()
diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withBin/verify.bsh b/src/it/projects/multimodule/two-levels-includeBaseDir-withBin/verify.groovy
similarity index 72%
rename from src/it/projects/multimodule/two-levels-includeBaseDir-withBin/verify.bsh
rename to src/it/projects/multimodule/two-levels-includeBaseDir-withBin/verify.groovy
index baf4a82..e9d89d0 100644
--- a/src/it/projects/multimodule/two-levels-includeBaseDir-withBin/verify.bsh
+++ b/src/it/projects/multimodule/two-levels-includeBaseDir-withBin/verify.groovy
@@ -17,15 +17,9 @@
* under the License.
*/
-import java.io.*;
+String finalName = "assembly/target/assembly-1.0-SNAPSHOT-bin/assembly-1.0-SNAPSHOT"
+String rootDir = finalName + "/modules/"
-boolean result = true;
+assert new File( basedir, rootDir + "child-level1-project1-1.0-SNAPSHOT.jar" ).exists()
-String finalName = "assembly/target/assembly-1.0-SNAPSHOT-bin/assembly-1.0-SNAPSHOT";
-String rootDir = finalName + "/modules/";
-
-result = result && new File( basedir, rootDir + "child-level1-project1-1.0-SNAPSHOT.jar" ).exists();
-
-result = result && new File( basedir, rootDir + "child-level2-project1-1.0-SNAPSHOT.jar" ).exists();
-
-return result;
+assert new File( basedir, rootDir + "child-level2-project1-1.0-SNAPSHOT.jar" ).exists()
\ No newline at end of file
diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/verify.bsh b/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/verify.groovy
similarity index 66%
rename from src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/verify.bsh
rename to src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/verify.groovy
index 013812f..aac21f2 100644
--- a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/verify.bsh
+++ b/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/verify.groovy
@@ -17,19 +17,11 @@
* under the License.
*/
-import java.io.*;
-import java.net.*;
-import java.util.jar.*;
+String finalName = "assembly/target/assembly-1.0-SNAPSHOT-src/assembly-1.0-SNAPSHOT"
+String rootDir = finalName + "/modules/"
-boolean result = true;
+assert new File( basedir, rootDir + "child-level1-project1/pom.xml" ).exists()
-String finalName = "assembly/target/assembly-1.0-SNAPSHOT-src/assembly-1.0-SNAPSHOT";
-String rootDir = finalName + "/modules/";
+assert new File( basedir, rootDir + "child-level1-project2/pom.xml" ).exists()
-result = result && new File( basedir, rootDir + "child-level1-project1/pom.xml" ).exists();
-
-result = result && new File( basedir, rootDir + "child-level1-project2/pom.xml" ).exists();
-
-result = result && new File( basedir, rootDir + "child-level2-project1/pom.xml" ).exists();
-
-return result;
+assert new File( basedir, rootDir + "child-level2-project1/pom.xml" ).exists()