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 2021/08/29 12:30:53 UTC

[maven-javadoc-plugin] branch MJAVADOC-618 updated: Transform bash to groovy

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MJAVADOC-618
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git


The following commit(s) were added to refs/heads/MJAVADOC-618 by this push:
     new 74c4e8e  Transform bash to groovy
74c4e8e is described below

commit 74c4e8ef49ef728b25c4feb7d1d13188408ac031
Author: rfscholte <rf...@apache.org>
AuthorDate: Sun Aug 29 14:30:40 2021 +0200

    Transform bash to groovy
---
 src/it/projects/MJAVADOC-137_jar/verify.bsh    | 76 --------------------------
 src/it/projects/MJAVADOC-137_jar/verify.groovy | 46 ++++++++++++++++
 2 files changed, 46 insertions(+), 76 deletions(-)

diff --git a/src/it/projects/MJAVADOC-137_jar/verify.bsh b/src/it/projects/MJAVADOC-137_jar/verify.bsh
deleted file mode 100644
index 6fa71a3..0000000
--- a/src/it/projects/MJAVADOC-137_jar/verify.bsh
+++ /dev/null
@@ -1,76 +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.util.*;
-import java.util.jar.*;
-
-boolean result = true;
-
-try
-{
-    File target1 = new File( basedir, "test1/target/test1-1.0-SNAPSHOT-javadoc.jar" );
-    if ( !target1.exists() )
-    {
-        System.err.println( "Javadoc jar for module test1 is missing." );
-        return false;
-    }
-
-    File target2 = new File( basedir, "test2/target/test2-1.0-SNAPSHOT-javadoc.jar" );
-    if ( !target2.exists() )
-    {
-        System.err.println( "Javadoc jar for module test2 is missing." );
-        return false;
-    }
-
-    JarFile jar = new JarFile( target1 );
-    Enumeration jarEntries = jar.entries();
-    long timestamp = -1;
-    while ( jarEntries.hasMoreElements() )
-    {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( timestamp == -1 )
-        {
-            timestamp = entry.getTime(); // reproducible timestamp in jar file cause local timestamp depending on timezone
-        }
-        if ( entry.getTime() != timestamp )
-        {
-            System.out.println( "wrong entry time for " + entry.getName() + ": " + entry.getTime() + " instead of " + timestamp );
-            return false;
-        }
-    }
-    jarEntries = new JarFile( target1 ).entries();
-    while ( jarEntries.hasMoreElements() )
-    {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( entry.getTime() != timestamp )
-        {
-            System.out.println( "wrong entry time for " + entry.getName() + ": " + entry.getTime() + " instead of " + timestamp );
-            return false;
-        }
-    }
-}
-catch( IOException e )
-{
-    e.printStackTrace();
-    result = false;
-}
-
-return result;
diff --git a/src/it/projects/MJAVADOC-137_jar/verify.groovy b/src/it/projects/MJAVADOC-137_jar/verify.groovy
new file mode 100644
index 0000000..93d5a74
--- /dev/null
+++ b/src/it/projects/MJAVADOC-137_jar/verify.groovy
@@ -0,0 +1,46 @@
+
+/*
+ * 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.util.jar.*
+
+File target1 = new File( basedir, 'test1/target/test1-1.0-SNAPSHOT-javadoc.jar' )
+assert target1.exists()
+
+File target2 = new File( basedir, 'test2/target/test2-1.0-SNAPSHOT-javadoc.jar' )
+assert target2.exists()
+
+JarFile jar = new JarFile( target1 )
+Enumeration jarEntries = jar.entries()
+long timestamp = -1
+while ( jarEntries.hasMoreElements() )
+{
+    JarEntry entry = (JarEntry) jarEntries.nextElement()
+    if ( timestamp == -1 )
+    {
+        timestamp = entry.getTime(); // reproducible timestamp in jar file cause local timestamp depending on timezone
+    }
+    assert entry.getTime() == timestamp
+}
+jarEntries = new JarFile( target1 ).entries()
+while ( jarEntries.hasMoreElements() )
+{
+    JarEntry entry = (JarEntry) jarEntries.nextElement()
+	assert entry.getTime() == timestamp
+}
\ No newline at end of file