modules/fxpackager/src/test/java/com/oracle/tools/packager/linux/LinuxAppBundlerTest.java

Print this page




 202         bundler.validate(bundleParams);
 203 
 204         File output = bundler.execute(bundleParams, new File(workDir, "Unicode"));
 205         System.err.println("Bundle at - " + output);
 206         assertNotNull(output);
 207         assertTrue(output.exists());
 208     }
 209 
 210     public void validatePackageCfg(File root, Map<String, ? super Object> params) throws IOException {
 211         try (FileInputStream fis = new FileInputStream(new File(root, LinuxAppBundler.getLauncherCfgName(params)))) {
 212             Properties p = new Properties();
 213             p.load(fis);
 214 
 215             // - verify we have app.mainjar, app.version, app.preferences, app.mainclass, and app.classpath
 216             assertNotNull(p.getProperty("app.runtime"));
 217             assertNotNull(p.getProperty("app.mainjar"));
 218             assertNotNull(p.getProperty("app.version"));
 219             assertNotNull(p.getProperty("app.preferences.id"));
 220             assertNotNull(p.getProperty("app.mainclass"));
 221             assertNotNull(p.getProperty("app.classpath"));

 222 
 223             // - make sure 'app.classpath=null' doesn't show up, prefer 'app.classpath='
 224             assertFalse(p.getProperty("app.classpath").equals("null"));
 225         }
 226     }
 227 
 228     /**
 229      * Test a misconfiguration where the runtime is misconfigured.
 230      */
 231     @Test(expected = ConfigException.class)
 232     public void runtimeBad() throws IOException, ConfigException, UnsupportedPlatformException {
 233         Bundler bundler = new LinuxAppBundler();
 234 
 235         Map<String, Object> bundleParams = new HashMap<>();
 236 
 237         bundleParams.put(BUILD_ROOT.getID(), tmpBase);
 238         bundleParams.put(VERBOSE.getID(), true);
 239 
 240         bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources));
 241         bundleParams.put(LINUX_RUNTIME.getID(), APP_RESOURCES.fetchFrom(bundleParams));




 202         bundler.validate(bundleParams);
 203 
 204         File output = bundler.execute(bundleParams, new File(workDir, "Unicode"));
 205         System.err.println("Bundle at - " + output);
 206         assertNotNull(output);
 207         assertTrue(output.exists());
 208     }
 209 
 210     public void validatePackageCfg(File root, Map<String, ? super Object> params) throws IOException {
 211         try (FileInputStream fis = new FileInputStream(new File(root, LinuxAppBundler.getLauncherCfgName(params)))) {
 212             Properties p = new Properties();
 213             p.load(fis);
 214 
 215             // - verify we have app.mainjar, app.version, app.preferences, app.mainclass, and app.classpath
 216             assertNotNull(p.getProperty("app.runtime"));
 217             assertNotNull(p.getProperty("app.mainjar"));
 218             assertNotNull(p.getProperty("app.version"));
 219             assertNotNull(p.getProperty("app.preferences.id"));
 220             assertNotNull(p.getProperty("app.mainclass"));
 221             assertNotNull(p.getProperty("app.classpath"));
 222             assertNotNull(p.getProperty("app.identifier"));
 223 
 224             // - make sure 'app.classpath=null' doesn't show up, prefer 'app.classpath='
 225             assertFalse(p.getProperty("app.classpath").equals("null"));
 226         }
 227     }
 228 
 229     /**
 230      * Test a misconfiguration where the runtime is misconfigured.
 231      */
 232     @Test(expected = ConfigException.class)
 233     public void runtimeBad() throws IOException, ConfigException, UnsupportedPlatformException {
 234         Bundler bundler = new LinuxAppBundler();
 235 
 236         Map<String, Object> bundleParams = new HashMap<>();
 237 
 238         bundleParams.put(BUILD_ROOT.getID(), tmpBase);
 239         bundleParams.put(VERBOSE.getID(), true);
 240 
 241         bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources));
 242         bundleParams.put(LINUX_RUNTIME.getID(), APP_RESOURCES.fetchFrom(bundleParams));