8180888: move jdk.testlibrary.JarUtils to the top level testlibrary
authoriignatyev
Tue, 30 May 2017 21:07:08 -0700
changeset 45287 e0bb5f83e17a
parent 45286 cd809e28c082
child 45288 58be10a068c2
8180888: move jdk.testlibrary.JarUtils to the top level testlibrary Reviewed-by: weijun
jdk/test/java/security/AccessController/DoPrivAccompliceTest.java
jdk/test/java/security/Policy/ExtensiblePolicy/ExtensiblePolicyWithJarTest.java
jdk/test/jdk/security/jarsigner/Spec.java
jdk/test/lib/testlibrary/jdk/testlibrary/JarUtils.java
jdk/test/sun/security/tools/jarsigner/AltProvider.java
jdk/test/sun/security/tools/jarsigner/Options.java
jdk/test/sun/security/tools/jarsigner/TimestampCheck.java
jdk/test/sun/security/tools/jarsigner/TsacertOptionTest.java
jdk/test/sun/security/tools/jarsigner/Warning.java
jdk/test/sun/security/tools/jarsigner/warnings/AliasNotInStoreTest.java
jdk/test/sun/security/tools/jarsigner/warnings/BadExtendedKeyUsageTest.java
jdk/test/sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java
jdk/test/sun/security/tools/jarsigner/warnings/BadNetscapeCertTypeTest.java
jdk/test/sun/security/tools/jarsigner/warnings/ChainNotValidatedTest.java
jdk/test/sun/security/tools/jarsigner/warnings/HasExpiredCertTest.java
jdk/test/sun/security/tools/jarsigner/warnings/HasExpiringCertTest.java
jdk/test/sun/security/tools/jarsigner/warnings/HasUnsignedEntryTest.java
jdk/test/sun/security/tools/jarsigner/warnings/MultipleWarningsTest.java
jdk/test/sun/security/tools/jarsigner/warnings/NoTimestampTest.java
jdk/test/sun/security/tools/jarsigner/warnings/NotSignedByAliasTest.java
jdk/test/sun/security/tools/jarsigner/warnings/NotYetValidCertTest.java
jdk/test/sun/security/tools/keytool/ReadJar.java
--- a/jdk/test/java/security/AccessController/DoPrivAccompliceTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/java/security/AccessController/DoPrivAccompliceTest.java	Tue May 30 21:07:08 2017 -0700
@@ -25,7 +25,7 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 import java.io.FileWriter;
 import java.io.IOException;
@@ -41,7 +41,7 @@
  * Run DoPrivTest.jar and try to access user.name property using
  * DoPrivAccmplice.jar.
  *
- * @library /test/lib /lib/testlibrary
+ * @library /test/lib
  *
  * @run main/othervm DoPrivAccompliceTest
  */
--- a/jdk/test/java/security/Policy/ExtensiblePolicy/ExtensiblePolicyWithJarTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/java/security/Policy/ExtensiblePolicy/ExtensiblePolicyWithJarTest.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,13 +27,13 @@
 import java.nio.file.Paths;
 import java.security.AccessController;
 import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * @test
  * @bug 8050402
  * @summary Check policy is extensible with user defined permissions
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @compile TVJar/TVPermission.java
  * @run main ExtensiblePolicyWithJarTest
  */
--- a/jdk/test/jdk/security/jarsigner/Spec.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/jdk/security/jarsigner/Spec.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @test
  * @bug 8056174
  * @summary Make sure JarSigner impl conforms to spec
- * @library /lib/testlibrary
+ * @library /test/lib
  * @modules java.base/sun.security.tools.keytool
  *          java.base/sun.security.provider.certpath
  *          jdk.jartool
@@ -35,7 +35,7 @@
 import com.sun.jarsigner.ContentSigner;
 import com.sun.jarsigner.ContentSignerParameters;
 import jdk.security.jarsigner.JarSigner;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 import sun.security.provider.certpath.X509CertPath;
 
 import java.io.File;
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/JarUtils.java	Tue May 30 15:05:33 2017 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.testlibrary;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-
-/**
- * Common library for various test jar file utility functions.
- */
-public final class JarUtils {
-
-    /**
-     * Create jar file with specified files. If a specified file does not exist,
-     * a new jar entry will be created with the file name itself as the content.
-     */
-    public static void createJar(String dest, String... files)
-            throws IOException {
-        try (JarOutputStream jos = new JarOutputStream(
-                new FileOutputStream(dest), new Manifest())) {
-            for (String file : files) {
-                System.out.println(String.format("Adding %s to %s",
-                        file, dest));
-
-                // add an archive entry, and write a file
-                jos.putNextEntry(new JarEntry(file));
-                try (FileInputStream fis = new FileInputStream(file)) {
-                    fis.transferTo(jos);
-                } catch (FileNotFoundException e) {
-                    jos.write(file.getBytes());
-                }
-            }
-        }
-        System.out.println();
-    }
-
-    /**
-     * Add or remove specified files to existing jar file. If a specified file
-     * to be updated or added does not exist, the jar entry will be created
-     * with the file name itself as the content.
-     *
-     * @param src the original jar file name
-     * @param dest the new jar file name
-     * @param files the files to update. The list is broken into 2 groups
-     *              by a "-" string. The files before in the 1st group will
-     *              be either updated or added. The files in the 2nd group
-     *              will be removed. If no "-" exists, all files belong to
-     *              the 1st group.
-     */
-    public static void updateJar(String src, String dest, String... files)
-            throws IOException {
-        try (JarOutputStream jos = new JarOutputStream(
-                new FileOutputStream(dest))) {
-
-            // copy each old entry into destination unless the entry name
-            // is in the updated list
-            List<String> updatedFiles = new ArrayList<>();
-            try (JarFile srcJarFile = new JarFile(src)) {
-                Enumeration<JarEntry> entries = srcJarFile.entries();
-                while (entries.hasMoreElements()) {
-                    JarEntry entry = entries.nextElement();
-                    String name = entry.getName();
-                    boolean found = false;
-                    boolean update = true;
-                    for (String file : files) {
-                        if (file.equals("-")) {
-                            update = false;
-                        } else if (name.equals(file)) {
-                            updatedFiles.add(file);
-                            found = true;
-                            break;
-                        }
-                    }
-
-                    if (found) {
-                        if (update) {
-                            System.out.println(String.format("Updating %s with %s",
-                                    dest, name));
-                            jos.putNextEntry(new JarEntry(name));
-                            try (FileInputStream fis = new FileInputStream(name)) {
-                                fis.transferTo(jos);
-                            } catch (FileNotFoundException e) {
-                                jos.write(name.getBytes());
-                            }
-                        } else {
-                            System.out.println(String.format("Removing %s from %s",
-                                    name, dest));
-                        }
-                    } else {
-                        System.out.println(String.format("Copying %s to %s",
-                                name, dest));
-                        jos.putNextEntry(entry);
-                        srcJarFile.getInputStream(entry).transferTo(jos);
-                    }
-                }
-            }
-
-            // append new files
-            for (String file : files) {
-                if (file.equals("-")) {
-                    break;
-                }
-                if (!updatedFiles.contains(file)) {
-                    System.out.println(String.format("Adding %s with %s",
-                            dest, file));
-                    jos.putNextEntry(new JarEntry(file));
-                    try (FileInputStream fis = new FileInputStream(file)) {
-                        fis.transferTo(jos);
-                    } catch (FileNotFoundException e) {
-                        jos.write(file.getBytes());
-                    }
-                }
-            }
-        }
-        System.out.println();
-    }
-
-}
--- a/jdk/test/sun/security/tools/jarsigner/AltProvider.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/AltProvider.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
 import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 import java.nio.file.*;
 
--- a/jdk/test/sun/security/tools/jarsigner/Options.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/Options.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
  * @bug 8056174
  * @summary Make sure the jarsigner tool still works after it's modified to
  *          be based on JarSigner API
- * @library /lib/testlibrary
+ * @library /test/lib
  * @modules java.base/sun.security.tools.keytool
  *          jdk.jartool/sun.security.tools.jarsigner
  *          java.base/sun.security.pkcs
@@ -35,7 +35,7 @@
 
 import com.sun.jarsigner.ContentSigner;
 import com.sun.jarsigner.ContentSignerParameters;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 import sun.security.pkcs.PKCS7;
 
 import java.io.ByteArrayInputStream;
--- a/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
 
 import jdk.test.lib.SecurityTools;
 import jdk.testlibrary.*;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 import sun.security.pkcs.ContentInfo;
 import sun.security.pkcs.PKCS7;
 import sun.security.pkcs.PKCS9Attribute;
@@ -557,7 +557,7 @@
     }
 
     static void prepare() throws Exception {
-        jdk.testlibrary.JarUtils.createJar("old.jar", "A");
+        JarUtils.createJar("old.jar", "A");
         Files.deleteIfExists(Paths.get("tsks"));
         keytool("-alias ca -genkeypair -ext bc -dname CN=CA");
         keytool("-alias old -genkeypair -dname CN=old");
--- a/jdk/test/sun/security/tools/jarsigner/TsacertOptionTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/TsacertOptionTest.java	Tue May 30 21:07:08 2017 -0700
@@ -22,7 +22,7 @@
  */
 
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * @test
--- a/jdk/test/sun/security/tools/jarsigner/Warning.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/Warning.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
  */
 
 import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 import jdk.testlibrary.OutputAnalyzer;
 import jdk.testlibrary.ProcessTools;
 
@@ -34,7 +34,7 @@
  * @test
  * @bug 8024302 8026037 8130132
  * @summary warnings, errors and -strict
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  */
 public class Warning {
 
--- a/jdk/test/sun/security/tools/jarsigner/warnings/AliasNotInStoreTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/AliasNotInStoreTest.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,13 @@
  */
 
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * @test
  * @bug 8024302 8026037
  * @summary Test for aliasNotInStore warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
  * @run main AliasNotInStoreTest
  */
 public class AliasNotInStoreTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/BadExtendedKeyUsageTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/BadExtendedKeyUsageTest.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,13 @@
  */
 
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * @test
  * @bug 8024302 8026037
  * @summary Test for badExtendedKeyUsage warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
  * @run main BadExtendedKeyUsageTest
  */
 public class BadExtendedKeyUsageTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,13 @@
  */
 
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * @test
  * @bug 8024302 8026037
  * @summary Test for badKeyUsage warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
  * @ignore until 8026393 is fixed
  * @run main BadKeyUsageTest
  */
--- a/jdk/test/sun/security/tools/jarsigner/warnings/BadNetscapeCertTypeTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/BadNetscapeCertTypeTest.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
  */
 
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 import java.nio.file.Files;
 import java.nio.file.Paths;
@@ -32,7 +32,7 @@
  * @test
  * @bug 8024302 8026037
  * @summary Test for badNetscapeCertType warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
  * @run main BadNetscapeCertTypeTest
  */
 public class BadNetscapeCertTypeTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/ChainNotValidatedTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/ChainNotValidatedTest.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,13 +24,13 @@
 import java.io.File;
 import jdk.testlibrary.OutputAnalyzer;
 import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * @test
  * @bug 8024302 8026037
  * @summary Test for chainNotValidated warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
  * @run main ChainNotValidatedTest
  */
 public class ChainNotValidatedTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/HasExpiredCertTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/HasExpiredCertTest.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,13 @@
  */
 
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * @test
  * @bug 8024302 8026037
  * @summary Test for hasExpiredCert warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
  * @run main HasExpiredCertTest
  */
 public class HasExpiredCertTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/HasExpiringCertTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/HasExpiringCertTest.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,13 @@
  */
 
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * @test
  * @bug 8024302 8026037
  * @summary Test for hasExpiringCert warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
  * @run main HasExpiringCertTest
  */
 public class HasExpiringCertTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/HasUnsignedEntryTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/HasUnsignedEntryTest.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,13 @@
  */
 
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * @test
  * @bug 8024302 8026037
  * @summary Test for hasUnsignedEntry warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
  * @run main HasUnsignedEntryTest
  */
 public class HasUnsignedEntryTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/MultipleWarningsTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/MultipleWarningsTest.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,13 @@
  */
 
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * @test
  * @bug 8024302 8026037
  * @summary Checks if jarsigner prints appropriate warnings
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
  * @run main MultipleWarningsTest
  */
 public class MultipleWarningsTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/NoTimestampTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/NoTimestampTest.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,13 +23,13 @@
 
 import java.util.Date;
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * @test
  * @bug 8024302 8026037
  * @summary Checks warnings if -tsa and -tsacert options are not specified
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
  * @run main NoTimestampTest
  */
 public class NoTimestampTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/NotSignedByAliasTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/NotSignedByAliasTest.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,13 @@
  */
 
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * @test
  * @bug 8024302 8026037
  * @summary Test for notSignedByAlias warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
  * @run main NotSignedByAliasTest
  */
 public class NotSignedByAliasTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/NotYetValidCertTest.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/NotYetValidCertTest.java	Tue May 30 21:07:08 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,13 @@
  */
 
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 /**
  * @test
  * @bug 8024302 8026037
  * @summary Test for notYetValidCert warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
  * @run main NotYetValidCertTest
  */
 public class NotYetValidCertTest extends Test {
--- a/jdk/test/sun/security/tools/keytool/ReadJar.java	Tue May 30 15:05:33 2017 -0700
+++ b/jdk/test/sun/security/tools/keytool/ReadJar.java	Tue May 30 21:07:08 2017 -0700
@@ -26,14 +26,13 @@
  * @bug 6890872 8168882
  * @summary keytool -printcert to recognize signed jar files
  * @library /test/lib
- * @library /lib/testlibrary
  */
 
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import jdk.test.lib.SecurityTools;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
 
 public class ReadJar {