diff options
author | Jiri Vanek <[email protected]> | 2012-08-27 17:38:52 +0200 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2012-08-27 17:38:52 +0200 |
commit | 85c4fcbcc483801ffc58e9cf02ffb0523608eadf (patch) | |
tree | 180fbde3d461c7c6ed4aa0250be3a120dbabfc3e /tests | |
parent | 36f7aeda80f29c9969099feb064985e1920518e9 (diff) |
Added PR822 reproducer
Diffstat (limited to 'tests')
13 files changed, 818 insertions, 1 deletions
diff --git a/tests/reproducers/signed2/MultipleSignaturesTest/resources/MultipleSignaturesTest.html b/tests/reproducers/signed2/MultipleSignaturesTest/resources/MultipleSignaturesTest.html new file mode 100644 index 0000000..8cae7a2 --- /dev/null +++ b/tests/reproducers/signed2/MultipleSignaturesTest/resources/MultipleSignaturesTest.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="somecrazytestpackage.MultipleSignaturesTest" archive="MultipleSignaturesTest.jar,SimpletestSigned1.jar" codebase="." width="800" height="600"> +</applet></p> +</body> +</html> diff --git a/tests/reproducers/signed2/MultipleSignaturesTest/resources/MultipleSignaturesTest1.jnlp b/tests/reproducers/signed2/MultipleSignaturesTest/resources/MultipleSignaturesTest1.jnlp new file mode 100644 index 0000000..e8b2792 --- /dev/null +++ b/tests/reproducers/signed2/MultipleSignaturesTest/resources/MultipleSignaturesTest1.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="MultipleSignaturesTest1.jnlp" codebase="."> + <information> + <title>MultipleSignaturesTest1</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>MultipleSignaturesTest1</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="MultipleSignaturesTest.jar"/> + <jar href="SimpletestSigned1.jar"/> + </resources> + <application-desc main-class="somecrazytestpackage.MultipleSignaturesTest"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed2/MultipleSignaturesTest/resources/MultipleSignaturesTest1_requesting.jnlp b/tests/reproducers/signed2/MultipleSignaturesTest/resources/MultipleSignaturesTest1_requesting.jnlp new file mode 100644 index 0000000..b6fd0be --- /dev/null +++ b/tests/reproducers/signed2/MultipleSignaturesTest/resources/MultipleSignaturesTest1_requesting.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="MultipleSignaturesTest1_requesting.jnlp" codebase="."> + <information> + <title>MultipleSignaturesTest1</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>MultipleSignaturesTest1</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="MultipleSignaturesTest.jar"/> + <jar href="SimpletestSigned1.jar"/> + </resources> + <application-desc main-class="somecrazytestpackage.MultipleSignaturesTest"> + </application-desc> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed2/MultipleSignaturesTest/resources/MultipleSignaturesTest2.jnlp b/tests/reproducers/signed2/MultipleSignaturesTest/resources/MultipleSignaturesTest2.jnlp new file mode 100644 index 0000000..b9910dc --- /dev/null +++ b/tests/reproducers/signed2/MultipleSignaturesTest/resources/MultipleSignaturesTest2.jnlp @@ -0,0 +1,59 @@ +<!-- + +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="MultipleSignaturesTest2.jnlp" codebase="."> + <information> + <title>MultipleSignaturesTest2</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web "/> + <description>MultipleSignaturesTest2</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="MultipleSignaturesTest.jar"/> + <jar href="SimpletestSigned1.jar"/> + </resources> + <applet-desc + documentBase="." + name="MultipleSignaturesTest" + main-class="somecrazytestpackage.MultipleSignaturesTest" + width="100" + height="100"> + </applet-desc> +</jnlp> diff --git a/tests/reproducers/signed2/MultipleSignaturesTest/srcs/somecrazytestpackage/MultipleSignaturesTest.java b/tests/reproducers/signed2/MultipleSignaturesTest/srcs/somecrazytestpackage/MultipleSignaturesTest.java new file mode 100644 index 0000000..9dd203e --- /dev/null +++ b/tests/reproducers/signed2/MultipleSignaturesTest/srcs/somecrazytestpackage/MultipleSignaturesTest.java @@ -0,0 +1,90 @@ +package somecrazytestpackage; + +import java.applet.Applet; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/* MultipleSignaturesTest.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 MultipleSignaturesTest extends Applet { + + public static void main(String[] args) { + executeForeignMethodCaught(); + } + + public static void executeForeignMethodCaught() { + try { + executeForeignMethod(); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + public static void executeForeignMethod() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException { + Class clazz = Class.forName("SimpletestSigned1"); + Method mainMethod = clazz.getDeclaredMethod("main", String[].class); + mainMethod.invoke(clazz.newInstance(), (Object) null); + } + + 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() { + killer.start(); + System.out.println("killer was started"); + main(null); + } +} diff --git a/tests/reproducers/signed2/MultipleSignaturesTest/testcases/MultipleSignaturesTestTests.java b/tests/reproducers/signed2/MultipleSignaturesTest/testcases/MultipleSignaturesTestTests.java new file mode 100644 index 0000000..732eb9d --- /dev/null +++ b/tests/reproducers/signed2/MultipleSignaturesTest/testcases/MultipleSignaturesTestTests.java @@ -0,0 +1,98 @@ +/* MultipleSignaturesTestTests.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 net.sourceforge.jnlp.ProcessResult; +import net.sourceforge.jnlp.annotations.Bug; +import net.sourceforge.jnlp.annotations.KnownToFail; +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 = {"PR822"}) +public class MultipleSignaturesTestTests extends BrowserTest{ + + public static final String GSJE = "Good simple javaws exapmle"; + + @Test + @NeedsDisplay + public void multipleSignaturesTestJnlpApplet() throws Exception { + ProcessResult pr = server.executeJavaws("/MultipleSignaturesTest2.jnlp"); + String s = GSJE; + 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)); + } + + @Test + @NeedsDisplay + @TestInBrowsers(testIn=Browsers.one) + public void multipleSignaturesTestHtmlApplet() throws Exception { + ProcessResult pr = server.executeBrowser("/MultipleSignaturesTest.html"); + String s = GSJE; + 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)); + } + + @Test + public void multipleSignaturesTestJnlpApplication() throws Exception { + ProcessResult pr = server.executeJavawsHeadless(null, "/MultipleSignaturesTest1.jnlp"); + //well this is questionable - application is signed but is not requesting + // permissions, but still usage of foreign code is allowed. + String s = GSJE; + 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.assertEquals((Integer) 0, pr.returnValue); + } + + @Test + @Bug(id={"PR822"}) + @KnownToFail + public void multipleSignaturesTestJnlpApplicationRequesting() throws Exception { + ProcessResult pr = server.executeJavawsHeadless(null, "/MultipleSignaturesTest1_requesting.jnlp"); + //This is buggy - application is signed, but requesting for permissions fails + String s = GSJE; + 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)); + } +} diff --git a/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/resources/MultipleSignaturesTest1_SamePackage.jnlp b/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/resources/MultipleSignaturesTest1_SamePackage.jnlp new file mode 100644 index 0000000..a8e7dc2 --- /dev/null +++ b/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/resources/MultipleSignaturesTest1_SamePackage.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="MultipleSignaturesTest1_SamePackage.jnlp" codebase="."> + <information> + <title>MultipleSignaturesTest1_SamePackage</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>MultipleSignaturesTest1_SamePackage</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="MultipleSignaturesTestSamePackage.jar"/> + <jar href="SimpletestSigned1.jar"/> + </resources> + <application-desc main-class="MultipleSignaturesTestSamePackage"> + </application-desc> +</jnlp> diff --git a/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/resources/MultipleSignaturesTest1_SamePackage_requesting.jnlp b/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/resources/MultipleSignaturesTest1_SamePackage_requesting.jnlp new file mode 100644 index 0000000..57bdfd8 --- /dev/null +++ b/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/resources/MultipleSignaturesTest1_SamePackage_requesting.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="MultipleSignaturesTest1_SamePackage_requesting.jnlp" codebase="."> + <information> + <title>MultipleSignaturesTest1_SamePackage</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>MultipleSignaturesTest1_SamePackage</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="MultipleSignaturesTestSamePackage.jar"/> + <jar href="SimpletestSigned1.jar"/> + </resources> + <application-desc main-class="MultipleSignaturesTestSamePackage"> + </application-desc> + <security> + <all-permissions/> + </security> +</jnlp> diff --git a/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/resources/MultipleSignaturesTest2_SamePackage.jnlp b/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/resources/MultipleSignaturesTest2_SamePackage.jnlp new file mode 100644 index 0000000..3b9243c --- /dev/null +++ b/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/resources/MultipleSignaturesTest2_SamePackage.jnlp @@ -0,0 +1,59 @@ +<!-- + +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="MultipleSignaturesTest2_SamePackage.jnlp" codebase="."> + <information> + <title>MultipleSignaturesTest2_SamePackage</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web "/> + <description>MultipleSignaturesTest2_SamePackage</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="MultipleSignaturesTestSamePackage.jar"/> + <jar href="SimpletestSigned1.jar"/> + </resources> + <applet-desc + documentBase="." + name="MultipleSignaturesTestSamePackage" + main-class="MultipleSignaturesTestSamePackage" + width="100" + height="100"> + </applet-desc> +</jnlp> diff --git a/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/resources/MultipleSignaturesTest_SamePackage.html b/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/resources/MultipleSignaturesTest_SamePackage.html new file mode 100644 index 0000000..d30b54d --- /dev/null +++ b/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/resources/MultipleSignaturesTest_SamePackage.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="MultipleSignaturesTestSamePackage" archive="MultipleSignaturesTestSamePackage.jar,SimpletestSigned1.jar" codebase="." width="800" height="600"> +</applet></p> +</body> +</html> diff --git a/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/srcs/MultipleSignaturesTestSamePackage.java b/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/srcs/MultipleSignaturesTestSamePackage.java new file mode 100644 index 0000000..132bbd0 --- /dev/null +++ b/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/srcs/MultipleSignaturesTestSamePackage.java @@ -0,0 +1,88 @@ +import java.applet.Applet; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/* MultipleSignaturesTest.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 MultipleSignaturesTestSamePackage extends Applet { + + public static void main(String[] args) { + executeForeignMethodCaught(); + } + + public static void executeForeignMethodCaught() { + try { + executeForeignMethod(); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + public static void executeForeignMethod() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException { + Class clazz = Class.forName("SimpletestSigned1"); + Method mainMethod = clazz.getDeclaredMethod("main", String[].class); + mainMethod.invoke(clazz.newInstance(), (Object) null); + } + + private static class Killer extends Thread { + + public static final 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() { + killer.start(); + System.out.println("killer was started"); + main(null); + } +} diff --git a/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/testcases/MultipleSignaturesTestTestsSamePackage.java b/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/testcases/MultipleSignaturesTestTestsSamePackage.java new file mode 100644 index 0000000..fa579ef --- /dev/null +++ b/tests/reproducers/signed2/MultipleSignaturesTestSamePackage/testcases/MultipleSignaturesTestTestsSamePackage.java @@ -0,0 +1,117 @@ +/* MultipleSignaturesTestTests.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.Arrays; +import java.util.List; +import net.sourceforge.jnlp.ProcessResult; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.annotations.Bug; +import net.sourceforge.jnlp.annotations.KnownToFail; +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={"PR822"}) +public class MultipleSignaturesTestTestsSamePackage extends BrowserTest{ + + public static final String secExcRegex = "(?s).*java.lang.SecurityException: .* signer information does not match signer information of other classes in the same package.*"; + public static final List<String> v = Arrays.asList(new String[] {ServerAccess.VERBOSE_OPTION}); + private static final String GSJE= "Good simple javaws exapmle"; + + @Test + @NeedsDisplay + public void multipleSignaturesTestSamePackageJnlpApplet() throws Exception { + ProcessResult pr = server.executeJavaws(v,"/MultipleSignaturesTest2_SamePackage.jnlp"); + String s = GSJE; + Assert.assertFalse("stdout should NOT contains `"+s+"`, but did",pr.stdout.contains(s)); + String ss = "killer was started"; + Assert.assertTrue("stdout should contains `"+ss+"`, but did not",pr.stdout.contains(ss)); + String sss="Applet killing himself after 2000 ms of life"; + Assert.assertTrue("stdout should contains `"+sss+"`, but did not",pr.stdout.contains(sss)); +//Applet in jnlp have exception consumed even in verbose mode. Howevwer at least foreign method is not invoken +// String cc = "xception"; +// Assert.assertTrue("stderr should contains `" + cc + "`, but did not", pr.stderr.contains(cc)); +// Assert.assertTrue("stderr should match " + secExcRegex + "`, but did not", pr.stderr.matches(secExcRegex)); + } + + @Test + @NeedsDisplay + @TestInBrowsers(testIn=Browsers.one) + public void multipleSignaturesTestSamePackageHtmlApplet() throws Exception { + ProcessResult pr = server.executeBrowser("/MultipleSignaturesTest_SamePackage.html"); + String s = GSJE; + Assert.assertFalse("stdout should NOT contains `"+s+"`, but did",pr.stdout.contains(s)); + String cc = "xception"; + Assert.assertTrue("stderr should contains `" + cc + "`, but did not", pr.stderr.contains(cc)); + Assert.assertTrue("stderr should match " + secExcRegex + "`, but did not", pr.stderr.matches(secExcRegex)); + String ss = "killer was started"; + Assert.assertTrue("stdout should contains `"+ss+"`, but did not",pr.stdout.contains(ss)); + String sss="Applet killing himself after 2000 ms of life"; + Assert.assertTrue("stdout should contains `"+sss+"`, but did not",pr.stdout.contains(sss)); + } + + + @Test + public void multipleSignaturesTestSamePackageJnlpApplication() throws Exception { + ProcessResult pr = server.executeJavawsHeadless(null, "/MultipleSignaturesTest1_SamePackage.jnlp"); + String s = GSJE; + Assert.assertFalse("stdout should NOT contains `"+s+"`, but did",pr.stdout.contains(s)); + String cc = "xception"; + Assert.assertTrue("stderr should contains `" + cc + "`, but did not", pr.stderr.contains(cc)); + Assert.assertTrue("stderr should match " + secExcRegex + "`, but did not", pr.stderr.matches(secExcRegex)); + } + + @Test + @Bug(id={"PR822"}) + @KnownToFail + public void multipleSignaturesTestSamePackageJnlpApplicationRequesting() throws Exception { + ProcessResult pr = server.executeJavawsHeadless(null, "/MultipleSignaturesTest1_SamePackage_requesting.jnlp"); + String s = GSJE; + Assert.assertFalse("stdout should NOT contains `"+s+"`, but did",pr.stdout.contains(s)); + String cc = "xception"; + Assert.assertTrue("stderr should contains `" + cc + "`, but did not", pr.stderr.contains(cc)); + //this is really wrong. Aplication shoud die with secExcRegex exception + //but not with Application Error: Cannot grant permissions to unsigned jars. Application requested security permissions, but jars are not signed. + //as it is now + Assert.assertTrue("stderr should match " + secExcRegex + "`, but did not", pr.stderr.matches(secExcRegex)); + } + +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java index 0ddc372..6607e35 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java +++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java @@ -156,7 +156,7 @@ public class ServerAccess { return port; } public static final String HEADLES_OPTION="-headless"; - public static final String VERBOSE_OPTION="-verbose "; + public static final String VERBOSE_OPTION="-verbose"; /** * we would like to have an singleton instance ASAP |