< prev index next >

test/jdk/tools/jpackage/helpers/JPackageInstallerHelper.java

Print this page

        

*** 142,243 **** if (!file.exists()) { throw new AssertionError("Cannot find " + file.getAbsolutePath()); } } } - - public static void validateStartMenu(String menuGroup, String menu, boolean exist) - throws Exception { - String startMenuLink = JPackagePath.getWinStartMenu() + - File.separator + menuGroup + File.separator + - menu + ".lnk"; - - File link = new File(startMenuLink); - if (exist) { - if (!link.exists()) { - throw new AssertionError("Cannot find " + link.getAbsolutePath()); - } - } else { - if (link.exists()) { - throw new AssertionError("Error: " + link.getAbsolutePath() + " exist"); - } - } - } - - public static void validateDesktopShortcut(String name, boolean exist) - throws Exception { - String shortcutLink = JPackagePath.getWinPublicDesktop() + - File.separator + name + ".lnk"; - - File link = new File(shortcutLink); - if (exist) { - if (!link.exists()) { - throw new AssertionError("Cannot find " + link.getAbsolutePath()); - } - } else { - if (link.exists()) { - throw new AssertionError("Error: " + link.getAbsolutePath() + " exist"); - } - } - } - - public static void validateUserLocalStartMenu(String menuGroup, String menu, boolean exist) - throws Exception { - String startMenuLink = JPackagePath.getWinUserLocalStartMenu() + - File.separator + menuGroup + File.separator + - menu + ".lnk"; - - File link = new File(startMenuLink); - if (exist) { - if (!link.exists()) { - throw new AssertionError("Cannot find " + link.getAbsolutePath()); - } - } else { - if (link.exists()) { - throw new AssertionError("Error: " + link.getAbsolutePath() + " exist"); - } - } - } - - public static void validateWinRegistry(String key, String [] values, boolean retValZero) - throws Exception { - File outFile = new File("regOutput.txt"); - if (outFile.exists()) { - outFile.delete(); - } - - int retVal = JPackageHelper.execute(outFile, "reg.exe", "query", key); - if (retValZero) { - if (retVal != 0) { - System.out.println("validateWinRegistry() key=" + key); - if (outFile.exists()) { - System.err.println(Files.readString(outFile.toPath())); - } - throw new AssertionError( - "Reg.exe application exited with error: " + retVal); - } - } else { - if (retVal == 0) { - System.out.println("validateWinRegistry() key=" + key); - if (outFile.exists()) { - System.err.println(Files.readString(outFile.toPath())); - } - throw new AssertionError( - "Reg.exe application exited without error: " + retVal); - } else { - return; // Done - } - } - - if (!outFile.exists()) { - throw new AssertionError(outFile.getAbsolutePath() + " was not created"); - } - - String output = Files.readString(outFile.toPath()); - for (String value : values) { - if (!output.contains(value)) { - System.err.println(output); - throw new AssertionError("Cannot find in registry: " + value); - } - } - } } --- 142,147 ----
< prev index next >