Changeset 429 for trunk/icedtea-web/tests/reproducers/simple
- Timestamp:
- Sep 24, 2014, 9:34:21 PM (11 years ago)
- Location:
- trunk/icedtea-web/tests/reproducers/simple
- Files:
-
- 1 deleted
- 27 edited
- 48 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/icedtea-web/tests/reproducers/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java
r418 r429 38 38 import java.util.Arrays; 39 39 import java.util.List; 40 import net.sourceforge.jnlp.ProcessResult; 40 41 import net.sourceforge.jnlp.ServerAccess; 41 import net.sourceforge.jnlp.ServerAccess.ProcessResult; 42 42 43 import org.junit.Assert; 43 44 44 import org.junit.Test; 45 45 … … 73 73 private static final List<String> xta = Arrays.asList(new String[]{"-Xtrustall"}); 74 74 75 private void testShouldFail( ServerAccess.ProcessResult pr, String s) {75 private void testShouldFail(ProcessResult pr, String s) { 76 76 String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + s + ".*"; 77 77 Assert.assertTrue("stderr should match `" + c + "`, but didn't ", pr.stderr.matches(c)); 78 78 } 79 79 80 private void testShouldNOTFail( ServerAccess.ProcessResult pr, String s) {80 private void testShouldNOTFail(ProcessResult pr, String s) { 81 81 String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + s + ".*"; 82 82 Assert.assertFalse("stderr should NOT match `" + c + "`, but did ", pr.stderr.matches(c)); … … 90 90 } 91 91 92 private void testShouldPass( ServerAccess.ProcessResult pr, String s) {92 private void testShouldPass(ProcessResult pr, String s) { 93 93 String c = "Class was obtained: " + s; 94 94 Assert.assertTrue("stdout should contains `" + c + "`, but didn't ", pr.stdout.contains(c)); 95 95 } 96 96 97 private void testShouldNOTPass( ServerAccess.ProcessResult pr, String s) {97 private void testShouldNOTPass(ProcessResult pr, String s) { 98 98 String c = "Class was obtained: " + s; 99 99 Assert.assertFalse("stdout should not contains `" + c + "`, but did ", pr.stdout.contains(c)); … … 102 102 @Test 103 103 public void AccessClassInPackageJAVAXJNLP() throws Exception { 104 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[0]);104 ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[0]); 105 105 commonPitfall(pr); 106 106 testShouldPass(pr, pass[0]); … … 110 110 @Test 111 111 public void AccessClassInPackageSELF() throws Exception { 112 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[1]);112 ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[1]); 113 113 commonPitfall(pr); 114 114 testShouldPass(pr, pass[1]); … … 118 118 @Test 119 119 public void AccessClassInPackageNETSF() throws Exception { 120 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[2]);120 ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[2]); 121 121 commonPitfall(pr); 122 122 testShouldFail(pr, badExceptions[2]); … … 126 126 @Test 127 127 public void AccessClassInPackageSUNSEC() throws Exception { 128 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[3]);128 ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[3]); 129 129 commonPitfall(pr); 130 130 commonPitfall(pr); … … 136 136 @Test 137 137 public void AccessClassInPackageSignedJAVAXJNLP() throws Exception { 138 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[0]);138 ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[0]); 139 139 commonPitfall(pr); 140 140 testShouldPass(pr, pass[0]); … … 144 144 @Test 145 145 public void AccessClassInPackageSignedSELF() throws Exception { 146 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[1]);146 ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[1]); 147 147 commonPitfall(pr); 148 148 testShouldPass(pr, pass[1]); … … 152 152 @Test 153 153 public void AccessClassInPackageSignedNETSF() throws Exception { 154 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[2]);154 ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[2]); 155 155 commonPitfall(pr); 156 156 testShouldPass(pr, pass[2]); … … 160 160 @Test 161 161 public void AccessClassInPackageSignedSUNSEC() throws Exception { 162 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[3]);162 ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[3]); 163 163 commonPitfall(pr); 164 164 testShouldPass(pr, pass[3]); -
trunk/icedtea-web/tests/reproducers/simple/AddShutdownHook/srcs/AddShutdownHook.java
r418 r429 1 2 import java.applet.Applet; 3 1 4 /* AddShutdownHook.java 2 Copyright (C) 2011 Red Hat, Inc.5 Copyright (C) 2011 Red Hat, Inc. 3 6 4 This file is part of IcedTea.7 This file is part of IcedTea. 5 8 6 IcedTea is free software; you can redistribute it and/or7 modify it under the terms of the GNU General Public License as published by8 the Free Software Foundation, version 2.9 IcedTea is free software; you can redistribute it and/or 10 modify it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, version 2. 9 12 10 IcedTea is distributed in the hope that it will be useful,11 but WITHOUT ANY WARRANTY; without even the implied warranty of12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13 General Public License for more details.13 IcedTea is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 General Public License for more details. 14 17 15 You should have received a copy of the GNU General Public License16 along with IcedTea; see the file COPYING. If not, write to17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA18 02110-1301 USA.18 You should have received a copy of the GNU General Public License 19 along with IcedTea; see the file COPYING. If not, write to 20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 02110-1301 USA. 19 22 20 Linking this library statically or dynamically with other modules is21 making a combined work based on this library. Thus, the terms and22 conditions of the GNU General Public License cover the whole23 combination.23 Linking this library statically or dynamically with other modules is 24 making a combined work based on this library. Thus, the terms and 25 conditions of the GNU General Public License cover the whole 26 combination. 24 27 25 As a special exception, the copyright holders of this library give you26 permission to link this library with independent modules to produce an27 executable, regardless of the license terms of these independent28 modules, and to copy and distribute the resulting executable under29 terms of your choice, provided that you also meet, for each linked30 independent module, the terms and conditions of the license of that31 module. An independent module is a module which is not derived from32 or based on this library. If you modify this library, you may extend33 this exception to your version of the library, but you are not34 obligated to do so. If you do not wish to do so, delete this35 exception statement from your version.28 As a special exception, the copyright holders of this library give you 29 permission to link this library with independent modules to produce an 30 executable, regardless of the license terms of these independent 31 modules, and to copy and distribute the resulting executable under 32 terms of your choice, provided that you also meet, for each linked 33 independent module, the terms and conditions of the license of that 34 module. An independent module is a module which is not derived from 35 or based on this library. If you modify this library, you may extend 36 this exception to your version of the library, but you are not 37 obligated to do so. If you do not wish to do so, delete this 38 exception statement from your version. 36 39 */ 40 public class AddShutdownHook extends Applet { 37 41 38 public class AddShutdownHook {39 42 public static void main(String[] args) { 40 43 41 Runtime.getRuntime().addShutdownHook(new Thread() { 42 public void run() { 43 // no op 44 } 45 }); 46 44 Runtime.getRuntime().addShutdownHook(new Thread() { 45 public void run() { 46 // no op 47 } 48 }); 49 50 } 51 52 @Override 53 public void start() { 54 main(null); 55 System.err.println("WRONG - ShutdownHook was probably added"); 47 56 } 48 57 } -
trunk/icedtea-web/tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java
r418 r429 1 1 /* AddShutdownHookTest.java 2 Copyright (C) 2011 Red Hat, Inc.2 Copyright (C) 2011 Red Hat, Inc. 3 3 4 This file is part of IcedTea.4 This file is part of IcedTea. 5 5 6 IcedTea is free software; you can redistribute it and/or7 modify it under the terms of the GNU General Public License as published by8 the Free Software Foundation, version 2.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 9 10 IcedTea is distributed in the hope that it will be useful,11 but WITHOUT ANY WARRANTY; without even the implied warranty of12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13 General Public License for more details.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 14 15 You should have received a copy of the GNU General Public License16 along with IcedTea; see the file COPYING. If not, write to17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA18 02110-1301 USA.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 19 20 Linking this library statically or dynamically with other modules is21 making a combined work based on this library. Thus, the terms and22 conditions of the GNU General Public License cover the whole23 combination.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 24 25 As a special exception, the copyright holders of this library give you26 permission to link this library with independent modules to produce an27 executable, regardless of the license terms of these independent28 modules, and to copy and distribute the resulting executable under29 terms of your choice, provided that you also meet, for each linked30 independent module, the terms and conditions of the license of that31 module. An independent module is a module which is not derived from32 or based on this library. If you modify this library, you may extend33 this exception to your version of the library, but you are not34 obligated to do so. If you do not wish to do so, delete this35 exception statement from your version.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 36 */ 37 37 38 import net.sourceforge.jnlp.ServerAccess; 38 import net.sourceforge.jnlp.ClosingListener; 39 import net.sourceforge.jnlp.ProcessResult; 40 import net.sourceforge.jnlp.annotations.TestInBrowsers; 41 import net.sourceforge.jnlp.browsertesting.BrowserTest; 42 import net.sourceforge.jnlp.browsertesting.Browsers; 43 import net.sourceforge.jnlp.closinglisteners.RulesFolowingClosingListener; 44 import net.sourceforge.jnlp.closinglisteners.StringMatchClosingListener; 39 45 import org.junit.Assert; 40 46 41 47 import org.junit.Test; 42 48 43 public class AddShutdownHookTest {49 public class AddShutdownHookTest extends BrowserTest { 44 50 45 private static ServerAccess server = new ServerAccess(); 51 public static final String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "shutdownHooks" + ".*"; 52 public static final String cnfString = "ClassNotFoundException"; 53 public static final String confirmFailure = "WRONG - ShutdownHook was probably added"; 54 public static final RulesFolowingClosingListener.MatchesRule mr = new RulesFolowingClosingListener.MatchesRule(s); 55 public static final RulesFolowingClosingListener.ContainsRule cnf = new RulesFolowingClosingListener.ContainsRule(cnfString); 56 public static final RulesFolowingClosingListener.ContainsRule cf = new RulesFolowingClosingListener.ContainsRule(confirmFailure); 57 public static final RulesFolowingClosingListener rfc = new RulesFolowingClosingListener(mr); 46 58 47 59 @Test 48 60 public void AddShutdownHookTestLunch1() throws Exception { 49 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/AddShutdownHook.jnlp"); 50 String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "shutdownHooks" + ".*"; 51 Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); 52 String cc="ClassNotFoundException"; 53 Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); 54 Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); 55 Assert.assertFalse("AddShutdownHookTestLunch1 should not be terminated, but was",pr.wasTerminated); 61 ProcessResult pr = server.executeJavawsHeadless(null, "/AddShutdownHook.jnlp"); 62 Assert.assertTrue("stderr " + mr.toPassingString(), mr.evaluate(pr.stderr)); 63 Assert.assertFalse("stderr " + cnf.toFailingString(), cnf.evaluate(pr.stderr)); 64 Assert.assertFalse("AddShutdownHookTestLunch1 should not be terminated, but was", pr.wasTerminated); 65 Assert.assertFalse("stderr " + cf.toFailingString(), cf.evaluate(pr.stderr)); 56 66 Assert.assertEquals((Integer) 0, pr.returnValue); 57 67 } 68 69 @Test 70 @TestInBrowsers(testIn = Browsers.one) 71 public void AddShutdownHookApplet() throws Exception { 72 ProcessResult pr = server.executeBrowser("/AddShutdownHook.html", null, rfc); 73 74 if (server.getCurrentBrowsers() == Browsers.firefox) { 75 //lookslike only firefox is able to recieve this 76 Assert.assertTrue("stderr " + mr.toPassingString(), mr.evaluate(pr.stderr)); 77 } 78 Assert.assertFalse("stderr " + cnf.toFailingString(), cnf.evaluate(pr.stderr)); 79 Assert.assertFalse("stderr " + cf.toFailingString(), cf.evaluate(pr.stderr)); 80 } 58 81 } -
trunk/icedtea-web/tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java
r418 r429 36 36 */ 37 37 38 import net.sourceforge.jnlp.ProcessResult; 38 39 import net.sourceforge.jnlp.ServerAccess; 39 40 import org.junit.Assert; … … 49 50 @Test 50 51 public void AllStackTracesTest1() throws Exception { 51 ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/AllStackTraces.jnlp");52 ProcessResult pr=server.executeJavawsHeadless(null,"/AllStackTraces.jnlp"); 52 53 String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "getStackTrace" + ".*"; 53 54 Assert.assertTrue("stderr should match `"+c+"`, but didn't ",pr.stderr.matches(c)); 54 55 String cc="ClassNotFoundException"; 55 56 Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did ",pr.stderr.contains(cc)); 56 Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2);57 57 Assert.assertFalse("AllStackTracesTest1 should not be terminated, but was",pr.wasTerminated); 58 58 Assert.assertEquals((Integer)0, pr.returnValue); -
trunk/icedtea-web/tests/reproducers/simple/AppletBaseURLTest/srcs/AppletBaseURL.java
r418 r429 38 38 import java.applet.Applet; 39 39 public class AppletBaseURL extends Applet { 40 41 private class Killer extends Thread {42 43 public int n = 1000;44 45 @Override46 public void run() {47 try {48 Thread.sleep(n);49 System.out.println("Aplet killing himself after " + n + " ms of life");50 System.exit(0);51 } catch (Exception ex) {52 }53 }54 }55 private Killer killer;56 57 40 @Override 58 41 public void init() { 59 42 System.out.println("Document base is " + getDocumentBase() + " for this applet"); 60 43 System.out.println("Codebase is " + getCodeBase() + " for this applet"); 61 killer = new Killer(); 62 killer.start(); 44 System.out.println("*** APPLET FINISHED ***"); 45 46 // Exits JNLP-launched applets, throws exception on normal applet: 47 System.exit(0); 63 48 } 64 49 } -
trunk/icedtea-web/tests/reproducers/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java
r418 r429 36 36 */ 37 37 38 import net.sourceforge.jnlp.ServerAccess.ProcessResult; 38 import net.sourceforge.jnlp.ProcessResult; 39 import net.sourceforge.jnlp.ServerAccess.AutoClose; 39 40 import net.sourceforge.jnlp.annotations.Bug; 40 41 import net.sourceforge.jnlp.annotations.NeedsDisplay; … … 49 50 50 51 private void evaluateApplet(ProcessResult pr, String baseName) { 51 String s8= "(?s).*Codebase is http://localhost:[0-9]{5}/ for this applet(?s).*";52 Assert.assertTrue("AppletBaseURL stdout should match" + s8 + " but didn't", pr.stdout.matches(s8));53 String s9 = "(?s).*Document base is http://localhost:[0-9]{5}/" + baseName + " for this applet(?s).*";54 Assert.assertTrue("AppletBaseURL stdout should match" + s9 + " but didn't", pr.stdout.matches(s9));55 String ss = "xception";56 Assert.assertFalse("AppletBaseURL stderr should not contain" + ss + " but did", pr.stderr.contains(ss));52 String codebaseRule = "(?s).*Codebase is http://localhost:[0-9]{5}/ for this applet(?s).*"; 53 Assert.assertTrue("AppletBaseURL stdout should match" + codebaseRule + " but didn't", 54 pr.stdout.matches(codebaseRule)); 55 String documentbaseRule = "(?s).*Document base is http://localhost:[0-9]{5}/" + baseName + " for this applet(?s).*"; 56 Assert.assertTrue("AppletBaseURL stdout should match" + documentbaseRule + " but didn't", 57 pr.stdout.matches(documentbaseRule)); 57 58 } 58 59 … … 60 61 @Test 61 62 public void AppletWebstartBaseURLTest() throws Exception { 62 ProcessResult pr = server.executeJavaws( null,"/AppletBaseURLTest.jnlp");63 ProcessResult pr = server.executeJavaws("/AppletBaseURLTest.jnlp"); 63 64 evaluateApplet(pr, ""); 64 65 Assert.assertFalse(pr.wasTerminated); … … 71 72 @TestInBrowsers(testIn={Browsers.one}) 72 73 public void AppletInFirefoxTest() throws Exception { 73 ProcessResult pr = server.executeBrowser("/AppletBaseURLTest.html" );74 ProcessResult pr = server.executeBrowser("/AppletBaseURLTest.html", AutoClose.CLOSE_ON_BOTH); 74 75 pr.process.destroy(); 75 76 evaluateApplet(pr, "AppletBaseURLTest.html"); … … 82 83 @TestInBrowsers(testIn={Browsers.one}) 83 84 public void AppletWithJNLPHrefTest() throws Exception { 84 ProcessResult pr = server.executeBrowser("/AppletJNLPHrefBaseURLTest.html" );85 ProcessResult pr = server.executeBrowser("/AppletJNLPHrefBaseURLTest.html", AutoClose.CLOSE_ON_BOTH); 85 86 pr.process.destroy(); 86 87 evaluateApplet(pr, "AppletJNLPHrefBaseURLTest.html"); -
trunk/icedtea-web/tests/reproducers/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java
r418 r429 36 36 */ 37 37 38 import net.sourceforge.jnlp.ProcessResult; 38 39 import net.sourceforge.jnlp.ServerAccess; 39 40 import net.sourceforge.jnlp.annotations.TestInBrowsers; 40 41 import net.sourceforge.jnlp.browsertesting.BrowserTest; 41 42 import net.sourceforge.jnlp.browsertesting.Browsers; 43 42 44 import org.junit.Assert; 43 44 45 import org.junit.Test; 45 46 … … 53 54 @Test 54 55 public void AppletJNLPTest() throws Exception { 55 ServerAccess.ProcessResult pr = server.executeJavawsHeadless("/AppletReadsInvalidJar.jnlp");56 ProcessResult pr = server.executeJavawsHeadless("/AppletReadsInvalidJar.jnlp"); 56 57 57 58 Assert.assertFalse("AppletReadsInvalidJar stdout should NOT contain '" + CORRECT_EXECUTION + "', but did (applet should not have ran!).", pr.stdout.contains(CORRECT_EXECUTION)); … … 63 64 @TestInBrowsers(testIn={Browsers.one}) 64 65 public void AppletInFirefoxTest() throws Exception { 65 ServerAccess.ProcessResult pr = server.executeBrowser("/AppletReadsInvalidJar.html");66 ProcessResult pr = server.executeBrowser("/AppletReadsInvalidJar.html"); 66 67 67 68 Assert.assertTrue("AppletReadsInvalidJar stdout should contain '" + CORRECT_EXECUTION + "' but did not.", pr.stdout.contains(CORRECT_EXECUTION)); -
trunk/icedtea-web/tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java
r418 r429 39 39 */ 40 40 public class AppletTakesLastParam extends Applet { 41 42 private class Killer extends Thread {43 44 public int n = 2000;45 46 @Override47 public void run() {48 try {49 Thread.sleep(n);50 System.out.println("Applet killing itself after " + n + " ms");51 System.exit(0);52 } catch (Exception ex) {53 }54 }55 }56 private Killer killer = new Killer();57 58 @Override59 41 public void init() { 60 42 System.out.println(getParameter("param")); 61 killer.start(); 43 System.out.println("*** APPLET FINISHED ***"); 44 45 // Exits JNLP-launched applets, throws exception on normal applet: 46 System.exit(0); 62 47 } 63 48 } -
trunk/icedtea-web/tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java
r418 r429 1 /* AppletT estTests.java1 /* AppletTakesLastParamTests.java 2 2 Copyright (C) 2011 Red Hat, Inc. 3 3 … … 36 36 */ 37 37 38 import net.sourceforge.jnlp. ServerAccess;39 import net.sourceforge.jnlp.ServerAccess. ProcessResult;38 import net.sourceforge.jnlp.ProcessResult; 39 import net.sourceforge.jnlp.ServerAccess.AutoClose; 40 40 import net.sourceforge.jnlp.browsertesting.BrowserTest; 41 41 import net.sourceforge.jnlp.browsertesting.Browsers; … … 46 46 47 47 public class AppletTakesLastParamTests extends BrowserTest { 48 private void evaluate(ProcessResult pr) { 49 String firstParam = "value1"; 50 String secondParam = "value2"; 48 51 49 @Test 50 public void AppletTest() throws Exception { 51 ServerAccess.ProcessResult pr = server.executeJavaws(null, "/appletTakesLastParam.jnlp"); 52 evaluateApplet(pr); 53 } 54 55 private void evaluateApplet(ProcessResult pr) { 56 String s0 = "value1"; 57 Assert.assertTrue("AppletTakesLastParam stdout should not contain " + s0 + " but did.", !pr.stdout.contains(s0)); 58 String s1 = "value2"; 59 Assert.assertTrue("AppletTakesLastParam stdout should contain " + s1 + " but did not.", pr.stdout.contains(s1)); 52 Assert.assertFalse("AppletTakesLastParam stdout should not contain " + firstParam + " but did.", 53 pr.stdout.contains(firstParam)); 54 Assert.assertTrue("AppletTakesLastParam stdout should contain " + secondParam + " but did not.", 55 pr.stdout.contains(secondParam)); 60 56 } 61 57 62 58 @Test 63 59 @TestInBrowsers(testIn = {Browsers.one}) 64 public void AppletInFirefoxTest() throws Exception { 65 ServerAccess.ProcessResult pr = server.executeBrowser("/appletTakesLastParam.html"); 66 evaluateApplet(pr); 60 public void appletTakesLastParam() throws Exception { 61 ProcessResult pr = server.executeBrowser("/appletTakesLastParam.html", AutoClose.CLOSE_ON_BOTH); 62 evaluate(pr); 63 } 64 @Test 65 public void jnlpTakesLastParam() throws Exception { 66 ProcessResult pr = server.executeJavaws("/appletTakesLastParam.jnlp"); 67 evaluate(pr); 67 68 } 68 69 } -
trunk/icedtea-web/tests/reproducers/simple/AppletTest/testcases/AppletTestTests.java
r418 r429 1 /* AppletTestTests.java1 /* 2 2 Copyright (C) 2011 Red Hat, Inc. 3 3 … … 36 36 */ 37 37 38 import net.sourceforge.jnlp.closinglisteners.CountingClosingListener; 38 39 import net.sourceforge.jnlp.ProcessResult; 39 40 import net.sourceforge.jnlp.ServerAccess; … … 48 49 public class AppletTestTests extends BrowserTest { 49 50 51 private final String s7 = "Aplet killing himself after 2000 ms of life"; 52 private final String s2 = "value2"; 53 private final String s1 = "value1"; 54 private final String s0 = "applet was started"; 55 private final String s3 = "applet was initialised"; 56 57 private class CountingClosingListenerImpl extends CountingClosingListener { 58 59 @Override 60 protected boolean isAlowedToFinish(String s) { 61 return (s.contains(s0) && s.contains(s1) && s.contains(s2) && s.contains(s3) && s.contains(s7)); 62 } 63 } 64 50 65 @Test 51 66 @TestInBrowsers(testIn = {Browsers.googleChrome}) … … 56 71 //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); 57 72 //just verify loging is recording browser 58 ProcessResult pr1 = server.executeBrowser("/appletAutoTests .html");73 ProcessResult pr1 = server.executeBrowser("/appletAutoTests2.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl()); 59 74 if (pr1.process == null) { 60 75 Assert.assertTrue("If proces was null here, then google-chrome had to not exist, and so " … … 65 80 return; 66 81 } 67 evaluateApplet(pr1, false);82 evaluateApplet(pr1, false); 68 83 Assert.assertTrue(pr1.wasTerminated); 69 84 //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); 70 85 // just verify loging is recording browser 71 ServerAccess.ProcessResult pr = server.executeBrowser("/appletAutoTests.html");72 evaluateApplet(pr, false);86 ProcessResult pr = server.executeBrowser("/appletAutoTests2.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl()); 87 evaluateApplet(pr, false); 73 88 Assert.assertTrue(pr.wasTerminated); 74 89 } finally { … … 81 96 public void AppletTest() throws Exception { 82 97 ProcessResult pr = server.executeJavawsHeadless(null, "/AppletTest.jnlp"); 83 evaluateApplet(pr, true);98 evaluateApplet(pr, true); 84 99 Assert.assertFalse(pr.wasTerminated); 85 100 Assert.assertEquals((Integer) 0, pr.returnValue); … … 87 102 88 103 private void evaluateApplet(ProcessResult pr, boolean javawsApplet) { 89 String s3 = "applet was initialised";90 104 Assert.assertTrue("AppletTest stdout should contains " + s3 + " bud didn't", pr.stdout.contains(s3)); 91 String s0 = "applet was started";92 105 Assert.assertTrue("AppletTest stdout should contains " + s0 + " bud didn't", pr.stdout.contains(s0)); 93 String s1 = "value1";94 106 Assert.assertTrue("AppletTest stdout should contains " + s1 + " bud didn't", pr.stdout.contains(s1)); 95 String s2 = "value2";96 107 Assert.assertTrue("AppletTest stdout should contains " + s2 + " bud didn't", pr.stdout.contains(s2)); 97 String ss = "xception";98 Assert.assertFalse("AppletTest stderr should not contains " + ss + " but did", pr.stderr.contains(ss));99 String s7 = "Aplet killing himself after 2000 ms of life";100 108 Assert.assertTrue("AppletTest stdout should contains " + s7 + " bud didn't", pr.stdout.contains(s7)); 101 109 if (!javawsApplet) { 102 110 /*this is working correctly in most browser, but not in all. temporarily disabling 103 String s4 = "applet was stopped";104 Assert.assertTrue("AppletTest stdout should contains" + s4 + " bud did't", pr.stdout.contains(s4));105 String s5 = "applet will be destroyed";106 Assert.assertTrue("AppletTest stdout should contains" + s5 + " bud did't", pr.stdout.contains(s5));111 String s4 = "applet was stopped"; 112 Assert.assertTrue("AppletTest stdout should contain " + s4 + " bud did't", pr.stdout.contains(s4)); 113 String s5 = "applet will be destroyed"; 114 Assert.assertTrue("AppletTest stdout should contain " + s5 + " bud did't", pr.stdout.contains(s5)); 107 115 */ 108 116 } … … 117 125 ServerAccess.PROCESS_TIMEOUT = 30 * 1000; 118 126 try { 119 ProcessResult pr = server.executeBrowser("/appletAutoTests2.html" );120 evaluateApplet(pr, false);121 Assert.assertTrue(pr.wasTerminated);127 ProcessResult pr = server.executeBrowser("/appletAutoTests2.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl()); 128 evaluateApplet(pr, false); 129 //Assert.assertTrue(pr.wasTerminated); this checks asre evil 122 130 //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null 123 131 } finally { … … 133 141 ServerAccess.PROCESS_TIMEOUT = 30 * 1000; 134 142 try { 135 ProcessResult pr = server.executeBrowser("/appletAutoTests.html" );143 ProcessResult pr = server.executeBrowser("/appletAutoTests.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl()); 136 144 pr.process.destroy(); 137 evaluateApplet(pr, false);145 evaluateApplet(pr, false); 138 146 Assert.assertTrue(pr.wasTerminated); 139 147 //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null … … 142 150 } 143 151 } 152 153 154 @Test 155 @TestInBrowsers(testIn = {Browsers.one}) 156 @NeedsDisplay 157 public void appletZeroWH() throws Exception { 158 ProcessResult pr = server.executeBrowser("/appletZeroWH.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl()); 159 evaluateApplet(pr, false); 160 } 161 162 @Test 163 @TestInBrowsers(testIn = {Browsers.one}) 164 @NeedsDisplay 165 public void appletZeroW() throws Exception { 166 ProcessResult pr = server.executeBrowser("/appletZeroW.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl()); 167 evaluateApplet(pr, false); 168 } 169 170 @Test 171 @TestInBrowsers(testIn = {Browsers.one}) 172 @NeedsDisplay 173 public void appletZeroH() throws Exception { 174 ProcessResult pr = server.executeBrowser("/appletZeroH.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl()); 175 evaluateApplet(pr, false); 176 } 144 177 } -
trunk/icedtea-web/tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java
r418 r429 36 36 */ 37 37 38 import net.sourceforge.jnlp.ProcessResult; 38 39 import net.sourceforge.jnlp.ServerAccess; 40 39 41 import org.junit.Assert; 40 41 42 import org.junit.Test; 42 43 … … 47 48 @Test 48 49 public void CreateClassLoaderLunch1() throws Exception { 49 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/CreateClassLoader.jnlp");50 ProcessResult pr = server.executeJavawsHeadless(null, "/CreateClassLoader.jnlp"); 50 51 String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "createClassLoader" + ".*"; 51 52 Assert.assertTrue("Stderr should match "+s+" but didn't",pr.stderr.matches(s)); 52 53 String cc="ClassNotFoundException"; 53 54 Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); 54 Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2);55 55 Assert.assertFalse("CreateClassLoaderLunch1 should not be terminated, but was",pr.wasTerminated); 56 56 Assert.assertEquals((Integer) 0, pr.returnValue); -
trunk/icedtea-web/tests/reproducers/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java
r418 r429 36 36 */ 37 37 38 39 38 import java.util.Arrays; 40 39 import java.util.List; 41 40 41 import net.sourceforge.jnlp.ProcessResult; 42 42 import net.sourceforge.jnlp.ServerAccess; 43 43 import org.junit.Assert; … … 50 50 public void runTest(String jnlpName, String exception) throws Exception { 51 51 List<String> verbosed = Arrays.asList(new String[] { "-verbose" }); 52 ServerAccess.ProcessResult pr=server.executeJavawsHeadless(verbosed, "/" + jnlpName + ".jnlp");52 ProcessResult pr=server.executeJavawsHeadless(verbosed, "/" + jnlpName + ".jnlp"); 53 53 String s1 = "Good simple javaws exapmle"; 54 54 Assert.assertFalse("test" + jnlpName + " stdout should not contain " + s1 + " but did.", pr.stdout.contains(s1)); -
trunk/icedtea-web/tests/reproducers/simple/LocalisedInformationElement/testcases/LocalisedInformationElementTest.java
r418 r429 63 63 Map<String, String> p = System.getenv(); 64 64 Set<Entry<String, String>> r = p.entrySet(); 65 List<Entry<String, String>> rr = new ArrayList (r);65 List<Entry<String, String>> rr = new ArrayList<Entry<String, String>>(r); 66 66 Collections.sort(rr, new Comparator<Entry<String, String>>() { 67 67 … … 94 94 String s = "LocalisedInformationElement launched"; 95 95 Assert.assertTrue(id + " stdout should contains " + s + " bud didn't", pr.stdout.contains(s)); 96 //to strict?97 //String ss = "xception";98 //Assert.assertFalse(id + " stderr should not contains " + ss + " but did", pr.stderr.contains(ss));99 96 String locMatch = "(?s).*default locale: \\w{2}.*"; 100 97 Assert.assertTrue(id + " stdout should match " + locMatch + " bud didn't", pr.stdout.matches(locMatch)); -
trunk/icedtea-web/tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java
r418 r429 36 36 */ 37 37 38 import java.util.Arrays; 39 import net.sourceforge.jnlp.ProcessResult; 38 40 import net.sourceforge.jnlp.ServerAccess; 39 41 import net.sourceforge.jnlp.annotations.Bug; 42 import net.sourceforge.jnlp.runtime.Translator; 43 40 44 import org.junit.Assert; 41 42 45 import org.junit.Test; 43 46 … … 50 53 private static final String twoMainException = "net.sourceforge.jnlp.ParseException: Invalid XML document syntax"; 51 54 52 private void assertManifestedJar1(String id, ServerAccess.ProcessResult q) {55 private void assertManifestedJar1(String id, ProcessResult q) { 53 56 String s = "Hello from ManifestedJar1"; 54 57 Assert.assertTrue(id + " stdout should contains `" + s + "`, but didn't ", q.stdout.contains(s)); 55 58 } 56 59 57 private void assertManifestedJar2(String id, ServerAccess.ProcessResult q) {60 private void assertManifestedJar2(String id, ProcessResult q) { 58 61 String s = "Hello from ManifestedJar2"; 59 62 Assert.assertTrue(id + " stdout should contains `" + s + "`, but didn't ", q.stdout.contains(s)); 60 63 } 61 64 62 private void assertNotManifestedJar1(String id, ServerAccess.ProcessResult q) {65 private void assertNotManifestedJar1(String id, ProcessResult q) { 63 66 String s = "Hello from ManifestedJar1"; 64 67 Assert.assertFalse(id + " stdout should NOT contains `" + s + "`, but didn ", q.stdout.contains(s)); 65 68 } 66 private void assertAppError(String id, ServerAccess.ProcessResult q) {69 private void assertAppError(String id, ProcessResult q) { 67 70 Assert.assertTrue(id + " stderr should contains `" + nonLunchableMessage + "`, but didnn't ", q.stderr.contains(nonLunchableMessage)); 68 71 } 69 72 70 private void assertNotManifestedJar2(String id, ServerAccess.ProcessResult q) {73 private void assertNotManifestedJar2(String id, ProcessResult q) { 71 74 String s = "Hello from ManifestedJar2"; 72 75 Assert.assertFalse(id + " stdout should NOT contains `" + s + "`, but didn ", q.stdout.contains(s)); 73 76 } 74 77 75 private void assertNotDead(String id, ServerAccess.ProcessResult pr) {78 private void assertNotDead(String id, ProcessResult pr) { 76 79 String cc = "ClassNotFoundException"; 77 80 Assert.assertFalse(id + " stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); … … 86 89 public void manifestedJar1nothing2nothingNoAppDesc() throws Exception { 87 90 String id = "ManifestedJar-1nothing2nothingNoAppDesc"; 88 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");91 ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); 89 92 assertManifestedJar1(id, pr); 90 93 assertNotDead(id, pr); … … 98 101 public void manifestedJar1noAppDesc() throws Exception { 99 102 String id = "ManifestedJar-1noAppDesc"; 100 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");103 ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); 101 104 assertManifestedJar1(id, pr); 102 105 assertNotDead(id, pr); … … 110 113 public void manifestedJar1mainNoAppDesc() throws Exception { 111 114 String id = "ManifestedJar-1mainNoAppDesc"; 112 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");115 ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); 113 116 assertManifestedJar1(id, pr); 114 117 assertNotDead(id, pr); … … 122 125 public void ManifestedJar1mainHaveAppDesc() throws Exception { 123 126 String id = "ManifestedJar-1mainHaveAppDesc"; 124 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");127 ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); 125 128 assertManifestedJar2(id, pr); 126 129 assertNotDead(id, pr); … … 134 137 public void ManifestedJar1main2nothingNoAppDesc() throws Exception { 135 138 String id = "ManifestedJar-1main2nothingNoAppDesc"; 136 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");139 ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); 137 140 assertManifestedJar2(id, pr); 138 141 assertNotDead(id, pr); … … 146 149 public void manifestedJar1main2nothingNoAppDesc() throws Exception { 147 150 String id = "ManifestedJar-1main2nothingNoAppDesc"; 148 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");151 ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); 149 152 assertManifestedJar2(id, pr); 150 153 assertNotDead(id, pr); … … 154 157 * 155 158 * Two jars, both with manifest, sboth with main tag, no app desc 156 * 157 * thisis passing, SUSPICIOUS, but to lunch at least something is better then to lunch nothing at all. 158 * althoug it maybe SHOULD throw twoMainException 159 * first jar is taken 160 * 159 161 */ 160 162 @Test 161 163 public void manifestedJar1main2mainNoAppDesc() throws Exception { 162 164 String id = "ManifestedJar-1main2mainNoAppDesc"; 163 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); 164 assertManifestedJar1(id, pr); 165 assertNotDead(id, pr); 165 ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); 166 assertManifestedJar1(id, pr); 167 assertNotManifestedJar2(id, pr); 168 assertNotDead(id, pr); 169 } 170 171 /** 172 * 173 * Two jars, both with manifest, sboth with main tag, no app desc 174 * two main jars reported 175 * 176 */ 177 @Test 178 public void manifestedJar1main2mainNoAppDescStrict() throws Exception { 179 String id = "ManifestedJar-1main2mainNoAppDesc"; 180 ProcessResult pr = server.executeJavawsHeadless(Arrays.asList(new String[]{"-strict"}), "/" + id + ".jnlp"); 181 assertNotManifestedJar1(id, pr); 182 assertNotManifestedJar2(id, pr); 183 assertNotDead(id, pr); 184 Assert.assertTrue(pr.stderr.contains(Translator.R("PTwoMains")) || pr.stdout.contains(Translator.R("PTwoMains"))); 166 185 } 167 186 … … 175 194 public void manifestedJar1main2mainAppDesc() throws Exception { 176 195 String id = "ManifestedJar-1main2mainAppDesc"; 177 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");196 ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); 178 197 assertNotManifestedJar1(id, pr); 179 198 assertNotManifestedJar2(id, pr); … … 190 209 public void manifestedJar1noAppDescAtAll() throws Exception { 191 210 String id = "ManifestedJar-1noAppDescAtAll"; 192 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");211 ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); 193 212 assertNotManifestedJar1(id, pr); 194 213 assertNotManifestedJar2(id, pr); … … 209 228 public void manifestedJar1nothing2nothingAppDesc() throws Exception { 210 229 String id = "ManifestedJar-1nothing2nothingAppDesc"; 211 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");212 assert NotManifestedJar2(id, pr);230 ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); 231 assertManifestedJar2(id, pr); 213 232 assertNotManifestedJar1(id, pr); 214 233 assertNotDead(id, pr); -
trunk/icedtea-web/tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java
r418 r429 36 36 */ 37 37 38 import net.sourceforge.jnlp.ProcessResult; 38 39 import net.sourceforge.jnlp.ServerAccess; 39 40 import org.junit.Assert; 40 41 41 import org.junit.Test; 42 42 … … 47 47 @Test 48 48 public void ReadEnvironmentLunch1() throws Exception { 49 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReadEnvironment.jnlp");49 ProcessResult pr = server.executeJavawsHeadless(null, "/ReadEnvironment.jnlp"); 50 50 String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "getenv.USER" + ".*"; 51 51 Assert.assertTrue("stderr should match"+s+"but didn't",pr.stderr.matches(s)); 52 52 String cc="ClassNotFoundException"; 53 53 Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); 54 Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2);55 54 Assert.assertFalse("ReadEnvironmentLunch1 should not be terminated, but was",pr.wasTerminated); 56 55 Assert.assertEquals((Integer) 0, pr.returnValue); -
trunk/icedtea-web/tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java
r418 r429 36 36 */ 37 37 38 38 import net.sourceforge.jnlp.ProcessResult; 39 39 import net.sourceforge.jnlp.ServerAccess; 40 40 import org.junit.Assert; … … 48 48 @Test 49 49 public void ReadPropertiesLunch1() throws Exception { 50 ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp");50 ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp"); 51 51 String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.name.{0,5}read" + ".*"; 52 52 Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); 53 53 String cc="ClassNotFoundException"; 54 54 Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); 55 Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2);56 55 Assert.assertFalse("ReadPropertiesLunch1 should not be terminated, but was",pr.wasTerminated); 57 56 Assert.assertEquals((Integer)0, pr.returnValue); … … 60 59 @Test 61 60 public void ReadPropertiesLunch2() throws Exception { 62 ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties2.jnlp");61 ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties2.jnlp"); 63 62 String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.home.{0,5}read" + ".*"; 64 63 Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); 65 64 String cc="ClassNotFoundException"; 66 65 Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); 67 Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2);68 66 Assert.assertFalse("ReadPropertiesLunch2 should not be terminated, but was",pr.wasTerminated); 69 67 Assert.assertEquals((Integer)0, pr.returnValue); -
trunk/icedtea-web/tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java
r418 r429 36 36 */ 37 37 38 import net.sourceforge.jnlp.ProcessResult; 38 39 import net.sourceforge.jnlp.ServerAccess; 39 40 import org.junit.Assert; … … 46 47 @Test 47 48 public void RedirectStreamsTest1() throws Exception { 48 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/RedirectStreams.jnlp");49 ProcessResult pr = server.executeJavawsHeadless(null, "/RedirectStreams.jnlp"); 49 50 String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setIO" + ".*"; 50 51 Assert.assertTrue("Stderr should match "+s+" but didn't",pr.stderr.matches(s)); 51 52 String cc="ClassNotFoundException"; 52 53 Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); 53 Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2);54 54 Assert.assertFalse("RedirectStreams should not be terminated, but was",pr.wasTerminated); 55 55 Assert.assertEquals((Integer) 0, pr.returnValue); -
trunk/icedtea-web/tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java
r418 r429 36 36 */ 37 37 38 import net.sourceforge.jnlp.ProcessResult; 38 39 import net.sourceforge.jnlp.ServerAccess; 39 40 import org.junit.Assert; … … 46 47 @Test 47 48 public void ReplaceSecurityManagerLunch1() throws Exception { 48 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReplaceSecurityManager.jnlp");49 ProcessResult pr = server.executeJavawsHeadless(null, "/ReplaceSecurityManager.jnlp"); 49 50 String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setSecurityManager" + ".*"; 50 51 Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); 51 52 String cc="ClassNotFoundException"; 52 53 Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); 53 Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2);54 54 Assert.assertFalse("ReplaceSecurityManagerLunch1 should not be terminated, but was",pr.wasTerminated); 55 55 Assert.assertEquals((Integer) 0, pr.returnValue); -
trunk/icedtea-web/tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java
r418 r429 36 36 */ 37 37 38 import net.sourceforge.jnlp.ProcessResult; 38 39 import net.sourceforge.jnlp.ServerAccess; 39 40 import org.junit.Assert; … … 46 47 @Test 47 48 public void SetContextClassLoader1() throws Exception { 48 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SetContextClassLoader.jnlp");49 ProcessResult pr = server.executeJavawsHeadless(null, "/SetContextClassLoader.jnlp"); 49 50 String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setContextClassLoader" + ".*"; 50 51 Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); 51 52 String cc="ClassNotFoundException"; 52 53 Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); 53 Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2);54 54 Assert.assertFalse("SetContextClassLoader1 should not be terminated, but was",pr.wasTerminated); 55 55 Assert.assertEquals((Integer) 0, pr.returnValue); -
trunk/icedtea-web/tests/reproducers/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java
r418 r429 37 37 38 38 import java.util.ArrayList; 39 import java.util.Arrays; 39 40 import java.util.List; 41 import net.sourceforge.jnlp.ContentReaderListener; 42 import net.sourceforge.jnlp.ProcessResult; 40 43 import net.sourceforge.jnlp.ServerAccess; 41 44 import net.sourceforge.jnlp.annotations.Bug; … … 44 47 import net.sourceforge.jnlp.browsertesting.Browsers; 45 48 import net.sourceforge.jnlp.annotations.TestInBrowsers; 49 import net.sourceforge.jnlp.closinglisteners.StringBasedClosingListener; 46 50 import org.junit.Assert; 47 51 import org.junit.Test; … … 50 54 public class SpacesCanBeEverywhereTests extends BrowserTest { 51 55 52 56 public static final String s = "Spaces can be everywhere.jsr was launched correctly"; 53 57 @Bug(id="PR811") 54 58 @Test … … 82 86 * only on ocal files, and probably only from test run - it can be ignored 83 87 */ 84 ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands); 85 String s="Spaces can be everywhere.jsr was launched correctly"; 86 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); 87 String cc = "xception"; 88 Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); 88 ProcessResult pr = ServerAccess.executeProcess(commands); 89 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); 89 90 Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); 90 91 Assert.assertEquals((Integer) 0, pr.returnValue); … … 95 96 @NeedsDisplay 96 97 public void SpacesCanBeEverywhereRemoteAppletTestsJnlp2() throws Exception { 97 ServerAccess.ProcessResult pr = server.executeJavaws("/NotOnly%20spaces%20can%20kill%20%C4%9B%C5%A1%C4%8D%C5%99%C5%BE%20too.jnlp"); 98 String s="Spaces can be everywhere.jsr was launched correctly"; 99 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); 100 String cc = "xception"; 101 Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); 102 Assert.assertFalse("should NOT be terminated, but was not", pr.wasTerminated); 98 ProcessResult pr = server.executeJavaws("/NotOnly%20spaces%20can%20kill%20%C4%9B%C5%A1%C4%8D%C5%99%C5%BE%20too.jnlp"); 99 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); 100 Assert.assertFalse("should NOT be terminated, but was", pr.wasTerminated); 103 101 } 104 102 … … 108 106 @TestInBrowsers(testIn = {Browsers.all}) 109 107 public void SpacesCanBeEverywhereRemoteAppletTestsHtml2() throws Exception { 110 ServerAccess.ProcessResult pr = server.executeBrowser("/spaces+applet+Tests.html"); 111 String s="Spaces can be everywhere.jsr was launched correctly"; 112 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); 113 String cc = "xception"; 114 Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); 108 ProcessResult pr = server.executeBrowser("/spaces+applet+Tests.html", Arrays.asList(new ContentReaderListener[] {new StringBasedClosingListener(s)}), null); 109 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); 115 110 Assert.assertTrue("should be terminated, but was not", pr.wasTerminated); 116 111 } … … 120 115 @Test 121 116 public void SpacesCanBeEverywhereRemoteTests1() throws Exception { 122 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere1.jnlp");117 ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere1.jnlp"); 123 118 String s = "Good simple javaws exapmle"; 124 119 Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s)); … … 132 127 @Test 133 128 public void SpacesCanBeEverywhereRemoteTests2() throws Exception { 134 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp"); 135 String s="Spaces can be everywhere.jsr was launched correctly"; 129 ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp"); 136 130 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); 137 131 String cc = "ClassNotFoundException"; … … 144 138 @Test 145 139 public void SpacesCanBeEverywhereRemoteTests2_withQuery1() throws Exception { 146 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp?test=10"); 147 String s="Spaces can be everywhere.jsr was launched correctly"; 140 ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp?test=10"); 148 141 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); 149 142 String cc = "ClassNotFoundException"; … … 157 150 @Test 158 151 public void SpacesCanBeEverywhereRemoteTests2_withQuery2() throws Exception { 159 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp?test%3D10"); 160 String s="Spaces can be everywhere.jsr was launched correctly"; 152 ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp?test%3D10"); 161 153 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); 162 154 String cc = "ClassNotFoundException"; … … 169 161 @Test 170 162 public void SpacesCanBeEverywhereRemoteTests3() throws Exception { 171 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SpacesCanBeEverywhere1.jnlp"); 172 String s="Spaces can be everywhere.jsr was launched correctly"; 163 ProcessResult pr = server.executeJavawsHeadless(null, "/SpacesCanBeEverywhere1.jnlp"); 173 164 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); 174 165 String cc = "ClassNotFoundException"; … … 186 177 commands.add(ServerAccess.HEADLES_OPTION); 187 178 commands.add("Spaces can be everywhere1.jnlp"); 188 ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir());179 ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); 189 180 String s = "Good simple javaws exapmle"; 190 181 Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s)); … … 202 193 commands.add(ServerAccess.HEADLES_OPTION); 203 194 commands.add("Spaces can be everywhere2.jnlp"); 204 ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); 205 String s="Spaces can be everywhere.jsr was launched correctly"; 195 ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); 206 196 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); 207 197 String cc = "ClassNotFoundException"; … … 218 208 commands.add(ServerAccess.HEADLES_OPTION); 219 209 commands.add(server.getDir()+"/Spaces can be everywhere2.jnlp"); 220 ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands); 221 String s="Spaces can be everywhere.jsr was launched correctly"; 210 ProcessResult pr = ServerAccess.executeProcess(commands); 222 211 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); 223 212 String cc = "ClassNotFoundException"; … … 234 223 commands.add(ServerAccess.HEADLES_OPTION); 235 224 commands.add("SpacesCanBeEverywhere1.jnlp"); 236 ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); 237 String s="Spaces can be everywhere.jsr was launched correctly"; 225 ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); 238 226 Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); 239 227 String cc = "ClassNotFoundException"; -
trunk/icedtea-web/tests/reproducers/simple/UnsignedJnlpApplication/testcases/UnsignedJnlpApplicationTest.java
r418 r429 39 39 import java.util.Collections; 40 40 import java.util.List; 41 import net.sourceforge.jnlp.ProcessResult; 41 42 import net.sourceforge.jnlp.ServerAccess; 42 43 import org.junit.Assert; … … 51 52 @Test 52 53 public void jnlpFileIsUnchecked1() throws Exception { 53 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication1.jnlp");54 ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication1.jnlp"); 54 55 Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); 55 56 } … … 57 58 @Test 58 59 public void jnlpFileIsUnchecked2() throws Exception { 59 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication2.jnlp");60 ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication2.jnlp"); 60 61 Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); 61 62 } … … 63 64 @Test 64 65 public void jnlpFileIsUnchecked3() throws Exception { 65 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication3.jnlp");66 ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication3.jnlp"); 66 67 Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); 67 68 } -
trunk/icedtea-web/tests/reproducers/simple/UnsignedJnlpTemplate/testcases/UnsignedJnlpTemplateTest.java
r418 r429 39 39 import java.util.Collections; 40 40 import java.util.List; 41 import net.sourceforge.jnlp.ProcessResult; 41 42 import net.sourceforge.jnlp.ServerAccess; 42 43 import org.junit.Assert; … … 51 52 @Test 52 53 public void jnlpTemplateIsUnchecked1() throws Exception { 53 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate1.jnlp");54 ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate1.jnlp"); 54 55 Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); 55 56 } … … 57 58 @Test 58 59 public void jnlpTemplateIsUnchecked2() throws Exception { 59 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate2.jnlp");60 ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate2.jnlp"); 60 61 Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); 61 62 } … … 63 64 @Test 64 65 public void jnlpTemplateIsUnchecked3() throws Exception { 65 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate3.jnlp");66 ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate3.jnlp"); 66 67 Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); 67 68 } -
trunk/icedtea-web/tests/reproducers/simple/deadlocktest/testcases/DeadLockTestTest.java
r418 r429 37 37 38 38 import java.util.ArrayList; 39 import net.sourceforge.jnlp.ProcessResult; 39 40 import net.sourceforge.jnlp.ServerAccess; 40 import net.sourceforge.jnlp.ServerAccess.ProcessResult;41 41 import org.junit.Assert; 42 42 import java.util.Arrays; … … 81 81 List<String> before = countJavaInstances(); 82 82 ServerAccess.logOutputReprint("java1 " + jnlp + " : " + before.size()); 83 ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, jnlp);83 ProcessResult pr = server.executeJavawsHeadless(null, jnlp); 84 84 assertDeadlockTestLaunched(pr); 85 85 List<String> after = countJavaInstances(); … … 168 168 ServerAccess.PROCESS_LOG = false; 169 169 try { 170 ServerAccess.ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"kill", "-9", string}));170 ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"kill", "-9", string})); 171 171 } finally { 172 172 ServerAccess.PROCESS_LOG = true; … … 183 183 ServerAccess.PROCESS_LOG = false; 184 184 try { 185 ServerAccess.ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"ps", "-eo", "pid,ppid,stat,fname"}));185 ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"ps", "-eo", "pid,ppid,stat,fname"})); 186 186 Matcher m = Pattern.compile("\\s*\\d+\\s+\\d+ .+ java\\s*").matcher(pr.stdout); 187 187 int i = 0; … … 206 206 String s = "Deadlock test started"; 207 207 Assert.assertTrue("Deadlock test should print out " + s + ", but did not", pr.stdout.contains(s)); 208 String ss = "xception";209 Assert.assertFalse("Deadlock test should not stderr " + ss + " but did", pr.stderr.contains(ss));210 208 //each 3500 seconds deadlock test stdout something 211 209 //timeout is 20s -
trunk/icedtea-web/tests/reproducers/simple/simpletest1/srcs/SimpleTest1.java
r418 r429 40 40 public static void main(String[] args){ 41 41 System.out.println("Good simple javaws exapmle"); 42 for (int i = 0; i < args.length; i++) { 43 String string = args[i]; 44 System.out.println(string); 45 46 } 42 47 } 43 48 } -
trunk/icedtea-web/tests/reproducers/simple/simpletest1/testcases/SimpleTest1Test.java
r418 r429 36 36 */ 37 37 38 38 import java.io.File; 39 import java.io.FileInputStream; 40 import java.io.IOException; 41 import java.net.MalformedURLException; 42 import java.net.URL; 43 import java.util.Arrays; 44 import java.util.List; 45 import net.sourceforge.jnlp.ProcessResult; 39 46 import net.sourceforge.jnlp.ServerAccess; 40 47 import org.junit.Assert; … … 45 52 46 53 private static ServerAccess server = new ServerAccess(); 54 private static final List<String> strict = Arrays.asList(new String[]{"-strict", ServerAccess.VERBOSE_OPTION}); 47 55 48 56 private void checkLaunched(ProcessResult pr) { 57 checkLaunched(pr, false); 58 } 59 60 private void checkLaunched(ProcessResult pr, boolean negate) { 61 String s = "Good simple javaws exapmle"; 62 if (negate) { 63 Assert.assertFalse("testSimpletest1lunchOk stdout should NOT contains " + s + " bud did", pr.stdout.contains(s)); 64 } else { 65 Assert.assertTrue("testSimpletest1lunchOk stdout should contains " + s + " bud didn't", pr.stdout.contains(s)); 66 } 67 String ss = "xception"; 68 if (negate) { 69 Assert.assertTrue("testSimpletest1lunchOk stderr should contains " + ss + " but didn't", pr.stderr.contains(ss)); 70 } else { 71 //disabled, unnecessary exceptions may occure 72 //Assert.assertFalse("testSimpletest1lunchOk stderr should not contains " + ss + " but did", pr.stderr.contains(ss)); 73 } 74 Assert.assertFalse(pr.wasTerminated); 75 Assert.assertEquals((Integer) 0, pr.returnValue); 76 } 49 77 50 78 @Test 51 79 public void testSimpletest1lunchOk() throws Exception { 52 ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/simpletest1.jnlp"); 53 String s="Good simple javaws exapmle"; 54 Assert.assertTrue("testSimpletest1lunchOk stdout should contains "+s+" bud didn't",pr.stdout.contains(s)); 55 String ss="xception"; 56 Assert.assertFalse("testSimpletest1lunchOk stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); 57 Assert.assertFalse(pr.wasTerminated); 58 Assert.assertEquals((Integer)0, pr.returnValue); 80 ProcessResult pr = server.executeJavawsHeadless(null, "/simpletest1.jnlp"); 81 checkLaunched(pr); 59 82 } 60 83 61 } 84 @Test 85 public void testSimpletest1lunchNotOkJnlpStrict() throws Exception { 86 ProcessResult pr = server.executeJavawsHeadless(strict, "/simpletest1.jnlp"); 87 checkLaunched(pr, true); 88 } 89 90 @Test 91 public void testSimpletest1lunchOkStrictJnlp() throws Exception { 92 String originalResourceName = "simpletest1.jnlp"; 93 String newResourceName = "simpletest1_strict.jnlp"; 94 createStrictFile(originalResourceName, newResourceName, server.getUrl("")); 95 ProcessResult pr = server.executeJavawsHeadless(null, "/" + newResourceName); 96 checkLaunched(pr); 97 } 98 99 @Test 100 public void testSimpletest1lunchOkStrictJnlpStrict() throws Exception { 101 String originalResourceName = "simpletest1.jnlp"; 102 String newResourceName = "simpletest1_strict.jnlp"; 103 createStrictFile(originalResourceName, newResourceName, server.getUrl("")); 104 ProcessResult pr = server.executeJavawsHeadless(strict, "/" + newResourceName); 105 checkLaunched(pr); 106 } 107 108 private void createStrictFile(String originalResourceName, String newResourceName, URL codebase) throws MalformedURLException, IOException { 109 String originalContent = ServerAccess.getContentOfStream(new FileInputStream(new File(server.getDir(), originalResourceName))); 110 String nwContent1 = originalContent.replaceAll("href=\""+originalResourceName+"\"", "href=\""+newResourceName+"\""); 111 String nwContent = nwContent1.replaceAll("codebase=\".\"", "codebase=\"" + codebase + "\""); 112 ServerAccess.saveFile(nwContent, new File(server.getDir(), newResourceName)); 113 } 114 } -
trunk/icedtea-web/tests/reproducers/simple/simpletest2/srcs/SimpleTest2.java
r418 r429 1 2 import java.applet.Applet; 3 1 4 /* SimpleTest2.java 2 5 Copyright (C) 2011 Red Hat, Inc. … … 36 39 */ 37 40 38 public class SimpleTest2 {41 public class SimpleTest2 extends Applet{ 39 42 40 public static void main(String[] args){ 41 throw new RuntimeException("Correct exception"); 43 public static void main(String[] args) { 44 throw new RuntimeException("Correct exception"); 45 } 42 46 47 @Override 48 public void init() { 49 System.out.println("applet was initialised"); 43 50 } 51 52 @Override 53 public void start() { 54 System.out.println("applet was started"); 55 main(null); 56 } 57 58 @Override 59 public void stop() { 60 System.out.println("applet was stopped"); 61 } 62 63 @Override 64 public void destroy() { 65 System.out.println("applet will be destroyed"); 66 } 67 44 68 } -
trunk/icedtea-web/tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java
r418 r429 36 36 */ 37 37 38 import net.sourceforge.jnlp.ProcessResult; 38 39 import net.sourceforge.jnlp.ServerAccess; 40 39 41 import org.junit.Assert; 40 41 42 import org.junit.Test; 42 43 … … 48 49 @Test 49 50 public void testSimpletest2lunchException() throws Exception { 50 ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/simpletest2.jnlp"); 51 Assert.assertTrue("stdout should be < 1 , but was "+pr.stdout.trim().length(),pr.stdout.trim().length() < 1); 51 ProcessResult pr=server.executeJavawsHeadless(null,"/simpletest2.jnlp"); 52 52 String s="Correct exception"; 53 53 Assert.assertTrue("stderr should contains "+s+" but didn't",pr.stderr.contains(s)); … … 55 55 Assert.assertTrue("stderr should contains "+ss+" but did not",pr.stderr.contains(ss)); 56 56 Assert.assertFalse("testSimpletest2lunchException should not be terminated, but was",pr.wasTerminated); 57 //Assert.assertFalse(0==pr.returnValue);exception and still returned 0?58 57 } 59 58
Note:
See TracChangeset
for help on using the changeset viewer.