modules/fxpackager/src/test/java/com/oracle/bundlers/mac/MacDMGBundlerTest.java
Print this page
@@ -25,11 +25,10 @@
package com.oracle.bundlers.mac;
import com.oracle.bundlers.AbstractBundler;
import com.oracle.bundlers.Bundler;
-import com.oracle.bundlers.StandardBundlerParam;
import com.sun.javafx.tools.packager.Log;
import com.sun.javafx.tools.packager.bundlers.*;
import org.junit.After;
import org.junit.Assume;
import org.junit.Before;
@@ -39,10 +38,11 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.*;
+import static com.oracle.bundlers.StandardBundlerParam.*;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class MacDMGBundlerTest {
@@ -110,30 +110,34 @@
* See if smoke comes out
*/
@Test
public void smokeTest() throws IOException, ConfigException, UnsupportedPlatformException {
AbstractBundler bundler = new MacDMGBundler();
- bundler.setVerbose(true);
assertNotNull(bundler.getName());
assertNotNull(bundler.getID());
assertNotNull(bundler.getDescription());
//assertNotNull(bundler.getBundleParameters());
Map<String, Object> bundleParams = new HashMap<>();
- bundleParams.put(StandardBundlerParam.BUILD_ROOT.getID(), tmpBase);
+ bundleParams.put(BUILD_ROOT.getID(), tmpBase);
- bundleParams.put(StandardBundlerParam.NAME.getID(), "Smoke");
- bundleParams.put(StandardBundlerParam.MAIN_CLASS.getID(), "hello.TestPackager");
- bundleParams.put(StandardBundlerParam.APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources));
+ bundleParams.put(APP_NAME.getID(), "Smoke");
+ bundleParams.put(MAIN_CLASS.getID(), "hello.TestPackager");
+ bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources));
+ bundleParams.put(VERBOSE.getID(), true);
// bundleParams.put(StandardBundlerParam.MAIN_JAR.getID(), new RelativeFileSet(appResourcesDir, appResources));
- bundleParams.put(StandardBundlerParam.RUNTIME.getID(),
- StandardBundlerParam.extractJreAsRelativeFileSet("~/tools/jdk1.8.0.jdk/Contents/Home/jre"));
-
- bundler.execute(bundleParams, new File(workDir, "smoke"));
+// bundleParams.put(StandardBundlerParam.RUNTIME.getID(),
+// JreUtils.extractJreAsRelativeFileSet(MacAppBundler.adjustMacRuntimePath(System.getProperty("java.home")),
+// MacAppBundler.macJDKRules));
+
+ File result = bundler.execute(bundleParams, new File(workDir, "smoke"));
+ System.err.println("Bundle at - " + result);
+ assertNotNull(result);
+ assertTrue(result.exists());
}
/**
* The bare minimum configuration needed to make it work
* <ul>
@@ -144,20 +148,18 @@
* All other values will be driven off of those two values.
*/
@Test
public void minimumConfig() throws IOException, ConfigException, UnsupportedPlatformException {
Bundler bundler = new MacDMGBundler();
- ((AbstractBundler)bundler).setVerbose(true);
Map<String, Object> bundleParams = new HashMap<>();
- bundleParams.put(StandardBundlerParam.BUILD_ROOT.getID(), tmpBase);
+ bundleParams.put(BUILD_ROOT.getID(), tmpBase);
- bundleParams.put(StandardBundlerParam.NAME.getID(), "Smoke");
- bundleParams.put(StandardBundlerParam.APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources));
+ bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources));
File output = bundler.execute(bundleParams, new File(workDir, "BareMinimum"));
- System.err.println("Bundle written to " + output);
- assertTrue(output.isFile());
- //TODO assert file name
+ System.err.println("Bundle at - " + output);
+ assertNotNull(output);
+ assertTrue(output.exists());
}
}