Debian Codegraph @

tests/reproducers/simple/VersionedJar__V1/testcases/VersionedJarTest.java

raw symbols SCIP
1 /* Copyright (C) 2012 Red Hat, Inc.
2
3 This file is part of IcedTea.
4
5 IcedTea is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, version 2.
8
9 IcedTea is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with IcedTea; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301 USA.
18
19 Linking this library statically or dynamically with other modules is
20 making a combined work based on this library. Thus, the terms and
21 conditions of the GNU General Public License cover the whole
22 combination.
23
24 As a special exception, the copyright holders of this library give you
25 permission to link this library with independent modules to produce an
26 executable, regardless of the license terms of these independent
27 modules, and to copy and distribute the resulting executable under
28 terms of your choice, provided that you also meet, for each linked
29 independent module, the terms and conditions of the license of that
30 module. An independent module is a module which is not derived from
31 or based on this library. If you modify this library, you may extend
32 this exception to your version of the library, but you are not
33 obligated to do so. If you do not wish to do so, delete this
34 exception statement from your version.
35 */
36
37 import net.sourceforge.jnlp.ProcessResult;
38 import net.sourceforge.jnlp.ServerAccess;
39
40 import org.junit.Assert;
41 import org.junit.BeforeClass;
42 import org.junit.Test;
43
44 public class VersionedJarTest {
45
46 private static final ServerAccess server = new ServerAccess();
47 private static final String VERSIONED = "Versioned jar was accessed.";
48 private static final String FAILURE = "net.sourceforge.jnlp.LaunchException";
49
50 @BeforeClass
51 public static void clearCache() throws Exception{
52 //to speedup individual methods
53 server.executeJavawsClearCache();
54 }
55
56 @Test
57 public void testDisabledVersionParameter() throws Exception {
58 //if testEnabledVersionParameter is run before this onne, then it fails
59 server.executeJavawsClearCache();
60 //the versioning is realted only to downloading of resources, so afaik this behaviour is correct
61 ProcessResult pr = server.executeJavawsHeadless("/VersionedJarDisabled.jnlp");
62 Assert.assertFalse("Stdout should NOT contain '" + VERSIONED + "', but did.", pr.stdout.contains(VERSIONED));
63 Assert.assertTrue("Stderr should contain '" +FAILURE + "', but did not.", pr.stderr.contains(FAILURE));
64 }
65
66 @Test
67 public void testEnabledVersionParameter() throws Exception {
68 server.executeJavawsClearCache();
69 ProcessResult pr = server.executeJavawsHeadless("/VersionedJarEnabled.jnlp");
70 Assert.assertTrue("Stdout should contain '" + VERSIONED + "', but did not.", pr.stdout.contains(VERSIONED));
71 Assert.assertFalse("Stderr should NOT contain '" +FAILURE + "', but did.", pr.stderr.contains(FAILURE));
72 }
73 }