< prev index next >

modules/fxpackager/src/test/java/com/oracle/tools/packager/mac/MacDaemonBundlerTest.java

Print this page
rev 9619 : imported patch 9-jake-fxpackager.patch


  31 import static com.oracle.tools.packager.StandardBundlerParam.VERBOSE;
  32 import static com.oracle.tools.packager.StandardBundlerParam.SYSTEM_WIDE;
  33 
  34 import java.io.File;
  35 import java.io.IOException;
  36 import java.nio.file.Files;
  37 import java.util.HashMap;
  38 import java.util.Map;
  39 
  40 import com.oracle.tools.packager.AbstractBundler;
  41 import com.oracle.tools.packager.Log;
  42 import com.oracle.tools.packager.ConfigException;
  43 import com.oracle.tools.packager.UnsupportedPlatformException;
  44 
  45 import org.junit.After;
  46 import org.junit.Assume;
  47 import org.junit.Before;
  48 import org.junit.BeforeClass;
  49 import org.junit.Test;
  50 
  51 import static com.oracle.tools.packager.mac.MacAppBundler.MAC_RUNTIME;
  52 import static org.junit.Assert.assertNotNull;
  53 import static org.junit.Assert.assertTrue;
  54 
  55 
  56 public class MacDaemonBundlerTest {
  57 
  58     static File tmpBase;
  59     static File workDir;
  60     static String runtimeJdk;
  61     static boolean retain = false;
  62 
  63     @BeforeClass
  64     public static void prepareApp() {
  65         // only run on mac
  66         Assume.assumeTrue(System.getProperty("os.name").toLowerCase().contains("os x"));
  67 
  68         runtimeJdk = System.getenv("PACKAGER_JDK_ROOT");
  69 
  70         // and only if we have the correct JRE settings
  71         String jre = System.getProperty("java.home").toLowerCase();


 121      */
 122     @Test
 123     public void smokeTest() throws IOException, ConfigException, UnsupportedPlatformException {
 124         AbstractBundler bundler = new MacDaemonBundler();
 125 
 126         assertNotNull(bundler.getName());
 127         assertNotNull(bundler.getID());
 128         assertNotNull(bundler.getDescription());
 129         //assertNotNull(bundler.getBundleParameters());
 130 
 131         Map<String, Object> bundleParams = new HashMap<>();
 132 
 133         bundleParams.put(BUILD_ROOT.getID(), tmpBase);
 134 
 135         bundleParams.put(APP_NAME.getID(), "Smoke Test App");
 136         bundleParams.put(IDENTIFIER.getID(), "smoke.app");
 137         bundleParams.put(VERBOSE.getID(), true);
 138         bundleParams.put(SYSTEM_WIDE.getID(), true);
 139 
 140         if (runtimeJdk != null) {
 141             bundleParams.put(MAC_RUNTIME.getID(), runtimeJdk);
 142         }
 143 
 144         boolean valid = bundler.validate(bundleParams);
 145         assertTrue(valid);
 146 
 147         File result = bundler.execute(bundleParams, new File(workDir, "smoke"));
 148         System.err.println("Bundle at - " + result);
 149         assertNotNull(result);
 150         assertTrue(result.exists());
 151     }
 152 
 153     /*
 154      * Test that bundler doesn't support per-user daemons (RT-37985)
 155      */
 156     @Test(expected = ConfigException.class)
 157     public void perUserDaemonTest() throws ConfigException, UnsupportedPlatformException {
 158         AbstractBundler bundler = new MacDaemonBundler();
 159 
 160         Map<String, Object> bundleParams = new HashMap<>();
 161         bundleParams.put(SYSTEM_WIDE.getID(), false);


  31 import static com.oracle.tools.packager.StandardBundlerParam.VERBOSE;
  32 import static com.oracle.tools.packager.StandardBundlerParam.SYSTEM_WIDE;
  33 
  34 import java.io.File;
  35 import java.io.IOException;
  36 import java.nio.file.Files;
  37 import java.util.HashMap;
  38 import java.util.Map;
  39 
  40 import com.oracle.tools.packager.AbstractBundler;
  41 import com.oracle.tools.packager.Log;
  42 import com.oracle.tools.packager.ConfigException;
  43 import com.oracle.tools.packager.UnsupportedPlatformException;
  44 
  45 import org.junit.After;
  46 import org.junit.Assume;
  47 import org.junit.Before;
  48 import org.junit.BeforeClass;
  49 import org.junit.Test;
  50 

  51 import static org.junit.Assert.assertNotNull;
  52 import static org.junit.Assert.assertTrue;
  53 
  54 
  55 public class MacDaemonBundlerTest {
  56 
  57     static File tmpBase;
  58     static File workDir;
  59     static String runtimeJdk;
  60     static boolean retain = false;
  61 
  62     @BeforeClass
  63     public static void prepareApp() {
  64         // only run on mac
  65         Assume.assumeTrue(System.getProperty("os.name").toLowerCase().contains("os x"));
  66 
  67         runtimeJdk = System.getenv("PACKAGER_JDK_ROOT");
  68 
  69         // and only if we have the correct JRE settings
  70         String jre = System.getProperty("java.home").toLowerCase();


 120      */
 121     @Test
 122     public void smokeTest() throws IOException, ConfigException, UnsupportedPlatformException {
 123         AbstractBundler bundler = new MacDaemonBundler();
 124 
 125         assertNotNull(bundler.getName());
 126         assertNotNull(bundler.getID());
 127         assertNotNull(bundler.getDescription());
 128         //assertNotNull(bundler.getBundleParameters());
 129 
 130         Map<String, Object> bundleParams = new HashMap<>();
 131 
 132         bundleParams.put(BUILD_ROOT.getID(), tmpBase);
 133 
 134         bundleParams.put(APP_NAME.getID(), "Smoke Test App");
 135         bundleParams.put(IDENTIFIER.getID(), "smoke.app");
 136         bundleParams.put(VERBOSE.getID(), true);
 137         bundleParams.put(SYSTEM_WIDE.getID(), true);
 138 
 139         if (runtimeJdk != null) {
 140 //FIXME            bundleParams.put(MAC_RUNTIME.getID(), runtimeJdk);
 141         }
 142 
 143         boolean valid = bundler.validate(bundleParams);
 144         assertTrue(valid);
 145 
 146         File result = bundler.execute(bundleParams, new File(workDir, "smoke"));
 147         System.err.println("Bundle at - " + result);
 148         assertNotNull(result);
 149         assertTrue(result.exists());
 150     }
 151 
 152     /*
 153      * Test that bundler doesn't support per-user daemons (RT-37985)
 154      */
 155     @Test(expected = ConfigException.class)
 156     public void perUserDaemonTest() throws ConfigException, UnsupportedPlatformException {
 157         AbstractBundler bundler = new MacDaemonBundler();
 158 
 159         Map<String, Object> bundleParams = new HashMap<>();
 160         bundleParams.put(SYSTEM_WIDE.getID(), false);
< prev index next >