< prev index next >

test/jdk/tools/jpackage/windows/WinConsoleTest.java

Print this page




  31  * @summary jpackage create image win console test
  32  * @library ../helpers
  33  * @library ../share
  34  * @build JPackageHelper
  35  * @build JPackagePath
  36  * @build Base
  37  * @requires (os.family == "windows")
  38  * @modules jdk.jpackage
  39  * @run main/othervm -Xmx512m WinConsoleTest
  40  */
  41 
  42 public class WinConsoleTest {
  43     private static final String NAME = "test";
  44     private static final String OUTPUT = "output";
  45     private static final String OUTPUT_WIN_CONSOLE = "outputWinConsole";
  46     private static final int BUFFER_SIZE = 512;
  47     private static final int GUI_SUBSYSTEM = 2;
  48     private static final int CONSOLE_SUBSYSTEM = 3;
  49 
  50     private static final String [] CMD = {

  51         "--input", "input",
  52         "--output", OUTPUT,
  53         "--name", NAME,
  54         "--main-jar", "hello.jar",
  55         "--main-class", "Hello",
  56     };
  57 
  58     private static final String [] CMD_WIN_CONSOLE = {

  59         "--input", "input",
  60         "--output", OUTPUT_WIN_CONSOLE,
  61         "--name", NAME,
  62         "--main-jar", "hello.jar",
  63         "--main-class", "Hello",
  64         "--win-console"
  65     };
  66 
  67     private static void checkSubsystem(boolean console) throws Exception {
  68         Path path = Path.of(console ? OUTPUT_WIN_CONSOLE : OUTPUT,
  69                 NAME, NAME + ".exe");
  70 
  71         System.out.println("validate path: " + path.toString());
  72         Base.validate(path.toString());
  73 
  74         try (InputStream inputStream = new FileInputStream(path.toString())) {
  75             byte [] bytes = new byte[BUFFER_SIZE];
  76             if (inputStream.read(bytes) != BUFFER_SIZE) {
  77                 throw new AssertionError("Wrong number of bytes read");
  78             }




  31  * @summary jpackage create image win console test
  32  * @library ../helpers
  33  * @library ../share
  34  * @build JPackageHelper
  35  * @build JPackagePath
  36  * @build Base
  37  * @requires (os.family == "windows")
  38  * @modules jdk.jpackage
  39  * @run main/othervm -Xmx512m WinConsoleTest
  40  */
  41 
  42 public class WinConsoleTest {
  43     private static final String NAME = "test";
  44     private static final String OUTPUT = "output";
  45     private static final String OUTPUT_WIN_CONSOLE = "outputWinConsole";
  46     private static final int BUFFER_SIZE = 512;
  47     private static final int GUI_SUBSYSTEM = 2;
  48     private static final int CONSOLE_SUBSYSTEM = 3;
  49 
  50     private static final String [] CMD = {
  51         "--package-type", "app-image",
  52         "--input", "input",
  53         "--output", OUTPUT,
  54         "--name", NAME,
  55         "--main-jar", "hello.jar",
  56         "--main-class", "Hello",
  57     };
  58 
  59     private static final String [] CMD_WIN_CONSOLE = {
  60         "--package-type", "app-image",
  61         "--input", "input",
  62         "--output", OUTPUT_WIN_CONSOLE,
  63         "--name", NAME,
  64         "--main-jar", "hello.jar",
  65         "--main-class", "Hello",
  66         "--win-console"
  67     };
  68 
  69     private static void checkSubsystem(boolean console) throws Exception {
  70         Path path = Path.of(console ? OUTPUT_WIN_CONSOLE : OUTPUT,
  71                 NAME, NAME + ".exe");
  72 
  73         System.out.println("validate path: " + path.toString());
  74         Base.validate(path.toString());
  75 
  76         try (InputStream inputStream = new FileInputStream(path.toString())) {
  77             byte [] bytes = new byte[BUFFER_SIZE];
  78             if (inputStream.read(bytes) != BUFFER_SIZE) {
  79                 throw new AssertionError("Wrong number of bytes read");
  80             }


< prev index next >