< prev index next >

test/jdk/tools/jpackage/share/LicenseTest.java

Print this page

        

@@ -97,22 +97,28 @@
         .forTypes(PackageType.LINUX)
         .addBundleVerifier(cmd -> {
             verifyLicenseFileInLinuxPackage(cmd, linuxLicenseFile(cmd));
         })
         .addInstallVerifier(cmd -> {
-            TKit.assertReadableFileExists(linuxLicenseFile(cmd));
+            Path path = linuxLicenseFile(cmd);
+            if (path != null) {
+                TKit.assertReadableFileExists(path);
+            }
         })
         .addUninstallVerifier(cmd -> {
             verifyLicenseFileNotInstalledLinux(linuxLicenseFile(cmd));
         })
         .forTypes(PackageType.LINUX_DEB)
         .addInstallVerifier(cmd -> {
             verifyLicenseFileInstalledDebian(debLicenseFile(cmd));
         })
         .forTypes(PackageType.LINUX_RPM)
         .addInstallVerifier(cmd -> {
-            verifyLicenseFileInstalledRpm(rpmLicenseFile(cmd));
+            Path path = rpmLicenseFile(cmd);
+            if (path != null) {
+                verifyLicenseFileInstalledRpm(path);
+            }
         })
         .run();
     }
 
     public static void testCustomDebianCopyright() {

@@ -122,10 +128,14 @@
     public static void testCustomDebianCopyrightSubst() {
         new CustomDebianCopyrightTest().withSubstitution(true).run();
     }
 
     private static Path rpmLicenseFile(JPackageCommand cmd) {
+        if (cmd.isPackageUnpacked("Not checking for rpm license file")) {
+            return null;
+        }
+
         final Path licenseRoot = Path.of(
                 new Executor()
                 .setExecutable("rpm")
                 .addArguments("--eval", "%{_defaultlicensedir}")
                 .executeAndGetFirstLineOfOutput());

@@ -234,11 +244,11 @@
             return this;
         }
 
         void run() {
             final Path srcLicenseFile = TKit.workDir().resolve("license");
-            new PackageTest().configureHelloApp().forTypes(PackageType.LINUX_DEB)
+            new PackageTest().forTypes(PackageType.LINUX_DEB).configureHelloApp()
             .addInitializer(cmd -> {
                 // Create source license file.
                 Files.write(srcLicenseFile, List.of(
                         licenseText.split("\\R", -1)));
 
< prev index next >