MCPcopy Index your code
hub / github.com/java-native-access/jna / WebStartTest

Class WebStartTest

test/com/sun/jna/WebStartTest.java:56–494  ·  view source on GitHub ↗

Run tests under web start Works under OSX, windows, and linux.

Source from the content-addressed store, hash-verified

54 * Works under OSX, windows, and linux.
55 */
56public class WebStartTest extends TestCase implements Paths {
57
58 // Provide a policy file for unsigned jars
59 // Unfortunately this does not allow native libraries
60 private static final String POLICY =
61 "grant { \n"
62 + " permission java.security.AllPermission;\n"
63 + "};";
64
65 private static final String JNLP =
66 "<?xml version='1.0' encoding='UTF-8'?>\n"
67 + "<jnlp spec='1.0' codebase='{CODEBASE}' href='{JNLP_FILE}'>\n"
68 + " <information>\n"
69 + " <title>JNLP Web Start Test</title>\n"
70 + " <vendor>JNA</vendor>\n"
71 + " <homepage href='https://github.com/java-native-access/jna'/>\n"
72 + " <description>Local JNLP launch test.</description>\n"
73 + " <description kind='short'>Launch Test</description>\n"
74 + " </information>\n"
75 // all-permissions is required for <nativelib>s
76 // but will cause unsigned jars to fail (irrespective of policy)
77 + " <security><all-permissions/></security>\n"
78 + " <resources>\n"
79 // Explicitly supply javawebstart.version, which is missing in NetX
80 // Boo, java-vm-args doesn't work in NetX
81 // and neither does javaws -J<arg>
82 // java-vm-args also causes javaws to ask for the JNLP to be signed,
83 // so don't bother
84 //+ " <j2se version='1.4+' java-vm-args='-Djavawebstart.version=0.0'/>\n"
85 + " <jar href='jna-test.jar'/>\n"
86 + " <jar href='jna.jar'/>\n"
87 + " <jar href='junit.jar'/>{CLOVER}\n"
88 + " <nativelib href='jnidispatch.jar'/>\n"
89 + " </resources>\n"
90 + " <offline-allowed/>\n"
91 + " <application-desc main-class='" + WebStartTest.class.getName() + "'>\n"
92 + " <argument>{CLASS}</argument>\n"
93 + " <argument>{METHOD}</argument>\n"
94 + " <argument>{PORT}</argument>\n"
95 // NetX doesn't set javawebstart.version, so explicitly flag it
96 + " <argument>javawebstart</argument>\n"
97 // Explicitly indicate the architecture we want to skip the test
98 // if we somehow got the wrong architecture javaws
99 + " <argument>arch64=" + Platform.is64Bit() + "</argument"
100 + " </application-desc>\n"
101 + "</jnlp>";
102
103 public void testLaunchedUnderWebStart() throws Exception {
104 assertNotNull("Test not launched under web start",
105 System.getProperty("javawebstart.version"));
106 }
107
108 private static final String FAILURE = "This test is supposed to fail";
109 public void testDetectFailure() {
110 fail(FAILURE);
111 }
112
113 private static final String ERROR = "This test is supposed to error";

Callers

nothing calls this directly

Calls 2

is64BitMethod · 0.95
getNameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…