< prev index next >

test/jdk/java/lang/ClassLoader/GetSystemPackage.java

Print this page
rev 51638 : [mq]: 8210112


   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8060130
  27  * @library /lib/testlibrary
  28  * @build package2.Class2 GetSystemPackage jdk.testlibrary.*
  29  * @summary Test if getSystemPackage() return consistent values for cases
  30  *          where a manifest is provided or not and ensure only jars on
  31  *          bootclasspath gets resolved via Package.getSystemPackage
  32  * @run main GetSystemPackage
  33  */
  34 
  35 import java.io.File;
  36 import java.io.FileInputStream;
  37 import java.io.FileNotFoundException;
  38 import java.io.FileOutputStream;
  39 import java.io.IOException;
  40 import java.util.jar.Attributes;
  41 import java.util.jar.JarEntry;
  42 import java.util.jar.JarOutputStream;
  43 import java.util.jar.Manifest;
  44 import jdk.testlibrary.ProcessTools;
  45 
  46 public class GetSystemPackage {
  47 
  48     static final String testClassesDir = System.getProperty("test.classes", ".");
  49     static final File tmpFolder = new File(testClassesDir);
  50     static final String manifestTitle = "Special JAR";
  51 
  52     public static void main(String ... args) throws Exception {
  53         if (args.length == 0) {
  54             buildJarsAndInitiateSystemPackageTest();
  55             return;
  56         }
  57         switch (args[0]) {
  58             case "system-manifest":
  59                 verifyPackage(true, true);
  60                 break;
  61             case "system-no-manifest":
  62                 verifyPackage(false, true);
  63                 break;
  64             case "non-system-manifest":




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8060130
  27  * @library /test/lib
  28  * @build package2.Class2 GetSystemPackage
  29  * @summary Test if getSystemPackage() return consistent values for cases
  30  *          where a manifest is provided or not and ensure only jars on
  31  *          bootclasspath gets resolved via Package.getSystemPackage
  32  * @run main GetSystemPackage
  33  */
  34 
  35 import java.io.File;
  36 import java.io.FileInputStream;
  37 import java.io.FileNotFoundException;
  38 import java.io.FileOutputStream;
  39 import java.io.IOException;
  40 import java.util.jar.Attributes;
  41 import java.util.jar.JarEntry;
  42 import java.util.jar.JarOutputStream;
  43 import java.util.jar.Manifest;
  44 import jdk.test.lib.process.ProcessTools;
  45 
  46 public class GetSystemPackage {
  47 
  48     static final String testClassesDir = System.getProperty("test.classes", ".");
  49     static final File tmpFolder = new File(testClassesDir);
  50     static final String manifestTitle = "Special JAR";
  51 
  52     public static void main(String ... args) throws Exception {
  53         if (args.length == 0) {
  54             buildJarsAndInitiateSystemPackageTest();
  55             return;
  56         }
  57         switch (args[0]) {
  58             case "system-manifest":
  59                 verifyPackage(true, true);
  60                 break;
  61             case "system-no-manifest":
  62                 verifyPackage(false, true);
  63                 break;
  64             case "non-system-manifest":


< prev index next >