Skip to content

Commit a2acaa2

Browse files
committedAug 30, 2021
[MJAVADOC-137] transform verify script from bsh to groovy
1 parent 16ca119 commit a2acaa2

File tree

2 files changed

+46
-76
lines changed

2 files changed

+46
-76
lines changed
 

‎src/it/projects/MJAVADOC-137_jar/verify.bsh

-76
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
/*
3+
* Licensed to the Apache Software Foundation (ASF) under one
4+
* or more contributor license agreements. See the NOTICE file
5+
* distributed with this work for additional information
6+
* regarding copyright ownership. The ASF licenses this file
7+
* to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance
9+
* with the License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing,
14+
* software distributed under the License is distributed on an
15+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
* KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations
18+
* under the License.
19+
*/
20+
21+
import java.util.jar.*
22+
23+
File target1 = new File( basedir, 'test1/target/test1-1.0-SNAPSHOT-javadoc.jar' )
24+
assert target1.exists()
25+
26+
File target2 = new File( basedir, 'test2/target/test2-1.0-SNAPSHOT-javadoc.jar' )
27+
assert target2.exists()
28+
29+
JarFile jar = new JarFile( target1 )
30+
Enumeration jarEntries = jar.entries()
31+
long timestamp = -1
32+
while ( jarEntries.hasMoreElements() )
33+
{
34+
JarEntry entry = (JarEntry) jarEntries.nextElement()
35+
if ( timestamp == -1 )
36+
{
37+
timestamp = entry.getTime(); // reproducible timestamp in jar file cause local timestamp depending on timezone
38+
}
39+
assert entry.getTime() == timestamp
40+
}
41+
jarEntries = new JarFile( target1 ).entries()
42+
while ( jarEntries.hasMoreElements() )
43+
{
44+
JarEntry entry = (JarEntry) jarEntries.nextElement()
45+
assert entry.getTime() == timestamp
46+
}

0 commit comments

Comments
 (0)
Please sign in to comment.