modules/fxpackager/src/test/java/com/oracle/tools/packager/windows/WinMsiBundlerTest.java
Print this page
@@ -62,18 +62,23 @@
static File tmpBase;
static File workDir;
static File appResourcesDir;
static File fakeMainJar;
+ static String runtimeJdk;
+ static String runtimeJre;
static Set<File> appResources;
static boolean retain = false;
@BeforeClass
public static void prepareApp() {
// only run on windows
Assume.assumeTrue(System.getProperty("os.name").toLowerCase().startsWith("win"));
+ runtimeJdk = System.getenv("PACKAGER_JDK_ROOT");
+ runtimeJre = System.getenv("PACKAGER_JRE_ROOT");
+
// only run if we have Wix tools installed
Assume.assumeNotNull(WinMsiBundler.TOOL_LIGHT_EXECUTABLE.fetchFrom(new HashMap<>()));
Assume.assumeNotNull(WinMsiBundler.TOOL_CANDLE_EXECUTABLE.fetchFrom(new HashMap<>()));
Log.setLogger(new Log.Logger(true));
@@ -538,6 +543,38 @@
File result = bundler.execute(bundleParams, new File(workDir, APP_FS_NAME.fetchFrom(bundleParams)));
System.err.println("Bundle at - " + result);
assertNotNull(result);
assertTrue(result.exists());
}
+
+
+ /**
+ * Turn on AppCDS
+ */
+ @Test
+ public void testAppCDS() throws IOException, ConfigException, UnsupportedPlatformException {
+ Bundler bundler = new WinMsiBundler();
+
+ Map<String, Object> bundleParams = new HashMap<>();
+
+ // not part of the typical setup, for testing
+ bundleParams.put(BUILD_ROOT.getID(), tmpBase);
+ bundleParams.put(VERBOSE.getID(), true);
+ if (runtimeJdk != null) {
+ bundleParams.put(WIN_RUNTIME.getID(), runtimeJdk);
+ }
+
+ bundleParams.put(APP_NAME.getID(), "AppCDS");
+ bundleParams.put(IDENTIFIER.getID(), "com.example.appcds.msi.Test");
+ bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources));
+ bundleParams.put(UNLOCK_COMMERCIAL_FEATURES.getID(), true);
+ bundleParams.put(ENABLE_APP_CDS.getID(), true);
+
+ boolean valid = bundler.validate(bundleParams);
+ assertTrue(valid);
+
+ File output = bundler.execute(bundleParams, new File(workDir, "CDSTest"));
+ System.err.println("Bundle at - " + output);
+ assertNotNull(output);
+ assertTrue(output.exists());
+ }
}