1 /* 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.oracle.tools.packager.linux; 27 28 import com.oracle.tools.packager.AbstractBundler; 29 import com.oracle.tools.packager.Bundler; 30 import com.oracle.tools.packager.BundlerParamInfo; 31 import com.oracle.tools.packager.BundlersTest; 32 import com.oracle.tools.packager.ConfigException; 33 import com.oracle.tools.packager.Log; 34 import com.oracle.tools.packager.RelativeFileSet; 35 import com.oracle.tools.packager.StandardBundlerParam; 36 import com.oracle.tools.packager.UnsupportedPlatformException; 37 import org.junit.After; 38 import org.junit.Assume; 39 import org.junit.Before; 40 import org.junit.BeforeClass; 41 import org.junit.Test; 42 43 import java.io.File; 44 import java.io.IOException; 45 import java.util.ArrayList; 46 import java.util.Arrays; 47 import java.util.Collection; 48 import java.util.HashMap; 49 import java.util.HashSet; 50 import java.util.List; 51 import java.util.Map; 52 import java.util.Set; 53 import java.util.TreeMap; 54 55 import static com.oracle.tools.packager.StandardBundlerParam.*; 56 import static com.oracle.tools.packager.linux.LinuxDebBundler.BUNDLE_NAME; 57 import static com.oracle.tools.packager.linux.LinuxDebBundler.EMAIL; 58 import static org.junit.Assert.*; 59 60 public class LinuxDebBundlerTest { 61 62 static File tmpBase; 63 static File workDir; 64 static File appResourcesDir; 65 static File fakeMainJar; 66 static Set<File> appResources; 67 static boolean retain = false; 68 69 @BeforeClass 70 public static void prepareApp() { 71 // only run on linux 72 Assume.assumeTrue(System.getProperty("os.name").toLowerCase().startsWith("linux")); 73 74 Assume.assumeTrue(LinuxDebBundler.testTool(LinuxDebBundler.TOOL_DPKG, "1")); 75 76 Log.setLogger(new Log.Logger(true)); 77 Log.setDebug(true); 78 79 retain = Boolean.parseBoolean(System.getProperty("RETAIN_PACKAGER_TESTS")); 80 81 workDir = new File("build/tmp/tests", "linuxdeb"); 82 appResourcesDir = new File("build/tmp/tests", "appResources"); 83 fakeMainJar = new File(appResourcesDir, "mainApp.jar"); 84 85 appResources = new HashSet<>(Arrays.asList(fakeMainJar, 86 new File(appResourcesDir, "LICENSE"), 87 new File(appResourcesDir, "LICENSE2") 88 )); 89 } 90 91 @Before 92 public void createTmpDir() throws IOException { 93 if (retain) { 94 tmpBase = new File("build/tmp/tests/linuxdeb"); 95 } else { 96 tmpBase = BUILD_ROOT.fetchFrom(new TreeMap<>()); 97 } 98 tmpBase.mkdir(); 99 } 100 101 @After 102 public void maybeCleanupTmpDir() { 103 if (!retain) { 104 attemptDelete(tmpBase); 105 } 106 } 107 108 private void attemptDelete(File tmpBase) { 109 if (tmpBase.isDirectory()) { 110 File[] children = tmpBase.listFiles(); 111 if (children != null) { 112 for (File f : children) { 113 attemptDelete(f); 114 } 115 } 116 } 117 boolean success; 118 try { 119 success = !tmpBase.exists() || tmpBase.delete(); 120 } catch (SecurityException se) { 121 success = false; 122 } 123 if (!success) { 124 System.err.println("Could not clean up " + tmpBase.toString()); 125 } 126 } 127 128 @Test 129 public void testAppNameForDebBundler() { 130 // valid names for deb package 131 BundlersTest.testValidValueForBaseParam(StandardBundlerParam.APP_NAME, "test", LinuxDebBundler.BUNDLE_NAME); 132 BundlersTest.testValidValueForBaseParam(StandardBundlerParam.APP_NAME, "te", LinuxDebBundler.BUNDLE_NAME); 133 134 // invalid name with cyrillic characters 135 BundlersTest.testInvalidValueForBaseParam(StandardBundlerParam.APP_NAME, "\u0442\u0435\u0441\u0442", LinuxDebBundler.BUNDLE_NAME); 136 // invalid name that starts with digit 137 BundlersTest.testInvalidValueForBaseParam(StandardBundlerParam.APP_NAME, "1test", LinuxDebBundler.BUNDLE_NAME); 138 // invalid name that one character long 139 BundlersTest.testInvalidValueForBaseParam(StandardBundlerParam.APP_NAME, "t", LinuxDebBundler.BUNDLE_NAME); 140 } 141 142 /** 143 * See if smoke comes out 144 */ 145 @Test 146 public void smokeTest() throws IOException, ConfigException, UnsupportedPlatformException { 147 Bundler bundler = new LinuxDebBundler(); 148 149 assertNotNull(bundler.getName()); 150 assertNotNull(bundler.getID()); 151 assertNotNull(bundler.getDescription()); 152 //assertNotNull(bundler.getBundleParameters()); 153 154 Map<String, Object> bundleParams = new HashMap<>(); 155 156 bundleParams.put(BUILD_ROOT.getID(), tmpBase); 157 158 bundleParams.put(APP_NAME.getID(), "Smoke Test"); 159 bundleParams.put(MAIN_CLASS.getID(), "hello.HelloRectangle"); 160 bundleParams.put(PREFERENCES_ID.getID(), "the/really/long/preferences/id"); 161 bundleParams.put(MAIN_JAR.getID(), 162 new RelativeFileSet(fakeMainJar.getParentFile(), 163 new HashSet<>(Arrays.asList(fakeMainJar))) 164 ); 165 bundleParams.put(CLASSPATH.getID(), "mainApp.jar"); 166 bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources)); 167 bundleParams.put(LICENSE_FILE.getID(), Arrays.asList("LICENSE", "LICENSE2")); 168 bundleParams.put(LICENSE_TYPE.getID(), "GPL2 + Classpath Exception"); 169 bundleParams.put(VERBOSE.getID(), true); 170 bundleParams.put(ICON.getID(), "java-logo2.gif"); 171 172 boolean valid = bundler.validate(bundleParams); 173 assertTrue(valid); 174 175 File result = bundler.execute(bundleParams, new File(workDir, "smoke")); 176 System.err.println("Bundle at - " + result); 177 assertNotNull(result); 178 assertTrue(result.exists()); 179 } 180 181 /** 182 * The bare minimum configuration needed to make it work 183 * <ul> 184 * <li>Where to build it</li> 185 * <li>The jar containing the application (with a main-class attribute)</li> 186 * </ul> 187 * 188 * All other values will be driven off of those two values. 189 */ 190 @Test 191 public void minimumConfig() throws IOException, ConfigException, UnsupportedPlatformException { 192 Bundler bundler = new LinuxDebBundler(); 193 194 Map<String, Object> bundleParams = new HashMap<>(); 195 196 bundleParams.put(BUILD_ROOT.getID(), tmpBase); 197 198 bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources)); 199 200 File output = bundler.execute(bundleParams, new File(workDir, "BareMinimum")); 201 System.err.println("Bundle at - " + output); 202 assertNotNull(output); 203 assertTrue(output.exists()); 204 } 205 206 /** 207 * Test with unicode in places we expect it to be 208 */ 209 @Test 210 public void unicodeConfig() throws IOException, ConfigException, UnsupportedPlatformException { 211 Bundler bundler = new LinuxDebBundler(); 212 213 Map<String, Object> bundleParams = new HashMap<>(); 214 215 bundleParams.put(BUILD_ROOT.getID(), tmpBase); 216 217 bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources)); 218 219 bundleParams.put(APP_NAME.getID(), "хелловорлд"); 220 bundleParams.put(TITLE.getID(), "ХеллоВорлд аппликейшн"); 221 bundleParams.put(VENDOR.getID(), "Оракл девелопмент"); 222 bundleParams.put(DESCRIPTION.getID(), "крайне большое описание со странными символами"); 223 bundleParams.put(EMAIL.getID(), "вася@пупкин.ком"); 224 225 // mandatory re-names 226 bundleParams.put(BUNDLE_NAME.getID(), "helloworld"); 227 228 bundler.validate(bundleParams); 229 230 File output = bundler.execute(bundleParams, new File(workDir, "Unicode")); 231 System.err.println("Bundle at - " + output); 232 assertNotNull(output); 233 assertTrue(output.exists()); 234 } 235 236 /** 237 * prove we fail when bundlename inherited from appname is bad 238 */ 239 @Test(expected = ConfigException.class) 240 public void badUnicodeAppName() throws IOException, ConfigException, UnsupportedPlatformException { 241 Bundler bundler = new LinuxDebBundler(); 242 243 Map<String, Object> bundleParams = new HashMap<>(); 244 245 bundleParams.put(BUILD_ROOT.getID(), tmpBase); 246 247 bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources)); 248 249 bundleParams.put(APP_NAME.getID(), "хелловорлд"); 250 251 bundler.validate(bundleParams); 252 } 253 254 @Test(expected = ConfigException.class) 255 public void invalidLicenseFile() throws ConfigException, UnsupportedPlatformException { 256 Bundler bundler = new LinuxDebBundler(); 257 258 Map<String, Object> bundleParams = new HashMap<>(); 259 260 bundleParams.put(BUILD_ROOT.getID(), tmpBase); 261 262 bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources)); 263 bundleParams.put(LICENSE_FILE.getID(), "BOGUS_LICENSE"); 264 265 bundler.validate(bundleParams); 266 } 267 268 @Test 269 public void configureEverything() throws Exception { 270 Bundler bundler = new LinuxDebBundler(); 271 Collection<BundlerParamInfo<?>> parameters = bundler.getBundleParameters(); 272 273 Map<String, Object> bundleParams = new HashMap<>(); 274 275 bundleParams.put(APP_NAME.getID(), "Everything App Name"); 276 bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources)); 277 bundleParams.put(ARGUMENTS.getID(), Arrays.asList("He Said", "She Said")); 278 bundleParams.put(CLASSPATH.getID(), "mainApp.jar"); 279 bundleParams.put(LinuxAppBundler.LINUX_RUNTIME.getID(), System.getProperty("java.home")); 280 bundleParams.put(JVM_OPTIONS.getID(), "-Xms128M"); 281 bundleParams.put(JVM_PROPERTIES.getID(), "everything.jvm.property=everything.jvm.property.value"); 282 bundleParams.put(MAIN_CLASS.getID(), "hello.HelloRectangle"); 283 bundleParams.put(MAIN_JAR.getID(), "mainApp.jar"); 284 bundleParams.put(PREFERENCES_ID.getID(), "everything/preferences/id"); 285 bundleParams.put(PRELOADER_CLASS.getID(), "hello.HelloPreloader"); 286 bundleParams.put(USER_JVM_OPTIONS.getID(), "-Xmx=256M\n"); 287 bundleParams.put(VERSION.getID(), "1.2.3.4"); 288 289 bundleParams.put(BUNDLE_NAME.getID(), "everything-bundle-name"); 290 bundleParams.put(COPYRIGHT.getID(), "(C) 2014 - Everything Copyright"); 291 bundleParams.put(CATEGORY.getID(), "everything category"); 292 bundleParams.put(DESCRIPTION.getID(), "This is a description of everything"); 293 bundleParams.put(EMAIL.getID(), "everything@example.com"); 294 bundleParams.put(LinuxAppBundler.ICON_PNG.getID(), "javalogo_white_48.png"); 295 bundleParams.put(LICENSE_FILE.getID(), "LICENSE"); 296 bundleParams.put(LICENSE_TYPE.getID(), "GPL v2 + CLASSPATH"); 297 bundleParams.put(TITLE.getID(), "Everything Title"); 298 bundleParams.put(VENDOR.getID(), "Everything Vendor"); 299 300 // assert they are set 301 for (BundlerParamInfo bi : parameters) { 302 assertTrue("Bundle args should contain " + bi.getID(), bundleParams.containsKey(bi.getID())); 303 } 304 305 // and only those are set 306 bundleParamLoop: 307 for (String s : bundleParams.keySet()) { 308 for (BundlerParamInfo<?> bpi : parameters) { 309 if (s.equals(bpi.getID())) { 310 continue bundleParamLoop; 311 } 312 } 313 fail("Enumerated parameters does not contain " + s); 314 } 315 316 // assert they resolve 317 for (BundlerParamInfo bi : parameters) { 318 bi.fetchFrom(bundleParams); 319 } 320 321 // add verbose now that we are done scoping out parameters 322 bundleParams.put(BUILD_ROOT.getID(), tmpBase); 323 bundleParams.put(VERBOSE.getID(), true); 324 325 // assert it validates 326 boolean valid = bundler.validate(bundleParams); 327 assertTrue(valid); 328 329 // only run the bundle with full tests 330 Assume.assumeTrue(Boolean.parseBoolean(System.getProperty("FULL_TEST"))); 331 332 File result = bundler.execute(bundleParams, new File(workDir, "everything")); 333 System.err.println("Bundle at - " + result); 334 assertNotNull(result); 335 assertTrue(result.exists()); 336 } 337 338 @Test 339 public void servicePackage() throws Exception { 340 Bundler bundler = new LinuxDebBundler(); 341 342 Map<String, Object> bundleParams = new HashMap<>(); 343 344 bundleParams.put(SERVICE_HINT.getID(), true); 345 bundleParams.put(START_ON_INSTALL.getID(), true); 346 bundleParams.put(STOP_ON_UNINSTALL.getID(), true); 347 bundleParams.put(RUN_AT_STARTUP.getID(), true); 348 349 bundleParams.put(APP_NAME.getID(), "Java Packager Service Test"); 350 bundleParams.put(BUNDLE_NAME.getID(), "j-p-daemon-test"); 351 bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources)); 352 bundleParams.put(MAIN_CLASS.getID(), "hello.HelloService"); 353 bundleParams.put(MAIN_JAR.getID(), "mainApp.jar"); 354 bundleParams.put(CLASSPATH.getID(), "mainApp.jar"); 355 356 bundleParams.put(DESCRIPTION.getID(), "Does a random heart beat every 30 seconds or so to a log file in tmp"); 357 bundleParams.put(LICENSE_FILE.getID(), "LICENSE"); 358 bundleParams.put(LICENSE_TYPE.getID(), "GPL v2 + CLASSPATH"); 359 bundleParams.put(VENDOR.getID(), "Packager Tests"); 360 361 bundleParams.put(BUILD_ROOT.getID(), tmpBase); 362 bundleParams.put(VERBOSE.getID(), true); 363 364 // assert it validates 365 boolean valid = bundler.validate(bundleParams); 366 assertTrue(valid); 367 368 File result = bundler.execute(bundleParams, new File(workDir, "service")); 369 System.err.println("Bundle at - " + result); 370 assertNotNull(result); 371 assertTrue(result.exists()); 372 } 373 374 @Test(expected = ConfigException.class) 375 public void invalidServiceAppName() throws ConfigException, UnsupportedPlatformException { 376 Bundler bundler = new LinuxDebBundler(); 377 378 Map<String, Object> bundleParams = new HashMap<>(); 379 380 bundleParams.put(BUILD_ROOT.getID(), tmpBase); 381 bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources)); 382 383 bundleParams.put(SERVICE_HINT.getID(), true); 384 bundleParams.put(BUNDLE_NAME.getID(), "ThisAppNameIsWayToLongForInitDToHandleGracefully"); 385 386 bundler.validate(bundleParams); 387 } 388 389 /** 390 * multiple launchers 391 */ 392 @Test 393 public void twoLaunchersTest() throws IOException, ConfigException, UnsupportedPlatformException { 394 Bundler bundler = new LinuxDebBundler(); 395 396 assertNotNull(bundler.getName()); 397 assertNotNull(bundler.getID()); 398 assertNotNull(bundler.getDescription()); 399 //assertNotNull(bundler.getBundleParameters()); 400 401 Map<String, Object> bundleParams = new HashMap<>(); 402 403 bundleParams.put(BUILD_ROOT.getID(), tmpBase); 404 405 bundleParams.put(APP_NAME.getID(), "Two Launchers Test"); 406 bundleParams.put(MAIN_CLASS.getID(), "hello.HelloRectangle"); 407 bundleParams.put(PREFERENCES_ID.getID(), "the/really/long/preferences/id"); 408 bundleParams.put(MAIN_JAR.getID(), 409 new RelativeFileSet(fakeMainJar.getParentFile(), 410 new HashSet<>(Arrays.asList(fakeMainJar))) 411 ); 412 bundleParams.put(CLASSPATH.getID(), "mainApp.jar"); 413 bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources)); 414 bundleParams.put(VERBOSE.getID(), true); 415 416 List<Map<String, ? super Object>> secondaryLaunchers = new ArrayList<>(); 417 for (String name : new String[] {"Fire", "More Fire"}) { 418 Map<String, ? super Object> launcher = new HashMap<>(); 419 launcher.put(APP_NAME.getID(), name); 420 launcher.put(PREFERENCES_ID.getID(), "secondary/launcher/" + name); 421 secondaryLaunchers.add(launcher); 422 } 423 bundleParams.put(SECONDARY_LAUNCHERS.getID(), secondaryLaunchers); 424 425 boolean valid = bundler.validate(bundleParams); 426 assertTrue(valid); 427 428 File output = bundler.execute(bundleParams, new File(workDir, "launchers")); 429 assertNotNull(output); 430 assertTrue(output.exists()); 431 assertTrue(output.isFile()); 432 assertTrue(output.length() > 1_000_000); 433 } 434 435 /** 436 * Set File Association 437 */ 438 @Test 439 public void testFileAssociation() 440 throws IOException, ConfigException, UnsupportedPlatformException 441 { 442 // only run the bundle with full tests 443 Assume.assumeTrue(Boolean.parseBoolean(System.getProperty("FULL_TEST"))); 444 445 testFileAssociation("FASmoke 1", "Bogus File", "bogus", "application/x-vnd.test-bogus", 446 new File(appResourcesDir, "javalogo_white_48.png")); 447 } 448 449 @Test 450 public void testFileAssociationWithNullExtension() 451 throws IOException, ConfigException, UnsupportedPlatformException 452 { 453 // association with no extension is still valid case (see RT-38625) 454 testFileAssociation("FASmoke null", "Bogus File", null, "application/x-vnd.test-bogus", 455 new File(appResourcesDir, "javalogo_white_48.png")); 456 } 457 458 @Test 459 public void testFileAssociationWithMultipleExtension() 460 throws IOException, ConfigException, UnsupportedPlatformException 461 { 462 // only run the bundle with full tests 463 Assume.assumeTrue(Boolean.parseBoolean(System.getProperty("FULL_TEST"))); 464 465 testFileAssociation("FASmoke ME", "Bogus File", "bogus fake", "application/x-vnd.test-bogus", 466 new File(appResourcesDir, "javalogo_white_48.png")); 467 } 468 469 @Test 470 public void testMultipleFileAssociation() 471 throws IOException, ConfigException, UnsupportedPlatformException 472 { 473 // only run the bundle with full tests 474 Assume.assumeTrue(Boolean.parseBoolean(System.getProperty("FULL_TEST"))); 475 476 testFileAssociationMultiples("FASmoke MA", 477 new String[]{"Bogus File", "Fake file"}, 478 new String[]{"bogus", "fake"}, 479 new String[]{"application/x-vnd.test-bogus", "application/x-vnd.test-fake"}, 480 new File[]{new File(appResourcesDir, "javalogo_white_48.png"), new File(appResourcesDir, "javalogo_white_48.png")}); 481 } 482 483 @Test 484 public void testMultipleFileAssociationWithMultipleExtension() 485 throws IOException, ConfigException, UnsupportedPlatformException 486 { 487 // association with no extension is still valid case (see RT-38625) 488 testFileAssociationMultiples("FASmoke MAME", 489 new String[]{"Bogus File", "Fake file"}, 490 new String[]{"bogus boguser", "fake faker"}, 491 new String[]{"application/x-vnd.test-bogus", "application/x-vnd.test-fake"}, 492 new File[]{new File(appResourcesDir, "javalogo_white_48.png"), new File(appResourcesDir, "javalogo_white_48.png")}); 493 } 494 495 private void testFileAssociation(String appName, String description, String extensions, 496 String contentType, File icon) 497 throws IOException, ConfigException, UnsupportedPlatformException 498 { 499 testFileAssociationMultiples(appName, new String[] {description}, new String[] {extensions}, 500 new String[] {contentType}, new File[] {icon}); 501 } 502 503 private void testFileAssociationMultiples(String appName, String[] description, String[] extensions, 504 String[] contentType, File[] icon) 505 throws IOException, ConfigException, UnsupportedPlatformException 506 { 507 assertEquals("Sanity: description same length as extensions", description.length, extensions.length); 508 assertEquals("Sanity: extensions same length as contentType", extensions.length, contentType.length); 509 assertEquals("Sanity: contentType same length as icon", contentType.length, icon.length); 510 511 AbstractBundler bundler = new LinuxDebBundler(); 512 513 assertNotNull(bundler.getName()); 514 assertNotNull(bundler.getID()); 515 assertNotNull(bundler.getDescription()); 516 //assertNotNull(bundler.getBundleParameters()); 517 518 Map<String, Object> bundleParams = new HashMap<>(); 519 520 bundleParams.put(BUILD_ROOT.getID(), tmpBase); 521 522 bundleParams.put(APP_NAME.getID(), appName); 523 bundleParams.put(MAIN_CLASS.getID(), "hello.HelloRectangle"); 524 bundleParams.put(MAIN_JAR.getID(), 525 new RelativeFileSet(fakeMainJar.getParentFile(), 526 new HashSet<>(Arrays.asList(fakeMainJar))) 527 ); 528 bundleParams.put(CLASSPATH.getID(), "mainApp.jar"); 529 bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources)); 530 bundleParams.put(VERBOSE.getID(), true); 531 bundleParams.put(SYSTEM_WIDE.getID(), true); 532 bundleParams.put(VENDOR.getID(), "Packager Tests"); 533 534 List<Map<String, Object>> associations = new ArrayList<>(); 535 536 for (int i = 0; i < description.length; i++) { 537 Map<String, Object> fileAssociation = new HashMap<>(); 538 fileAssociation.put(FA_DESCRIPTION.getID(), description[i]); 539 fileAssociation.put(FA_EXTENSIONS.getID(), extensions[i]); 540 fileAssociation.put(FA_CONTENT_TYPE.getID(), contentType[i]); 541 fileAssociation.put(FA_ICON.getID(), icon[i]); 542 543 associations.add(fileAssociation); 544 } 545 546 bundleParams.put(FILE_ASSOCIATIONS.getID(), associations); 547 548 boolean valid = bundler.validate(bundleParams); 549 assertTrue(valid); 550 551 File result = bundler.execute(bundleParams, new File(workDir, APP_FS_NAME.fetchFrom(bundleParams))); 552 System.err.println("Bundle at - " + result); 553 assertNotNull(result); 554 assertTrue(result.exists()); 555 } 556 557 /* 558 * Test that bundler doesn't support per-user daemons (RT-37985) 559 */ 560 @Test(expected = ConfigException.class) 561 public void perUserDaemonTest() throws ConfigException, UnsupportedPlatformException { 562 AbstractBundler bundler = new LinuxDebBundler(); 563 564 Map<String, Object> bundleParams = new HashMap<>(); 565 566 bundleParams.put(BUILD_ROOT.getID(), tmpBase); 567 bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources)); 568 569 bundleParams.put(SERVICE_HINT.getID(), true); 570 bundleParams.put(SYSTEM_WIDE.getID(), false); 571 572 bundler.validate(bundleParams); 573 } 574 575 @Test 576 public void perSystemDaemonTest() throws ConfigException, UnsupportedPlatformException { 577 AbstractBundler bundler = new LinuxDebBundler(); 578 579 Map<String, Object> bundleParams = new HashMap<>(); 580 581 bundleParams.put(BUILD_ROOT.getID(), tmpBase); 582 bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources)); 583 584 bundleParams.put(SERVICE_HINT.getID(), true); 585 bundleParams.put(SYSTEM_WIDE.getID(), true); 586 587 bundler.validate(bundleParams); 588 } 589 }