21
21
* questions.
22
22
*/
23
23
24
+ import java .io .IOException ;
24
25
import java .nio .file .Files ;
25
26
import java .nio .file .Path ;
26
- import jdk .jpackage .test .TKit ;
27
27
import jdk .jpackage .test .Annotations .Test ;
28
+ import jdk .jpackage .test .Executor ;
28
29
import jdk .jpackage .test .JPackageCommand ;
29
30
import jdk .jpackage .test .JavaTool ;
30
- import jdk .jpackage .test .Executor ;
31
+ import jdk .jpackage .test .TKit ;
31
32
32
33
/*
33
34
* @test
43
44
public class RuntimeImageTest {
44
45
45
46
@ Test
46
- public static void test () throws Exception {
47
+ public static void test () throws IOException {
47
48
48
49
JPackageCommand cmd = JPackageCommand .helloAppImage ();
49
50
@@ -70,4 +71,27 @@ public static void test() throws Exception {
70
71
cmd .executeAndAssertHelloAppImageCreated ();
71
72
}
72
73
74
+ @ Test
75
+ public static void testStrippedFiles () throws IOException {
76
+ final var cmd = JPackageCommand .helloAppImage ().setFakeRuntime ();
77
+
78
+ final var runtimePath = Path .of (cmd .executePrerequisiteActions ().getArgumentValue ("--runtime-image" ));
79
+
80
+ Files .createDirectories (runtimePath .resolve ("jmods" ));
81
+ Files .createDirectories (runtimePath .resolve ("lib" ));
82
+ Files .createFile (runtimePath .resolve ("lib/src.zip" ));
83
+ Files .createFile (runtimePath .resolve ("src.zip" ));
84
+
85
+ Files .createDirectories (runtimePath .resolve ("foo/bar/src.zip" ));
86
+ Files .createDirectories (runtimePath .resolve ("custom/jmods" ));
87
+
88
+ (new JPackageCommand ()).addArguments (cmd .getAllArguments ()).executeAndAssertHelloAppImageCreated ();
89
+
90
+ final var appRuntimeDir = cmd .appLayout ().runtimeHomeDirectory ();
91
+ TKit .assertPathExists (appRuntimeDir .resolve ("jmods" ), false );
92
+ TKit .assertPathExists (appRuntimeDir .resolve ("lib/src.zip" ), false );
93
+ TKit .assertPathExists (appRuntimeDir .resolve ("src.zip" ), false );
94
+ TKit .assertDirectoryExists (appRuntimeDir .resolve ("foo/bar/src.zip" ));
95
+ TKit .assertDirectoryExists (appRuntimeDir .resolve ("custom/jmods" ));
96
+ }
73
97
}
0 commit comments