test/tools/pack200/Pack200Props.java

Print this page


   1 /*
   2  * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   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  */


  71         cmdsList.add(testJar.getAbsolutePath());
  72         List<String> outList = Utils.runExec(cmdsList);
  73 
  74         int count = 0;
  75         for (String line : outList) {
  76             System.out.println(line);
  77             if (line.matches(".*Transmitted.*files of.*input bytes in a segment of.*bytes")) {
  78                 count++;
  79             }
  80         }
  81         if (count == 0) {
  82             throw new RuntimeException("no segments or no output ????");
  83         } else if (count > 1) {
  84             throw new RuntimeException("multiple segments detected, expected 1");
  85         }
  86     }
  87 
  88     private static void verifyDefaults() {
  89         Map<String, String> expectedDefaults = new HashMap<>();
  90         Packer p = Pack200.newPacker();
  91         expectedDefaults.put("com.sun.java.util.jar.pack.default.timezone",
  92                 p.FALSE);
  93         expectedDefaults.put("com.sun.java.util.jar.pack.disable.native",
  94                 p.FALSE);
  95         expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0");
  96         expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH");
  97         expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH");
  98         expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable",
  99                 "NH[PHPOHIIH]");
 100         expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable",
 101                 "NH[PHHII]");
 102         expectedDefaults.put(p.DEFLATE_HINT, p.KEEP);
 103         expectedDefaults.put(p.EFFORT, "5");
 104         expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE);
 105         expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP);
 106         expectedDefaults.put(p.SEGMENT_LIMIT, "-1");
 107         expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS);
 108 
 109         Map<String, String> props = p.properties();
 110         int errors = 0;
 111         for (String key : expectedDefaults.keySet()) {
 112             String def = expectedDefaults.get(key);
   1 /*
   2  * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   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  */


  71         cmdsList.add(testJar.getAbsolutePath());
  72         List<String> outList = Utils.runExec(cmdsList);
  73 
  74         int count = 0;
  75         for (String line : outList) {
  76             System.out.println(line);
  77             if (line.matches(".*Transmitted.*files of.*input bytes in a segment of.*bytes")) {
  78                 count++;
  79             }
  80         }
  81         if (count == 0) {
  82             throw new RuntimeException("no segments or no output ????");
  83         } else if (count > 1) {
  84             throw new RuntimeException("multiple segments detected, expected 1");
  85         }
  86     }
  87 
  88     private static void verifyDefaults() {
  89         Map<String, String> expectedDefaults = new HashMap<>();
  90         Packer p = Pack200.newPacker();


  91         expectedDefaults.put("com.sun.java.util.jar.pack.disable.native",
  92                 p.FALSE);
  93         expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0");
  94         expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH");
  95         expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH");
  96         expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable",
  97                 "NH[PHPOHIIH]");
  98         expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable",
  99                 "NH[PHHII]");
 100         expectedDefaults.put(p.DEFLATE_HINT, p.KEEP);
 101         expectedDefaults.put(p.EFFORT, "5");
 102         expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE);
 103         expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP);
 104         expectedDefaults.put(p.SEGMENT_LIMIT, "-1");
 105         expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS);
 106 
 107         Map<String, String> props = p.properties();
 108         int errors = 0;
 109         for (String key : expectedDefaults.keySet()) {
 110             String def = expectedDefaults.get(key);