diff options
author | Jiri Vanek <[email protected]> | 2012-07-02 15:08:21 +0200 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2012-07-02 15:08:21 +0200 |
commit | d71e609b1279077474135364ed4bb223e068d0bd (patch) | |
tree | 28544c882d03f00e270b8b6f1d15130dea63e17c /tests/reproducers/simple | |
parent | d11831804f320ce432b904032d5cfbf00c1a198b (diff) |
Refactored reproducers directry structure
Diffstat (limited to 'tests/reproducers/simple')
108 files changed, 6231 insertions, 0 deletions
diff --git a/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageJAVAXJNLP.jnlp b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageJAVAXJNLP.jnlp new file mode 100644 index 0000000..cea0a6c --- /dev/null +++ b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageJAVAXJNLP.jnlp @@ -0,0 +1,54 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="." + href="AccessClassInPackageJAVAXJNLP.jnlp"> + <information> + <title>Test accessClassInPackage</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing access to some javax.jnlp.* package</description> + </information> + <resources> + <jar href="AccessClassInPackage.jar" main="true"/> + </resources> + <application-desc main-class="AccessClassInPackage"> + <argument>javax.jnlp.ServiceManager</argument> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageNETSF.jnlp b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageNETSF.jnlp new file mode 100644 index 0000000..f8413e6 --- /dev/null +++ b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageNETSF.jnlp @@ -0,0 +1,54 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="." + href="AccessClassInPackageNETSF.jnlp"> + <information> + <title>Test accessClassInPackage</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing access to net.sourceforge.* package</description> + </information> + <resources> + <jar href="AccessClassInPackage.jar" main="true"/> + </resources> + <application-desc main-class="AccessClassInPackage"> + <argument>net.sourceforge.jnlp.Parser</argument> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSELF.jnlp b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSELF.jnlp new file mode 100644 index 0000000..4af8c04 --- /dev/null +++ b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSELF.jnlp @@ -0,0 +1,54 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="." + href="AccessClassInPackageSELF.jnlp"> + <information> + <title>Test accessClassInPackage</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing aaccess to package's internal class</description> + </information> + <resources> + <jar href="AccessClassInPackage.jar" main="true"/> + </resources> + <application-desc main-class="AccessClassInPackage"> + <argument>AccessClassInPackage</argument> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSUNSEC.jnlp b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSUNSEC.jnlp new file mode 100644 index 0000000..8f3c06a --- /dev/null +++ b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSUNSEC.jnlp @@ -0,0 +1,54 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="." + href="AccessClassInPackageSUNSEC.jnlp"> + <information> + <title>Test accessClassInPackage</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing access to sun.security.* package</description> + </information> + <resources> + <jar href="AccessClassInPackage.jar" main="true"/> + </resources> + <application-desc main-class="AccessClassInPackage"> + <argument>sun.security.internal.spec.TlsKeyMaterialSpec</argument> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/AccessClassInPackage/srcs/AccessClassInPackage.java b/tests/reproducers/simple/AccessClassInPackage/srcs/AccessClassInPackage.java new file mode 100644 index 0000000..7164006 --- /dev/null +++ b/tests/reproducers/simple/AccessClassInPackage/srcs/AccessClassInPackage.java @@ -0,0 +1,44 @@ +/* AccessClassInPackage.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class AccessClassInPackage { + + public static void main(String[] args) throws Exception{ + Class.forName(args[0]); + System.out.println("Class was obtained: "+ args[0]); + } +} diff --git a/tests/reproducers/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java b/tests/reproducers/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java new file mode 100644 index 0000000..e9952ff --- /dev/null +++ b/tests/reproducers/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java @@ -0,0 +1,168 @@ +/* AccessClassInPackageTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.Arrays; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import org.junit.Assert; + +import org.junit.Test; + +public class AccessClassInPackageTest { + + private static ServerAccess server = new ServerAccess(); + private String[] files = { + "AccessClassInPackageJAVAXJNLP.jnlp", + "AccessClassInPackageSELF.jnlp", + "AccessClassInPackageNETSF.jnlp", + "AccessClassInPackageSUNSEC.jnlp" + }; + private String[] filesSigned = { + "AccessClassInPackageSignedJAVAXJNLP.jnlp", + "AccessClassInPackageSignedSELF.jnlp", + "AccessClassInPackageSignedNETSF.jnlp", + "AccessClassInPackageSignedSUNSEC.jnlp" + }; + private String[] badExceptions = { + "accessClassInPackage.javax.jnlp.ServiceManager", + "accessClassInPackage.AccessClassInPackage", + "accessClassInPackage.net.sourceforge.jnlp", + "accessClassInPackage.sun.security.internal.spec" + }; + private String[] pass = { + "javax.jnlp.ServiceManager", + "AccessClassInPackage", + "net.sourceforge.jnlp.Parser", + "sun.security.internal.spec.TlsKeyMaterialSpec" + }; + private static final List<String> xta = Arrays.asList(new String[]{"-Xtrustall"}); + + private void testShouldFail(ServerAccess.ProcessResult pr, String s) { + String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + s + ".*"; + Assert.assertTrue("stderr should match `" + c + "`, but didn't ", pr.stderr.matches(c)); + } + + private void testShouldNOTFail(ServerAccess.ProcessResult pr, String s) { + String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + s + ".*"; + Assert.assertFalse("stderr should NOT match `" + c + "`, but did ", pr.stderr.matches(c)); + } + + private void commonPitfall(ProcessResult pr) { + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("AccessClassInPackageTestLunch1 should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + private void testShouldPass(ServerAccess.ProcessResult pr, String s) { + String c = "Class was obtained: " + s; + Assert.assertTrue("stdout should contains `" + c + "`, but didn't ", pr.stdout.contains(c)); + } + + private void testShouldNOTPass(ServerAccess.ProcessResult pr, String s) { + String c = "Class was obtained: " + s; + Assert.assertFalse("stdout should not contains `" + c + "`, but did ", pr.stdout.contains(c)); + } + + @Test + public void AccessClassInPackageJAVAXJNLP() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[0]); + commonPitfall(pr); + testShouldPass(pr, pass[0]); + testShouldNOTFail(pr, badExceptions[0]); + } + + @Test + public void AccessClassInPackageSELF() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[1]); + commonPitfall(pr); + testShouldPass(pr, pass[1]); + testShouldNOTFail(pr, badExceptions[1]); + } + + @Test + public void AccessClassInPackageNETSF() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[2]); + commonPitfall(pr); + testShouldFail(pr, badExceptions[2]); + testShouldNOTPass(pr, pass[2]); + } + + @Test + public void AccessClassInPackageSUNSEC() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[3]); + commonPitfall(pr); + commonPitfall(pr); + testShouldFail(pr, badExceptions[3]); + testShouldNOTPass(pr, pass[3]); + } + + //now signed vaiants + @Test + public void AccessClassInPackageSignedJAVAXJNLP() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[0]); + commonPitfall(pr); + testShouldPass(pr, pass[0]); + testShouldNOTFail(pr, badExceptions[0]); + } + + @Test + public void AccessClassInPackageSignedSELF() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[1]); + commonPitfall(pr); + testShouldPass(pr, pass[1]); + testShouldNOTFail(pr, badExceptions[1]); + } + + @Test + public void AccessClassInPackageSignedNETSF() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[2]); + commonPitfall(pr); + testShouldPass(pr, pass[2]); + testShouldNOTFail(pr, badExceptions[2]); + } + + @Test + public void AccessClassInPackageSignedSUNSEC() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[3]); + commonPitfall(pr); + testShouldPass(pr, pass[3]); + testShouldNOTFail(pr, badExceptions[3]); + } + +} diff --git a/tests/reproducers/simple/AddShutdownHook/resources/AddShutdownHook.jnlp b/tests/reproducers/simple/AddShutdownHook/resources/AddShutdownHook.jnlp new file mode 100644 index 0000000..42272ff --- /dev/null +++ b/tests/reproducers/simple/AddShutdownHook/resources/AddShutdownHook.jnlp @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="AddShutdownHook.jnlp"> + <information> + <title>test adding shutdown hooks</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="AddShutdownHook.jar" main="true" download="eager"/> + </resources> + <application-desc main-class="AddShutdownHook"/> +</jnlp> diff --git a/tests/reproducers/simple/AddShutdownHook/srcs/AddShutdownHook.java b/tests/reproducers/simple/AddShutdownHook/srcs/AddShutdownHook.java new file mode 100644 index 0000000..2b731eb --- /dev/null +++ b/tests/reproducers/simple/AddShutdownHook/srcs/AddShutdownHook.java @@ -0,0 +1,48 @@ +/* AddShutdownHook.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class AddShutdownHook { + public static void main(String[] args) { + + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + // no op + } + }); + + } +} diff --git a/tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java b/tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java new file mode 100644 index 0000000..165276a --- /dev/null +++ b/tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java @@ -0,0 +1,58 @@ +/* AddShutdownHookTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; + +import org.junit.Test; + +public class AddShutdownHookTest { + + private static ServerAccess server = new ServerAccess(); + + @Test + public void AddShutdownHookTestLunch1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/AddShutdownHook.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "shutdownHooks" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("AddShutdownHookTestLunch1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/AllStackTraces/resources/AllStackTraces.jnlp b/tests/reproducers/simple/AllStackTraces/resources/AllStackTraces.jnlp new file mode 100644 index 0000000..be6b3f3 --- /dev/null +++ b/tests/reproducers/simple/AllStackTraces/resources/AllStackTraces.jnlp @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="AllStackTraces.jnlp"> + <information> + <title>Test Thread.getAllStackTraces</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="AllStackTraces.jar" main="true" download="eager"/> + </resources> + <application-desc main-class="AllStackTraces"/> +</jnlp> diff --git a/tests/reproducers/simple/AllStackTraces/srcs/AllStackTraces.java b/tests/reproducers/simple/AllStackTraces/srcs/AllStackTraces.java new file mode 100644 index 0000000..f871b9c --- /dev/null +++ b/tests/reproducers/simple/AllStackTraces/srcs/AllStackTraces.java @@ -0,0 +1,42 @@ +/* AllStackTraces.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class AllStackTraces { + public static void main(String[] args) { + Thread.getAllStackTraces(); + } +} diff --git a/tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java b/tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java new file mode 100644 index 0000000..0372f4c --- /dev/null +++ b/tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java @@ -0,0 +1,61 @@ +/* AllStackTracesTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; + +import org.junit.Test; + +public class AllStackTracesTest { + + private static ServerAccess server = new ServerAccess(); + + + + @Test + public void AllStackTracesTest1() throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/AllStackTraces.jnlp"); + String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "getStackTrace" + ".*"; + Assert.assertTrue("stderr should match `"+c+"`, but didn't ",pr.stderr.matches(c)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did ",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("AllStackTracesTest1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + } diff --git a/tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html b/tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html new file mode 100644 index 0000000..9cc0fe1 --- /dev/null +++ b/tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html @@ -0,0 +1,48 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<html> + <head></head> + <body> + <applet code="AppletBaseURL.class" + archive="AppletBaseURLTest.jar" + codebase="." + width="800" + height="600"> + </applet> + </body> +</html> diff --git a/tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp b/tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp new file mode 100644 index 0000000..4902f25 --- /dev/null +++ b/tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp @@ -0,0 +1,58 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="AppletBaseURLTest.jnlp" codebase="."> + <information> + <title>AppletBaseURL</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>AppletBaseURL</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="AppletBaseURLTest.jar"/> + </resources> + <applet-desc + documentBase="." + name="AppletBaseURL" + main-class="AppletBaseURL" + width="100" + height="100"> + </applet-desc> +</jnlp> diff --git a/tests/reproducers/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html b/tests/reproducers/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html new file mode 100644 index 0000000..752a767 --- /dev/null +++ b/tests/reproducers/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html @@ -0,0 +1,46 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + +--> +<html> + <head></head> + <body> + <applet code="AppletBaseURL.class" width="800" height="600"> + <param name="jnlp_href" value="AppletBaseURLTest.jnlp"> + </applet> + </body> +</html> + diff --git a/tests/reproducers/simple/AppletBaseURLTest/srcs/AppletBaseURL.java b/tests/reproducers/simple/AppletBaseURLTest/srcs/AppletBaseURL.java new file mode 100644 index 0000000..8234e3c --- /dev/null +++ b/tests/reproducers/simple/AppletBaseURLTest/srcs/AppletBaseURL.java @@ -0,0 +1,64 @@ +/* AppletBaseURL.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.applet.Applet; +public class AppletBaseURL extends Applet { + + private class Killer extends Thread { + + public int n = 1000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("Aplet killing himself after " + n + " ms of life"); + System.exit(0); + } catch (Exception ex) { + } + } + } + private Killer killer; + + @Override + public void init() { + System.out.println("Document base is " + getDocumentBase() + " for this applet"); + System.out.println("Codebase is " + getCodeBase() + " for this applet"); + killer = new Killer(); + killer.start(); + } +} diff --git a/tests/reproducers/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java b/tests/reproducers/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java new file mode 100644 index 0000000..ec14cfa --- /dev/null +++ b/tests/reproducers/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java @@ -0,0 +1,89 @@ +/* AppletBaseURLTest.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.annotations.Bug; +import net.sourceforge.jnlp.annotations.NeedsDisplay; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; + +import org.junit.Assert; +import org.junit.Test; + +public class AppletBaseURLTest extends BrowserTest{ + + private void evaluateApplet(ProcessResult pr, String baseName) { + String s8 = "(?s).*Codebase is http://localhost:[0-9]{5}/ for this applet(?s).*"; + Assert.assertTrue("AppletBaseURL stdout should match" + s8 + " but didn't", pr.stdout.matches(s8)); + String s9 = "(?s).*Document base is http://localhost:[0-9]{5}/" + baseName + " for this applet(?s).*"; + Assert.assertTrue("AppletBaseURL stdout should match" + s9 + " but didn't", pr.stdout.matches(s9)); + String ss = "xception"; + Assert.assertFalse("AppletBaseURL stderr should not contain" + ss + " but did", pr.stderr.contains(ss)); + } + + @NeedsDisplay + @Test + public void AppletWebstartBaseURLTest() throws Exception { + ProcessResult pr = server.executeJavaws(null, "/AppletBaseURLTest.jnlp"); + evaluateApplet(pr, ""); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR855") + @NeedsDisplay + @Test + @TestInBrowsers(testIn={Browsers.one}) + public void AppletInFirefoxTest() throws Exception { + ProcessResult pr = server.executeBrowser("/AppletBaseURLTest.html"); + pr.process.destroy(); + evaluateApplet(pr, "AppletBaseURLTest.html"); + Assert.assertTrue(pr.wasTerminated); + } + + @Bug(id="PR855") + @NeedsDisplay + @Test + @TestInBrowsers(testIn={Browsers.one}) + public void AppletWithJNLPHrefTest() throws Exception { + ProcessResult pr = server.executeBrowser("/AppletJNLPHrefBaseURLTest.html"); + pr.process.destroy(); + evaluateApplet(pr, "AppletJNLPHrefBaseURLTest.html"); + Assert.assertTrue(pr.wasTerminated); + } +} diff --git a/tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.html b/tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.html new file mode 100644 index 0000000..aed49b8 --- /dev/null +++ b/tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.html @@ -0,0 +1,42 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<html><head></head><body bgcolor="blue"> +<p><applet code="Valid.class" archive="NOT_A_VALID_JAR.jar,AppletReadsInvalidJar.jar"> +</applet></p> +</body> +</html> diff --git a/tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.jnlp b/tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.jnlp new file mode 100644 index 0000000..6a2325d --- /dev/null +++ b/tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.jnlp @@ -0,0 +1,62 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="AppletReadsInvalidJar.jnlp" codebase="."> + <information> + <title>AppletReadsInvalidJar</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>AppletTest</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="NOT_A_VALID_JAR.jar"/> + <jar href="AppletReadsInvalidJar.jar"/> + </resources> + <applet-desc + documentBase="." + name="AppletReadsInvalidJar" + main-class="Valid" + width="100" + height="100"> + </applet-desc> +</jnlp> + + +</applet-desc> diff --git a/tests/reproducers/simple/AppletReadsInvalidJar/resources/NOT_A_VALID_JAR.jar b/tests/reproducers/simple/AppletReadsInvalidJar/resources/NOT_A_VALID_JAR.jar new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/reproducers/simple/AppletReadsInvalidJar/resources/NOT_A_VALID_JAR.jar diff --git a/tests/reproducers/simple/AppletReadsInvalidJar/srcs/Valid.java b/tests/reproducers/simple/AppletReadsInvalidJar/srcs/Valid.java new file mode 100644 index 0000000..9b0bcd6 --- /dev/null +++ b/tests/reproducers/simple/AppletReadsInvalidJar/srcs/Valid.java @@ -0,0 +1,58 @@ +import java.applet.Applet; + +/* +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +public class Valid extends Applet { + + private static class Killer extends Thread { + @Override + public void run() { + try { + int n = 2000; + Thread.sleep(n); + System.exit(0); + } catch (Exception ex) { + } + } + } + + @Override + public void init() { + new Killer().start(); + System.out.println("Program Executed Correctly."); + } +} diff --git a/tests/reproducers/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java b/tests/reproducers/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java new file mode 100644 index 0000000..11b0bb0 --- /dev/null +++ b/tests/reproducers/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java @@ -0,0 +1,69 @@ +/* AppletReadsInvalidJarTests.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; +import org.junit.Assert; + +import org.junit.Test; + +public class AppletReadsInvalidJarTests extends BrowserTest{ + + + static final String CORRECT_EXECUTION = "Program Executed Correctly."; + static final String JNLP_EXPECTED_EXCEPTION = "ZipException"; + + /*This SHOULD NOT execute the applet!*/ + @Test + public void AppletJNLPTest() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless("/AppletReadsInvalidJar.jnlp"); + + Assert.assertFalse("AppletReadsInvalidJar stdout should NOT contain '" + CORRECT_EXECUTION + "', but did (applet should not have ran!).", pr.stdout.contains(CORRECT_EXECUTION)); + Assert.assertTrue("AppletReadsInvalidJar stderr should contain 'ZipException', but did not.", pr.stderr.contains(JNLP_EXPECTED_EXCEPTION)); + } + + /*This SHOULD execute the applet!*/ + @Test + @TestInBrowsers(testIn={Browsers.one}) + public void AppletInFirefoxTest() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("/AppletReadsInvalidJar.html"); + + Assert.assertTrue("AppletReadsInvalidJar stdout should contain '" + CORRECT_EXECUTION + "' but did not.", pr.stdout.contains(CORRECT_EXECUTION)); + } +} diff --git a/tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.html b/tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.html new file mode 100644 index 0000000..fcd9454 --- /dev/null +++ b/tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.html @@ -0,0 +1,44 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<html><head></head><body bgcolor="blue"> +<p><applet code="AppletTakesLastParam.class" archive="AppletTakesLastParam.jar"> + <param name="param" value="value1"> + <param name="param" value="value2"> +</applet></p> +</body> +</html> diff --git a/tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.jnlp b/tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.jnlp new file mode 100644 index 0000000..76ea69f --- /dev/null +++ b/tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.jnlp @@ -0,0 +1,63 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="appletTakesLastParam.jnlp" codebase="."> + <information> + <title>AppletTakesLastParam</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>AppletTakesLastParam</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="AppletTakesLastParam.jar"/> + </resources> + <applet-desc + documentBase="." + name="AppletTakesLastParam" + main-class="AppletTakesLastParam" + width="100" + height="100"> + <param name="param" value="value1"/> + <param name="param" value="value2"/> + </applet-desc> +</jnlp> + + +</applet-desc> diff --git a/tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java b/tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java new file mode 100644 index 0000000..9d2b44d --- /dev/null +++ b/tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java @@ -0,0 +1,63 @@ + +import java.applet.Applet; + +/* AppletTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +public class AppletTakesLastParam extends Applet { + + private class Killer extends Thread { + + public int n = 2000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("Applet killing itself after " + n + " ms"); + System.exit(0); + } catch (Exception ex) { + } + } + } + private Killer killer = new Killer(); + + @Override + public void init() { + System.out.println(getParameter("param")); + killer.start(); + } +} diff --git a/tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java b/tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java new file mode 100644 index 0000000..206f6de --- /dev/null +++ b/tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java @@ -0,0 +1,68 @@ +/* AppletTestTests.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import org.junit.Assert; + +import org.junit.Test; + +public class AppletTakesLastParamTests extends BrowserTest { + + @Test + public void AppletTest() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavaws(null, "/appletTakesLastParam.jnlp"); + evaluateApplet(pr); + } + + private void evaluateApplet(ProcessResult pr) { + String s0 = "value1"; + Assert.assertTrue("AppletTakesLastParam stdout should not contain " + s0 + " but did.", !pr.stdout.contains(s0)); + String s1 = "value2"; + Assert.assertTrue("AppletTakesLastParam stdout should contain " + s1 + " but did not.", pr.stdout.contains(s1)); + } + + @Test + @TestInBrowsers(testIn = {Browsers.one}) + public void AppletInFirefoxTest() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("/appletTakesLastParam.html"); + evaluateApplet(pr); + } +} diff --git a/tests/reproducers/simple/AppletTest/resources/AppletTest.jnlp b/tests/reproducers/simple/AppletTest/resources/AppletTest.jnlp new file mode 100644 index 0000000..1b27e8f --- /dev/null +++ b/tests/reproducers/simple/AppletTest/resources/AppletTest.jnlp @@ -0,0 +1,63 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="AppletTest.jnlp" codebase="."> + <information> + <title>AppletTest</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>AppletTest</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="AppletTest.jar"/> + </resources> + <applet-desc + documentBase="." + name="AppletTest" + main-class="AppletTest" + width="100" + height="100"> + <param name="key1" value="value1"/> + <param name="key2" value="value2"/> + </applet-desc> +</jnlp> + + +</applet-desc> diff --git a/tests/reproducers/simple/AppletTest/resources/appletAutoTests.html b/tests/reproducers/simple/AppletTest/resources/appletAutoTests.html new file mode 100644 index 0000000..a2613d9 --- /dev/null +++ b/tests/reproducers/simple/AppletTest/resources/appletAutoTests.html @@ -0,0 +1,44 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<html><head></head><body bgcolor="blue"> +<p><applet code="AppletTest.class" archive="XslowXAppletTest.jar" codebase="." width="800" height="600"> + <param name="key1" value="value1"> + <param name="key2" value="#value2"> +</applet></p> +</body> +</html> diff --git a/tests/reproducers/simple/AppletTest/resources/appletAutoTests2.html b/tests/reproducers/simple/AppletTest/resources/appletAutoTests2.html new file mode 100644 index 0000000..a5c370c --- /dev/null +++ b/tests/reproducers/simple/AppletTest/resources/appletAutoTests2.html @@ -0,0 +1,44 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<html><head></head><body bgcolor="blue"> +<p><applet code="AppletTest.class" archive="AppletTest.jar" codebase="." width="800" height="600"> + <param name="key1" value="value1"> + <param name="key2" value="#value2"> +</applet></p> +</body> +</html> diff --git a/tests/reproducers/simple/AppletTest/resources/appletViewTest.html b/tests/reproducers/simple/AppletTest/resources/appletViewTest.html new file mode 100644 index 0000000..0b489c8 --- /dev/null +++ b/tests/reproducers/simple/AppletTest/resources/appletViewTest.html @@ -0,0 +1,52 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> + <html><head> +<title>ok applet</title> +</head><body bgcolor="blue"> +<h1>ok applet</h1> +<p align="center"> +<applet code="AppletTest.class" archive="XslowXAppletTest.jar" codebase="." width=100 height=100> +</applet></p> +<h1>ok applet</h1> +<h1>bad applet</h1> +<p align="center"> +<applet code="AppletTest.classsss" archive="XslowXAppletTest.jar" codebase="." width=800 height=600> +</applet></p> +<h1>bad applet</h1> +</body> +</html> diff --git a/tests/reproducers/simple/AppletTest/srcs/AppletTest.java b/tests/reproducers/simple/AppletTest/srcs/AppletTest.java new file mode 100644 index 0000000..bac629a --- /dev/null +++ b/tests/reproducers/simple/AppletTest/srcs/AppletTest.java @@ -0,0 +1,82 @@ + +import java.applet.Applet; + +/* AppletTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +public class AppletTest extends Applet { + + private class Killer extends Thread { + + public int n = 2000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("Aplet killing himself after " + n + " ms of life"); + System.exit(0); + } catch (Exception ex) { + } + } + } + private Killer killer; + + @Override + public void init() { + System.out.println("applet was initialised"); + killer = new Killer(); + } + + @Override + public void start() { + System.out.println("applet was started"); + System.out.println(getParameter("key1")); + System.out.println(getParameter("key2")); + killer.start(); + System.out.println("killer was started"); + } + + @Override + public void stop() { + System.out.println("applet was stopped"); + } + + @Override + public void destroy() { + System.out.println("applet will be destroyed"); + } +} diff --git a/tests/reproducers/simple/AppletTest/testcases/AppletTestTests.java b/tests/reproducers/simple/AppletTest/testcases/AppletTestTests.java new file mode 100644 index 0000000..9fd662d --- /dev/null +++ b/tests/reproducers/simple/AppletTest/testcases/AppletTestTests.java @@ -0,0 +1,141 @@ +/* AppletTestTests.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; +import net.sourceforge.jnlp.annotations.Bug; +import net.sourceforge.jnlp.annotations.NeedsDisplay; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import org.junit.Assert; + +import org.junit.Test; + +public class AppletTestTests extends BrowserTest { + + @Test + @TestInBrowsers(testIn = {Browsers.googleChrome}) + @NeedsDisplay + public void doubleChrome() throws Exception { + server.PROCESS_TIMEOUT = 30 * 1000; + try { + //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); + //just verify loging is recording browser + ServerAccess.ProcessResult pr1 = server.executeBrowser("/appletAutoTests.html"); + if (pr1.process == null) { + Assert.assertTrue("If proces was null here, then google-chrome had to not exist, and so " + + ServerAccess.UNSET_BROWSER + + " should be in exception, but exception was " + + pr1.deadlyException.getMessage(), + pr1.deadlyException.getMessage().contains(ServerAccess.UNSET_BROWSER)); + return; + } + evaluateApplet(pr1); + Assert.assertTrue(pr1.wasTerminated); + //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); + // just verify loging is recording browser + ServerAccess.ProcessResult pr = server.executeBrowser("/appletAutoTests.html"); + evaluateApplet(pr); + Assert.assertTrue(pr.wasTerminated); + } finally { + server.PROCESS_TIMEOUT = 20 * 1000; //back to normal + } + } + + @Test + @NeedsDisplay + public void AppletTest() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/AppletTest.jnlp"); + evaluateApplet(pr); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + private void evaluateApplet(ProcessResult pr) { + String s3 = "applet was initialised"; + Assert.assertTrue("AppletTest stdout should contains " + s3 + " bud didn't", pr.stdout.contains(s3)); + String s0 = "applet was started"; + Assert.assertTrue("AppletTest stdout should contains " + s0 + " bud didn't", pr.stdout.contains(s0)); + String s1 = "value1"; + Assert.assertTrue("AppletTest stdout should contains " + s1 + " bud didn't", pr.stdout.contains(s1)); + String s2 = "value2"; + Assert.assertTrue("AppletTest stdout should contains " + s2 + " bud didn't", pr.stdout.contains(s2)); + String s4 = "applet was stopped"; + Assert.assertFalse("AppletTest stdout shouldn't contains " + s4 + " bud did", pr.stdout.contains(s4)); + String s5 = "applet will be destroyed"; + Assert.assertFalse("AppletTest stdout shouldn't contains " + s5 + " bud did", pr.stdout.contains(s5)); + String ss = "xception"; + Assert.assertFalse("AppletTest stderr should not contains " + ss + " but did", pr.stderr.contains(ss)); + String s7 = "Aplet killing himself after 2000 ms of life"; + Assert.assertTrue("AppletTest stdout should contains " + s7 + " bud didn't", pr.stdout.contains(s7)); + } + + @Test + @TestInBrowsers(testIn = {Browsers.all}) + @NeedsDisplay + public void AppletInBrowserTest() throws Exception { + //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); + //just verify loging is recordingb rowser + ServerAccess.PROCESS_TIMEOUT = 30 * 1000; + try { + ServerAccess.ProcessResult pr = server.executeBrowser("/appletAutoTests2.html"); + evaluateApplet(pr); + Assert.assertTrue(pr.wasTerminated); + //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null + } finally { + ServerAccess.PROCESS_TIMEOUT = 20 * 1000; //back to normal + } + } + + @TestInBrowsers(testIn = {Browsers.all}) + @NeedsDisplay + public void AppletInBrowserTestXslowX() throws Exception { + //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); + //just verify loging is recording browser + ServerAccess.PROCESS_TIMEOUT = 30 * 1000; + try { + ServerAccess.ProcessResult pr = server.executeBrowser("/appletAutoTests.html"); + pr.process.destroy(); + evaluateApplet(pr); + Assert.assertTrue(pr.wasTerminated); + //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null + } finally { + ServerAccess.PROCESS_TIMEOUT = 20 * 1000; //back to normal + } + } +} diff --git a/tests/reproducers/simple/CheckServices/resources/CheckPluginServices.html b/tests/reproducers/simple/CheckServices/resources/CheckPluginServices.html new file mode 100644 index 0000000..0cdb0b7 --- /dev/null +++ b/tests/reproducers/simple/CheckServices/resources/CheckPluginServices.html @@ -0,0 +1,46 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + +--> +<html> + <head></head> + <body> + <applet code="CheckServices" width="800" height="600"> + <param name="jnlp_href" value="CheckServices.jnlp"> + </applet> + </body> +</html> + diff --git a/tests/reproducers/simple/CheckServices/resources/CheckServices.jnlp b/tests/reproducers/simple/CheckServices/resources/CheckServices.jnlp new file mode 100644 index 0000000..22419b5 --- /dev/null +++ b/tests/reproducers/simple/CheckServices/resources/CheckServices.jnlp @@ -0,0 +1,57 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="CheckServices.jnlp" codebase="."> + <information> + <title>CheckServices</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>CheckServices</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="CheckServices.jar"/> + </resources> + <applet-desc + documentBase="." + name="CheckServices" + main-class="CheckServices" + width="100" + height="100" /> +</jnlp> diff --git a/tests/reproducers/simple/CheckServices/srcs/CheckServices.java b/tests/reproducers/simple/CheckServices/srcs/CheckServices.java new file mode 100644 index 0000000..df5205a --- /dev/null +++ b/tests/reproducers/simple/CheckServices/srcs/CheckServices.java @@ -0,0 +1,109 @@ +/* CheckServices.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import javax.jnlp.ServiceManager; +import javax.jnlp.BasicService; +import java.applet.Applet; + +public class CheckServices extends Applet { + + public CheckServices() { + System.out.println("Applet constructor reached."); + checkSetup("constructor"); + } + + public void checkSetup(String method) { + try { + BasicService basicService = + (BasicService)ServiceManager.lookup("javax.jnlp.BasicService"); + // getCodeBase() will return null if ServiceManager does not + // have access to ApplicationInstance. + String codebase = basicService.getCodeBase().toString(); + System.out.println("Codebase for applet was found in " + method + + ": " + codebase); + } catch (NullPointerException npe) { + System.err.println("Exception occurred with null codebase in " + method); + npe.printStackTrace(); + } catch (Exception ex) { + System.err.println("Exception occurred (probably with ServiceManager)."); + ex.printStackTrace(); + } + } + + @Override + public void init() { + System.out.println("Applet is initializing."); + checkSetup("init()"); + } + + @Override + public void start() { + System.out.println("Applet is starting."); + checkSetup("start()"); + // FIXME: Instead of killing the thread, use the AWT robot to close + // the applet window, signaling the event that runs stop/destroy. + System.out.println("Killer thread is starting."); + Thread killer = new Thread() { + public int n = 2000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("Applet killing itself after " + n + " ms of life"); + System.exit(0); + } catch (Exception ex) { + } + } + }; + killer.start(); + } + + /* FIXME: Check ServiceManagaer is setup once stop/destroy can be called. + @Override + public void stop() { + System.out.println("Applet is stopping."); + checkSetup("stop()"); + } + + @Override + public void destroy() { + System.out.println("Applet is destorying itself."); + checkSetup("destroy()"); + } + */ +} diff --git a/tests/reproducers/simple/CheckServices/testcases/CheckServicesTests.java b/tests/reproducers/simple/CheckServices/testcases/CheckServicesTests.java new file mode 100644 index 0000000..a36e394 --- /dev/null +++ b/tests/reproducers/simple/CheckServices/testcases/CheckServicesTests.java @@ -0,0 +1,88 @@ +/* CheckServicesTests.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.annotations.Bug; +import net.sourceforge.jnlp.annotations.NeedsDisplay; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; + +import org.junit.Assert; +import org.junit.Test; + +@Bug(id="http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-February/017153.html") +public class CheckServicesTests extends BrowserTest{ + + public void evaluateApplet(ProcessResult pr) { + String s0 = "Codebase for applet was found in constructor"; + Assert.assertTrue("CheckServices stdout should contain `" + s0 + "' but didn't.", pr.stdout.contains(s0)); + String s1 = "Codebase for applet was found in init()"; + Assert.assertTrue("CheckServices stdout should contain `" + s1 + "' but didn't.", pr.stdout.contains(s1)); + String s2 = "Codebase for applet was found in start()"; + Assert.assertTrue("CheckServices stdout should contain `" + s2 + "' but didn't.", pr.stdout.contains(s2)); + /* FIXME: Once the awt robot can close the applet window (i.e. send + * a stop event), stdout should be checked for these asserts. + String s3 = "Codebase for applet was found in stop()"; + Assert.assertTrue("CheckServices stdout should contain `" + s3 + "' but didn't.", pr.stdout.contains(s3)); + String s4 = "Codebase for applet was found in destroy()"; + Assert.assertTrue("CheckServices stdout should contain `" + s4 + "' but didn't.", pr.stdout.contains(s4)); + */ + String s5 = "Exception occurred with null codebase in"; + Assert.assertFalse("CheckServices stderr should not contain `" + s5 + "' but did.", pr.stdout.contains(s5)); + String s6 = "Applet killing itself after 2000 ms of life"; + Assert.assertTrue("CheckServices stdout should contain `" + s6 + "' but didn't.", pr.stdout.contains(s6)); + } + + @Test + @NeedsDisplay + public void CheckWebstartServices() throws Exception { + ProcessResult pr = server.executeJavaws(null, "/CheckServices.jnlp"); + evaluateApplet(pr); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + @Test + @NeedsDisplay + @TestInBrowsers(testIn={Browsers.one}) + public void CheckPluginJNLPHServices() throws Exception { + ProcessResult pr = server.executeBrowser(null, "/CheckPluginServices.html"); + evaluateApplet(pr); + Assert.assertTrue(pr.wasTerminated); + } +} diff --git a/tests/reproducers/simple/CreateClassLoader/resources/CreateClassLoader.jnlp b/tests/reproducers/simple/CreateClassLoader/resources/CreateClassLoader.jnlp new file mode 100644 index 0000000..6804bcd --- /dev/null +++ b/tests/reproducers/simple/CreateClassLoader/resources/CreateClassLoader.jnlp @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="CreateClassLoader.jnlp"> + <information> + <title>set context classloader</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="CreateClassLoader.jar" main="true" download="eager"/> + </resources> + <application-desc main-class="CreateClassLoader"/> +</jnlp> diff --git a/tests/reproducers/simple/CreateClassLoader/srcs/CreateClassLoader.java b/tests/reproducers/simple/CreateClassLoader/srcs/CreateClassLoader.java new file mode 100644 index 0000000..e33299e --- /dev/null +++ b/tests/reproducers/simple/CreateClassLoader/srcs/CreateClassLoader.java @@ -0,0 +1,46 @@ +/* CreateClassLoader.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.net.URL; +import java.net.URLClassLoader; + +public class CreateClassLoader { + public static void main(String[] args) throws Exception { + URLClassLoader ucl = new URLClassLoader(new URL[0]); + + } +} diff --git a/tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java b/tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java new file mode 100644 index 0000000..46b7300 --- /dev/null +++ b/tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java @@ -0,0 +1,58 @@ +/* CreateClassLoaderTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; + +import org.junit.Test; + +public class CreateClassLoaderTest { + + private static ServerAccess server = new ServerAccess(); + + @Test + public void CreateClassLoaderLunch1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/CreateClassLoader.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "createClassLoader" + ".*"; + Assert.assertTrue("Stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("CreateClassLoaderLunch1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/InformationTitleVendorParser/resources/InformationParser.jnlp b/tests/reproducers/simple/InformationTitleVendorParser/resources/InformationParser.jnlp new file mode 100644 index 0000000..aabd685 --- /dev/null +++ b/tests/reproducers/simple/InformationTitleVendorParser/resources/InformationParser.jnlp @@ -0,0 +1,47 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="InformationParser.jnlp" codebase="."> + <!-- information tag missing --> + <resources> + <j2se version="1.4+"/> + <jar href="simpletest1.jar"/> + </resources> + <application-desc main-class="TitleVendorParser"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/InformationTitleVendorParser/resources/TitleParser.jnlp b/tests/reproducers/simple/InformationTitleVendorParser/resources/TitleParser.jnlp new file mode 100644 index 0000000..fad50cc --- /dev/null +++ b/tests/reproducers/simple/InformationTitleVendorParser/resources/TitleParser.jnlp @@ -0,0 +1,52 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="TitleParser.jnlp" codebase="."> + <information> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>Title tag missing</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="simpletest1.jar"/> + </resources> + <application-desc main-class="TitleVendorParser"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/InformationTitleVendorParser/resources/TitleVendorParser.jnlp b/tests/reproducers/simple/InformationTitleVendorParser/resources/TitleVendorParser.jnlp new file mode 100644 index 0000000..f3159b9 --- /dev/null +++ b/tests/reproducers/simple/InformationTitleVendorParser/resources/TitleVendorParser.jnlp @@ -0,0 +1,51 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="TitleVendorParser.jnlp" codebase="."> + <information> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>Title/Vendor tags missing</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="simpletest1.jar"/> + </resources> + <application-desc main-class="TitleVendorParser"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/InformationTitleVendorParser/resources/VendorParser.jnlp b/tests/reproducers/simple/InformationTitleVendorParser/resources/VendorParser.jnlp new file mode 100644 index 0000000..5a76e1e --- /dev/null +++ b/tests/reproducers/simple/InformationTitleVendorParser/resources/VendorParser.jnlp @@ -0,0 +1,52 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="VendorParser.jnlp" codebase="."> + <information> + <title>VendorParser</title> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>Vendor tag missing</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="simpletest1.jar"/> + </resources> + <application-desc main-class="TitleVendorParser"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java b/tests/reproducers/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java new file mode 100644 index 0000000..b760441 --- /dev/null +++ b/tests/reproducers/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java @@ -0,0 +1,77 @@ +/* InformationTitleVendorParserTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class InformationTitleVendorParserTest { + + private static ServerAccess server = new ServerAccess(); + + public void runTest(String jnlpName, String exceptionMessage) throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/" + jnlpName + ".jnlp"); + String s1 = "Good simple javaws exapmle"; + Assert.assertFalse("test" + jnlpName + " stdout should not contain " + s1 + " but did.", pr.stdout.contains(s1)); + // Looking for "Could not read or parse the JNLP file. (${DESCRIPTION})" + String s2 = "(?s).*Could not read or parse the JNLP file.{0,5}" + exceptionMessage + "(?s).*"; + Assert.assertTrue("testForTitle stderr should match " + s2 + " but did not.", pr.stderr.matches(s2)); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + @Test + public void testInformationeParser() throws Exception { + runTest("InformationParser", "No information section defined"); + } + + @Test + public void testTitleParser() throws Exception { + runTest("TitleParser", "The title section has not been defined in the JNLP file."); + } + @Test + public void testVendorParser() throws Exception { + runTest("VendorParser", "The vendor section has not been defined in the JNLP file."); + } + + @Test + public void testTitleVendorParser() throws Exception { + // Note that the title message missing causes an immediate exception, regardless of Vendor. + runTest("TitleVendorParser", "The title section has not been defined in the JNLP file."); + } +} diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainAppDesc.jnlp new file mode 100644 index 0000000..32e4fbb --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainAppDesc.jnlp @@ -0,0 +1,53 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ManifestedJar-1main2mainNoAppDesc.jnlp"> + <information> + <title>Test Thread.getAllStackTraces</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing jar with manin class in manifest. Invalid xml exception should go out</description> + </information> + <resources> + <jar href="ManifestedJar1.jar" main="true"/> + <jar href="ManifestedJar2.jar" main="true"/> + </resources> + <application-desc main-class="ManifestedJar2"> +</jnlp> diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainNoAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainNoAppDesc.jnlp new file mode 100644 index 0000000..0e91484 --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainNoAppDesc.jnlp @@ -0,0 +1,54 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> + +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ManifestedJar-1main2mainNoAppDesc.jnlp"> + <information> + <title>ManifestedJar-1main2mainNoAppDesc.jnlp</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing jar with manin class in manifest, hello from manifestedjar1 should go out</description> + </information> + <resources> + <jar href="ManifestedJar1.jar" main="true"/> + <jar href="ManifestedJar2.jar" main="true"/> + </resources> + <application-desc/> +</jnlp> diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2nothingNoAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2nothingNoAppDesc.jnlp new file mode 100644 index 0000000..ee8a3bf --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2nothingNoAppDesc.jnlp @@ -0,0 +1,54 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> + +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ManifestedJar-1main2nothingNoAppDesc.jnlp"> + <information> + <title>ManifestedJar-1main2nothingNoAppDesc</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing jar with manin class in manifest, hello from manifestedjar2 should be printed</description> + </information> + <resources> + <jar href="ManifestedJar1.jar" /> + <jar href="ManifestedJar2.jar" main="true"/> + </resources> + <application-desc/> +</jnlp> diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainHaveAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainHaveAppDesc.jnlp new file mode 100644 index 0000000..5faf1e0 --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainHaveAppDesc.jnlp @@ -0,0 +1,54 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ManifestedJar-1mainHaveAppDesc.jnlp"> + <information> + <title>"ManifestedJar-1mainHaveAppDesc.jnlp</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing jar with manin class in manifest, hello from manifestedjar2 should be printed</description> + </information> + <resources> + <jar href="ManifestedJar1.jar" main="true"/> + <jar href="ManifestedJar2.jar" /> + </resources> + <application-desc main-class="ManifestedJar2"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainNoAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainNoAppDesc.jnlp new file mode 100644 index 0000000..1aaed4a --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainNoAppDesc.jnlp @@ -0,0 +1,53 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> + +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ManifestedJar-1mainNoAppDesc.jnlp"> + <information> + <title>ManifestedJar-1mainNoAppDesc.jnlp</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing jar with manin class in manifest, hello from manifestedjar should be printed</description> + </information> + <resources> + <jar href="ManifestedJar1.jar" main="true"/> + </resources> + <application-desc/> +</jnlp> diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDesc.jnlp new file mode 100644 index 0000000..4a6c7a9 --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDesc.jnlp @@ -0,0 +1,52 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ManifestedJar-1noAppDesc.jnlp"> + <information> + <title>ManifestedJar-1noAppDesc</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing jar with manin class in manifest, hello from manifestedjar1 shold be printed</description> + </information> + <resources> + <jar href="ManifestedJar1.jar"/> + </resources> + <application-desc/> +</jnlp> diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDescAtAll.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDescAtAll.jnlp new file mode 100644 index 0000000..54ed21a --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDescAtAll.jnlp @@ -0,0 +1,49 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" codebase="./" href="ManifestedJar-1noAppDescAtAll.jnlp"> + <information> + <title>ManifestedJar-1noAppDescAtAll</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing jar with manin class in manifest, exception during launching, no application specified</description> + </information> + <resources> + <jar href="ManifestedJar1.jar"/> + </resources> +</jnlp> diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingAppDesc.jnlp new file mode 100644 index 0000000..2d60dcd --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingAppDesc.jnlp @@ -0,0 +1,54 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> + +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ManifestedJar-1nothing2nothingAppDesc.jnlp"> + <information> + <title>ManifestedJar-1nothing2nothingAppDesc</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing jar with manin class in manifest. Hello from manifestedjar2 should be printed</description> + </information> + <resources> + <jar href="ManifestedJar1.jar" /> + <jar href="ManifestedJar2.jar" /> + </resources> + <application-desc main-class="ManifestedJar2"> +</jnlp> diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingNoAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingNoAppDesc.jnlp new file mode 100644 index 0000000..476d34b --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingNoAppDesc.jnlp @@ -0,0 +1,54 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> + +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ManifestedJar-1nothing2nothingNoAppDesc.jnlp"> + <information> + <title>ManifestedJar-1nothing2nothingNoAppDesc</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing jar with manin class in manifest. Hello from manifestedjar1 should be printed</description> + </information> + <resources> + <jar href="ManifestedJar1.jar" /> + <jar href="ManifestedJar2.jar" /> + </resources> + <application-desc/> +</jnlp> diff --git a/tests/reproducers/simple/ManifestedJar1/srcs/META-INF/MANIFEST.MF b/tests/reproducers/simple/ManifestedJar1/srcs/META-INF/MANIFEST.MF new file mode 100644 index 0000000..badcd09 --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/srcs/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: ManifestedJar1 + diff --git a/tests/reproducers/simple/ManifestedJar1/srcs/ManifestedJar1.java b/tests/reproducers/simple/ManifestedJar1/srcs/ManifestedJar1.java new file mode 100644 index 0000000..a7cfb9b --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/srcs/ManifestedJar1.java @@ -0,0 +1,45 @@ +/* AllStackTraces.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class ManifestedJar1 { + public static void main(String[] args) { + hello1(); + } + public static void hello1() { + System.out.println("Hello from ManifestedJar1"); + } +} diff --git a/tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java b/tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java new file mode 100644 index 0000000..47baa6f --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java @@ -0,0 +1,217 @@ +/* ManifestedJar1Test.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.annotations.Bug; +import org.junit.Assert; + +import org.junit.Test; + +@Bug(id="http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-February/017435.html") +public class ManifestedJar1Test { + + private static ServerAccess server = new ServerAccess(); + private static final String nonLunchableMessage = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: Not a launchable JNLP file. File must be a JNLP application, applet, or installer type."; + //actually this on eis never printed as stderr will not recieve this message in headless mode :( + private static final String twoMainException = "net.sourceforge.jnlp.ParseException: Invalid XML document syntax"; + + private void assertManifestedJar1(String id, ServerAccess.ProcessResult q) { + String s = "Hello from ManifestedJar1"; + Assert.assertTrue(id + " stdout should contains `" + s + "`, but didn't ", q.stdout.contains(s)); + } + + private void assertManifestedJar2(String id, ServerAccess.ProcessResult q) { + String s = "Hello from ManifestedJar2"; + Assert.assertTrue(id + " stdout should contains `" + s + "`, but didn't ", q.stdout.contains(s)); + } + + private void assertNotManifestedJar1(String id, ServerAccess.ProcessResult q) { + String s = "Hello from ManifestedJar1"; + Assert.assertFalse(id + " stdout should NOT contains `" + s + "`, but didn ", q.stdout.contains(s)); + } + private void assertAppError(String id, ServerAccess.ProcessResult q) { + Assert.assertTrue(id + " stderr should contains `" + nonLunchableMessage + "`, but didnn't ", q.stderr.contains(nonLunchableMessage)); + } + + private void assertNotManifestedJar2(String id, ServerAccess.ProcessResult q) { + String s = "Hello from ManifestedJar2"; + Assert.assertFalse(id + " stdout should NOT contains `" + s + "`, but didn ", q.stdout.contains(s)); + } + + private void assertNotDead(String id, ServerAccess.ProcessResult pr) { + String cc = "ClassNotFoundException"; + Assert.assertFalse(id + " stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse(id + " should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Test + /** + * if two jars with manifest specified, none is main and no main class, then first one is loaded + */ + public void manifestedJar1nothing2nothingNoAppDesc() throws Exception { + String id = "ManifestedJar-1nothing2nothingNoAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar1(id, pr); + assertNotDead(id, pr); + } + + /** + *if one jar with manifest, is not main, and no main class then is lunched + * + */ + @Test + public void manifestedJar1noAppDesc() throws Exception { + String id = "ManifestedJar-1noAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar1(id, pr); + assertNotDead(id, pr); + } + + /** + *if one jar with manifest, but not marked as main and no main class then is lunched + * + */ + @Test + public void manifestedJar1mainNoAppDesc() throws Exception { + String id = "ManifestedJar-1mainNoAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar1(id, pr); + assertNotDead(id, pr); + } + + /** + *if one jar with manifest, marked as main and no main class then is lunched + * + */ + @Test + public void ManifestedJar1mainHaveAppDesc() throws Exception { + String id = "ManifestedJar-1mainHaveAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar2(id, pr); + assertNotDead(id, pr); + } + + /** + * + * Two jars, both with manifest, First is main, but specified mainclass belongs to second one, then second one should be lunched + */ + @Test + public void ManifestedJar1main2nothingNoAppDesc() throws Exception { + String id = "ManifestedJar-1main2nothingNoAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar2(id, pr); + assertNotDead(id, pr); + } + + /** + * + * Two jars, both with manifest, seconds is main, no mainclass, then the one marked as main is lunched + */ + @Test + public void manifestedJar1main2nothingNoAppDesc() throws Exception { + String id = "ManifestedJar-1main2nothingNoAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar2(id, pr); + assertNotDead(id, pr); + } + + /** + * + * Two jars, both with manifest, sboth with main tag, no app desc + * + * thisis passing, SUSPICIOUS, but to lunch at least something is better then to lunch nothing at all. + * althoug it maybe SHOULD throw twoMainException + */ + @Test + public void manifestedJar1main2mainNoAppDesc() throws Exception { + String id = "ManifestedJar-1main2mainNoAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar1(id, pr); + assertNotDead(id, pr); + } + + /** + * + * Two jars, both with manifest, sboth with main tag, have app desc + * + * corectly failing with twoMainException + */ + @Test + public void manifestedJar1main2mainAppDesc() throws Exception { + String id = "ManifestedJar-1main2mainAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertNotManifestedJar1(id, pr); + assertNotManifestedJar2(id, pr); + assertNotDead(id, pr); + } + + /** + * + * Two jars, both with manifest, sboth with main tag, have app desc + * + * corectly failing + */ + @Test + public void manifestedJar1noAppDescAtAll() throws Exception { + String id = "ManifestedJar-1noAppDescAtAll"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertNotManifestedJar1(id, pr); + assertNotManifestedJar2(id, pr); + assertAppError(id, pr); + assertNotDead(id, pr); + } + + + + /** + * + * Two jars, both with manifest, non with main tag, have app desc + * + * this jnlp is NOT lunched, twoMainException thrown - ok + * + */ + @Test + public void manifestedJar1nothing2nothingAppDesc() throws Exception { + String id = "ManifestedJar-1nothing2nothingAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertNotManifestedJar2(id, pr); + assertNotManifestedJar1(id, pr); + assertNotDead(id, pr); + } + +} diff --git a/tests/reproducers/simple/ManifestedJar2/srcs/META-INF/MANIFEST.MF b/tests/reproducers/simple/ManifestedJar2/srcs/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d11e8a5 --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar2/srcs/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: ManifestedJar2 + diff --git a/tests/reproducers/simple/ManifestedJar2/srcs/ManifestedJar2.java b/tests/reproducers/simple/ManifestedJar2/srcs/ManifestedJar2.java new file mode 100644 index 0000000..3682209 --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar2/srcs/ManifestedJar2.java @@ -0,0 +1,45 @@ +/* AllStackTraces.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class ManifestedJar2 { + public static void main(String[] args) { + hello2(); + } + public static void hello2() { + System.out.println("Hello from ManifestedJar2"); + } +} diff --git a/tests/reproducers/simple/ReadEnvironment/resources/ReadEnvironment.jnlp b/tests/reproducers/simple/ReadEnvironment/resources/ReadEnvironment.jnlp new file mode 100644 index 0000000..dd3bce4 --- /dev/null +++ b/tests/reproducers/simple/ReadEnvironment/resources/ReadEnvironment.jnlp @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ReadEnvironment.jnlp"> + <information> + <title>ReadEnvironment using System.getenv()</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="ReadEnvironment.jar" main="true" /> + </resources> + <application-desc main-class="ReadEnvironment"/> +</jnlp> diff --git a/tests/reproducers/simple/ReadEnvironment/srcs/ReadEnvironment.java b/tests/reproducers/simple/ReadEnvironment/srcs/ReadEnvironment.java new file mode 100644 index 0000000..a426803 --- /dev/null +++ b/tests/reproducers/simple/ReadEnvironment/srcs/ReadEnvironment.java @@ -0,0 +1,44 @@ +/* ReadEnvironment.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class ReadEnvironment { + public static void main(String[] args) { + + System.getenv("USER"); + + } +} diff --git a/tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java b/tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java new file mode 100644 index 0000000..5d82da4 --- /dev/null +++ b/tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java @@ -0,0 +1,58 @@ +/* ReadEnvironmentTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; + +import org.junit.Test; + +public class ReadEnvironmentTest { + + private static ServerAccess server = new ServerAccess(); + + @Test + public void ReadEnvironmentLunch1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReadEnvironment.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "getenv.USER" + ".*"; + Assert.assertTrue("stderr should match"+s+"but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("ReadEnvironmentLunch1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/ReadProperties/resources/ReadProperties1.jnlp b/tests/reproducers/simple/ReadProperties/resources/ReadProperties1.jnlp new file mode 100644 index 0000000..54873c2 --- /dev/null +++ b/tests/reproducers/simple/ReadProperties/resources/ReadProperties1.jnlp @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ReadProperties1.jnlp"> + <information> + <title>read properties using System.getenv()</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="ReadProperties.jar" main="true"/> + </resources> + <application-desc main-class="ReadProperties"> + <argument>user.name</argument> + </application-desc> + + +</jnlp> diff --git a/tests/reproducers/simple/ReadProperties/resources/ReadProperties2.jnlp b/tests/reproducers/simple/ReadProperties/resources/ReadProperties2.jnlp new file mode 100644 index 0000000..f4e5418 --- /dev/null +++ b/tests/reproducers/simple/ReadProperties/resources/ReadProperties2.jnlp @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ReadProperties2.jnlp"> + <information> + <title>read properties using System.getenv()</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="ReadProperties.jar" main="true"/> + </resources> + <application-desc main-class="ReadProperties"> + <argument>user.home</argument> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/ReadProperties/srcs/ReadProperties.java b/tests/reproducers/simple/ReadProperties/srcs/ReadProperties.java new file mode 100644 index 0000000..f031369 --- /dev/null +++ b/tests/reproducers/simple/ReadProperties/srcs/ReadProperties.java @@ -0,0 +1,45 @@ +/* ReadProperties.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +public class ReadProperties { + +/** +*some system property is expected as arg[0], eg user.name or user.home +*/ + public static void main(String[] args) { + System.out.println(System.getProperty(args[0])); + } +} diff --git a/tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java b/tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java new file mode 100644 index 0000000..dfe9590 --- /dev/null +++ b/tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java @@ -0,0 +1,71 @@ +/* ReadPropertiesTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class ReadPropertiesTest { + + private static ServerAccess server = new ServerAccess(); + + + @Test + public void ReadPropertiesLunch1() throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.name.{0,5}read" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("ReadPropertiesLunch1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + @Test + public void ReadPropertiesLunch2() throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties2.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.home.{0,5}read" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("ReadPropertiesLunch2 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + } diff --git a/tests/reproducers/simple/RedirectStreams/resources/RedirectStreams.jnlp b/tests/reproducers/simple/RedirectStreams/resources/RedirectStreams.jnlp new file mode 100644 index 0000000..ca26613 --- /dev/null +++ b/tests/reproducers/simple/RedirectStreams/resources/RedirectStreams.jnlp @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="RedirectStreams.jnlp"> + <information> + <title>redirect stdin/stdout streams</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="RedirectStreams.jar" main="true"/> + </resources> + <application-desc main-class="RedirectStreams"/> +</jnlp> diff --git a/tests/reproducers/simple/RedirectStreams/srcs/RedirectStreams.java b/tests/reproducers/simple/RedirectStreams/srcs/RedirectStreams.java new file mode 100644 index 0000000..2130168 --- /dev/null +++ b/tests/reproducers/simple/RedirectStreams/srcs/RedirectStreams.java @@ -0,0 +1,44 @@ +/* RedirectStreams.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.io.StringBufferInputStream; + +public class RedirectStreams { + public static void main(String[] args) { + System.setIn(new StringBufferInputStream("TEST")); + } +} diff --git a/tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java b/tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java new file mode 100644 index 0000000..1d745c7 --- /dev/null +++ b/tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java @@ -0,0 +1,57 @@ +/* RedirectStreamsTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class RedirectStreamsTest { + + private static ServerAccess server = new ServerAccess(); + + @Test + public void RedirectStreamsTest1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/RedirectStreams.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setIO" + ".*"; + Assert.assertTrue("Stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("RedirectStreams should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/ReplaceSecurityManager/resources/ReplaceSecurityManager.jnlp b/tests/reproducers/simple/ReplaceSecurityManager/resources/ReplaceSecurityManager.jnlp new file mode 100644 index 0000000..4f153bf --- /dev/null +++ b/tests/reproducers/simple/ReplaceSecurityManager/resources/ReplaceSecurityManager.jnlp @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ReplaceSecurityManager.jnlp"> + <information> + <title>Test replacing security manager</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="ReplaceSecurityManager.jar" main="true"/> + </resources> + <application-desc main-class="ReplaceSecurityManager"/> +</jnlp> diff --git a/tests/reproducers/simple/ReplaceSecurityManager/srcs/ReplaceSecurityManager.java b/tests/reproducers/simple/ReplaceSecurityManager/srcs/ReplaceSecurityManager.java new file mode 100644 index 0000000..e00cd5a --- /dev/null +++ b/tests/reproducers/simple/ReplaceSecurityManager/srcs/ReplaceSecurityManager.java @@ -0,0 +1,43 @@ +/* ReplaceSecurityManager.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +public class ReplaceSecurityManager { + public static void main(String[] args) throws Exception{ + + System.setSecurityManager(null); + + } +} diff --git a/tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java b/tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java new file mode 100644 index 0000000..73bbd9d --- /dev/null +++ b/tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java @@ -0,0 +1,57 @@ +/* ReplaceSecurityManagerTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class ReplaceSecurityManagerTest { + + private static ServerAccess server = new ServerAccess(); + + @Test + public void ReplaceSecurityManagerLunch1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReplaceSecurityManager.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setSecurityManager" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("ReplaceSecurityManagerLunch1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/SetContextClassLoader/resources/SetContextClassLoader.jnlp b/tests/reproducers/simple/SetContextClassLoader/resources/SetContextClassLoader.jnlp new file mode 100644 index 0000000..996bb88 --- /dev/null +++ b/tests/reproducers/simple/SetContextClassLoader/resources/SetContextClassLoader.jnlp @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="SetContextClassLoader.jnlp"> + <information> + <title>set context classloader</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="SetContextClassLoader.jar" main="true" download="eager"/> + </resources> + <application-desc main-class="SetContextClassLoader"/> +</jnlp> diff --git a/tests/reproducers/simple/SetContextClassLoader/srcs/SetContextClassLoader.java b/tests/reproducers/simple/SetContextClassLoader/srcs/SetContextClassLoader.java new file mode 100644 index 0000000..5c5b215 --- /dev/null +++ b/tests/reproducers/simple/SetContextClassLoader/srcs/SetContextClassLoader.java @@ -0,0 +1,44 @@ +/* SetContextClassLoader.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SetContextClassLoader { + public static void main(String[] args) throws Exception{ + + Thread.currentThread().setContextClassLoader(null); + + } +} diff --git a/tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java b/tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java new file mode 100644 index 0000000..f45aedb --- /dev/null +++ b/tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java @@ -0,0 +1,57 @@ +/* SetContextClassLoaderTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class SetContextClassLoaderTest { + + private static ServerAccess server = new ServerAccess(); + + @Test + public void SetContextClassLoader1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SetContextClassLoader.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setContextClassLoader" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("SetContextClassLoader1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/Spaces can be everywhere/resources/NotOnly spaces can kill ěščřž too.jnlp b/tests/reproducers/simple/Spaces can be everywhere/resources/NotOnly spaces can kill ěščřž too.jnlp new file mode 100644 index 0000000..9856676 --- /dev/null +++ b/tests/reproducers/simple/Spaces can be everywhere/resources/NotOnly spaces can kill ěščřž too.jnlp @@ -0,0 +1,61 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="NotOnly spaces can kill ěščřž too.jnlp" codebase="."> + <information> + <title>Spaces can be everywhere test with few more chars for encoding</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>AppletTest</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="Spaces can be everywhere.jar"/> + </resources> + <applet-desc + documentBase="." + name="SpacesCanBeEverywhere" + main-class="SpacesCanBeEverywhere" + width="100" + height="100"> + </applet-desc> +</jnlp> + + +</applet-desc> diff --git a/tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere1.jnlp b/tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere1.jnlp new file mode 100644 index 0000000..245b01d --- /dev/null +++ b/tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere1.jnlp @@ -0,0 +1,53 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="Spaces can be everywhere1.jnlp" codebase="."> + <information> + <title>Spaces can be everywhere1</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>Spaces can be everywhere1</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="simpletest1.jar"/> + </resources> + <application-desc main-class="SimpleTest1"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere2.jnlp b/tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere2.jnlp new file mode 100644 index 0000000..274add7 --- /dev/null +++ b/tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere2.jnlp @@ -0,0 +1,53 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="Spaces can be everywhere2.jnlp" codebase="."> + <information> + <title>Spaces can be everywhere2</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>Spaces can be everywhere2</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="Spaces can be everywhere.jar"/> + </resources> + <application-desc main-class="SpacesCanBeEverywhere"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/Spaces can be everywhere/resources/SpacesCanBeEverywhere1.jnlp b/tests/reproducers/simple/Spaces can be everywhere/resources/SpacesCanBeEverywhere1.jnlp new file mode 100644 index 0000000..22b77b0 --- /dev/null +++ b/tests/reproducers/simple/Spaces can be everywhere/resources/SpacesCanBeEverywhere1.jnlp @@ -0,0 +1,53 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="SpacesCanBeEverywhere1.jnlp" codebase="."> + <information> + <title>simpletest1</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>simpletest1</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="Spaces can be everywhere.jar"/> + </resources> + <application-desc main-class="SpacesCanBeEverywhere"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/Spaces can be everywhere/resources/spaces applet Tests.html b/tests/reproducers/simple/Spaces can be everywhere/resources/spaces applet Tests.html new file mode 100644 index 0000000..74b7554 --- /dev/null +++ b/tests/reproducers/simple/Spaces can be everywhere/resources/spaces applet Tests.html @@ -0,0 +1,42 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<html><head></head><body bgcolor="blue"> +<p><applet code="SpacesCanBeEverywhere.class" archive="Spaces can be everywhere.jar" codebase="." width=800 height=600> +</applet></p> +</body> +</html> diff --git a/tests/reproducers/simple/Spaces can be everywhere/srcs/SpacesCanBeEverywhere.java b/tests/reproducers/simple/Spaces can be everywhere/srcs/SpacesCanBeEverywhere.java new file mode 100644 index 0000000..e65544b --- /dev/null +++ b/tests/reproducers/simple/Spaces can be everywhere/srcs/SpacesCanBeEverywhere.java @@ -0,0 +1,76 @@ + +import java.applet.Applet; + +/* SpacesCanBeEverywhere.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SpacesCanBeEverywhere extends Applet{ + + public static void main(String[] args){ + System.out.println("Spaces can be everywhere.jsr was launched correctly"); + } + + private class Killer extends Thread { + + public int n = 2000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("Applet killing himself after " + n + " ms of life"); + System.exit(0); + } catch (Exception ex) { + } + } + } + private Killer killer; + + @Override + public void init() { + killer = new Killer(); + } + + @Override + public void start() { + main(null); + killer.start(); + System.out.println("killer was started"); + } + + +} diff --git a/tests/reproducers/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java b/tests/reproducers/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java new file mode 100644 index 0000000..cb2a98f --- /dev/null +++ b/tests/reproducers/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java @@ -0,0 +1,244 @@ +/* SpacesCanBeEverywhereTests.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.ArrayList; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.annotations.Bug; +import net.sourceforge.jnlp.annotations.NeedsDisplay; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import org.junit.Assert; +import org.junit.Test; + +@Bug(id={"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016127.html","PR804","PR811"}) +public class SpacesCanBeEverywhereTests extends BrowserTest { + + + @Bug(id="PR811") + @Test + @NeedsDisplay + public void SpacesCanBeEverywhereLocalAppletTestsJnlp2() throws Exception { + List<String> commands=new ArrayList<String>(1); + commands.add(server.getJavawsLocation()); + commands.add(server.getDir()+"/NotOnly spaces can kill ěščřž too.jnlp"); + /* Change of dir is cousing the Exception bellow + * ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + * No X11 DISPLAY variable was set, but this program performed an operation which requires it. + * at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:173) + * at java.awt.Window.<init>(Window.java:476) + * at java.awt.Frame.<init>(Frame.java:419) + * at java.awt.Frame.<init>(Frame.java:384) + * at javax.swing.SwingUtilities$SharedOwnerFrame.<init>(SwingUtilities.java:1754) + * at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1831) + * at javax.swing.JWindow.<init>(JWindow.java:185) + * at javax.swing.JWindow.<init>(JWindow.java:137) + * at net.sourceforge.jnlp.runtime.JNLPSecurityManager.<init>(JNLPSecurityManager.java:121) + * at net.sourceforge.jnlp.runtime.JNLPRuntime.initialize(JNLPRuntime.java:202) + * at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:177) + * at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:51) + * at java.security.AccessController.doPrivileged(Native Method) + * at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:168) + * + * Thats why there is absolute path to the file. + * + * This is also why SpacesCanBeEverywhereLocalTests1Signed is passing - + * it is in headless mode. This can be considered as bug, but because it is + * only on ocal files, and probably only from test run - it can be ignored + */ + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "xception"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR811") + @Test + @NeedsDisplay + public void SpacesCanBeEverywhereRemoteAppletTestsJnlp2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavaws("/NotOnly%20spaces%20can%20kill%20%C4%9B%C5%A1%C4%8D%C5%99%C5%BE%20too.jnlp"); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "xception"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should NOT be terminated, but was not", pr.wasTerminated); + } + + @Bug(id="PR811") + @Test + @NeedsDisplay + @TestInBrowsers(testIn = {Browsers.all}) + public void SpacesCanBeEverywhereRemoteAppletTestsHtml2() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("/spaces+applet+Tests.html"); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "xception"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertTrue("should be terminated, but was not", pr.wasTerminated); + } + + + @Bug(id={"PR811","http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016144.html"}) + @Test + public void SpacesCanBeEverywhereRemoteTests1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere1.jnlp"); + String s = "Good simple javaws exapmle"; + Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR811") + @Test + public void SpacesCanBeEverywhereRemoteTests2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp"); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR811") + @Test + public void SpacesCanBeEverywhereRemoteTests2_withQuery1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp?test=10"); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + + @Bug(id="PR811") + @Test + public void SpacesCanBeEverywhereRemoteTests2_withQuery2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp?test%3D10"); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR811") + @Test + public void SpacesCanBeEverywhereRemoteTests3() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SpacesCanBeEverywhere1.jnlp"); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + + @Bug(id="PR804") + @Test + public void SpacesCanBeEverywhereLocalTests1() throws Exception { + List<String> commands=new ArrayList<String>(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add("Spaces can be everywhere1.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + String s = "Good simple javaws exapmle"; + Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR804") + @Test + public void SpacesCanBeEverywhereLocalTests2() throws Exception { + List<String> commands=new ArrayList<String>(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add("Spaces can be everywhere2.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR804") + @Test + public void SpacesCanBeEverywhereLocalTests4() throws Exception { + List<String> commands=new ArrayList<String>(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add(server.getDir()+"/Spaces can be everywhere2.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR804") + @Test + public void SpacesCanBeEverywhereLocalTests3() throws Exception { + List<String> commands=new ArrayList<String>(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add("SpacesCanBeEverywhere1.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication1.jnlp b/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication1.jnlp new file mode 100644 index 0000000..979058d --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication1.jnlp @@ -0,0 +1,54 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UnsignedJnlpApplication1.jnlp" codebase="."> + <information> + <title>UnsignedJnlpApplication</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>UnsignedJnlpApplication</description> + <offline/> + </information> + + <resources> + <j2se version="1.6+"/> + <jar href="UnsignedJnlpApplication.jar"/> + </resources> + <application-desc main-class="UnsignedJnlpApplication"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication2.jnlp b/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication2.jnlp new file mode 100644 index 0000000..84f7539 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication2.jnlp @@ -0,0 +1,56 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + +**************************************** +* Missing 'description' element in the launching JNLP file * +**************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UnsignedJnlpApplication1.jnlp" codebase="."> + <information> + <title>UnsignedJnlpApplication</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <offline/> + </information> + + <resources> + <j2se version="1.6+"/> + <jar href="UnsignedJnlpApplication.jar"/> + </resources> + <application-desc main-class="UnsignedJnlpApplication"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication3.jnlp b/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication3.jnlp new file mode 100644 index 0000000..d5e6584 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication3.jnlp @@ -0,0 +1,57 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + +***************************************************************** +* Using a different value of name within the 'title' element in the launching JNLP file * +***************************************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UnsignedJnlpApplication1.jnlp" codebase="."> + <information> + <title>DIFFERENTJnlpApplicationNAME</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>UnsignedJnlpApplication</description> + <offline/> + </information> + + <resources> + <j2se version="1.6+"/> + <jar href="UnsignedJnlpApplication.jar"/> + </resources> + <application-desc main-class="UnsignedJnlpApplication"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/UnsignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp b/tests/reproducers/simple/UnsignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp new file mode 100644 index 0000000..e4a3722 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp @@ -0,0 +1,62 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UnsignedJnlpApplication1.jnlp" codebase="."> + <information> + <title>UnsignedJnlpApplication</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>UnsignedJnlpApplication</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="specialProperty" value="icedtea"/> + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="UnsignedJnlpApplication.jar"/> + </resources> + <application-desc main-class="UnsignedJnlpApplication"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/UnsignedJnlpApplication/srcs/UnsignedJnlpApplication.java b/tests/reproducers/simple/UnsignedJnlpApplication/srcs/UnsignedJnlpApplication.java new file mode 100644 index 0000000..f4afa4f --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpApplication/srcs/UnsignedJnlpApplication.java @@ -0,0 +1,43 @@ +/* UnsignedJnlpApplication.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class UnsignedJnlpApplication { + + public static void main(String[] args) { + System.out.println("Running unsigned application in main"); + } +} diff --git a/tests/reproducers/simple/UnsignedJnlpApplication/testcases/UnsignedJnlpApplicationTest.java b/tests/reproducers/simple/UnsignedJnlpApplication/testcases/UnsignedJnlpApplicationTest.java new file mode 100644 index 0000000..e48509d --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpApplication/testcases/UnsignedJnlpApplicationTest.java @@ -0,0 +1,68 @@ +/* UnsignedJnlpApplicationTest.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class UnsignedJnlpApplicationTest { + + private static ServerAccess server = new ServerAccess(); + private final List<String> l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); + private final String outputString = "Running unsigned application in main"; + + @Test + public void jnlpFileIsUnchecked1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication1.jnlp"); + Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); + } + + @Test + public void jnlpFileIsUnchecked2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication2.jnlp"); + Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); + } + + @Test + public void jnlpFileIsUnchecked3() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication3.jnlp"); + Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); + } +} diff --git a/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate1.jnlp b/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate1.jnlp new file mode 100644 index 0000000..077c5dc --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate1.jnlp @@ -0,0 +1,54 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UnsignedJnlpTemplate1.jnlp" codebase="."> + <information> + <title>UnsignedJnlpTemplate</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>UnsignedJnlpTemplate</description> + <offline/> + </information> + + <resources> + <j2se version="1.6+"/> + <jar href="UnsignedJnlpTemplate.jar"/> + </resources> + <application-desc main-class="UnsignedJnlpTemplate"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate2.jnlp b/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate2.jnlp new file mode 100644 index 0000000..f665a93 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate2.jnlp @@ -0,0 +1,56 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + +**************************************** +* Missing 'description' element in the launching JNLP file * +**************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UnsignedJnlpTemplate1.jnlp" codebase="."> + <information> + <title>UnsignedJnlpTemplate</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <offline/> + </information> + + <resources> + <j2se version="1.6+"/> + <jar href="UnsignedJnlpTemplate.jar"/> + </resources> + <application-desc main-class="UnsignedJnlpTemplate"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate3.jnlp b/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate3.jnlp new file mode 100644 index 0000000..abbd085 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate3.jnlp @@ -0,0 +1,57 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + +***************************************************************** +* Using a different value of name within the 'title' element in the launching JNLP file * +***************************************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UnsignedJnlpTemplate1.jnlp" codebase="."> + <information> + <title>DIFFERENTJnlpTemplateNAME</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>UnsignedJnlpTemplate</description> + <offline/> + </information> + + <resources> + <j2se version="1.6+"/> + <jar href="UnsignedJnlpTemplate.jar"/> + </resources> + <application-desc main-class="UnsignedJnlpTemplate"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/UnsignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp b/tests/reproducers/simple/UnsignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp new file mode 100644 index 0000000..5a9dce0 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp @@ -0,0 +1,62 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UnsignedJnlpTemplate1.jnlp" codebase="."> + <information> + <title>UnsignedJnlpTemplate</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>UnsignedJnlpTemplate</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="specialProperty" value="icedtea"/> + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="UnsignedJnlpTemplate.jar"/> + </resources> + <application-desc main-class="UnsignedJnlpTemplate"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/UnsignedJnlpTemplate/srcs/UnsignedJnlpTemplate.java b/tests/reproducers/simple/UnsignedJnlpTemplate/srcs/UnsignedJnlpTemplate.java new file mode 100644 index 0000000..3883c22 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpTemplate/srcs/UnsignedJnlpTemplate.java @@ -0,0 +1,43 @@ +/* UnsignedJnlpTemplate.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class UnsignedJnlpTemplate { + + public static void main(String[] args) { + System.out.println("Running unsigned application in main"); + } +} diff --git a/tests/reproducers/simple/UnsignedJnlpTemplate/testcases/UnsignedJnlpTemplateTest.java b/tests/reproducers/simple/UnsignedJnlpTemplate/testcases/UnsignedJnlpTemplateTest.java new file mode 100644 index 0000000..b2aec62 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpTemplate/testcases/UnsignedJnlpTemplateTest.java @@ -0,0 +1,68 @@ +/* UnsignedJnlpTemplateTest.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class UnsignedJnlpTemplateTest { + + private static ServerAccess server = new ServerAccess(); + private final List<String> l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); + private final String outputString = "Running unsigned application in main"; + + @Test + public void jnlpTemplateIsUnchecked1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate1.jnlp"); + Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); + } + + @Test + public void jnlpTemplateIsUnchecked2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate2.jnlp"); + Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); + } + + @Test + public void jnlpTemplateIsUnchecked3() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate3.jnlp"); + Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); + } +}
\ No newline at end of file diff --git a/tests/reproducers/simple/deadlocktest/resources/deadlocktest.jnlp b/tests/reproducers/simple/deadlocktest/resources/deadlocktest.jnlp new file mode 100644 index 0000000..f45c475 --- /dev/null +++ b/tests/reproducers/simple/deadlocktest/resources/deadlocktest.jnlp @@ -0,0 +1,53 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="deadlocktest.jnlp" codebase="."> + <information> + <title>simpletest1</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>simpletest1</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="deadlocktest.jar"/> + </resources> + <application-desc main-class="DeadlockTest"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/deadlocktest/resources/deadlocktest_1.jnlp b/tests/reproducers/simple/deadlocktest/resources/deadlocktest_1.jnlp new file mode 100644 index 0000000..bf7e82c --- /dev/null +++ b/tests/reproducers/simple/deadlocktest/resources/deadlocktest_1.jnlp @@ -0,0 +1,53 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="deadlocktest_1.jnlp" codebase="." java-vm-args="-Xmx1g" > + <information> + <title>simpletest1</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>simpletest1</description> + <offline/> + </information> + <resources> + <j2se version="1.4+" max-heap-size="1024m"/> + <jar href="deadlocktest.jar"/> + </resources> + <application-desc main-class="DeadlockTest"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/deadlocktest/srcs/DeadlockTest.java b/tests/reproducers/simple/deadlocktest/srcs/DeadlockTest.java new file mode 100644 index 0000000..4d348b0 --- /dev/null +++ b/tests/reproducers/simple/deadlocktest/srcs/DeadlockTest.java @@ -0,0 +1,58 @@ +/* DeadlockTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class DeadlockTest { + + private static final int DEADLOCK_TEST_TIME_OF_LIFE=30000; + + public static void main(String[] args) throws Exception { + long startTime = System.nanoTime() / 1000000l; + System.out.println("Deadlock test started"); + int i=0; + while (true) { + long now = System.nanoTime() / 1000000l; + Thread.sleep(3500); + i++; + System.out.println(i+" Deadlock sleeping"); + if (now - startTime > DEADLOCK_TEST_TIME_OF_LIFE) { + System.out.println("This process is hanging more then "+DEADLOCK_TEST_TIME_OF_LIFE/1000+"s. Should be killed"); + System.out.flush(); + System.exit(5); + } + } + } +} diff --git a/tests/reproducers/simple/deadlocktest/testcases/DeadLockTestTest.java b/tests/reproducers/simple/deadlocktest/testcases/DeadLockTestTest.java new file mode 100644 index 0000000..b2e0a48 --- /dev/null +++ b/tests/reproducers/simple/deadlocktest/testcases/DeadLockTestTest.java @@ -0,0 +1,267 @@ +/* DeadLockTestTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.ArrayList; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import org.junit.Assert; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.junit.BeforeClass; + +import org.junit.Test; + +public class DeadLockTestTest { + + private static ServerAccess server = new ServerAccess(); + private static String deadlocktest_1 = "/deadlocktest_1.jnlp"; + private static String deadlocktest = "/deadlocktest.jnlp"; + + @BeforeClass + public static void printJavas() throws Exception { + ServerAccess.logOutputReprint("Currently runnng javas1 " + countJavaInstances()); + + } + + @Test + public void testDeadLockTestTerminated() throws Exception { + testDeadLockTestTerminatedBody(deadlocktest); + testDeadLockTestTerminatedBody(deadlocktest); + ServerAccess.logOutputReprint("Currently running javas12 " + countJavaInstances()); + } + + @Test + public void testDeadLockTestTerminated2() throws Exception { + testDeadLockTestTerminatedBody(deadlocktest_1); + testDeadLockTestTerminatedBody(deadlocktest_1); + /** + * this happens, when p.p.destroy is called before p.interrupt. and destroyed variable is removedI have no idea why, but it is incorrect. + Assert.assertNotNull("return can not be null in no fork process. Was ",pr.returnValue);//in this case forking is forbiden, and sojava throws an exception after destroy + */ + ServerAccess.logOutputReprint("Currently running javas13 " + countJavaInstances()); + } + + public void testDeadLockTestTerminatedBody(String jnlp) throws Exception { + List<String> before = countJavaInstances(); + ServerAccess.logOutputReprint("java1 " + jnlp + " : " + before.size()); + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, jnlp); + assertDeadlockTestLaunched(pr); + List<String> after = countJavaInstances(); + ServerAccess.logOutputReprint("java2 " + jnlp + " : " + after.size()); + String ss = "This process is hanging more than 30s. Should be killed"; + Assert.assertFalse("stdout should not contains: " + ss + ", but did", pr.stdout.contains(ss)); +// Assert.assertTrue(pr.stderr.contains("xception"));, exception is thrown by engine,not by application + Assert.assertTrue("testDeadLockTestTerminated should be terminated, but wasn't", pr.wasTerminated); + Assert.assertNull("Killed process must have null return value. Have not - ", pr.returnValue); + killDiff(before, after); + List<String> afterKill = countJavaInstances(); + ServerAccess.logOutputReprint("java3 " + jnlp + " : " + afterKill.size()); + Assert.assertEquals("assert that just old javas remians", 0, (before.size() - afterKill.size())); + } + + @Test + public void ensureAtLeasOneJavaIsRunning() throws Exception { + Assert.assertTrue("at least one java should be running, but isn't! Javas are probably counted badly", countJavaInstances().size() > 0); + + } + + @Test + public void testSimpletest1lunchFork() throws Exception { + List<String> before = countJavaInstances(); + ServerAccess.logOutputReprint("java4: " + before.size()); + BackgroundDeadlock bd = new BackgroundDeadlock(deadlocktest_1, null); + bd.start(); + Thread.sleep(ServerAccess.PROCESS_TIMEOUT * 2 / 3); + List<String> during = countJavaInstances(); + ServerAccess.logOutputReprint("java5: " + during.size()); + waitForBackgroundDeadlock(bd); + List<String> after = countJavaInstances(); + ServerAccess.logOutputReprint("java6: " + after.size()); + Assert.assertNotNull("proces inside background deadlock cant be null. It was.", bd.getPr()); + assertDeadlockTestLaunched(bd.getPr()); + killDiff(before, during); + List<String> afterKill = countJavaInstances(); + ServerAccess.logOutputReprint("java66: " + afterKill.size()); + Assert.assertEquals("assert that just old javas remians", 0, (before.size() - afterKill.size())); + // div by two is caused by jav in java process hierarchy + Assert.assertEquals("launched JVMs must be exactly 2, was " + (during.size() - before.size()) / 2, 2, (during.size() - before.size()) / 2); + } + + @Test + public void testSimpletest1lunchNoFork() throws Exception { + List<String> before = countJavaInstances(); + ServerAccess.logOutputReprint("java7: " + before.size()); + BackgroundDeadlock bd = new BackgroundDeadlock(deadlocktest_1, Arrays.asList(new String[]{"-Xnofork"})); + bd.start(); + Thread.sleep(ServerAccess.PROCESS_TIMEOUT * 2 / 3); + List<String> during = countJavaInstances(); + ServerAccess.logOutputReprint("java8: " + during.size()); + waitForBackgroundDeadlock(bd); + List<String> after = countJavaInstances(); + ServerAccess.logOutputReprint("java9: " + after.size()); + Assert.assertNotNull("proces inside background deadlock cant be null. It was.", bd.getPr()); + assertDeadlockTestLaunched(bd.getPr()); + killDiff(before, during); + List<String> afterKill = countJavaInstances(); + ServerAccess.logOutputReprint("java99: " + afterKill.size()); + Assert.assertEquals("assert that just old javas remians", 0, (before.size() - afterKill.size())); + // div by two is caused by jav in java process hierarchy + Assert.assertEquals("launched JVMs must be exactly 1, was " + (during.size() - before.size()) / 2, 1, (during.size() - before.size()) / 2); + } + + /** + * by process assasin destroyed processes are hanging random amount of time as zombies. + * Kill -9 is handling zombies pretty well. + * + * This function kills or processes which are in nw but are not in old + * (eq.to killing new zombies:) ) + * + * @param old + * @param nw + * @return + * @throws Exception + */ + private static List<String> killDiff(List<String> old, List<String> nw) throws Exception { + ensureLinux(); + List<String> result = new ArrayList<String>(); + for (String string : nw) { + if (old.contains(string)) { + continue; + } + ServerAccess.logOutputReprint("Killing " + string); + ServerAccess.PROCESS_LOG = false; + try { + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"kill", "-9", string})); + } finally { + ServerAccess.PROCESS_LOG = true; + } + result.add(string); + ServerAccess.logOutputReprint("Killed " + string); + } + return result; + } + + private static List<String> countJavaInstances() throws Exception { + ensureLinux(); + List<String> result = new ArrayList<String>(); + ServerAccess.PROCESS_LOG = false; + try { + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"ps", "-eo", "pid,ppid,stat,fname"})); + Matcher m = Pattern.compile("\\s*\\d+\\s+\\d+ .+ java\\s*").matcher(pr.stdout); + int i = 0; + while (m.find()) { + i++; + String ss = m.group(); + //ServerAccess.logOutputReprint(i+": "+ss); + result.add(ss.trim().split("\\s+")[0]); + } + } finally { + ServerAccess.PROCESS_LOG = true; + } + return result; + + } + + public static void main(String[] args) throws Exception { + ServerAccess.logOutputReprint("" + countJavaInstances()); + } + + private void assertDeadlockTestLaunched(ProcessResult pr) { + String s = "Deadlock test started"; + Assert.assertTrue("Deadlock test should print out " + s + ", but did not", pr.stdout.contains(s)); + String ss = "xception"; + Assert.assertFalse("Deadlock test should not stderr " + ss + " but did", pr.stderr.contains(ss)); + //each 3500 seconds deadlock test stdout something + //timeout is 20s + //so it should write out FIVE sentences, but is mostly just three or four. Last is nearly always consumed by termination + for (int i = 1; i <= 3; i++) { + String sentence = i + " Deadlock sleeping"; + Assert.assertTrue( + "stdout should contains: " + sentence + ", didn't, so framework have consumed to much during termination", + pr.stdout.contains(sentence)); + } + } + + private void waitForBackgroundDeadlock(final BackgroundDeadlock bd) throws InterruptedException { + while (!bd.isFinished()) { + Thread.sleep(500); + + } + } + + private static class BackgroundDeadlock extends Thread { + + private boolean finished = false; + private ProcessResult pr = null; + String jnlp; + List<String> args; + + public BackgroundDeadlock(String jnlp, List<String> args) { + this.jnlp = jnlp; + this.args = args; + } + + @Override + public void run() { + try { + pr = server.executeJavawsHeadless(args, jnlp); + } catch (Exception ex) { + ServerAccess.logException(ex); + } finally { + finished = true; + } + + } + + public ProcessResult getPr() { + return pr; + } + + public boolean isFinished() { + return finished; + } + } + + private static void ensureLinux() { + String os = System.getProperty("os.name").toLowerCase(); + if (!(os.contains("linux") || os.contains("unix"))) { + throw new IllegalStateException("This test can be procesed only on linux like machines"); + } + } +} diff --git a/tests/reproducers/simple/simpletest1/resources/simpletest1.jnlp b/tests/reproducers/simple/simpletest1/resources/simpletest1.jnlp new file mode 100644 index 0000000..d7d0b85 --- /dev/null +++ b/tests/reproducers/simple/simpletest1/resources/simpletest1.jnlp @@ -0,0 +1,53 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="simpletest1.jnlp" codebase="."> + <information> + <title>simpletest1</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>simpletest1</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="simpletest1.jar"/> + </resources> + <application-desc main-class="SimpleTest1"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/simpletest1/resources/simpletestCustomSplash.jnlp b/tests/reproducers/simple/simpletest1/resources/simpletestCustomSplash.jnlp new file mode 100644 index 0000000..66eb519 --- /dev/null +++ b/tests/reproducers/simple/simpletest1/resources/simpletestCustomSplash.jnlp @@ -0,0 +1,55 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="simpletestCustomSplash.jnlp" codebase="."> + <information> + <title>simpletest1</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>simpletest1</description> + <icon kind="splash" href="netxPlugin.png"/> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <!--<jar href="XslowXsimpletest1.jar"/>--> + <jar href="XslowXdeadlocktest.jar"/> + </resources> + <application-desc main-class="SimpleTest1"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/simpletest1/resources/simpletestMegaSlow.jnlp b/tests/reproducers/simple/simpletest1/resources/simpletestMegaSlow.jnlp new file mode 100644 index 0000000..7e319d3 --- /dev/null +++ b/tests/reproducers/simple/simpletest1/resources/simpletestMegaSlow.jnlp @@ -0,0 +1,53 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="XslowXsimpletestMegaSlow.jnlp" codebase="."> + <information> + <title>simpletest1</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>simpletest1</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="XslowXsimpletest1.jar"/> + </resources> + <application-desc main-class="SimpleTest1"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/simpletest1/resources/simpletestSlow.jnlp b/tests/reproducers/simple/simpletest1/resources/simpletestSlow.jnlp new file mode 100644 index 0000000..905cf7c --- /dev/null +++ b/tests/reproducers/simple/simpletest1/resources/simpletestSlow.jnlp @@ -0,0 +1,53 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="simpletestSlow.jnlp" codebase="."> + <information> + <title>simpletest1</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>simpletest1</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="XslowXsimpletest1.jar"/> + </resources> + <application-desc main-class="SimpleTest1"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/simpletest1/resources/simpletestSlowBrokenCustomSplash.jnlp b/tests/reproducers/simple/simpletest1/resources/simpletestSlowBrokenCustomSplash.jnlp new file mode 100644 index 0000000..0b09c5b --- /dev/null +++ b/tests/reproducers/simple/simpletest1/resources/simpletestSlowBrokenCustomSplash.jnlp @@ -0,0 +1,54 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="simpletestSlowBrokenCustomSplash.jnlp" codebase="."> + <information> + <title>simpletest1</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <icon kind="splash" href="netxPlugin.pngggg"/> + <description>simpletest1</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="XslowXsimpletest1.jar"/> + </resources> + <application-desc main-class="SimpleTest1"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/simpletest1/resources/simpletestSlowSlowCustomSplash.jnlp b/tests/reproducers/simple/simpletest1/resources/simpletestSlowSlowCustomSplash.jnlp new file mode 100644 index 0000000..99ad0b0 --- /dev/null +++ b/tests/reproducers/simple/simpletest1/resources/simpletestSlowSlowCustomSplash.jnlp @@ -0,0 +1,54 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="simpletestSlowSlowCustomSplash.jnlp" codebase="."> + <information> + <title>simpletest1</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <icon kind="splash" href="XslowXnetxPlugin.png"/> + <description>simpletest1</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="XslowXsimpletest1.jar"/> + </resources> + <application-desc main-class="SimpleTest1"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/simpletest1/srcs/SimpleTest1.java b/tests/reproducers/simple/simpletest1/srcs/SimpleTest1.java new file mode 100644 index 0000000..0957480 --- /dev/null +++ b/tests/reproducers/simple/simpletest1/srcs/SimpleTest1.java @@ -0,0 +1,43 @@ +/* SimpleTest1.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SimpleTest1{ + + public static void main(String[] args){ + System.out.println("Good simple javaws exapmle"); + } +} diff --git a/tests/reproducers/simple/simpletest1/testcases/SimpleTest1Test.java b/tests/reproducers/simple/simpletest1/testcases/SimpleTest1Test.java new file mode 100644 index 0000000..abc1592 --- /dev/null +++ b/tests/reproducers/simple/simpletest1/testcases/SimpleTest1Test.java @@ -0,0 +1,61 @@ +/* SimpleTest1Test.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; + +import org.junit.Test; + +public class SimpleTest1Test { + + private static ServerAccess server = new ServerAccess(); + + + + @Test + public void testSimpletest1lunchOk() throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/simpletest1.jnlp"); + String s="Good simple javaws exapmle"; + Assert.assertTrue("testSimpletest1lunchOk stdout should contains "+s+" bud didn't",pr.stdout.contains(s)); + String ss="xception"; + Assert.assertFalse("testSimpletest1lunchOk stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + } diff --git a/tests/reproducers/simple/simpletest2/resources/simpletest2.jnlp b/tests/reproducers/simple/simpletest2/resources/simpletest2.jnlp new file mode 100644 index 0000000..cc6e11a --- /dev/null +++ b/tests/reproducers/simple/simpletest2/resources/simpletest2.jnlp @@ -0,0 +1,53 @@ +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="simpletest2.jnlp" codebase="."> + <information> + <title>simpletest2</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>simpletest2</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="simpletest2.jar"/> + </resources> + <application-desc main-class="SimpleTest2"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/simple/simpletest2/srcs/SimpleTest2.java b/tests/reproducers/simple/simpletest2/srcs/SimpleTest2.java new file mode 100644 index 0000000..9160c62 --- /dev/null +++ b/tests/reproducers/simple/simpletest2/srcs/SimpleTest2.java @@ -0,0 +1,44 @@ +/* SimpleTest2.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SimpleTest2{ + + public static void main(String[] args){ +throw new RuntimeException("Correct exception"); + + } +} diff --git a/tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java b/tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java new file mode 100644 index 0000000..9a77da4 --- /dev/null +++ b/tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java @@ -0,0 +1,62 @@ +/* SimpleTest2Test.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; + +import org.junit.Test; + +public class SimpleTest2Test { + + private static ServerAccess server = new ServerAccess(); + + + @Test + public void testSimpletest2lunchException() throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/simpletest2.jnlp"); + Assert.assertTrue("stdout should be < 1 , but was "+pr.stdout.trim().length(),pr.stdout.trim().length() < 1); + String s="Correct exception"; + Assert.assertTrue("stderr should contains "+s+" but didn't",pr.stderr.contains(s)); + String ss="Exception"; + Assert.assertTrue("stderr should contains "+ss+" but did not",pr.stderr.contains(ss)); + Assert.assertFalse("testSimpletest2lunchException should not be terminated, but was",pr.wasTerminated); + //Assert.assertFalse(0==pr.returnValue);exception and still returned 0? + } + + + + } |