31 import jdk.jpackage.test.Functional; |
31 import jdk.jpackage.test.Functional; |
32 import jdk.jpackage.test.JPackageCommand; |
32 import jdk.jpackage.test.JPackageCommand; |
33 import jdk.jpackage.test.Annotations.Parameter; |
33 import jdk.jpackage.test.Annotations.Parameter; |
34 |
34 |
35 /** |
35 /** |
36 * Test --install-dir parameter. Output of the test should be installdirtest*.* |
36 * Test --install-dir parameter. Output of the test should be |
37 * package bundle. The output package should provide the same functionality as |
37 * commoninstalldirtest*.* package bundle. The output package should provide the |
38 * the default package but install test application in specified directory. |
38 * same functionality as the default package but install test application in |
|
39 * specified directory. |
39 * |
40 * |
40 * Linux: |
41 * Linux: |
41 * |
42 * |
42 * Application should be installed in /opt/jpackage/installdirtest folder. |
43 * Application should be installed in /opt/jpackage/commoninstalldirtest folder. |
43 * |
44 * |
44 * Mac: |
45 * Mac: |
45 * |
46 * |
46 * Application should be installed in /Applications/jpackage/installdirtest.app |
47 * Application should be installed in /Applications/jpackage/commoninstalldirtest.app |
47 * folder. |
48 * folder. |
48 * |
49 * |
49 * Windows: |
50 * Windows: |
50 * |
51 * |
51 * Application should be installed in %ProgramFiles%/TestVendor/InstallDirTest1234 |
52 * Application should be installed in %ProgramFiles%/TestVendor/InstallDirTest1234 |
114 } |
115 } |
115 |
116 |
116 private static void testLinuxBad(String installDir, |
117 private static void testLinuxBad(String installDir, |
117 String errorMessageSubstring) { |
118 String errorMessageSubstring) { |
118 new PackageTest().configureHelloApp() |
119 new PackageTest().configureHelloApp() |
119 .setExpectedExitCode(1) |
120 .setExpectedExitCode(1) |
120 .forTypes(PackageType.LINUX) |
121 .forTypes(PackageType.LINUX) |
121 .addInitializer(cmd -> { |
122 .addInitializer(cmd -> { |
122 cmd.addArguments("--install-dir", installDir); |
123 cmd.addArguments("--install-dir", installDir); |
123 cmd.saveConsoleOutput(true); |
124 cmd.saveConsoleOutput(true); |
124 }) |
125 }) |
125 .addBundleVerifier((cmd, result) -> { |
126 .addBundleVerifier((cmd, result) -> { |
126 String errorMessage = JPackageCommand.filterOutput(result. |
127 String errorMessage = JPackageCommand.filterOutput( |
127 getOutput().stream()).filter(line -> line.contains( |
128 result.getOutput().stream()).filter(line -> line.contains( |
128 errorMessageSubstring)).findFirst().orElse(null); |
129 errorMessageSubstring)).findFirst().orElse(null); |
129 TKit.assertNotNull(errorMessage, String.format( |
130 TKit.assertNotNull(errorMessage, String.format( |
130 "Check output contains [%s] substring", |
131 "Check output contains [%s] substring", |
131 errorMessageSubstring)); |
132 errorMessageSubstring)); |
132 }) |
133 }) |
133 .run(); |
134 .run(); |
134 } |
135 } |
135 } |
136 } |