< prev index next >

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

Print this page

        

*** 68,111 **** } @Test @Parameter("0") @Parameter("10") ! public void test(int wsfExitCode) { final ScriptData appImageScriptData; if (wsfExitCode != 0 && packageType == PackageType.WIN_EXE) { appImageScriptData = new ScriptData(PackageType.WIN_MSI, 0); } else { appImageScriptData = new ScriptData(PackageType.WIN_MSI, wsfExitCode); } final ScriptData msiScriptData = new ScriptData(PackageType.WIN_EXE, wsfExitCode); test.setExpectedExitCode(wsfExitCode == 0 ? 0 : 1); ! TKit.withTempDirectory("resources", tempDir -> { test.addInitializer(cmd -> { cmd.addArguments("--resource-dir", tempDir); appImageScriptData.createScript(cmd); msiScriptData.createScript(cmd); }); ! if (packageType == PackageType.WIN_MSI) { test.addBundleVerifier((cmd, result) -> { appImageScriptData.assertJPackageOutput(result.getOutput()); }); ! } ! if (packageType == PackageType.WIN_EXE) { test.addBundleVerifier((cmd, result) -> { appImageScriptData.assertJPackageOutput(result.getOutput()); msiScriptData.assertJPackageOutput(result.getOutput()); }); } test.run(); - }); } private static class ScriptData { ScriptData(PackageType scriptType, int wsfExitCode) { if (scriptType == PackageType.WIN_MSI) { --- 68,114 ---- } @Test @Parameter("0") @Parameter("10") ! public void test(int wsfExitCode) throws IOException { final ScriptData appImageScriptData; if (wsfExitCode != 0 && packageType == PackageType.WIN_EXE) { appImageScriptData = new ScriptData(PackageType.WIN_MSI, 0); } else { appImageScriptData = new ScriptData(PackageType.WIN_MSI, wsfExitCode); } final ScriptData msiScriptData = new ScriptData(PackageType.WIN_EXE, wsfExitCode); test.setExpectedExitCode(wsfExitCode == 0 ? 0 : 1); ! ! final Path tempDir = TKit.createTempDirectory("resources"); ! test.addInitializer(cmd -> { cmd.addArguments("--resource-dir", tempDir); appImageScriptData.createScript(cmd); msiScriptData.createScript(cmd); }); ! switch (packageType) { ! case WIN_MSI: test.addBundleVerifier((cmd, result) -> { appImageScriptData.assertJPackageOutput(result.getOutput()); }); ! break; ! case WIN_EXE: test.addBundleVerifier((cmd, result) -> { appImageScriptData.assertJPackageOutput(result.getOutput()); msiScriptData.assertJPackageOutput(result.getOutput()); }); + break; } test.run(); } private static class ScriptData { ScriptData(PackageType scriptType, int wsfExitCode) { if (scriptType == PackageType.WIN_MSI) {
< prev index next >