Debian Codegraph @

tests/reproducers/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java

raw
1 /* SpacesCanBeEverywhereTestsSigned.java
2 Copyright (C) 20121 Red Hat, Inc.
3
4 This file is part of IcedTea.
5
6 IcedTea is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, version 2.
9
10 IcedTea is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with IcedTea; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301 USA.
19
20 Linking this library statically or dynamically with other modules is
21 making a combined work based on this library. Thus, the terms and
22 conditions of the GNU General Public License cover the whole
23 combination.
24
25 As a special exception, the copyright holders of this library give you
26 permission to link this library with independent modules to produce an
27 executable, regardless of the license terms of these independent
28 modules, and to copy and distribute the resulting executable under
29 terms of your choice, provided that you also meet, for each linked
30 independent module, the terms and conditions of the license of that
31 module. An independent module is a module which is not derived from
32 or based on this library. If you modify this library, you may extend
33 this exception to your version of the library, but you are not
34 obligated to do so. If you do not wish to do so, delete this
35 exception statement from your version.
36 */
37
38 import java.util.ArrayList;
39 import java.util.List;
40 import net.sourceforge.jnlp.ProcessResult;
41 import net.sourceforge.jnlp.ServerAccess;
42 import net.sourceforge.jnlp.annotations.Bug;
43 import net.sourceforge.jnlp.annotations.NeedsDisplay;
44 import net.sourceforge.jnlp.browsertesting.BrowserTest;
45 import net.sourceforge.jnlp.browsertesting.Browsers;
46 import net.sourceforge.jnlp.annotations.TestInBrowsers;
47
48 import org.junit.Assert;
49 import org.junit.Test;
50
51 @Bug(id={"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016127.html","PR804","PR811"})
52 public class SpacesCanBeEverywhereTestsSigned extends BrowserTest {
53
54 @Bug(id="PR811")
55 @Test
56 @NeedsDisplay
57 public void SpacesCanBeEverywhereLocalAppletTestsJnlp2Signed() throws Exception {
58 List<String> commands=new ArrayList<String>(1);
59 commands.add(server.getJavawsLocation());
60 commands.add(server.getDir()+"/NotOnly spaces can kill ěščřž too signed.jnlp");
61 /* Change of dir is cousing the Exception bellow
62 * ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir());
63 * No X11 DISPLAY variable was set, but this program performed an operation which requires it.
64 * at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:173)
65 * at java.awt.Window.<init>(Window.java:476)
66 * at java.awt.Frame.<init>(Frame.java:419)
67 * at java.awt.Frame.<init>(Frame.java:384)
68 * at javax.swing.SwingUtilities$SharedOwnerFrame.<init>(SwingUtilities.java:1754)
69 * at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1831)
70 * at javax.swing.JWindow.<init>(JWindow.java:185)
71 * at javax.swing.JWindow.<init>(JWindow.java:137)
72 * at net.sourceforge.jnlp.runtime.JNLPSecurityManager.<init>(JNLPSecurityManager.java:121)
73 * at net.sourceforge.jnlp.runtime.JNLPRuntime.initialize(JNLPRuntime.java:202)
74 * at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:177)
75 * at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:51)
76 * at java.security.AccessController.doPrivileged(Native Method)
77 * at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:168)
78 *
79 * Thats why there is absolute path to the file.
80 *
81 * This is also why SpacesCanBeEverywhereLocalTests1Signed is passing -
82 * it is in headless mode. This can be considered as bug, but because it is
83 * only on ocal files, and probably only from test run - it can be ignored
84 */
85 ProcessResult pr = ServerAccess.executeProcess(commands);
86 String s="Signed spaces can be everywhere.jsr was launched correctly";
87 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
88 Assert.assertFalse("should not be terminated, but was", pr.wasTerminated);
89 Assert.assertEquals((Integer) 0, pr.returnValue);
90 }
91
92 @Bug(id="PR811")
93 @Test
94 @NeedsDisplay
95 public void SpacesCanBeEverywhereRemoteAppletTestsJnlp2Signed() throws Exception {
96 ProcessResult pr = server.executeJavaws("/NotOnly%20spaces%20can%20kill%20%C4%9B%C5%A1%C4%8D%C5%99%C5%BE%20too%20signed.jnlp");
97 String s="Signed spaces can be everywhere.jsr was launched correctly";
98 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
99 Assert.assertFalse("should NOT be terminated, but was not", pr.wasTerminated);
100 }
101
102 @Bug(id="PR811")
103 @Test
104 @NeedsDisplay
105 @TestInBrowsers(testIn = {Browsers.one})
106 public void SpacesCanBeEverywhereRemoteAppletTestsHtml2Signed() throws Exception {
107 ProcessResult pr = server.executeBrowser("/spaces+applet+Tests+signed.html");
108 String s="Signed spaces can be everywhere.jsr was launched correctly";
109 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
110 Assert.assertTrue("should be terminated, but was not", pr.wasTerminated);
111 }
112
113
114 @Bug(id={"PR811","http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016144.html"})
115 @Test
116 public void SpacesCanBeEverywhereRemoteTests1Signed() throws Exception {
117 ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere1%20signed.jnlp");
118 String s = "Good simple javaws exapmle";
119 Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s));
120 String cc = "ClassNotFoundException";
121 Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc));
122 Assert.assertFalse("should not be terminated, but was", pr.wasTerminated);
123 Assert.assertEquals((Integer) 0, pr.returnValue);
124 }
125
126 @Bug(id="PR811")
127 @Test
128 public void SpacesCanBeEverywhereRemoteTests2Signed() throws Exception {
129 ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp");
130 String s="Signed spaces can be everywhere.jsr was launched correctly";
131 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
132 String cc = "ClassNotFoundException";
133 Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc));
134 Assert.assertFalse("should not be terminated, but was", pr.wasTerminated);
135 Assert.assertEquals((Integer) 0, pr.returnValue);
136 }
137
138 @Bug(id="PR811")
139 @Test
140 public void SpacesCanBeEverywhereRemoteTests2Signed_withQuery1() throws Exception {
141 ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp?test=20");
142 String s="Signed spaces can be everywhere.jsr was launched correctly";
143 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
144 String cc = "ClassNotFoundException";
145 Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc));
146 Assert.assertFalse("should not be terminated, but was", pr.wasTerminated);
147 Assert.assertEquals((Integer) 0, pr.returnValue);
148 }
149
150 @Bug(id="PR811")
151 @Test
152 public void SpacesCanBeEverywhereRemoteTests2Signed_withQuery2() throws Exception {
153 ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp?test%3D20");
154
155 String s="Signed spaces can be everywhere.jsr was launched correctly";
156 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
157 String cc = "ClassNotFoundException";
158 Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc));
159 Assert.assertFalse("should not be terminated, but was", pr.wasTerminated);
160 Assert.assertEquals((Integer) 0, pr.returnValue);
161 }
162
163 @Bug(id="PR811")
164 @Test
165 public void SpacesCanBeEverywhereRemoteTests3Signed() throws Exception {
166 ProcessResult pr = server.executeJavawsHeadless(null, "/SpacesCanBeEverywhere1signed.jnlp");
167 String s="Signed spaces can be everywhere.jsr was launched correctly";
168 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
169 String cc = "ClassNotFoundException";
170 Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc));
171 Assert.assertFalse("should not be terminated, but was", pr.wasTerminated);
172 Assert.assertEquals((Integer) 0, pr.returnValue);
173 }
174
175
176 @Bug(id="PR804")
177 @Test
178 public void SpacesCanBeEverywhereLocalTests1Signed() throws Exception {
179 List<String> commands=new ArrayList<String>(4);
180 commands.add(server.getJavawsLocation());
181 commands.add(ServerAccess.HEADLES_OPTION);
182 commands.add("Spaces can be everywhere1.jnlp");
183 ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir());
184 String s = "Good simple javaws exapmle";
185 Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s));
186 String cc = "ClassNotFoundException";
187 Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc));
188 Assert.assertFalse("should not be terminated, but was", pr.wasTerminated);
189 Assert.assertEquals((Integer) 0, pr.returnValue);
190 }
191
192 @Bug(id="PR804")
193 @Test
194 public void SpacesCanBeEverywhereLocalTests2Signed() throws Exception {
195 List<String> commands=new ArrayList<String>(4);
196 commands.add(server.getJavawsLocation());
197 commands.add(ServerAccess.HEADLES_OPTION);
198 commands.add("Spaces can be everywhere2 signed.jnlp");
199 ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir());
200 String s="Signed spaces can be everywhere.jsr was launched correctly";
201 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
202 String cc = "ClassNotFoundException";
203 Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc));
204 Assert.assertFalse("should not be terminated, but was", pr.wasTerminated);
205 Assert.assertEquals((Integer) 0, pr.returnValue);
206 }
207
208 @Bug(id="PR804")
209 @Test
210 public void SpacesCanBeEverywhereLocalTests4Signed() throws Exception {
211 List<String> commands=new ArrayList<String>(4);
212 commands.add(server.getJavawsLocation());
213 commands.add(ServerAccess.HEADLES_OPTION);
214 commands.add(server.getDir()+"/Spaces can be everywhere2 signed.jnlp");
215 ProcessResult pr = ServerAccess.executeProcess(commands);
216 String s="Signed spaces can be everywhere.jsr was launched correctly";
217 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
218 String cc = "ClassNotFoundException";
219 Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc));
220 Assert.assertFalse("should not be terminated, but was", pr.wasTerminated);
221 Assert.assertEquals((Integer) 0, pr.returnValue);
222 }
223
224 @Bug(id="PR804")
225 @Test
226 public void SpacesCanBeEverywhereLocalTests3Signed() throws Exception {
227 List<String> commands=new ArrayList<String>(4);
228 commands.add(server.getJavawsLocation());
229 commands.add(ServerAccess.HEADLES_OPTION);
230 commands.add("SpacesCanBeEverywhere1signed.jnlp");
231 ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir());
232 String s="Signed spaces can be everywhere.jsr was launched correctly";
233 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
234 String cc = "ClassNotFoundException";
235 Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc));
236 Assert.assertFalse("should not be terminated, but was", pr.wasTerminated);
237 Assert.assertEquals((Integer) 0, pr.returnValue);
238 }
239 }