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 | |
parent | d11831804f320ce432b904032d5cfbf00c1a198b (diff) |
Refactored reproducers directry structure
Diffstat (limited to 'tests/reproducers')
180 files changed, 10772 insertions, 0 deletions
diff --git a/tests/reproducers/README b/tests/reproducers/README new file mode 100644 index 0000000..a582318 --- /dev/null +++ b/tests/reproducers/README @@ -0,0 +1,32 @@ +Each file in directory simple must follows hierarchy conventions and is compiled/jared + automatically into server's working directory and content of resources likewise. + The name of jnlp is independent, and there can be even more jnlps for each future jar. +Directories are honored in srcs and in resources, but not in testcases. +Directories in signed handle their content in similar way as simple's content is handled, + but in addition final jars are signed with simple testkey. +Files in custom directory have to care about compilation/packaging and deploying of srcs + directory themselves. This can affect also testcase and resources, but testcases and + resources are still automatically prepared like they are in the other test types. +There are three reproducers – simpletest1, simpletest2 and deadlocktest, which tests + test’s suite itself and serve as examples of behaviour. + +Directory "signed" is listed in Makefile.am. You can specify as much to-be-signed +directories as you want. And jars in each of those signed directories will be +signed by their's own unique key (number of signed directories == number of certificates). +Do not forget to add each this directory into list n Makefile.am + +If the name of a folder in simple/signed is composed of dots, then its contents + are deployed from under a directory structure such that each part evaluates to + a folder. For example, my.dir.reproducer/ will be deployed as jnlp_test_server/my/dir/reproducer.jar. + +Inside custom directory are expected directories which are handling themselves. + The only strictly necessary file is custom/reproducerName/srcs/Makefile. Upon + all custom/*/srcs are then launched make prepare-reproducer and during cleaning make + clean-reproducer. Those targets are run after all simple and signed reproducers are + prepared, so they can reuse components of the simple and signed reproducers, eg + certificates or dependencies. to keep this custom makefiles as simple as possible. + Some comment in makefile or readme file is recommended for each custom reproducer + to tell dependencies and what it does. Some readme (or comment in classes) is good + advice for any reproducer anyway;) +Because of automake only small set of variables from icedtea-web Makefile is + available for custom makefiles, but feel free to export others if needed. diff --git a/tests/reproducers/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html b/tests/reproducers/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html new file mode 100644 index 0000000..88b8d99 --- /dev/null +++ b/tests/reproducers/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.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="AppletFolderInArchiveTag.class" archive="archive_tag_folder_test/"> +</applet></p> +</body> +</html> diff --git a/tests/reproducers/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java b/tests/reproducers/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java new file mode 100644 index 0000000..0440500 --- /dev/null +++ b/tests/reproducers/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.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 AppletFolderInArchiveTag 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("This was ran from a folder specified in the archive tag."); + } +} diff --git a/tests/reproducers/custom/AppletFolderInArchiveTag/srcs/Makefile b/tests/reproducers/custom/AppletFolderInArchiveTag/srcs/Makefile new file mode 100644 index 0000000..aa7f7fe --- /dev/null +++ b/tests/reproducers/custom/AppletFolderInArchiveTag/srcs/Makefile @@ -0,0 +1,18 @@ +TESTNAME=AppletFolderInArchiveTag +ARCHIVE_TEST_FOLDER=archive_tag_folder_test +JAVAC_CLASSPATH=$(JNLP_TESTS_ENGINE_DIR):$(NETX_DIR)/lib/classes.jar +DEPLOY_SUBDIR=$(JNLP_TESTS_SERVER_DEPLOYDIR)/$(ARCHIVE_TEST_FOLDER) +INDEX_HTML_BODY="<html><body><h1>Required to recognize folder structure</h1></body></html>" + +prepare-reproducer: + echo PREPARING REPRODUCER $(TESTNAME) + mkdir -p $(DEPLOY_SUBDIR) + echo INDEX_HTML_BODY > $(DEPLOY_SUBDIR)/index.html + $(EXPORTED_JAVAC) -classpath $(JAVAC_CLASSPATH) -d $(DEPLOY_SUBDIR) $(TESTNAME).java + echo PREPARED REPRODUCER $(TESTNAME) + +clean-reproducer: + echo CLEANING REPRODUCER $(TESTNAME) + rm -rf $(DEPLOY_SUBDIR) + echo CLEANED REPRODUCER $(TESTNAME) + diff --git a/tests/reproducers/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java b/tests/reproducers/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java new file mode 100644 index 0000000..63e8d7c --- /dev/null +++ b/tests/reproducers/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java @@ -0,0 +1,61 @@ +/* AppletFolderInArchiveTagTests.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.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 AppletFolderInArchiveTagTests extends BrowserTest{ + + + @NeedsDisplay + @Test + @TestInBrowsers(testIn={Browsers.all}) + @Bug(id="PR1011") + public void testClassInAppletFolder() throws Exception { + ProcessResult pr = server.executeBrowser("/AppletFolderInArchiveTag.html"); + + String s0 = "This was ran from a folder specified in the archive tag."; + Assert.assertTrue("Expected '"+s0+"', stdout was: " + pr.stdout, pr.stdout.contains(s0)); + } +}
\ No newline at end of file diff --git a/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedJAVAXJNLP.jnlp b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedJAVAXJNLP.jnlp new file mode 100644 index 0000000..d75a83b --- /dev/null +++ b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedJAVAXJNLP.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" + codebase="." + href="AccessClassInPackageJAVAXJNLP.jnlp"> + <information> + <title>Test accessClassInPackage signed</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing access to some javax.jnlp.* package by signed app</description> + </information> + <resources> + <jar href="AccessClassInPackageSigned.jar" main="true"/> + </resources> + <application-desc main-class="AccessClassInPackageSigned"> + <argument>javax.jnlp.ServiceManager</argument> + </application-desc> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedNETSF.jnlp b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedNETSF.jnlp new file mode 100644 index 0000000..c6b066b --- /dev/null +++ b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedNETSF.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" + codebase="." + href="AccessClassInPackageSignedNETSF.jnlp"> + <information> + <title>Test accessClassInPackage by signed app</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing access to net.sourceforge.* package by signed app</description> + </information> + <resources> + <jar href="AccessClassInPackageSigned.jar" main="true"/> + </resources> + <application-desc main-class="AccessClassInPackageSigned"> + <argument>net.sourceforge.jnlp.Parser</argument> + </application-desc> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSELF.jnlp b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSELF.jnlp new file mode 100644 index 0000000..b7d1ff5 --- /dev/null +++ b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSELF.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" + codebase="." + href="AccessClassInPackageSignedSELF.jnlp"> + <information> + <title>Test accessClassInPackage by signed app</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing aaccess to package's internal class by signed app</description> + </information> + <resources> + <jar href="AccessClassInPackageSigned.jar" main="true"/> + </resources> + <application-desc main-class="AccessClassInPackageSigned"> + <argument>AccessClassInPackageSigned</argument> + </application-desc> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSUNSEC.jnlp b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSUNSEC.jnlp new file mode 100644 index 0000000..ae4a19e --- /dev/null +++ b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSUNSEC.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" + codebase="." + href="AccessClassInPackageSignedSUNSEC.jnlp"> + <information> + <title>Test accessClassInPackage by signed app</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>testing access to sun.security.* package by signed app</description> + </information> + <resources> + <jar href="AccessClassInPackageSigned.jar" main="true"/> + </resources> + <application-desc main-class="AccessClassInPackageSigned"> + <argument>sun.security.internal.spec.TlsKeyMaterialSpec</argument> + </application-desc> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/AccessClassInPackageSigned/srcs/AccessClassInPackageSigned.java b/tests/reproducers/signed/AccessClassInPackageSigned/srcs/AccessClassInPackageSigned.java new file mode 100644 index 0000000..63c681d --- /dev/null +++ b/tests/reproducers/signed/AccessClassInPackageSigned/srcs/AccessClassInPackageSigned.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 AccessClassInPackageSigned { + + 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/signed/AppletTestSigned/resources/AppletTestSigned.html b/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.html new file mode 100644 index 0000000..6c6ac48 --- /dev/null +++ b/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.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 bgcolor="red"> +<p> + <applet code="AppletTestSigned.class" archive="XslowXAppletTestSigned.jar" codebase="." width="100" height="100"> + <param name="key1" value="value1"> + <param name="key2" value="#value2"> + </applet> +</p> +</body> +</html> diff --git a/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.jnlp b/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.jnlp new file mode 100644 index 0000000..2045818 --- /dev/null +++ b/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.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="AppletTestSigned.jnlp" codebase="."> + <information> + <title>SignedAppletTest</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web "/> + <description>SignedAppletTest</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="AppletTestSigned.jar"/> + </resources> + <applet-desc + documentBase="." + name="AppletTest" + main-class="AppletTestSigned" + width="100" + height="100"> + <param name="key1" value="value1"/> + <param name="key2" value="value2"/> + </applet-desc> +</jnlp> + + +</applet-desc> diff --git a/tests/reproducers/signed/AppletTestSigned/srcs/AppletTestSigned.java b/tests/reproducers/signed/AppletTestSigned/srcs/AppletTestSigned.java new file mode 100644 index 0000000..1d475a5 --- /dev/null +++ b/tests/reproducers/signed/AppletTestSigned/srcs/AppletTestSigned.java @@ -0,0 +1,82 @@ +/* AppletTestSigned.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 AppletTestSigned extends Applet { + + private class Killer extends Thread { + + public int n = 2000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("AppletTestSigned killing himself after " + n + " ms of life"); + System.exit(0); + } catch (Exception ex) { + } + } + } + private Killer killer; + + @Override + public void init() { + System.out.println("AppletTestSigned was initialised"); + killer = new Killer(); + } + + @Override + public void start() { + System.out.println("AppletTestSigned 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("AppletTestSigned was stopped"); + } + + @Override + public void destroy() { + System.out.println("AppletTestSigned will be destroyed"); + } +} diff --git a/tests/reproducers/signed/AppletTestSigned/testcases/AppletTestSignedTests.java b/tests/reproducers/signed/AppletTestSigned/testcases/AppletTestSignedTests.java new file mode 100644 index 0000000..d3d87ba --- /dev/null +++ b/tests/reproducers/signed/AppletTestSigned/testcases/AppletTestSignedTests.java @@ -0,0 +1,94 @@ +/* AppletTestSignedTests.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 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 AppletTestSignedTests extends BrowserTest { + + private final List<String> l = Collections.unmodifiableList(Arrays.asList(new String[]{"-Xtrustall"})); + + @Test + public void AppletTestSignedTest() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/AppletTestSigned.jnlp"); + evaluateSignedApplet(pr); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + private void evaluateSignedApplet(ProcessResult pr) { + String s3 = "AppletTestSigned was initialised"; + Assert.assertTrue("AppletTestSigned stdout should contain " + s3 + " but didn't", pr.stdout.contains(s3)); + String s0 = "AppletTestSigned was started"; + Assert.assertTrue("AppletTestSigned stdout should contain " + s0 + " but didn't", pr.stdout.contains(s0)); + String s1 = "value1"; + Assert.assertTrue("AppletTestSigned stdout should contain " + s1 + " but didn't", pr.stdout.contains(s1)); + String s2 = "value2"; + Assert.assertTrue("AppletTestSigned stdout should contain " + s2 + " but didn't", pr.stdout.contains(s2)); + String s4 = "AppletTestSigned was stopped"; + Assert.assertFalse("AppletTestSigned stdout shouldn't contain " + s4 + " but did", pr.stdout.contains(s4)); + String s5 = "AppletTestSigned will be destroyed"; + Assert.assertFalse("AppletTestSigned stdout shouldn't contain " + s5 + " but did", pr.stdout.contains(s5)); + String ss = "xception"; + Assert.assertFalse("AppletTestSigned stderr should not contain " + ss + " but did", pr.stderr.contains(ss)); + String s7 = "AppletTestSigned killing himself after 2000 ms of life"; + Assert.assertTrue("AppletTestSigned stdout should contain " + s7 + " but didn't", pr.stdout.contains(s7)); + } + + @Test + @TestInBrowsers(testIn = {Browsers.all}) + public void AppletTestSignedFirefoxTest() throws Exception { + ServerAccess.PROCESS_TIMEOUT = 30 * 1000; + try { + ServerAccess.ProcessResult pr = server.executeBrowser("/AppletTestSigned.html"); + evaluateSignedApplet(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/signed/CacheReproducer/resources/CacheReproducer1.jnlp b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer1.jnlp new file mode 100644 index 0000000..87bfde4 --- /dev/null +++ b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer1.jnlp @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="CacheReproducer1.jnlp"> + <information> + <title>Just prints out "Good simple javaws exapmle" using reflection call from CacheReproducer.jar SimpletestSigned1.jar</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="CacheReproducer.jar" main="true"/> + <jar href="SimpletestSigned1.jar" main="false" download="eager"/> + </resources> + <application-desc main-class="CacheReproducer"/> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer1_1.jnlp b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer1_1.jnlp new file mode 100644 index 0000000..dba2a65 --- /dev/null +++ b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer1_1.jnlp @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="CacheReproducer1_1.jnlp"> + <information> + <title>Just prints out "Good simple javaws exapmle" using reflection call from CacheReproducer.jar SimpletestSigned1.jar</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="CacheReproducer.jar" main="true"/> + <jar href="SimpletestSigned1.jar" main="false" download="lazy"/> + </resources> + <application-desc main-class="CacheReproducer"/> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2.jnlp b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2.jnlp new file mode 100644 index 0000000..a588211 --- /dev/null +++ b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2.jnlp @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="CacheReproducer2.jnlp"> + <information> + <title>Just prints out "Good simple javaws exapmle" using reflection call from CacheReproducer.jar SimpletestSigned1.jar</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="SimpletestSigned1.jar" main="false" download="eager"/> + <jar href="CacheReproducer.jar" main="true"/> + </resources> + <application-desc main-class="CacheReproducer"/> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2_1.jnlp b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2_1.jnlp new file mode 100644 index 0000000..97745a7 --- /dev/null +++ b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2_1.jnlp @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="CacheReproducer2_1.jnlp"> + <information> + <title>Just prints out "Good simple javaws exapmle" using reflection call from CacheReproducer.jar SimpletestSigned1.jar</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="SimpletestSigned1.jar" main="false" download="lazy"/> + <jar href="CacheReproducer.jar" main="true"/> + </resources> + <application-desc main-class="CacheReproducer"/> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/CacheReproducer/srcs/CacheReproducer.java b/tests/reproducers/signed/CacheReproducer/srcs/CacheReproducer.java new file mode 100644 index 0000000..e0813fa --- /dev/null +++ b/tests/reproducers/signed/CacheReproducer/srcs/CacheReproducer.java @@ -0,0 +1,47 @@ +/* CacheReproducer.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.lang.reflect.*; + +public class CacheReproducer{ + + public static void main(String[] args) throws Exception{ + Class c1= Class.forName("SimpletestSigned1"); + Method m1=c1.getDeclaredMethod("main",args.getClass()); + m1.invoke((Object) null, (Object)args); + } +} diff --git a/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java b/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java new file mode 100644 index 0000000..a8a2859 --- /dev/null +++ b/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java @@ -0,0 +1,478 @@ +/* CacheReproducerTest.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.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.annotations.KnownToFail; +import org.junit.AfterClass; +import org.junit.Assert; + +import org.junit.Test; + +public class CacheReproducerTest { + + private static final ServerAccess server = new ServerAccess(); + private static final List<String> clear = Arrays.asList(new String[]{server.getJavawsLocation(), "-Xclearcache", ServerAccess.HEADLES_OPTION}); + private static final List<String> trustedVerboses = Arrays.asList(new String[]{"-Xtrustall", ServerAccess.HEADLES_OPTION,"-verbose"}); + private static final List<String> verbosed = Arrays.asList(new String[]{"-verbose", ServerAccess.HEADLES_OPTION}); + private static final String home = System.getProperty("user.home"); + private static final String name = System.getProperty("user.name"); + private static final String tmp = System.getProperty("java.io.tmpdir"); + private static final File icedteaDir = new File(home + "/" + ".icedtea"); + private static final File icedteaCache = new File(icedteaDir, "cache"); + private static final File icedteaCacheFile = new File(icedteaCache, "recently_used"); + private static final File netxLock = new File(tmp + "/" + name + "/netx/locks/netx_running"); + private static final String lre = "LruCacheException"; + private static final String ioobe = "IndexOutOfBoundsException"; + private static final String corruptRegex = "\\d{13}"; + private static final Pattern corruptPatern = Pattern.compile(corruptRegex); + private static final String corruptString = "156dsf1562kd5"; + + String testS = "#netx file\n" + + "#Mon Dec 12 16:20:46 CET 2011\n" + + "1323703236508,0=/home/xp13/.icedtea/cache/0/http/localhost/ReadPropertiesBySignedHack.jnlp\n" + + "1323703243086,2=/home/xp14/.icedtea/cache/2/http/localhost/ReadProperties.jar\n" + + "1323703243082,1=/home/xp15/.icedtea/cache/1/http/localhost/ReadPropertiesBySignedHack.jar"; + + @Test + public void cacheIsWorkingTest() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + } + + @Test + public void cacheIsWorkingTestSigned() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1Signed()); + assertCacheIsNotEmpty(); + } + + private class ParallelSimpleTestRunner extends Thread { + public boolean b=false; + @Override + public void run() { + try { + + ServerAccess.ProcessResult pr = runSimpleTest1(); + evaluateSimpleTest1OkCache(pr); + b=true; + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + }; + + @Test + @KnownToFail + public void startParallelInstancesUponBrokenCache() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + breakCache1(); + ParallelSimpleTestRunner t1=new ParallelSimpleTestRunner(); + ParallelSimpleTestRunner t2=new ParallelSimpleTestRunner(); + ParallelSimpleTestRunner t3=new ParallelSimpleTestRunner(); + t1.start(); + t2.start(); + t3.start(); + int c=0; + while(true){ + c++; + Thread.sleep(100); + if (c>600) throw new Error("threads have not died in time"); + if (!t1.isAlive() && !t2.isAlive() && !t3.isAlive()) break; + } + Thread.sleep(1000); + Assert.assertTrue(t1.b); + Assert.assertTrue(t2.b); + Assert.assertTrue(t3.b); + } + + + private void assertCacheIsNotEmpty() { + Assert.assertTrue("icedtea cache " + icedteaCache.getAbsolutePath() + " should exist some any run", icedteaCache.exists()); + Assert.assertTrue("icedtea cache file " + icedteaCacheFile.getAbsolutePath() + " should exist some any run", icedteaCacheFile.exists()); + Assert.assertTrue("icedtea cache file " + icedteaCacheFile.getAbsolutePath() + " should not be empty", icedteaCacheFile.length() > 0); + } + + /** + * This is breaking integer numbers in first part of cache file item + * @throws Exception + */ + @Test + public void coruptAndRunCache1() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + breakCache1(); + ProcessResult pr = runSimpleTest1(); + assertLruExceptionAppeared(pr); + evaluateSimpleTest1OkCache(pr); + clearAndEvaluateCache(); + ProcessResult pr2 = runSimpleTest1(); + evaluateSimpleTest1OkCache(pr2); + assertLruExceptionNOTappeared(pr2); + } + + /** + * This is breaking integer numbers in first part of cache file item + * @throws Exception + */ + @Test + public void coruptAndRunCache2() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + breakCache1(); + ProcessResult pr = runSimpleTest1(); + assertLruExceptionAppeared(pr); + evaluateSimpleTest1OkCache(pr); + ProcessResult pr3 = runSimpleTest1(); + evaluateSimpleTest1OkCache(pr3); + assertLruExceptionNOTappeared(pr3); + clearAndEvaluateCache(); + ProcessResult pr2 = runSimpleTest1(); + evaluateSimpleTest1OkCache(pr2); + assertLruExceptionNOTappeared(pr2); + } + + /** + * This is breaking paths in second part of cache file item + * @throws Exception + */ + @Test + public void coruptAndRunCache3() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + breakCache3(); + ProcessResult pr = runSimpleTest1(); + assertAoobNOTappeared(pr); + assertLruExceptionAppeared(pr); + evaluateSimpleTest1OkCache(pr); + ProcessResult pr3 = runSimpleTest1(); + evaluateSimpleTest1OkCache(pr3); + assertLruExceptionNOTappeared(pr3); + clearAndEvaluateCache(); + ProcessResult pr2 = runSimpleTest1(); + evaluateSimpleTest1OkCache(pr2); + assertLruExceptionNOTappeared(pr2); + } + + private void assertAoobNOTappeared(ProcessResult pr2) { + Assert.assertFalse("serr should NOT contain " + ioobe, pr2.stderr.contains(ioobe)); + } + + private void assertLruExceptionNOTappeared(ProcessResult pr2) { + Assert.assertFalse("serr should NOT contain " + lre, pr2.stderr.contains(lre)); + } + + private void assertLruExceptionAppeared(ProcessResult pr) { + Assert.assertTrue("serr should contain " + lre, pr.stderr.contains(lre)); + } + + @Test + public void coruptAndRunCache1Signed() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + breakCache1(); + ProcessResult pr = runSimpleTest1Signed(); + assertLruExceptionAppeared(pr); + evaluateSimpleTest1OkCache(pr); + clearAndEvaluateCache(); + ProcessResult pr2 = runSimpleTest1Signed(); + evaluateSimpleTest1OkCache(pr2); + assertLruExceptionNOTappeared(pr2); + } + + @Test + public void coruptAndRunCache2Signed() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + breakCache1(); + ProcessResult pr = runSimpleTest1Signed(); + assertLruExceptionAppeared(pr); + evaluateSimpleTest1OkCache(pr); + ProcessResult pr3 = runSimpleTest1Signed(); + evaluateSimpleTest1OkCache(pr3); + assertLruExceptionNOTappeared(pr3); + clearAndEvaluateCache(); + ProcessResult pr2 = runSimpleTest1Signed(); + evaluateSimpleTest1OkCache(pr2); + assertLruExceptionNOTappeared(pr2); + } + + @Test + public void clearCacheUnsucessfully() throws Exception { + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + ProcessResult pr; + Thread t = new Thread(new Runnable() { + + @Override + public void run() { + try { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(verbosed, "/deadlocktest.jnlp"); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + }); + t.start(); + Thread.sleep(1000); + pr = tryToClearcache(); + String q = "Can not clear cache at this time"; + Assert.assertTrue("Stderr should contain " + q + ", but did not.", pr.stderr.contains(q)); + assertCacheIsNotEmpty(); + } + + + //next four tests are designed to ensure, that corrupted cache will not break already loaded cached files + public static final String CR1 = "CacheReproducer1"; + public static final String CR2 = "CacheReproducer2"; + public static final String CR11 = "CacheReproducer1_1"; + public static final String CR21 = "CacheReproducer2_1"; + + public void testsBody(String id, int breaker) throws Exception { + clearAndEvaluateCache(); + ProcessResult pr1 = runSimpleTestSigned(id); + assertLruExceptionNOTappeared(pr1); + evaluateSimpleTest1OkCache(pr1); + if (breaker < 0) { + breakCache1(); + } else { + breakCache2(breaker); + } + ProcessResult pr2 = runSimpleTestSigned(id); + assertLruExceptionAppeared(pr2); + evaluateSimpleTest1OkCache(pr2); + } + + @Test + public void testAlreadyLoadedCached1() throws Exception { + testsBody(CR1, 1); + testsBody(CR1, 2); + testsBody(CR1, -1); + } + + @Test + public void testAlreadyLoadedCached2() throws Exception { + testsBody(CR2, 1); + testsBody(CR2, 2); + testsBody(CR2, -1); + } + + @Test + public void testAlreadyLoadedCached11() throws Exception { + testsBody(CR11, 1); + testsBody(CR11, 2); + testsBody(CR11, -1); + } + + @Test + public void testAlreadyLoadedCached21() throws Exception { + testsBody(CR21, 1); + testsBody(CR21, 2); + testsBody(CR21, -1); + } + + @AfterClass + public static void clearCache() throws Exception { + clearAndEvaluateCache(); + } + + private static void clearAndEvaluateCache() throws Exception { + clearAndEvaluateCache(true); + } + + private static void clearAndEvaluateCache(boolean force) throws Exception { + if (force) { + if (netxLock.isFile()) { + boolean b = netxLock.delete(); + junit.framework.Assert.assertTrue(b); + } + + } + tryToClearcache(); + Assert.assertFalse("icedtea cache " + icedteaCache.getAbsolutePath() + " should not exist after clearing", icedteaCache.exists()); + } + + private static String loadFile(File f) throws FileNotFoundException, UnsupportedEncodingException, IOException { + BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(icedteaCacheFile), "UTF-8")); + StringBuilder sb = new StringBuilder(); + while (true) { + String s = r.readLine(); + if (s == null) { + break; + } + sb.append(s).append("\n"); + + } + return sb.toString(); + } + + private static String loadCacheFile() throws IOException { + return loadFile(icedteaCacheFile); + } + + @Test + public void assertBreakers1AreWorking() { + String s=testS; + String sp[] = s.split("\n"); + String ss[] = breakAll(s).split("\n"); + for (int i = 0; i < 2; i++) { + Assert.assertEquals(sp[i], ss[i]); + + } + for (int i = 2; i < ss.length; i++) { + Assert.assertNotSame(sp[i], ss[i]); + + } + String sb = breakOne(s, 0); + junit.framework.Assert.assertEquals(s, sb); + for (int x = 1; x <= 3; x++) { + String[] sx = breakOne(s, x).split("\n"); + for (int i = 0; i < sx.length; i++) { + if (i == x + 1) { + Assert.assertNotSame(sp[i], sx[i]); + } else { + Assert.assertEquals(sp[i], sx[i]); + } + + } + } + String sbb = breakOne(s, 4); + Assert.assertEquals(s, sbb); + } + + private static String breakAll(String s) { + return s.replaceAll(corruptRegex, corruptString); + } + + private static String breakOne(String s, int i) { + Matcher m1 = corruptPatern.matcher(s); + int x = 0; + while (m1.find()) { + x++; + String r = (m1.group(0)); + if (x == i) { + return s.replace(r, corruptString); + } + } + return s; + } + + @Test + public void assertBreakers2AreWorking() { + String s=testS; + String sp[] = s.split("\n"); + String ss[] = breakPaths (s).split("\n"); + for (int i = 0; i < 2; i++) { + Assert.assertEquals(sp[i], ss[i]); + + } + for (int i = 2; i < ss.length; i++) { + Assert.assertNotSame(sp[i], ss[i]); + + } + } + + private static String breakPaths(String s) { + return s.replaceAll(home+".*", "/ho"); + } + + private static void breakCache1() throws IOException { + String s = loadCacheFile(); + s = breakAll(s); + ServerAccess.saveFile(s, icedteaCacheFile); + } + + private static void breakCache2(int i) throws FileNotFoundException, UnsupportedEncodingException, IOException { + String s = loadCacheFile(); + s = breakOne(s, i); + ServerAccess.saveFile(s, icedteaCacheFile); + } + + private static void breakCache3() throws IOException { + String s = loadCacheFile(); + s = breakPaths(s); + ServerAccess.saveFile(s, icedteaCacheFile); + } + + private static ServerAccess.ProcessResult runSimpleTest1() throws Exception { + return runSimpleTest1(verbosed, "simpletest1"); + } + + private static ServerAccess.ProcessResult runSimpleTest1(List<String> args, String s) throws Exception { + ServerAccess.ProcessResult pr2 = server.executeJavawsHeadless(args, "/" + s + ".jnlp"); + return pr2; + } + + private static ServerAccess.ProcessResult runSimpleTest1Signed() throws Exception { + return runSimpleTestSigned("SimpletestSigned1"); + } + + private static ServerAccess.ProcessResult runSimpleTestSigned(String id) throws Exception { + return runSimpleTest1(trustedVerboses, id); + } + + private static void evaluateSimpleTest1OkCache(ServerAccess.ProcessResult pr2) throws Exception { + String s = "Good simple javaws exapmle"; + Assert.assertTrue("test stdout should contain " + s + " but didn't", pr2.stdout.contains(s)); + Assert.assertFalse(pr2.wasTerminated); + Assert.assertEquals((Integer) 0, pr2.returnValue); + } + + private static ProcessResult tryToClearcache() throws Exception { + ServerAccess.ProcessResult pr1 = ServerAccess.executeProcess(clear); + return pr1; + } +} diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-hack.jnlp b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-hack.jnlp new file mode 100644 index 0000000..44d9025 --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-hack.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="InternalClassloaderWithDownloadedResource-applet-hack.jnlp" codebase="."> + <information> + <title>InternalClassloaderWithDownloadedResource-applet-hack</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>InternalClassloaderWithDownloadedResource-applet-hack</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="InternalClassloaderWithDownloadedResource.jar"/> + </resources> + <applet-desc + documentBase="." + name="InternalClassloaderWithDownloadedResource-applet" + main-class="InternalClassloaderWithDownloadedResource" + width="100" + height="100"> + <param name="arg" value="hack"/> + </applet-desc> + <security> + <all-permissions/> + </security> +</jnlp>
\ No newline at end of file diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-new.jnlp b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-new.jnlp new file mode 100644 index 0000000..882461c --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-new.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="InternalClassloaderWithDownloadedResource-applet-new.jnlp" codebase="."> + <information> + <title>InternalClassloaderWithDownloadedResource-applet-new</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>InternalClassloaderWithDownloadedResource-applet-new</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="InternalClassloaderWithDownloadedResource.jar"/> + </resources> + <applet-desc + documentBase="." + name="InternalClassloaderWithDownloadedResource-applet" + main-class="InternalClassloaderWithDownloadedResource" + width="100" + height="100"> + <param name="arg" value="new"/> + </applet-desc> + <security> + <all-permissions/> + </security> +</jnlp>
\ No newline at end of file diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.html b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.html new file mode 100644 index 0000000..7373bbd --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.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 bgcolor="red"> + <p> + <applet code="InternalClassloaderWithDownloadedResource.class" archive="InternalClassloaderWithDownloadedResource.jar" codebase="." width="100" height="100"> + <param name="arg" value="hack"/> + </applet> + </p> + </body> +</html> diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.jnlp b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.jnlp new file mode 100644 index 0000000..911cc81 --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.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="InternalClassloaderWithDownloadedResource-hack.jnlp" codebase="."> + <information> + <title>InternalClassloaderWithDownloadedResource-hack</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>InternalClassloaderWithDownloadedResource-hack</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="InternalClassloaderWithDownloadedResource.jar"/> + </resources> + <application-desc main-class="InternalClassloaderWithDownloadedResource"> + <argument>hack</argument> + </application-desc> + <security> + <all-permissions/> + </security> +</jnlp>
\ No newline at end of file diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.html b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.html new file mode 100644 index 0000000..4d0c401 --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.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 bgcolor="red"> + <p> + <applet code="InternalClassloaderWithDownloadedResource.class" archive="InternalClassloaderWithDownloadedResource.jar" codebase="." width="100" height="100"> + <param name="arg" value="new"/> + </applet> + </p> + </body> +</html> diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.jnlp b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.jnlp new file mode 100644 index 0000000..5a3050e --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.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="InternalClassloaderWithDownloadedResource-new.jnlp" codebase="."> + <information> + <title>InternalClassloaderWithDownloadedResource-new</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>InternalClassloaderWithDownloadedResource-new</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="InternalClassloaderWithDownloadedResource.jar"/> + </resources> + <application-desc main-class="InternalClassloaderWithDownloadedResource"> + <argument>new</argument> + </application-desc> + <security> + <all-permissions/> + </security> +</jnlp>
\ No newline at end of file diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/srcs/InternalClassloaderWithDownloadedResource.java b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/srcs/InternalClassloaderWithDownloadedResource.java new file mode 100644 index 0000000..96cfcdf --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/srcs/InternalClassloaderWithDownloadedResource.java @@ -0,0 +1,164 @@ +/* InternalClassloaderWithDownloadedResource.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; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; + +public class InternalClassloaderWithDownloadedResource extends Applet { + + public static void main(String[] args) throws Exception { + int port = 44321; //debug default + String sPort = System.getProperty("serveraccess.port"); + if (sPort != null) { + port = new Integer(sPort); + } + if (args.length != 1) { + throw new IllegalArgumentException("exactly one argument expected"); + } + resolveArgument(args[0], port); + + } + + private static void downlaodAndExecuteForeignMethod(int port, int classlaoder) throws SecurityException, InvocationTargetException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, MalformedURLException, IllegalArgumentException { + URL url = new URL("http://localhost:" + port + "/SimpletestSigned1.jar"); + URLClassLoader ucl = null; + if (classlaoder == 1) { + ucl = (URLClassLoader) InternalClassloaderWithDownloadedResource.class.getClassLoader(); + System.out.println("Downloading " + url.toString()); + Method privateStringMethod = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); + privateStringMethod.setAccessible(true); + privateStringMethod.invoke(ucl, url); + } else if (classlaoder == 2) { + ucl = new URLClassLoader(new URL[]{url}); + } else { + throw new IllegalArgumentException("just 1 or 2 classlaoder id expected"); + } + executeForeignMethod(port, ucl); + } + + private static void executeForeignMethod(int port, URLClassLoader loader) throws SecurityException, InvocationTargetException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, MalformedURLException, IllegalArgumentException { + String className = "SimpletestSigned1"; + Class<?> cls = loader.loadClass(className); + Method m = cls.getMethod("main", new Class[]{new String[0].getClass()}); + System.out.println("executing " + className + "'s main"); + m.invoke(null, (Object) new String[0]); + } + + private static void resolveArgument(String s, int port) throws Exception { + if (s == null) { + throw new IllegalArgumentException("arg was null"); + } else if (s.equalsIgnoreCase("hack")) { + downlaodAndExecuteForeignMethod(port, 1); + } else if (s.equalsIgnoreCase("new")) { + downlaodAndExecuteForeignMethod(port, 2); + } else { + throw new IllegalArgumentException("hack or new expected as argument"); + } + } + + 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() { + System.out.println("applet was initialised"); + killer = new Killer(); + } + + @Override + public void start() { + System.out.println("applet was started"); + killer.start(); + int port = 44321; //debug default + try { + File portsFile = new File(System.getProperty("java.io.tmpdir"), "serveraccess.port"); + if (portsFile.exists()) { + String sPort = null; + BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(portsFile), "utf-8")); + try { + sPort = br.readLine(); + } finally { + br.close(); + } + if (sPort != null) { + port = new Integer(sPort.trim()); + } + } + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + try { + resolveArgument(getParameter("arg"), port); + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + 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/signed/InternalClassloaderWithDownloadedResource/testcases/InternalClassloaderWithDownloadedResourceTest.java b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/testcases/InternalClassloaderWithDownloadedResourceTest.java new file mode 100644 index 0000000..54cb203 --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/testcases/InternalClassloaderWithDownloadedResourceTest.java @@ -0,0 +1,140 @@ +/* InternalClassloaderWithDownloadedResourceTest.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.File; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +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.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +@Bug(id = {"RH816592","PR858"}) +public class InternalClassloaderWithDownloadedResourceTest extends BrowserTest { + + private final List<String> l = Collections.unmodifiableList(Arrays.asList(new String[]{"-verbose", "-Xtrustall", "-J-Dserveraccess.port=" + server.getPort()})); + private static final File portsFile = new File(System.getProperty("java.io.tmpdir"), "serveraccess.port"); + + @Before + public void setUp() { + try { + ServerAccess.logOutputReprint("Writeing " + server.getPort() + " to " + portsFile.getAbsolutePath()); + ServerAccess.saveFile("" + server.getPort(), portsFile); + ServerAccess.logOutputReprint("done"); + } catch (Exception ex) { + ServerAccess.logException(ex); + } + } + + @After + public void tearDown() { + ServerAccess.logOutputReprint("Deleting " + portsFile.getAbsolutePath()); + boolean b = portsFile.delete(); + ServerAccess.logOutputReprint("Deletion state (should be true) is " + b); + } + + @Test + @Bug(id = {"RH816592","PR858"}) + public void launchInternalClassloaderWithDownloadedResourceAsJnlpApplication() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/InternalClassloaderWithDownloadedResource-new.jnlp"); + evaluate(pr); + Assert.assertFalse("should not be terminated but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + private void evaluate(ProcessResult pr) { + String ss = "Good simple javaws exapmle"; + Assert.assertTrue("Stdout should contains " + ss + " but didn't", pr.stdout.contains(ss)); + String s = "xception"; + Assert.assertFalse("Stderr should not contains " + s + " but did", pr.stderr.contains(s)); + } + + @Test + @Bug(id = {"RH816592","PR858"}) + public void launchInternalClassloaderWithDownloadedResourceAsJnlpApplet() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/InternalClassloaderWithDownloadedResource-applet-new.jnlp"); + evaluate(pr); + Assert.assertFalse("should not be terminated but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Test + @Bug(id = {"RH816592","PR858"}) + @NeedsDisplay + @TestInBrowsers(testIn={Browsers.all}) + public void launchInternalClassloaderWithDownloadedResourceAsHtmlApplet() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("/InternalClassloaderWithDownloadedResource-new.html"); + evaluate(pr); + Assert.assertTrue("should be terminated but was not", pr.wasTerminated); + } + + @Test + @Bug(id = {"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-May/018737.html"}) + public void launchInternalClassloaderWithDownloadedResourceAsJnlpApplicationHack() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/InternalClassloaderWithDownloadedResource-hack.jnlp"); + evaluate(pr); + Assert.assertFalse("should not be terminated but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Test + @Bug(id = {"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-May/018737.html"}) + public void launchInternalClassloaderWithDownloadedResourceAsJnlpAppletHack() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/InternalClassloaderWithDownloadedResource-applet-hack.jnlp"); + evaluate(pr); + Assert.assertFalse("should not be terminated but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Test + @NeedsDisplay + @Bug(id = {"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-May/018737.html"}) + @TestInBrowsers(testIn={Browsers.all}) + public void launchInternalClassloaderWithDownloadedResourceAsHtmlAppletHack() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("/InternalClassloaderWithDownloadedResource-hack.html"); + evaluate(pr); + Assert.assertTrue("should be terminated but was not", pr.wasTerminated); + } +} diff --git a/tests/reproducers/signed/MissingJar/resources/MissingJar.jnlp b/tests/reproducers/signed/MissingJar/resources/MissingJar.jnlp new file mode 100644 index 0000000..ed761ca --- /dev/null +++ b/tests/reproducers/signed/MissingJar/resources/MissingJar.jnlp @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="MissingJar.jnlp"> + <information> + <title>test MissingJar</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <!-- MissingJar is name of reproducer and of main jar, + so MissingJar.jar is presented unlike the ThisOneIsMissing jar --> + <jar href="MissingJar.jar" main="true" /> + </resources> + <resources> + <jar href="ThisOneIsMissing.jar" /> + </resources> + <application-desc main-class="MissingJar"/> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/MissingJar/resources/MissingJar2.jnlp b/tests/reproducers/signed/MissingJar/resources/MissingJar2.jnlp new file mode 100644 index 0000000..4a32d78 --- /dev/null +++ b/tests/reproducers/signed/MissingJar/resources/MissingJar2.jnlp @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="MissingJar2.jnlp"> + <information> + <title>test MissingJar</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="ThisOneIsMissing.jar" /> + <!-- MissingJar is name of reproducer and of main jar, + so MissingJar.jar is presented unlike the ThisOneIsMissing jar --> + <jar href="MissingJar.jar" main="true" /> + </resources> + <application-desc main-class="MissingJar"/> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/MissingJar/resources/MissingJar3.jnlp b/tests/reproducers/signed/MissingJar/resources/MissingJar3.jnlp new file mode 100644 index 0000000..b2b6007 --- /dev/null +++ b/tests/reproducers/signed/MissingJar/resources/MissingJar3.jnlp @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="MissingJar3.jnlp"> + <information> + <title>test MissingJar</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <!-- MissingJar is name of reproducer and of main jar, + so MissingJar.jar is presented unlike the ThisOneIsMissing jar --> + <jar href="MissingJar.jar" main="true" /> + <jar href="ThisOneIsMissing.jar" /> + </resources> + <application-desc main-class="MissingJar"/> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/MissingJar/resources/MissingJar4.jnlp b/tests/reproducers/signed/MissingJar/resources/MissingJar4.jnlp new file mode 100644 index 0000000..60a53c0 --- /dev/null +++ b/tests/reproducers/signed/MissingJar/resources/MissingJar4.jnlp @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="MissingJar4.jnlp"> + <information> + <title>test MissingJar</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="ThisOneIsMissing.jar" /> + </resources> + <resources> + <!-- MissingJar is name of reproducer and of main jar, + so MissingJar.jar is presented unlike the ThisOneIsMissing jar --> + <jar href="MissingJar.jar" main="true" /> + </resources> + <application-desc main-class="MissingJar"/> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/MissingJar/srcs/MissingJar.java b/tests/reproducers/signed/MissingJar/srcs/MissingJar.java new file mode 100644 index 0000000..a2b2794 --- /dev/null +++ b/tests/reproducers/signed/MissingJar/srcs/MissingJar.java @@ -0,0 +1,42 @@ +/* MissingJar.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 MissingJar { + public static void main(String[] args) { + System.out.println("only fixed classloader can initialize this app"); + } +} diff --git a/tests/reproducers/signed/MissingJar/testcases/MissingJarTest.java b/tests/reproducers/signed/MissingJar/testcases/MissingJarTest.java new file mode 100644 index 0000000..dc8bb77 --- /dev/null +++ b/tests/reproducers/signed/MissingJar/testcases/MissingJarTest.java @@ -0,0 +1,84 @@ +/* MissingJar.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.Collections; +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 MissingJarTest { + + private static ServerAccess server = new ServerAccess(); + private final List<String> l = Collections.unmodifiableList(Arrays.asList(new String[]{"-Xtrustall"})); + + private void evaluateResult(ProcessResult pr) { + String c = "only fixed classloader can initialize this app"; + Assert.assertTrue("stdout should contains `" + c + "`, but didn't ", pr.stdout.contains(c)); + 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); + } + + @Test + public void MissingJarTest1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar.jnlp"); + evaluateResult(pr); + } + + @Test + public void MissingJarTest2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar2.jnlp"); + evaluateResult(pr); + } + + @Test + public void MissingJarTest3() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar3.jnlp"); + evaluateResult(pr); + } + + @Test + public void MissingJarTest4() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar4.jnlp"); + evaluateResult(pr); + } +} diff --git a/tests/reproducers/signed/ReadPropertiesBySignedHack/resources/ReadPropertiesBySignedHack.jnlp b/tests/reproducers/signed/ReadPropertiesBySignedHack/resources/ReadPropertiesBySignedHack.jnlp new file mode 100644 index 0000000..f4e1223 --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesBySignedHack/resources/ReadPropertiesBySignedHack.jnlp @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ReadPropertiesBySignedHack.jnlp"> + <information> + <title>read properties using System.getenv()</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="ReadPropertiesBySignedHack.jar" main="true"/> + <jar href="ReadProperties.jar" main="false" download="lazy"/> + </resources> + <application-desc main-class="ReadPropertiesBySignedHack"> + <argument>user.name</argument> + </application-desc> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/ReadPropertiesBySignedHack/srcs/ReadPropertiesBySignedHack.java b/tests/reproducers/signed/ReadPropertiesBySignedHack/srcs/ReadPropertiesBySignedHack.java new file mode 100644 index 0000000..cea64af --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesBySignedHack/srcs/ReadPropertiesBySignedHack.java @@ -0,0 +1,63 @@ +/* ReadPropertiesSigned.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.lang.reflect.*; + +public class ReadPropertiesBySignedHack { + + /** + *some system property is expected as arg[0], eg user.name or user.home + */ + public static void main(String[] args) throws Throwable { + //security manager is not protecting us from accessing classes from + //net.sourceforge.jnlp.runtime via reflection + Class c2= Class.forName("net.sourceforge.jnlp.runtime.JNLPRuntime"); + Field f2 = c2.getDeclaredField("trustAll"); + f2.setAccessible(true); + f2.setBoolean(null, true); + Method m2=c2.getDeclaredMethod("setTrustAll",Boolean.TYPE); + m2.setAccessible(true); + m2.invoke((Object) null, true ); + //but security manager is guarding us against lunching unsigned code + //from signed archvive even if Xtrustall is on. + Class c1= Class.forName("ReadProperties"); + Method m1=c1.getDeclaredMethod("main",args.getClass()); + m1.invoke((Object) null, (Object)args); + } + + + +} diff --git a/tests/reproducers/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java b/tests/reproducers/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java new file mode 100644 index 0000000..8f9455d --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java @@ -0,0 +1,65 @@ +/* ReadPropertiesSignedTest.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.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class ReadPropertiesBySignedHackTest { + + private static ServerAccess server = new ServerAccess(); + private final List<String> l=Collections.unmodifiableList(Arrays.asList(new String[] {"-Xtrustall"})); + + + @Test + public void ReadPropertiesBySignedHackWithjoutXtrustAll() throws Exception { + //no request for permissions + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadPropertiesBySignedHack.jnlp"); + String s="java.lang.SecurityException: class \"ReadProperties\"'s signer information does not match signer information of other classes in the same package"; + Assert.assertTrue("Stderr should contains "+s+" but did not",pr.stderr.contains(s)); + String ss="ClassNotFoundException"; + Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); + Assert.assertTrue("stdout lenght should be <2 but was "+pr.stdout.length(),pr.stdout.length()<2); // /home/user or /root or eanything else :( + Assert.assertFalse("should not be terminated but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + } diff --git a/tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned1.jnlp b/tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned1.jnlp new file mode 100644 index 0000000..a1adab8 --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned1.jnlp @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ReadPropertiesSigned1.jnlp"> + <information> + <title>read properties using System.getenv()</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="ReadPropertiesSigned.jar" main="true"/> + </resources> + <application-desc main-class="ReadPropertiesSigned"> + <argument>user.name</argument> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned2.jnlp b/tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned2.jnlp new file mode 100644 index 0000000..db338df --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned2.jnlp @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ReadPropertiesSigned2.jnlp"> + <information> + <title>read properties using System.getenv()</title> + <vendor>IcedTea</vendor> + </information> + <resources> + <jar href="ReadPropertiesSigned.jar" main="true"/> + </resources> + <application-desc main-class="ReadPropertiesSigned"> + <argument>user.name</argument> + </application-desc> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed/ReadPropertiesSigned/srcs/ReadPropertiesSigned.java b/tests/reproducers/signed/ReadPropertiesSigned/srcs/ReadPropertiesSigned.java new file mode 100644 index 0000000..60f53cb --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesSigned/srcs/ReadPropertiesSigned.java @@ -0,0 +1,45 @@ +/* ReadPropertiesSigned.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 ReadPropertiesSigned { + + /** + *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/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java b/tests/reproducers/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java new file mode 100644 index 0000000..6b389e3 --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java @@ -0,0 +1,91 @@ +/* ReadPropertiesSignedTest.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.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class ReadPropertiesSignedTest { + + private static ServerAccess server = new ServerAccess(); + private final List<String> l=Collections.unmodifiableList(Arrays.asList(new String[] {"-Xtrustall"})); + + String accessMatcher = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.name.{0,5}read" + ".*"; + + @Test + public void ReadSignedPropertiesWithoutPermissionsWithXtrustAll() throws Exception { + //no request for permissions + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadPropertiesSigned1.jnlp"); + Assert.assertTrue("Stderr should match "+accessMatcher+" but did not",pr.stderr.matches(accessMatcher)); + String ss="ClassNotFoundException"; + Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); + Assert.assertTrue("stdout lenght should be <2 but was "+pr.stdout.length(),pr.stdout.length()<2); // /home/user or /root or eanything else :( + Assert.assertFalse("should not be terminated but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + @Test + public void ReadSignedPropertiesWithPermissionsWithXtrustAll() throws Exception { + //request for allpermissions + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadPropertiesSigned2.jnlp"); + Assert.assertFalse("Stderr should NOT match "+accessMatcher+" but did",pr.stderr.matches(accessMatcher)); + String ss="ClassNotFoundException"; + Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); + Assert.assertTrue("stdout lenght should be >= but was "+pr.stdout.length(),pr.stdout.length()>=4); // /home/user or /root or eanything else :( + Assert.assertFalse("should not be terminated but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + @Test + public void EnsureXtrustallNotAffectingUnsignedBehaviour() throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadProperties1.jnlp"); + Assert.assertTrue("Stderr should match "+accessMatcher+" but did not",pr.stderr.matches(accessMatcher)); + String ss="ClassNotFoundException"; + Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); + Assert.assertFalse("stdout lenght should not be >2 but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("should not be terminated but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + ServerAccess.ProcessResult pr2=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp"); + Assert.assertEquals(pr.stderr, pr2.stderr); + Assert.assertEquals(pr.stdout, pr2.stdout); + + } + } diff --git a/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication1.jnlp b/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication1.jnlp new file mode 100644 index 0000000..5285cd9 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication1.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="SignedJnlpApplication1.jnlp" codebase="."> + <information> + <title>SignedJnlpApplication</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJnlpApplication</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="specialProperty" value="icedtea"/> + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpApplication.jar"/> + </resources> + <application-desc main-class="SignedJnlpApplication"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication2.jnlp b/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication2.jnlp new file mode 100644 index 0000000..a86d0c2 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication2.jnlp @@ -0,0 +1,65 @@ +<!-- + +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-1201 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 'property' element in the launching JNLP file * +***************************************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="SignedJnlpApplication2.jnlp" codebase="."> + <information> + <title>SignedJnlpApplication</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJnlpApplication</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="DIFFERENT PROPERTY NAME" value="icedtea"/> + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpApplication.jar"/> + </resources> + <application-desc main-class="SignedJnlpApplication"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication3.jnlp b/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication3.jnlp new file mode 100644 index 0000000..0c7cc1f --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication3.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. + +********************************************************* +* Missing 'property' child element within 'resource' in the launching JNLP file * +********************************************************* + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="SignedJnlpApplication3.jnlp" codebase="."> + <information> + <title>SignedJnlpApplication</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJnlpApplication</description> + <offline/> + </information> + + <resources> + + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpApplication.jar"/> + </resources> + <application-desc main-class="SignedJnlpApplication"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp b/tests/reproducers/signed/SignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp new file mode 100644 index 0000000..5285cd9 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpApplication/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="SignedJnlpApplication1.jnlp" codebase="."> + <information> + <title>SignedJnlpApplication</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJnlpApplication</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="specialProperty" value="icedtea"/> + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpApplication.jar"/> + </resources> + <application-desc main-class="SignedJnlpApplication"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpApplication/srcs/SignedJnlpApplication.java b/tests/reproducers/signed/SignedJnlpApplication/srcs/SignedJnlpApplication.java new file mode 100644 index 0000000..1f16697 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpApplication/srcs/SignedJnlpApplication.java @@ -0,0 +1,43 @@ +/* SignedJnlpApplication.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 SignedJnlpApplication { + + public static void main(String[] args) { + System.out.println("Running signed application in main"); + } +} diff --git a/tests/reproducers/signed/SignedJnlpApplication/testcases/SignedJnlpApplicationTest.java b/tests/reproducers/signed/SignedJnlpApplication/testcases/SignedJnlpApplicationTest.java new file mode 100644 index 0000000..fb4e9ff --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpApplication/testcases/SignedJnlpApplicationTest.java @@ -0,0 +1,77 @@ +/* SignedJnlpApplicationTest.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 SignedJnlpApplicationTest { + + private static ServerAccess server = new ServerAccess(); + private final List<String> l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); + private final String signedException = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: The signed " + + "JNLP file did not match the launching JNLP file. Missing Resource: Signed Application did not match " + + "launching JNLP File"; + + @Test + public void launchingFileMatchesSignedApplication1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpApplication1.jnlp"); + String s = "Running signed application in main"; + Assert.assertTrue("Stdout should contains " + s + " but did not", pr.stdout.contains(s)); + } + + /** + * Using a different value of name within the 'property' element in the launching JNLP file + */ + @Test + public void launchingFileDoesNotMatchSignedApplication1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpApplication2.jnlp"); + Assert.assertTrue("Stderr should contains " + signedException + " but did not", pr.stderr.contains(signedException)); + } + + /** + * Missing 'property' child element within 'resource' in the launching JNLP file + */ + @Test + public void launchingFileDoesNotMatchSignedApplication2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpApplication3.jnlp"); + Assert.assertTrue("Stderr should contains " + signedException + " but did not", pr.stderr.contains(signedException)); + } +}
\ No newline at end of file diff --git a/tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne1.jnlp b/tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne1.jnlp new file mode 100644 index 0000000..3a5651e --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne1.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="SignedJnlpCaseTestOne1.jnlp" codebase="."> + <information> + <title>SignedJnlpCaseTest</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJnlpCaseTest</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="specialProperty" value="icedtea"/> + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpCaseTestOne.jar"/> + </resources> + <application-desc main-class="SignedJnlpCase"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne2.jnlp b/tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne2.jnlp new file mode 100644 index 0000000..18c0943 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne2.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="SignedJnlpCaseTestOne2.jnlp" codebase="."> + <information> + <title>SignedJnlpCaseTest 2</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJnlpCaseTest 2</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="specialProperty" value="icedtea"/> + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpCaseTestOne.jar"/> + </resources> + <application-desc main-class="SignedJnlpCase"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpCaseTestOne/srcs/JNLP-INF/aPpLiCaTioN.jnlp b/tests/reproducers/signed/SignedJnlpCaseTestOne/srcs/JNLP-INF/aPpLiCaTioN.jnlp new file mode 100644 index 0000000..3a5651e --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestOne/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="SignedJnlpCaseTestOne1.jnlp" codebase="."> + <information> + <title>SignedJnlpCaseTest</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJnlpCaseTest</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="specialProperty" value="icedtea"/> + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpCaseTestOne.jar"/> + </resources> + <application-desc main-class="SignedJnlpCase"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpCaseTestOne/srcs/SignedJnlpCase.java b/tests/reproducers/signed/SignedJnlpCaseTestOne/srcs/SignedJnlpCase.java new file mode 100644 index 0000000..993fe6d --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestOne/srcs/SignedJnlpCase.java @@ -0,0 +1,43 @@ +/* SignedJnlpCase.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 SignedJnlpCase { + + public static void main(String[] args) { + System.out.println("Running signed application in main"); + } +} diff --git a/tests/reproducers/signed/SignedJnlpCaseTestOne/testcases/SignedJnlpCaseOneTest.java b/tests/reproducers/signed/SignedJnlpCaseTestOne/testcases/SignedJnlpCaseOneTest.java new file mode 100644 index 0000000..d410790 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestOne/testcases/SignedJnlpCaseOneTest.java @@ -0,0 +1,65 @@ +/* SignedJnlpCaseOneTest.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 SignedJnlpCaseOneTest { + + private static ServerAccess server = new ServerAccess(); + private final List<String> l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); + + @Test + public void launchingFileMatchesSigned() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpCaseTestOne1.jnlp"); + String s = "Running signed application in main"; + Assert.assertTrue("Stdout should contains " + s + " but did not", pr.stdout.contains(s)); + } + + @Test + public void launchingFileDoesNotMatchSigned() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpCaseTestOne2.jnlp"); + String s = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: The signed " + + "JNLP file did not match the launching JNLP file. Missing Resource: Signed Application did not match " + + "launching JNLP File"; + Assert.assertTrue("Stderr should contains " + s + " but did not", pr.stderr.contains(s)); + } +} diff --git a/tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo1.jnlp b/tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo1.jnlp new file mode 100644 index 0000000..23fcacb --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo1.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="SignedJnlpCaseTestTwo1.jnlp" codebase="."> + <information> + <title>SignedJnlpCaseTest</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJnlpCaseTest</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="specialProperty" value="icedtea"/> + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpCaseTestTwo.jar"/> + </resources> + <application-desc main-class="SignedJnlpCase"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo2.jnlp b/tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo2.jnlp new file mode 100644 index 0000000..e97a126 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo2.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="SignedJnlpCaseTestTwo2.jnlp" codebase="."> + <information> + <title>SignedJnlpCaseTest 2</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJnlpCaseTest 2</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="specialProperty" value="icedtea"/> + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpCaseTestTwo.jar"/> + </resources> + <application-desc main-class="SignedJnlpCase"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpCaseTestTwo/srcs/JNLP-INF/aPpLiCaTiOn_tEmPlAte.jnlp b/tests/reproducers/signed/SignedJnlpCaseTestTwo/srcs/JNLP-INF/aPpLiCaTiOn_tEmPlAte.jnlp new file mode 100644 index 0000000..ed34ac9 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestTwo/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="*" codebase="*"> + <information> + <title>SignedJnlpCaseTest</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJnlpCaseTest</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="*" value="icedtea"/> + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="*"/> + </resources> + <application-desc main-class="*"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpCaseTestTwo/srcs/SignedJnlpCase.java b/tests/reproducers/signed/SignedJnlpCaseTestTwo/srcs/SignedJnlpCase.java new file mode 100644 index 0000000..993fe6d --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestTwo/srcs/SignedJnlpCase.java @@ -0,0 +1,43 @@ +/* SignedJnlpCase.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 SignedJnlpCase { + + public static void main(String[] args) { + System.out.println("Running signed application in main"); + } +} diff --git a/tests/reproducers/signed/SignedJnlpCaseTestTwo/testcases/SignedJnlpCaseTwoTest.java b/tests/reproducers/signed/SignedJnlpCaseTestTwo/testcases/SignedJnlpCaseTwoTest.java new file mode 100644 index 0000000..2869552 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestTwo/testcases/SignedJnlpCaseTwoTest.java @@ -0,0 +1,65 @@ +/* SignedJnlpCaseTwoTest.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 SignedJnlpCaseTwoTest { + + private static ServerAccess server = new ServerAccess(); + private final List<String> l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); + + @Test + public void launchingFileMatchesSigned() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpCaseTestTwo1.jnlp"); + String s = "Running signed application in main"; + Assert.assertTrue("Stdout should contains " + s + " but did not", pr.stdout.contains(s)); + } + + @Test + public void launchingFileDoesNotMatchSigned() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpCaseTestTwo2.jnlp"); + String s = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: The signed " + + "JNLP file did not match the launching JNLP file. Missing Resource: Signed Application did not match " + + "launching JNLP File"; + Assert.assertTrue("Stderr should contains " + s + " but did not", pr.stderr.contains(s)); + } +} diff --git a/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate1.jnlp b/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate1.jnlp new file mode 100644 index 0000000..782c465 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate1.jnlp @@ -0,0 +1,66 @@ +<!-- + +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. + +****************************************** +* This jnlp file is valid when compared to the signed jnlp * +****************************************** + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="SignedJnlpTemplate1.jnlp" codebase="."> + <information> + <title>SignedJnlpTemplate</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJnlpTemplate</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="specialProperty" value="icedtea"/> + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpTemplate.jar"/> + </resources> + <application-desc main-class="SignedJnlpTemplate"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate2.jnlp b/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate2.jnlp new file mode 100644 index 0000000..d43f834 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate2.jnlp @@ -0,0 +1,64 @@ +<!-- + +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 'j2se' child within the 'resource' element in the launching JNLP file * +******************************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="SignedJnlpTemplate2.jnlp" codebase="."> + <information> + <title>SignedJnlpTemplate</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJnlpTemplate</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="specialProperty" value="icedtea"/> + </resources> + + <resources> + <jar href="SignedJnlpTemplate.jar"/> + </resources> + <application-desc main-class="SignedJnlpTemplate"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate3.jnlp b/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate3.jnlp new file mode 100644 index 0000000..c47a74d --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate3.jnlp @@ -0,0 +1,71 @@ +<!-- + +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. + +************************************************* +* Added an extra "information" element to the launching JNLP file * +************************************************* + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="SignedJnlpTemplate3.jnlp" codebase="."> + <information> + <title>SignedJnlpTemplate</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJnlpTemplate</description> + <offline/> + </information> + + <information locale="test"> + <title>IcedTea-Web</title> + <vendor>IcedTea</vendor> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="specialProperty" value="icedtea"/> + </resources> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpTemplate.jar"/> + </resources> + <application-desc main-class="SignedJnlpTemplate"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp b/tests/reproducers/signed/SignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp new file mode 100644 index 0000000..8936031 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpTemplate/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="*" codebase="*"> + <information> + <title>*</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>*</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <property name="specialProperty" value="icedtea"/> + </resources> + + <resources> + <j2se version="*"/> + <jar href="SignedJnlpTemplate.jar"/> + </resources> + <application-desc main-class="SignedJnlpTemplate"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SignedJnlpTemplate/srcs/SignedJnlpTemplate.java b/tests/reproducers/signed/SignedJnlpTemplate/srcs/SignedJnlpTemplate.java new file mode 100644 index 0000000..9a94182 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpTemplate/srcs/SignedJnlpTemplate.java @@ -0,0 +1,43 @@ +/* SignedJnlpTemplate.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 SignedJnlpTemplate { + + public static void main(String[] args) { + System.out.println("Running signed application in main"); + } +} diff --git a/tests/reproducers/signed/SignedJnlpTemplate/testcases/SignedJnlpTemplateTest.java b/tests/reproducers/signed/SignedJnlpTemplate/testcases/SignedJnlpTemplateTest.java new file mode 100644 index 0000000..5f2dd78 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpTemplate/testcases/SignedJnlpTemplateTest.java @@ -0,0 +1,77 @@ +/* SignedJnlpTemplateTest.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 SignedJnlpTemplateTest { + + private static ServerAccess server = new ServerAccess(); + private final List<String> l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); + private final String signedException = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: The signed " + + "JNLP file did not match the launching JNLP file. Missing Resource: Signed Application did not match " + + "launching JNLP File"; + + @Test + public void launchingFileMatchesSignedTemplate1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpTemplate1.jnlp"); + String s = "Running signed application in main"; + Assert.assertTrue("Stdout should contains " + s + " but did not", pr.stdout.contains(s)); + } + + /** + * Missing 'j2se' child within the 'resource' element in the launching JNLP file + */ + @Test + public void launchingFileDoesNotMatchSignedTemplate2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpTemplate2.jnlp"); + Assert.assertTrue("Stderr should contains " + signedException + " but did not", pr.stderr.contains(signedException)); + } + + /** + * Added an extra "information" element to the launching JNLP file * + */ + @Test + public void launchingFileDoesNotMatchSignedTemplate3() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpTemplate3.jnlp"); + Assert.assertTrue("Stderr should contains " + signedException + " but did not", pr.stderr.contains(signedException)); + } +}
\ No newline at end of file diff --git a/tests/reproducers/signed/SimpletestSigned1/resources/SimpletestSigned1.jnlp b/tests/reproducers/signed/SimpletestSigned1/resources/SimpletestSigned1.jnlp new file mode 100644 index 0000000..177dcaa --- /dev/null +++ b/tests/reproducers/signed/SimpletestSigned1/resources/SimpletestSigned1.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="SimpletestSigned1.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="SimpletestSigned1.jar"/> + </resources> + <application-desc main-class="SimpletestSigned1"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/SimpletestSigned1/srcs/SimpletestSigned1.java b/tests/reproducers/signed/SimpletestSigned1/srcs/SimpletestSigned1.java new file mode 100644 index 0000000..b0a30a9 --- /dev/null +++ b/tests/reproducers/signed/SimpletestSigned1/srcs/SimpletestSigned1.java @@ -0,0 +1,43 @@ +/* SimpletestSigned1.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 SimpletestSigned1{ + + public static void main(String[] args){ + System.out.println("Good simple javaws exapmle"); + } +} diff --git a/tests/reproducers/signed/Spaces can be everywhere signed/resources/NotOnly spaces can kill ěščřž too signed.jnlp b/tests/reproducers/signed/Spaces can be everywhere signed/resources/NotOnly spaces can kill ěščřž too signed.jnlp new file mode 100644 index 0000000..ba5cbc3 --- /dev/null +++ b/tests/reproducers/signed/Spaces can be everywhere signed/resources/NotOnly spaces can kill ěščřž too signed.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 signed.jnlp" codebase="."> + <information> + <title>Spaces can be everywhere test with few more chars for encoding signed</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 signed.jar"/> + </resources> + <applet-desc + documentBase="." + name="SpacesCanBeEverywhereSigned" + main-class="SpacesCanBeEverywhereSigned" + width="100" + height="100"> + </applet-desc> +</jnlp> + + +</applet-desc> diff --git a/tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere1 signed.jnlp b/tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere1 signed.jnlp new file mode 100644 index 0000000..e73043c --- /dev/null +++ b/tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere1 signed.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 signed.jnlp" codebase="."> + <information> + <title>Spaces can be everywhere1 signed</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>Spaces can be everywhere1 signed</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="SimpletestSigned1.jar"/> + </resources> + <application-desc main-class="SimpletestSigned1"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere2 signed.jnlp b/tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere2 signed.jnlp new file mode 100644 index 0000000..872fb8c --- /dev/null +++ b/tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere2 signed.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 signed.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 signed</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="Spaces can be everywhere signed.jar"/> + </resources> + <application-desc main-class="SpacesCanBeEverywhereSigned"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/Spaces can be everywhere signed/resources/SpacesCanBeEverywhere1signed.jnlp b/tests/reproducers/signed/Spaces can be everywhere signed/resources/SpacesCanBeEverywhere1signed.jnlp new file mode 100644 index 0000000..801a62b --- /dev/null +++ b/tests/reproducers/signed/Spaces can be everywhere signed/resources/SpacesCanBeEverywhere1signed.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="SpacesCanBeEverywhere1signed.jnlp" codebase="."> + <information> + <title>Spaces can be everywhere signed</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 signed.jar"/> + </resources> + <application-desc main-class="SpacesCanBeEverywhereSigned"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed/Spaces can be everywhere signed/resources/spaces applet Tests signed.html b/tests/reproducers/signed/Spaces can be everywhere signed/resources/spaces applet Tests signed.html new file mode 100644 index 0000000..32e60b4 --- /dev/null +++ b/tests/reproducers/signed/Spaces can be everywhere signed/resources/spaces applet Tests signed.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="red"> +<p><applet code="SpacesCanBeEverywhereSigned.class" archive="Spaces can be everywhere signed.jar" codebase="." width=800 height=600> +</applet></p> +</body> +</html> diff --git a/tests/reproducers/signed/Spaces can be everywhere signed/srcs/SpacesCanBeEverywhereSigned.java b/tests/reproducers/signed/Spaces can be everywhere signed/srcs/SpacesCanBeEverywhereSigned.java new file mode 100644 index 0000000..25d28cf --- /dev/null +++ b/tests/reproducers/signed/Spaces can be everywhere signed/srcs/SpacesCanBeEverywhereSigned.java @@ -0,0 +1,76 @@ + +import java.applet.Applet; + +/* SpacesCanBeEverywhereSigned.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 SpacesCanBeEverywhereSigned extends Applet{ + + public static void main(String[] args){ + System.out.println("Signed 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/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java b/tests/reproducers/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java new file mode 100644 index 0000000..f33b203 --- /dev/null +++ b/tests/reproducers/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java @@ -0,0 +1,245 @@ +/* SpacesCanBeEverywhereTestsSigned.java +Copyright (C) 20121 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 SpacesCanBeEverywhereTestsSigned extends BrowserTest { + + + @Bug(id="PR811") + @Test + @NeedsDisplay + public void SpacesCanBeEverywhereLocalAppletTestsJnlp2Signed() throws Exception { + List<String> commands=new ArrayList<String>(1); + commands.add(server.getJavawsLocation()); + commands.add(server.getDir()+"/NotOnly spaces can kill ěščřž too signed.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="Signed 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 SpacesCanBeEverywhereRemoteAppletTestsJnlp2Signed() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavaws("/NotOnly%20spaces%20can%20kill%20%C4%9B%C5%A1%C4%8D%C5%99%C5%BE%20too%20signed.jnlp"); + String s="Signed 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.one}) + public void SpacesCanBeEverywhereRemoteAppletTestsHtml2Signed() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("/spaces+applet+Tests+signed.html"); + String s="Signed 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 SpacesCanBeEverywhereRemoteTests1Signed() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere1%20signed.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 SpacesCanBeEverywhereRemoteTests2Signed() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp"); + String s="Signed 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 SpacesCanBeEverywhereRemoteTests2Signed_withQuery1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp?test=20"); + String s="Signed 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 SpacesCanBeEverywhereRemoteTests2Signed_withQuery2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp?test%3D20"); + + String s="Signed 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 SpacesCanBeEverywhereRemoteTests3Signed() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SpacesCanBeEverywhere1signed.jnlp"); + String s="Signed 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 SpacesCanBeEverywhereLocalTests1Signed() 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 SpacesCanBeEverywhereLocalTests2Signed() throws Exception { + List<String> commands=new ArrayList<String>(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add("Spaces can be everywhere2 signed.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + String s="Signed 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 SpacesCanBeEverywhereLocalTests4Signed() 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 signed.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands); + String s="Signed 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 SpacesCanBeEverywhereLocalTests3Signed() throws Exception { + List<String> commands=new ArrayList<String>(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add("SpacesCanBeEverywhere1signed.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + String s="Signed 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/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? + } + + + + } |