author | herrick |
Wed, 16 Oct 2019 10:32:08 -0400 | |
branch | JDK-8200758-branch |
changeset 58648 | 3bf53ffa9ae7 |
parent 58416 | f09bf58c1f17 |
child 58696 | 61c44899b4eb |
permissions | -rw-r--r-- |
58113 | 1 |
/* |
2 |
* Copyright (c) 2018, 2019, 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. |
|
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 |
||
58416 | 24 |
import jdk.jpackage.test.TKit; |
58113 | 25 |
import jdk.jpackage.test.PackageTest; |
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
26 |
import jdk.jpackage.test.FileAssociations; |
58648 | 27 |
import jdk.jpackage.test.Annotations.Test; |
58113 | 28 |
|
29 |
/** |
|
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
30 |
* Test --file-associations parameter. Output of the test should be |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
31 |
* fileassociationstest*.* installer. The output installer should provide the |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
32 |
* same functionality as the default installer (see description of the default |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
33 |
* installer in SimplePackageTest.java) plus configure file associations. After |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
34 |
* installation files with ".jptest1" and ".jptest2" suffixes should be |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
35 |
* associated with the test app. |
58113 | 36 |
* |
37 |
* Suggested test scenario is to create empty file with ".jptest1" suffix, |
|
38 |
* double click on it and make sure that test application was launched in |
|
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
39 |
* response to double click event with the path to test .jptest1 file on the |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
40 |
* commend line. The same applies to ".jptest2" suffix. |
58113 | 41 |
* |
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
42 |
* On Linux use "echo > foo.jptest1" and not "touch foo.jptest1" to create test |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
43 |
* file as empty files are always interpreted as plain text and will not be |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
44 |
* opened with the test app. This is a known bug. |
58113 | 45 |
*/ |
46 |
||
47 |
/* |
|
48 |
* @test |
|
49 |
* @summary jpackage with --file-associations |
|
50 |
* @library ../helpers |
|
58416 | 51 |
* @build jdk.jpackage.test.* |
58113 | 52 |
* @modules jdk.jpackage/jdk.jpackage.internal |
58648 | 53 |
* @compile FileAssociationsTest.java |
54 |
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main |
|
55 |
* --jpt-run=FileAssociationsTest |
|
58113 | 56 |
*/ |
57 |
public class FileAssociationsTest { |
|
58648 | 58 |
@Test |
59 |
public static void test() { |
|
60 |
PackageTest packageTest = new PackageTest(); |
|
58113 | 61 |
|
58648 | 62 |
applyFileAssociations(packageTest, new FileAssociations("jptest1")); |
63 |
applyFileAssociations(packageTest, |
|
64 |
new FileAssociations("jptest2").setFilename("fa2")); |
|
65 |
packageTest.run(); |
|
58113 | 66 |
} |
67 |
||
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
68 |
private static void applyFileAssociations(PackageTest test, |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
69 |
FileAssociations fa) { |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
70 |
test.addInitializer(cmd -> { |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
71 |
fa.createFile(); |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
72 |
cmd.addArguments("--file-associations", fa.getPropertiesFile()); |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
73 |
}).addHelloAppFileAssociationsVerifier(fa); |
58113 | 74 |
} |
75 |
} |