< prev index next >

test/jdk/tools/jpackage/linux/PackageDepsTest.java

Print this page




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import jdk.jpackage.test.TKit;
  25 import jdk.jpackage.test.PackageTest;
  26 import jdk.jpackage.test.PackageType;
  27 import jdk.jpackage.test.LinuxHelper;

  28 
  29 
  30 /**
  31  * Test --linux-package-deps parameter. Output of the test should be
  32  * apackagedepstestprereq_1.0-1_amd64.deb and packagedepstest_1.0-1_amd64.deb or
  33  * apackagedepstestprereq-1.0-1.amd64.rpm and packagedepstest-1.0-1.amd64.rpm
  34  * package bundles. The output packages should provide the same functionality as
  35  * the default package.
  36  *
  37  * deb: Value of Depends property of packagedepstest package should contain
  38  * apackagedepstestprereq word.
  39  *
  40  * rpm: Value of Requires property of packagedepstest package should contain
  41  * apackagedepstestprereq word.
  42  */
  43 
  44 
  45 /*
  46  * @test
  47  * @summary jpackage with --linux-package-deps
  48  * @library ../helpers
  49  * @key jpackagePlatformPackage
  50  * @build jdk.jpackage.test.*
  51  * @requires (os.family == "linux")
  52  * @modules jdk.incubator.jpackage/jdk.incubator.jpackage.internal
  53  * @run main/othervm/timeout=360 -Xmx512m PackageDepsTest


  54  */
  55 public class PackageDepsTest {
  56 
  57     public static void main(String[] args) {
  58         // Pick the name of prerequisite package to be alphabetically
  59         // preceeding the main package name.
  60         // This is needed to make Bash script batch installing/uninstalling packages
  61         // produced by jtreg tests install/uninstall packages in the right order.
  62         final String PREREQ_PACKAGE_NAME = "apackagedepstestprereq";
  63 
  64         TKit.run(args, () -> {
  65             new PackageTest()
  66             .forTypes(PackageType.LINUX)
  67             .configureHelloApp()
  68             .addInitializer(cmd -> {
  69                 cmd.setArgumentValue("--name", PREREQ_PACKAGE_NAME);
  70             })
  71             .run();
  72 
  73             new PackageTest()
  74             .forTypes(PackageType.LINUX)
  75             .configureHelloApp()
  76             .addInitializer(cmd -> {
  77                 cmd.addArguments("--linux-package-deps", PREREQ_PACKAGE_NAME);
  78             })
  79             .forTypes(PackageType.LINUX)
  80             .addBundleVerifier(cmd -> {
  81                 TKit.assertTrue(
  82                         LinuxHelper.getPrerequisitePackages(cmd).contains(
  83                                 PREREQ_PACKAGE_NAME), String.format(
  84                                 "Check package depends on [%s] package",
  85                                 PREREQ_PACKAGE_NAME));
  86             })
  87             .run();
  88         });


  89     }
  90 }


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import jdk.jpackage.test.TKit;
  25 import jdk.jpackage.test.PackageTest;
  26 import jdk.jpackage.test.PackageType;
  27 import jdk.jpackage.test.LinuxHelper;
  28 import jdk.jpackage.test.Annotations.Test;
  29 
  30 
  31 /**
  32  * Test --linux-package-deps parameter. Output of the test should be
  33  * apackagedepstestprereq_1.0-1_amd64.deb and packagedepstest_1.0-1_amd64.deb or
  34  * apackagedepstestprereq-1.0-1.amd64.rpm and packagedepstest-1.0-1.amd64.rpm
  35  * package bundles. The output packages should provide the same functionality as
  36  * the default package.
  37  *
  38  * deb: Value of Depends property of packagedepstest package should contain
  39  * apackagedepstestprereq word.
  40  *
  41  * rpm: Value of Requires property of packagedepstest package should contain
  42  * apackagedepstestprereq word.
  43  */
  44 
  45 
  46 /*
  47  * @test
  48  * @summary jpackage with --linux-package-deps
  49  * @library ../helpers
  50  * @key jpackagePlatformPackage
  51  * @build jdk.jpackage.test.*
  52  * @requires (os.family == "linux")
  53  * @modules jdk.incubator.jpackage/jdk.incubator.jpackage.internal
  54  * @compile PackageDepsTest.java
  55  * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
  56  *  --jpt-run=PackageDepsTest
  57  */
  58 public class PackageDepsTest {
  59 
  60     @Test
  61     public static void test() {



  62         final String PREREQ_PACKAGE_NAME = "apackagedepstestprereq";
  63 
  64         PackageTest test1 = new PackageTest()

  65         .forTypes(PackageType.LINUX)
  66         .configureHelloApp()
  67         .addInitializer(cmd -> {
  68             cmd.setArgumentValue("--name", PREREQ_PACKAGE_NAME);
  69         });

  70 
  71         PackageTest test2 = new PackageTest()
  72         .forTypes(PackageType.LINUX)
  73         .configureHelloApp()
  74         .addInitializer(cmd -> {
  75             cmd.addArguments("--linux-package-deps", PREREQ_PACKAGE_NAME);
  76         })
  77         .forTypes(PackageType.LINUX)
  78         .addBundleVerifier(cmd -> {
  79             TKit.assertTrue(
  80                     LinuxHelper.getPrerequisitePackages(cmd).contains(
  81                             PREREQ_PACKAGE_NAME), String.format(
  82                             "Check package depends on [%s] package",
  83                             PREREQ_PACKAGE_NAME));


  84         });
  85 
  86         new PackageTest.Group(test1, test2).run();
  87     }
  88 }
< prev index next >