< prev index next >

test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageNoNameTest.java

Print this page




  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 import java.io.File;
  25 import java.nio.file.Files;
  26 
  27 /*
  28  * @test
  29  * @summary jpackage create image with no --name
  30  * @library ../helpers
  31  * @build JPackageHelper
  32  * @build JPackagePath
  33  * @modules jdk.jpackage
  34  * @run main/othervm -Xmx512m JPackageCreateImageNoNameTest
  35  */
  36 public class JPackageCreateImageNoNameTest {
  37     private static final String OUTPUT = "output";
  38     private static final String app = JPackagePath.getAppNoName();
  39     private static final String appOutput = JPackagePath.getAppOutputFile();
  40     private static final String appWorkingDir = JPackagePath.getAppWorkingDirNoName();
  41 
  42     private static final String[] CMD = {
  43         "create-image",
  44         "--input", "input",
  45         "--output", OUTPUT,
  46         "--main-jar", "hello.jar",
  47         "--main-class", "Hello",
  48         "--files", "hello.jar"};
  49 
  50     private static void validateResult(String[] result) throws Exception {
  51         if (result.length != 2) {
  52             throw new AssertionError(
  53                    "Unexpected number of lines: " + result.length);
  54         }
  55 
  56         if (!result[0].trim().equals("jpackage test application")) {
  57             throw new AssertionError("Unexpected result[0]: " + result[0]);
  58         }
  59 
  60         if (!result[1].trim().equals("args.length: 0")) {
  61             throw new AssertionError("Unexpected result[1]: " + result[1]);
  62         }
  63     }
  64 
  65     private static void validate() throws Exception {
  66         int retVal = JPackageHelper.execute(null, app);
  67         if (retVal != 0) {
  68             throw new AssertionError(




  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 import java.io.File;
  25 import java.nio.file.Files;
  26 
  27 /*
  28  * @test
  29  * @summary jpackage create image with no --name
  30  * @library ../helpers
  31  * @build JPackageHelper
  32  * @build JPackagePath
  33  * @modules jdk.jpackage
  34  * @run main/othervm -Xmx512m JPackageCreateAppImageNoNameTest
  35  */
  36 public class JPackageCreateAppImageNoNameTest {
  37     private static final String OUTPUT = "output";
  38     private static final String app = JPackagePath.getAppNoName();
  39     private static final String appOutput = JPackagePath.getAppOutputFile();
  40     private static final String appWorkingDir = JPackagePath.getAppWorkingDirNoName();
  41 
  42     private static final String[] CMD = {
  43         "create-app-image",
  44         "--input", "input",
  45         "--output", OUTPUT,
  46         "--main-jar", "hello.jar",
  47         "--main-class", "Hello",
  48     };
  49 
  50     private static void validateResult(String[] result) throws Exception {
  51         if (result.length != 2) {
  52             throw new AssertionError(
  53                    "Unexpected number of lines: " + result.length);
  54         }
  55 
  56         if (!result[0].trim().equals("jpackage test application")) {
  57             throw new AssertionError("Unexpected result[0]: " + result[0]);
  58         }
  59 
  60         if (!result[1].trim().equals("args.length: 0")) {
  61             throw new AssertionError("Unexpected result[1]: " + result[1]);
  62         }
  63     }
  64 
  65     private static void validate() throws Exception {
  66         int retVal = JPackageHelper.execute(null, app);
  67         if (retVal != 0) {
  68             throw new AssertionError(


< prev index next >