< prev index next >

test/jdk/tools/jpackage/linux/base/Base.java

Print this page




  40 
  41     private static void testCreateInstaller() throws Exception {
  42         JPackageHelper.executeCLI(true, CMD);
  43         JPackageInstallerHelper.validateOutput(OUTPUT);
  44         copyResults();
  45     }
  46 
  47     private static void verifyInstall() throws Exception {
  48         String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
  49         JPackageInstallerHelper.validateApp(app);
  50     }
  51 
  52     private static void verifyUnInstall() throws Exception {
  53         String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
  54         File folder = new File(folderPath);
  55         if (folder.exists()) {
  56             throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
  57         }
  58     }
  59 











  60     private static void init(String name, String ext) {
  61         TEST_NAME = name;
  62         EXT = ext;
  63         if (EXT.equals("rpm")) {
  64             OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
  65         } else {
  66             OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
  67         }
  68         CMD = new String[]{
  69             "--package-type", EXT,
  70             "--input", "input",
  71             "--output", "output",
  72             "--name", TEST_NAME,
  73             "--main-jar", "hello.jar",
  74             "--main-class", "Hello" };
  75     }
  76 
  77     public static void run(String name, String ext) throws Exception {
  78         init(name, ext);
  79 
  80         if (JPackageInstallerHelper.isVerifyInstall()) {
  81             verifyInstall();
  82         } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
  83             verifyUnInstall();
  84         } else {


  40 
  41     private static void testCreateInstaller() throws Exception {
  42         JPackageHelper.executeCLI(true, CMD);
  43         JPackageInstallerHelper.validateOutput(OUTPUT);
  44         copyResults();
  45     }
  46 
  47     private static void verifyInstall() throws Exception {
  48         String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
  49         JPackageInstallerHelper.validateApp(app);
  50     }
  51 
  52     private static void verifyUnInstall() throws Exception {
  53         String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
  54         File folder = new File(folderPath);
  55         if (folder.exists()) {
  56             throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
  57         }
  58     }
  59 
  60     static String getRpmArch() {
  61         String arch = System.getProperty("os.arch"); // JVM arch
  62         if ("x86".equals(arch))
  63             return "i386";
  64         if ("amd64".equals(arch))
  65             return "x86_64";
  66         if ("arm".equals(arch))
  67             return "armv7hl";
  68         return arch;
  69     }
  70 
  71     private static void init(String name, String ext) {
  72         TEST_NAME = name;
  73         EXT = ext;
  74         if (EXT.equals("rpm")) {
  75             OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1." + getRpmArch() + "." + EXT;
  76         } else {
  77             OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
  78         }
  79         CMD = new String[]{
  80             "--package-type", EXT,
  81             "--input", "input",
  82             "--output", "output",
  83             "--name", TEST_NAME,
  84             "--main-jar", "hello.jar",
  85             "--main-class", "Hello" };
  86     }
  87 
  88     public static void run(String name, String ext) throws Exception {
  89         init(name, ext);
  90 
  91         if (JPackageInstallerHelper.isVerifyInstall()) {
  92             verifyInstall();
  93         } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
  94             verifyUnInstall();
  95         } else {
< prev index next >