Ignore:
Timestamp:
Sep 24, 2014, 9:34:21 PM (11 years ago)
Author:
dmik
Message:

icedtea-web: Merge version 1.5.1 from vendor to trunk.

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  
    3838import java.util.Arrays;
    3939import java.util.List;
     40import net.sourceforge.jnlp.ProcessResult;
    4041import net.sourceforge.jnlp.ServerAccess;
    41 import net.sourceforge.jnlp.ServerAccess.ProcessResult;
     42
    4243import org.junit.Assert;
    43 
    4444import org.junit.Test;
    4545
     
    7373    private static final List<String> xta = Arrays.asList(new String[]{"-Xtrustall"});
    7474
    75     private void testShouldFail(ServerAccess.ProcessResult pr, String s) {
     75    private void testShouldFail(ProcessResult pr, String s) {
    7676        String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + s + ".*";
    7777        Assert.assertTrue("stderr should match `" + c + "`, but didn't ", pr.stderr.matches(c));
    7878    }
    7979
    80     private void testShouldNOTFail(ServerAccess.ProcessResult pr, String s) {
     80    private void testShouldNOTFail(ProcessResult pr, String s) {
    8181        String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + s + ".*";
    8282        Assert.assertFalse("stderr should NOT match `" + c + "`, but did ", pr.stderr.matches(c));
     
    9090    }
    9191
    92     private void testShouldPass(ServerAccess.ProcessResult pr, String s) {
     92    private void testShouldPass(ProcessResult pr, String s) {
    9393        String c = "Class was obtained: " + s;
    9494        Assert.assertTrue("stdout should contains `" + c + "`, but didn't ", pr.stdout.contains(c));
    9595    }
    9696
    97     private void testShouldNOTPass(ServerAccess.ProcessResult pr, String s) {
     97    private void testShouldNOTPass(ProcessResult pr, String s) {
    9898        String c = "Class was obtained: " + s;
    9999        Assert.assertFalse("stdout should not contains `" + c + "`, but did ", pr.stdout.contains(c));
     
    102102    @Test
    103103    public void AccessClassInPackageJAVAXJNLP() throws Exception {
    104         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[0]);
     104        ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[0]);
    105105        commonPitfall(pr);
    106106        testShouldPass(pr, pass[0]);
     
    110110    @Test
    111111    public void AccessClassInPackageSELF() throws Exception {
    112         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[1]);
     112        ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[1]);
    113113        commonPitfall(pr);
    114114        testShouldPass(pr, pass[1]);
     
    118118    @Test
    119119    public void AccessClassInPackageNETSF() throws Exception {
    120         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[2]);
     120        ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[2]);
    121121        commonPitfall(pr);
    122122        testShouldFail(pr, badExceptions[2]);
     
    126126    @Test
    127127    public void AccessClassInPackageSUNSEC() throws Exception {
    128         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[3]);
     128        ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[3]);
    129129        commonPitfall(pr);
    130130        commonPitfall(pr);
     
    136136    @Test
    137137    public void AccessClassInPackageSignedJAVAXJNLP() throws Exception {
    138         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[0]);
     138        ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[0]);
    139139        commonPitfall(pr);
    140140        testShouldPass(pr, pass[0]);
     
    144144    @Test
    145145    public void AccessClassInPackageSignedSELF() throws Exception {
    146         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[1]);
     146        ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[1]);
    147147        commonPitfall(pr);
    148148        testShouldPass(pr, pass[1]);
     
    152152    @Test
    153153    public void AccessClassInPackageSignedNETSF() throws Exception {
    154         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[2]);
     154        ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[2]);
    155155        commonPitfall(pr);
    156156        testShouldPass(pr, pass[2]);
     
    160160    @Test
    161161    public void AccessClassInPackageSignedSUNSEC() throws Exception {
    162         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[3]);
     162        ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[3]);
    163163        commonPitfall(pr);
    164164        testShouldPass(pr, pass[3]);
  • trunk/icedtea-web/tests/reproducers/simple/AddShutdownHook/srcs/AddShutdownHook.java

    r418 r429  
     1
     2import java.applet.Applet;
     3
    14/* AddShutdownHook.java
    2 Copyright (C) 2011 Red Hat, Inc.
     5 Copyright (C) 2011 Red Hat, Inc.
    36
    4 This file is part of IcedTea.
     7 This file is part of IcedTea.
    58
    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 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.
    912
    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.
     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.
    1417
    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.
     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.
    1922
    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.
     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.
    2427
    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.
     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.
    3639 */
     40public class AddShutdownHook extends Applet {
    3741
    38 public class AddShutdownHook {
    3942    public static void main(String[] args) {
    4043
    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");
    4756    }
    4857}
  • trunk/icedtea-web/tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java

    r418 r429  
    11/* AddShutdownHookTest.java
    2 Copyright (C) 2011 Red Hat, Inc.
     2 Copyright (C) 2011 Red Hat, Inc.
    33
    4 This file is part of IcedTea.
     4 This file is part of IcedTea.
    55
    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.
     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.
    99
    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.
     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.
    1414
    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.
     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.
    1919
    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.
     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.
    2424
    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.
     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.
    3636 */
    3737
    38 import net.sourceforge.jnlp.ServerAccess;
     38import net.sourceforge.jnlp.ClosingListener;
     39import net.sourceforge.jnlp.ProcessResult;
     40import net.sourceforge.jnlp.annotations.TestInBrowsers;
     41import net.sourceforge.jnlp.browsertesting.BrowserTest;
     42import net.sourceforge.jnlp.browsertesting.Browsers;
     43import net.sourceforge.jnlp.closinglisteners.RulesFolowingClosingListener;
     44import net.sourceforge.jnlp.closinglisteners.StringMatchClosingListener;
    3945import org.junit.Assert;
    4046
    4147import org.junit.Test;
    4248
    43 public class AddShutdownHookTest {
     49public class AddShutdownHookTest extends BrowserTest {
    4450
    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);
    4658
    4759    @Test
    4860    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));
    5666        Assert.assertEquals((Integer) 0, pr.returnValue);
    5767    }
     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    }
    5881}
  • trunk/icedtea-web/tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java

    r418 r429  
    3636 */
    3737
     38import net.sourceforge.jnlp.ProcessResult;
    3839import net.sourceforge.jnlp.ServerAccess;
    3940import org.junit.Assert;
     
    4950    @Test
    5051    public void AllStackTracesTest1() throws Exception {
    51         ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/AllStackTraces.jnlp");
     52        ProcessResult pr=server.executeJavawsHeadless(null,"/AllStackTraces.jnlp");
    5253        String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "getStackTrace" + ".*";
    5354        Assert.assertTrue("stderr should match `"+c+"`, but didn't ",pr.stderr.matches(c));
    5455        String cc="ClassNotFoundException";
    5556        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);
    5757        Assert.assertFalse("AllStackTracesTest1 should not be terminated, but was",pr.wasTerminated);
    5858        Assert.assertEquals((Integer)0, pr.returnValue);
  • trunk/icedtea-web/tests/reproducers/simple/AppletBaseURLTest/srcs/AppletBaseURL.java

    r418 r429  
    3838import java.applet.Applet;
    3939public class AppletBaseURL extends Applet {
    40 
    41     private class Killer extends Thread {
    42 
    43         public int n = 1000;
    44 
    45         @Override
    46         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 
    5740    @Override
    5841    public void init() {
    5942        System.out.println("Document base is " + getDocumentBase() + " for this applet");
    6043        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);
    6348    }
    6449}
  • trunk/icedtea-web/tests/reproducers/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java

    r418 r429  
    3636 */
    3737
    38 import net.sourceforge.jnlp.ServerAccess.ProcessResult;
     38import net.sourceforge.jnlp.ProcessResult;
     39import net.sourceforge.jnlp.ServerAccess.AutoClose;
    3940import net.sourceforge.jnlp.annotations.Bug;
    4041import net.sourceforge.jnlp.annotations.NeedsDisplay;
     
    4950
    5051    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));
    5758    }
    5859
     
    6061    @Test
    6162    public void AppletWebstartBaseURLTest() throws Exception {
    62         ProcessResult pr = server.executeJavaws(null, "/AppletBaseURLTest.jnlp");
     63        ProcessResult pr = server.executeJavaws("/AppletBaseURLTest.jnlp");
    6364        evaluateApplet(pr, "");
    6465        Assert.assertFalse(pr.wasTerminated);
     
    7172    @TestInBrowsers(testIn={Browsers.one})
    7273    public void AppletInFirefoxTest() throws Exception {
    73         ProcessResult pr = server.executeBrowser("/AppletBaseURLTest.html");
     74        ProcessResult pr = server.executeBrowser("/AppletBaseURLTest.html", AutoClose.CLOSE_ON_BOTH);
    7475        pr.process.destroy();
    7576        evaluateApplet(pr, "AppletBaseURLTest.html");
     
    8283    @TestInBrowsers(testIn={Browsers.one})
    8384    public void AppletWithJNLPHrefTest() throws Exception {
    84         ProcessResult pr = server.executeBrowser("/AppletJNLPHrefBaseURLTest.html");
     85        ProcessResult pr = server.executeBrowser("/AppletJNLPHrefBaseURLTest.html", AutoClose.CLOSE_ON_BOTH);
    8586        pr.process.destroy();
    8687        evaluateApplet(pr, "AppletJNLPHrefBaseURLTest.html");
  • trunk/icedtea-web/tests/reproducers/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java

    r418 r429  
    3636 */
    3737
     38import net.sourceforge.jnlp.ProcessResult;
    3839import net.sourceforge.jnlp.ServerAccess;
    3940import net.sourceforge.jnlp.annotations.TestInBrowsers;
    4041import net.sourceforge.jnlp.browsertesting.BrowserTest;
    4142import net.sourceforge.jnlp.browsertesting.Browsers;
     43
    4244import org.junit.Assert;
    43 
    4445import org.junit.Test;
    4546
     
    5354    @Test
    5455    public void AppletJNLPTest() throws Exception {
    55         ServerAccess.ProcessResult pr = server.executeJavawsHeadless("/AppletReadsInvalidJar.jnlp");
     56        ProcessResult pr = server.executeJavawsHeadless("/AppletReadsInvalidJar.jnlp");
    5657
    5758        Assert.assertFalse("AppletReadsInvalidJar stdout should NOT contain '" + CORRECT_EXECUTION + "', but did (applet should not have ran!).", pr.stdout.contains(CORRECT_EXECUTION));
     
    6364    @TestInBrowsers(testIn={Browsers.one})
    6465    public void AppletInFirefoxTest() throws Exception {
    65         ServerAccess.ProcessResult pr = server.executeBrowser("/AppletReadsInvalidJar.html");
     66        ProcessResult pr = server.executeBrowser("/AppletReadsInvalidJar.html");
    6667
    6768        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  
    3939 */
    4040public class AppletTakesLastParam extends Applet {
    41 
    42     private class Killer extends Thread {
    43 
    44         public int n = 2000;
    45 
    46         @Override
    47         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     @Override
    5941    public void init() {
    6042        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);
    6247    }
    6348}
  • trunk/icedtea-web/tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java

    r418 r429  
    1 /* AppletTestTests.java
     1/* AppletTakesLastParamTests.java
    22Copyright (C) 2011 Red Hat, Inc.
    33
     
    3636 */
    3737
    38 import net.sourceforge.jnlp.ServerAccess;
    39 import net.sourceforge.jnlp.ServerAccess.ProcessResult;
     38import net.sourceforge.jnlp.ProcessResult;
     39import net.sourceforge.jnlp.ServerAccess.AutoClose;
    4040import net.sourceforge.jnlp.browsertesting.BrowserTest;
    4141import net.sourceforge.jnlp.browsertesting.Browsers;
     
    4646
    4747public class AppletTakesLastParamTests extends BrowserTest {
     48    private void evaluate(ProcessResult pr) {
     49        String firstParam = "value1";
     50        String secondParam = "value2";
    4851
    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));
    6056    }
    6157
    6258    @Test
    6359    @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);
    6768    }
    6869}
  • trunk/icedtea-web/tests/reproducers/simple/AppletTest/testcases/AppletTestTests.java

    r418 r429  
    1 /* AppletTestTests.java
     1/*
    22Copyright (C) 2011 Red Hat, Inc.
    33
     
    3636 */
    3737
     38import net.sourceforge.jnlp.closinglisteners.CountingClosingListener;
    3839import net.sourceforge.jnlp.ProcessResult;
    3940import net.sourceforge.jnlp.ServerAccess;
     
    4849public class AppletTestTests extends BrowserTest {
    4950
     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
    5065    @Test
    5166    @TestInBrowsers(testIn = {Browsers.googleChrome})
     
    5671            //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString());
    5772            //just verify loging is recording browser
    58             ProcessResult pr1 = server.executeBrowser("/appletAutoTests.html");
     73            ProcessResult pr1 = server.executeBrowser("/appletAutoTests2.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl());
    5974            if (pr1.process == null) {
    6075                Assert.assertTrue("If proces was null here, then google-chrome had to not exist, and so "
     
    6580                return;
    6681            }
    67             evaluateApplet(pr1,false);
     82            evaluateApplet(pr1, false);
    6883            Assert.assertTrue(pr1.wasTerminated);
    6984            //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString());
    7085            // 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);
    7388            Assert.assertTrue(pr.wasTerminated);
    7489        } finally {
     
    8196    public void AppletTest() throws Exception {
    8297        ProcessResult pr = server.executeJavawsHeadless(null, "/AppletTest.jnlp");
    83         evaluateApplet(pr,true);
     98        evaluateApplet(pr, true);
    8499        Assert.assertFalse(pr.wasTerminated);
    85100        Assert.assertEquals((Integer) 0, pr.returnValue);
     
    87102
    88103    private void evaluateApplet(ProcessResult pr, boolean javawsApplet) {
    89         String s3 = "applet was initialised";
    90104        Assert.assertTrue("AppletTest stdout should contains " + s3 + " bud didn't", pr.stdout.contains(s3));
    91         String s0 = "applet was started";
    92105        Assert.assertTrue("AppletTest stdout should contains " + s0 + " bud didn't", pr.stdout.contains(s0));
    93         String s1 = "value1";
    94106        Assert.assertTrue("AppletTest stdout should contains " + s1 + " bud didn't", pr.stdout.contains(s1));
    95         String s2 = "value2";
    96107        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";
    100108        Assert.assertTrue("AppletTest stdout should contains " + s7 + " bud didn't", pr.stdout.contains(s7));
    101109        if (!javawsApplet) {
    102110            /*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));
    107115             */
    108116        }
     
    117125        ServerAccess.PROCESS_TIMEOUT = 30 * 1000;
    118126        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
    122130            //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null
    123131        } finally {
     
    133141        ServerAccess.PROCESS_TIMEOUT = 30 * 1000;
    134142        try {
    135             ProcessResult pr = server.executeBrowser("/appletAutoTests.html");
     143            ProcessResult pr = server.executeBrowser("/appletAutoTests.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl());
    136144            pr.process.destroy();
    137             evaluateApplet(pr,false);
     145            evaluateApplet(pr, false);
    138146            Assert.assertTrue(pr.wasTerminated);
    139147            //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null
     
    142150        }
    143151    }
     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    }
    144177}
  • trunk/icedtea-web/tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java

    r418 r429  
    3636 */
    3737
     38import net.sourceforge.jnlp.ProcessResult;
    3839import net.sourceforge.jnlp.ServerAccess;
     40
    3941import org.junit.Assert;
    40 
    4142import org.junit.Test;
    4243
     
    4748    @Test
    4849    public void CreateClassLoaderLunch1() throws Exception {
    49         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/CreateClassLoader.jnlp");
     50        ProcessResult pr = server.executeJavawsHeadless(null, "/CreateClassLoader.jnlp");
    5051        String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "createClassLoader" + ".*";
    5152        Assert.assertTrue("Stderr should match "+s+" but didn't",pr.stderr.matches(s));
    5253        String cc="ClassNotFoundException";
    5354        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);
    5555        Assert.assertFalse("CreateClassLoaderLunch1 should not be terminated, but was",pr.wasTerminated);
    5656        Assert.assertEquals((Integer) 0, pr.returnValue);
  • trunk/icedtea-web/tests/reproducers/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java

    r418 r429  
    3636 */
    3737
    38 
    3938import java.util.Arrays;
    4039import java.util.List;
    4140
     41import net.sourceforge.jnlp.ProcessResult;
    4242import net.sourceforge.jnlp.ServerAccess;
    4343import org.junit.Assert;
     
    5050    public void runTest(String jnlpName, String exception) throws Exception {
    5151        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");
    5353        String s1 = "Good simple javaws exapmle";
    5454        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  
    6363        Map<String, String> p = System.getenv();
    6464        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);
    6666        Collections.sort(rr, new Comparator<Entry<String, String>>() {
    6767
     
    9494        String s = "LocalisedInformationElement launched";
    9595        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));
    9996        String locMatch = "(?s).*default locale: \\w{2}.*";
    10097        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  
    3636 */
    3737
     38import java.util.Arrays;
     39import net.sourceforge.jnlp.ProcessResult;
    3840import net.sourceforge.jnlp.ServerAccess;
    3941import net.sourceforge.jnlp.annotations.Bug;
     42import net.sourceforge.jnlp.runtime.Translator;
     43
    4044import org.junit.Assert;
    41 
    4245import org.junit.Test;
    4346
     
    5053    private static final String twoMainException = "net.sourceforge.jnlp.ParseException: Invalid XML document syntax";
    5154
    52     private void assertManifestedJar1(String id, ServerAccess.ProcessResult q) {
     55    private void assertManifestedJar1(String id, ProcessResult q) {
    5356        String s = "Hello from ManifestedJar1";
    5457        Assert.assertTrue(id + " stdout should contains `" + s + "`, but didn't ", q.stdout.contains(s));
    5558    }
    5659
    57     private void assertManifestedJar2(String id, ServerAccess.ProcessResult q) {
     60    private void assertManifestedJar2(String id, ProcessResult q) {
    5861        String s = "Hello from ManifestedJar2";
    5962        Assert.assertTrue(id + " stdout should contains `" + s + "`, but didn't ", q.stdout.contains(s));
    6063    }
    6164
    62     private void assertNotManifestedJar1(String id, ServerAccess.ProcessResult q) {
     65    private void assertNotManifestedJar1(String id, ProcessResult q) {
    6366        String s = "Hello from ManifestedJar1";
    6467        Assert.assertFalse(id + " stdout should NOT contains `" + s + "`, but didn ", q.stdout.contains(s));
    6568    }
    66     private void assertAppError(String id, ServerAccess.ProcessResult q) {
     69    private void assertAppError(String id, ProcessResult q) {
    6770        Assert.assertTrue(id + " stderr should contains `" + nonLunchableMessage + "`, but didnn't ", q.stderr.contains(nonLunchableMessage));
    6871    }
    6972
    70     private void assertNotManifestedJar2(String id, ServerAccess.ProcessResult q) {
     73    private void assertNotManifestedJar2(String id, ProcessResult q) {
    7174        String s = "Hello from ManifestedJar2";
    7275        Assert.assertFalse(id + " stdout should NOT contains `" + s + "`, but didn ", q.stdout.contains(s));
    7376    }
    7477
    75     private void assertNotDead(String id, ServerAccess.ProcessResult pr) {
     78    private void assertNotDead(String id, ProcessResult pr) {
    7679        String cc = "ClassNotFoundException";
    7780        Assert.assertFalse(id + " stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc));
     
    8689    public void manifestedJar1nothing2nothingNoAppDesc() throws Exception {
    8790        String id = "ManifestedJar-1nothing2nothingNoAppDesc";
    88         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
     91        ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
    8992        assertManifestedJar1(id, pr);
    9093        assertNotDead(id, pr);
     
    98101    public void manifestedJar1noAppDesc() throws Exception {
    99102        String id = "ManifestedJar-1noAppDesc";
    100         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
     103        ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
    101104        assertManifestedJar1(id, pr);
    102105        assertNotDead(id, pr);
     
    110113    public void manifestedJar1mainNoAppDesc() throws Exception {
    111114        String id = "ManifestedJar-1mainNoAppDesc";
    112         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
     115        ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
    113116        assertManifestedJar1(id, pr);
    114117        assertNotDead(id, pr);
     
    122125    public void ManifestedJar1mainHaveAppDesc() throws Exception {
    123126        String id = "ManifestedJar-1mainHaveAppDesc";
    124         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
     127        ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
    125128        assertManifestedJar2(id, pr);
    126129        assertNotDead(id, pr);
     
    134137    public void ManifestedJar1main2nothingNoAppDesc() throws Exception {
    135138        String id = "ManifestedJar-1main2nothingNoAppDesc";
    136         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
     139        ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
    137140        assertManifestedJar2(id, pr);
    138141        assertNotDead(id, pr);
     
    146149    public void manifestedJar1main2nothingNoAppDesc() throws Exception {
    147150        String id = "ManifestedJar-1main2nothingNoAppDesc";
    148         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
     151        ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
    149152        assertManifestedJar2(id, pr);
    150153        assertNotDead(id, pr);
     
    154157     *
    155158     * 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     *
    159161     */
    160162    @Test
    161163    public void manifestedJar1main2mainNoAppDesc() throws Exception {
    162164        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")));
    166185    }
    167186
     
    175194    public void manifestedJar1main2mainAppDesc() throws Exception {
    176195        String id = "ManifestedJar-1main2mainAppDesc";
    177         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
     196        ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
    178197        assertNotManifestedJar1(id, pr);
    179198        assertNotManifestedJar2(id, pr);
     
    190209    public void manifestedJar1noAppDescAtAll() throws Exception {
    191210        String id = "ManifestedJar-1noAppDescAtAll";
    192         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
     211        ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
    193212        assertNotManifestedJar1(id, pr);
    194213        assertNotManifestedJar2(id, pr);
     
    209228    public void manifestedJar1nothing2nothingAppDesc() throws Exception {
    210229        String id = "ManifestedJar-1nothing2nothingAppDesc";
    211         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
    212         assertNotManifestedJar2(id, pr);
     230        ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
     231        assertManifestedJar2(id, pr);
    213232        assertNotManifestedJar1(id, pr);
    214233        assertNotDead(id, pr);
  • trunk/icedtea-web/tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java

    r418 r429  
    3636 */
    3737
     38import net.sourceforge.jnlp.ProcessResult;
    3839import net.sourceforge.jnlp.ServerAccess;
    3940import org.junit.Assert;
    40 
    4141import org.junit.Test;
    4242
     
    4747    @Test
    4848    public void ReadEnvironmentLunch1() throws Exception {
    49         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReadEnvironment.jnlp");
     49        ProcessResult pr = server.executeJavawsHeadless(null, "/ReadEnvironment.jnlp");
    5050        String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "getenv.USER" + ".*";
    5151        Assert.assertTrue("stderr should match"+s+"but didn't",pr.stderr.matches(s));
    5252        String cc="ClassNotFoundException";
    5353        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);
    5554        Assert.assertFalse("ReadEnvironmentLunch1 should not be terminated, but was",pr.wasTerminated);
    5655        Assert.assertEquals((Integer) 0, pr.returnValue);
  • trunk/icedtea-web/tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java

    r418 r429  
    3636 */
    3737
    38 
     38import net.sourceforge.jnlp.ProcessResult;
    3939import net.sourceforge.jnlp.ServerAccess;
    4040import org.junit.Assert;
     
    4848    @Test
    4949    public void ReadPropertiesLunch1() throws Exception {
    50         ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp");
     50        ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp");
    5151        String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.name.{0,5}read" + ".*";
    5252        Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s));
    5353        String cc="ClassNotFoundException";
    5454        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);
    5655        Assert.assertFalse("ReadPropertiesLunch1 should not be terminated, but was",pr.wasTerminated);
    5756        Assert.assertEquals((Integer)0, pr.returnValue);
     
    6059    @Test
    6160    public void ReadPropertiesLunch2() throws Exception {
    62         ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties2.jnlp");
     61        ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties2.jnlp");
    6362        String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.home.{0,5}read" + ".*";
    6463        Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s));
    6564        String cc="ClassNotFoundException";
    6665        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);
    6866        Assert.assertFalse("ReadPropertiesLunch2 should not be terminated, but was",pr.wasTerminated);
    6967        Assert.assertEquals((Integer)0, pr.returnValue);
  • trunk/icedtea-web/tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java

    r418 r429  
    3636 */
    3737
     38import net.sourceforge.jnlp.ProcessResult;
    3839import net.sourceforge.jnlp.ServerAccess;
    3940import org.junit.Assert;
     
    4647    @Test
    4748    public void RedirectStreamsTest1() throws Exception {
    48         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/RedirectStreams.jnlp");
     49        ProcessResult pr = server.executeJavawsHeadless(null, "/RedirectStreams.jnlp");
    4950        String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setIO" + ".*";
    5051        Assert.assertTrue("Stderr should match "+s+" but didn't",pr.stderr.matches(s));
    5152        String cc="ClassNotFoundException";
    5253        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);
    5454        Assert.assertFalse("RedirectStreams should not be terminated, but was",pr.wasTerminated);
    5555        Assert.assertEquals((Integer) 0, pr.returnValue);
  • trunk/icedtea-web/tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java

    r418 r429  
    3636 */
    3737
     38import net.sourceforge.jnlp.ProcessResult;
    3839import net.sourceforge.jnlp.ServerAccess;
    3940import org.junit.Assert;
     
    4647    @Test
    4748    public void ReplaceSecurityManagerLunch1() throws Exception {
    48         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReplaceSecurityManager.jnlp");
     49        ProcessResult pr = server.executeJavawsHeadless(null, "/ReplaceSecurityManager.jnlp");
    4950        String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setSecurityManager" + ".*";
    5051        Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s));
    5152        String cc="ClassNotFoundException";
    5253        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);
    5454        Assert.assertFalse("ReplaceSecurityManagerLunch1 should not be terminated, but was",pr.wasTerminated);
    5555        Assert.assertEquals((Integer) 0, pr.returnValue);
  • trunk/icedtea-web/tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java

    r418 r429  
    3636 */
    3737
     38import net.sourceforge.jnlp.ProcessResult;
    3839import net.sourceforge.jnlp.ServerAccess;
    3940import org.junit.Assert;
     
    4647    @Test
    4748    public void SetContextClassLoader1() throws Exception {
    48         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SetContextClassLoader.jnlp");
     49        ProcessResult pr = server.executeJavawsHeadless(null, "/SetContextClassLoader.jnlp");
    4950        String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setContextClassLoader" + ".*";
    5051        Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s));
    5152        String cc="ClassNotFoundException";
    5253        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);
    5454        Assert.assertFalse("SetContextClassLoader1 should not be terminated, but was",pr.wasTerminated);
    5555        Assert.assertEquals((Integer) 0, pr.returnValue);
  • trunk/icedtea-web/tests/reproducers/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java

    r418 r429  
    3737
    3838import java.util.ArrayList;
     39import java.util.Arrays;
    3940import java.util.List;
     41import net.sourceforge.jnlp.ContentReaderListener;
     42import net.sourceforge.jnlp.ProcessResult;
    4043import net.sourceforge.jnlp.ServerAccess;
    4144import net.sourceforge.jnlp.annotations.Bug;
     
    4447import net.sourceforge.jnlp.browsertesting.Browsers;
    4548import net.sourceforge.jnlp.annotations.TestInBrowsers;
     49import net.sourceforge.jnlp.closinglisteners.StringBasedClosingListener;
    4650import org.junit.Assert;
    4751import org.junit.Test;
     
    5054public class SpacesCanBeEverywhereTests extends BrowserTest {
    5155
    52 
     56public static final String s = "Spaces can be everywhere.jsr was launched correctly";
    5357    @Bug(id="PR811")
    5458    @Test
     
    8286         * only on ocal files, and probably only from test run - it can be ignored
    8387         */
    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));
    8990        Assert.assertFalse("should not be terminated, but was", pr.wasTerminated);
    9091        Assert.assertEquals((Integer) 0, pr.returnValue);
     
    9596    @NeedsDisplay
    9697    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);
    103101    }
    104102
     
    108106    @TestInBrowsers(testIn = {Browsers.all})
    109107    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));
    115110        Assert.assertTrue("should be terminated, but was not", pr.wasTerminated);
    116111    }
     
    120115    @Test
    121116    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");
    123118        String s = "Good simple javaws exapmle";
    124119        Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s));
     
    132127    @Test
    133128    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");
    136130        Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
    137131        String cc = "ClassNotFoundException";
     
    144138    @Test
    145139    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");
    148141        Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
    149142        String cc = "ClassNotFoundException";
     
    157150    @Test
    158151    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");
    161153        Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
    162154        String cc = "ClassNotFoundException";
     
    169161    @Test
    170162    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");
    173164        Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
    174165        String cc = "ClassNotFoundException";
     
    186177        commands.add(ServerAccess.HEADLES_OPTION);
    187178        commands.add("Spaces can be everywhere1.jnlp");
    188         ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir());
     179        ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir());
    189180        String s = "Good simple javaws exapmle";
    190181        Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s));
     
    202193        commands.add(ServerAccess.HEADLES_OPTION);
    203194        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());
    206196        Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
    207197        String cc = "ClassNotFoundException";
     
    218208        commands.add(ServerAccess.HEADLES_OPTION);
    219209        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);
    222211        Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
    223212        String cc = "ClassNotFoundException";
     
    234223        commands.add(ServerAccess.HEADLES_OPTION);
    235224        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());
    238226        Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
    239227        String cc = "ClassNotFoundException";
  • trunk/icedtea-web/tests/reproducers/simple/UnsignedJnlpApplication/testcases/UnsignedJnlpApplicationTest.java

    r418 r429  
    3939import java.util.Collections;
    4040import java.util.List;
     41import net.sourceforge.jnlp.ProcessResult;
    4142import net.sourceforge.jnlp.ServerAccess;
    4243import org.junit.Assert;
     
    5152    @Test
    5253    public void jnlpFileIsUnchecked1() throws Exception {
    53         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication1.jnlp");
     54        ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication1.jnlp");
    5455        Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString));
    5556    }
     
    5758    @Test
    5859    public void jnlpFileIsUnchecked2() throws Exception {
    59         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication2.jnlp");
     60        ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication2.jnlp");
    6061        Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString));
    6162    }
     
    6364    @Test
    6465    public void jnlpFileIsUnchecked3() throws Exception {
    65         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication3.jnlp");
     66        ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication3.jnlp");
    6667        Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString));
    6768    }
  • trunk/icedtea-web/tests/reproducers/simple/UnsignedJnlpTemplate/testcases/UnsignedJnlpTemplateTest.java

    r418 r429  
    3939import java.util.Collections;
    4040import java.util.List;
     41import net.sourceforge.jnlp.ProcessResult;
    4142import net.sourceforge.jnlp.ServerAccess;
    4243import org.junit.Assert;
     
    5152    @Test
    5253    public void jnlpTemplateIsUnchecked1() throws Exception {
    53         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate1.jnlp");
     54        ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate1.jnlp");
    5455        Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString));
    5556    }
     
    5758    @Test
    5859    public void jnlpTemplateIsUnchecked2() throws Exception {
    59         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate2.jnlp");
     60        ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate2.jnlp");
    6061        Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString));
    6162    }
     
    6364    @Test
    6465    public void jnlpTemplateIsUnchecked3() throws Exception {
    65         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate3.jnlp");
     66        ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate3.jnlp");
    6667        Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString));
    6768    }
  • trunk/icedtea-web/tests/reproducers/simple/deadlocktest/testcases/DeadLockTestTest.java

    r418 r429  
    3737
    3838import java.util.ArrayList;
     39import net.sourceforge.jnlp.ProcessResult;
    3940import net.sourceforge.jnlp.ServerAccess;
    40 import net.sourceforge.jnlp.ServerAccess.ProcessResult;
    4141import org.junit.Assert;
    4242import java.util.Arrays;
     
    8181        List<String> before = countJavaInstances();
    8282        ServerAccess.logOutputReprint("java1 " + jnlp + " : " + before.size());
    83         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, jnlp);
     83        ProcessResult pr = server.executeJavawsHeadless(null, jnlp);
    8484        assertDeadlockTestLaunched(pr);
    8585        List<String> after = countJavaInstances();
     
    168168            ServerAccess.PROCESS_LOG = false;
    169169            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}));
    171171            } finally {
    172172                ServerAccess.PROCESS_LOG = true;
     
    183183        ServerAccess.PROCESS_LOG = false;
    184184        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"}));
    186186            Matcher m = Pattern.compile("\\s*\\d+\\s+\\d+ .+ java\\s*").matcher(pr.stdout);
    187187            int i = 0;
     
    206206        String s = "Deadlock test started";
    207207        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));
    210208        //each 3500 seconds deadlock test stdout something
    211209        //timeout is 20s
  • trunk/icedtea-web/tests/reproducers/simple/simpletest1/srcs/SimpleTest1.java

    r418 r429  
    4040    public static void main(String[] args){
    4141        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        }
    4247    }
    4348}
  • trunk/icedtea-web/tests/reproducers/simple/simpletest1/testcases/SimpleTest1Test.java

    r418 r429  
    3636 */
    3737
    38 
     38import java.io.File;
     39import java.io.FileInputStream;
     40import java.io.IOException;
     41import java.net.MalformedURLException;
     42import java.net.URL;
     43import java.util.Arrays;
     44import java.util.List;
     45import net.sourceforge.jnlp.ProcessResult;
    3946import net.sourceforge.jnlp.ServerAccess;
    4047import org.junit.Assert;
     
    4552
    4653    private static ServerAccess server = new ServerAccess();
     54    private static final List<String> strict = Arrays.asList(new String[]{"-strict", ServerAccess.VERBOSE_OPTION});
    4755
    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    }
    4977
    5078    @Test
    5179    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);
    5982    }
    6083
    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
     2import java.applet.Applet;
     3
    14/* SimpleTest2.java
    25Copyright (C) 2011 Red Hat, Inc.
     
    3639 */
    3740
    38 public class SimpleTest2{
     41public class SimpleTest2 extends Applet{
    3942
    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    }
    4246
     47    @Override
     48    public void init() {
     49        System.out.println("applet was initialised");
    4350    }
     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
    4468}
  • trunk/icedtea-web/tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java

    r418 r429  
    3636 */
    3737
     38import net.sourceforge.jnlp.ProcessResult;
    3839import net.sourceforge.jnlp.ServerAccess;
     40
    3941import org.junit.Assert;
    40 
    4142import org.junit.Test;
    4243
     
    4849    @Test
    4950    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");
    5252        String s="Correct exception";
    5353        Assert.assertTrue("stderr should contains "+s+" but didn't",pr.stderr.contains(s));
     
    5555        Assert.assertTrue("stderr should contains "+ss+" but did not",pr.stderr.contains(ss));
    5656        Assert.assertFalse("testSimpletest2lunchException should not be terminated, but was",pr.wasTerminated);
    57         //Assert.assertFalse(0==pr.returnValue);exception and still returned 0?
    5857    }
    5958
Note: See TracChangeset for help on using the changeset viewer.