Skip to content

Commit

Permalink
[MJAVADOC-137] transform verify script from bsh to groovy
Browse files Browse the repository at this point in the history
  • Loading branch information
rfscholte committed Aug 30, 2021
1 parent 16ca119 commit a2acaa2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 76 deletions.
76 changes: 0 additions & 76 deletions src/it/projects/MJAVADOC-137_jar/verify.bsh

This file was deleted.

46 changes: 46 additions & 0 deletions src/it/projects/MJAVADOC-137_jar/verify.groovy
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit a2acaa2

Please sign in to comment.