Mercurial > hg > release > icedtea-web-1.6
changeset 262:63bb7f2b0604
added first set of reproducers
line wrap: on
line diff
--- a/ChangeLog Tue Jun 21 16:09:47 2011 +0200 +++ b/ChangeLog Tue Jun 21 16:22:09 2011 +0200 @@ -1,3 +1,9 @@ +2011-06-21 Jiri Vanek <jvanek@redhat.com> + + *tests/jnlp_tests/simple: AccessClassInPackage, ReplaceSecurityManager, + AddShutdownHook, ReadEnvironment, SetContextClassLoader, + AllStackTraces, ReadProperties, CreateClassLoader, RedirectStreams tests + 2011-06-21 Jiri Vanek <jvanek@redhat.com> *Makefile.am: (run-netx-dist-tests): no depends on copying of styles
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackage.jnlp Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="." + href="AccessClassInPackage.jnlp"> + <information> + <title>Test accessClassInPackage</title> + </information> + <resources> + <jar href="AccessClassInPackage.jar" main="true"/> + </resources> + <application-desc main-class="AccessClassInPackage"/> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/AccessClassInPackage/srcs/AccessClassInPackage.java Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,43 @@ +/* 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("sun.security.internal.spec.TlsKeyMaterialSpec"); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,59 @@ +/* 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 net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; + +import org.junit.Test; + +public class AccessClassInPackageTest { + + private static ServerAccess server = new ServerAccess(); + + @Test + public void AccessClassInPackageTestLunch1() throws Exception { + System.out.println("connecting AccessClassInPackageTest request"); + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/AccessClassInPackage.jnlp"); + System.out.println(pr.stdout); + System.err.println(pr.stderr); + Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.security.internal.spec)")); + Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); + Assert.assertFalse(pr.stdout.length() > 2); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/AddShutdownHook/resources/AddShutdownHook.jnlp Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="AddShutdownHook.jnlp"> + <information> + <title>test adding shutdown hooks</title> + </information> + <resources> + <jar href="AddShutdownHook.jar" main="true" download="eager"/> + </resources> + <application-desc main-class="AddShutdownHook"/> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/AddShutdownHook/srcs/AddShutdownHook.java Tue Jun 21 16:22:09 2011 +0200 @@ -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 + } + }); + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,59 @@ +/* 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 { + System.out.println("connecting AddShutdownHook request"); + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/AddShutdownHook.jnlp"); + System.out.println(pr.stdout); + System.err.println(pr.stderr); + Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission shutdownHooks)")); + Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); + Assert.assertFalse(pr.stdout.length() > 2); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/AllStackTraces/resources/AllStackTraces.jnlp Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="AllStackTraces.jnlp"> + <information> + <title>Test Thread.getAllStackTraces</title> + </information> + <resources> + <jar href="AllStackTraces.jar" main="true" download="eager"/> + </resources> + <application-desc main-class="AllStackTraces"/> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/AllStackTraces/srcs/AllStackTraces.java Tue Jun 21 16:22:09 2011 +0200 @@ -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(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,62 @@ +/* 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 AddShutdownHookTestLunch1() throws Exception { + System.out.println("connecting AllStackTraces request"); + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/AllStackTraces.jnlp"); + System.out.println(pr.stdout); + System.err.println(pr.stderr); + Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission getStackTrace)")); + Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); + Assert.assertFalse(pr.stdout.length()>2); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/CreateClassLoader/resources/CreateClassLoader.jnlp Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="CreateClassLoader.jnlp"> + <information> + <title>set context classloader</title> + </information> + <resources> + <jar href="CreateClassLoader.jar" main="true" download="eager"/> + </resources> + <application-desc main-class="CreateClassLoader"/> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/CreateClassLoader/srcs/CreateClassLoader.java Tue Jun 21 16:22:09 2011 +0200 @@ -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]); + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,59 @@ +/* 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 { + System.out.println("connecting CreateClassLoader request"); + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/CreateClassLoader.jnlp"); + System.out.println(pr.stdout); + System.err.println(pr.stderr); + Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)")); + Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); + Assert.assertFalse(pr.stdout.length() > 2); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/ReadEnvironment/resources/ReadEnvironment.jnlp Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ReadEnvironment.jnlp"> + <information> + <title>ReadEnvironment using System.getenv()</title> + </information> + <resources> + <jar href="ReadEnvironment.jar" main="true" /> + </resources> + <application-desc main-class="ReadEnvironment"/> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/ReadEnvironment/srcs/ReadEnvironment.java Tue Jun 21 16:22:09 2011 +0200 @@ -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"); + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,59 @@ +/* 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 { + System.out.println("connecting ReadEnvironment request"); + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReadEnvironment.jnlp"); + System.out.println(pr.stdout); + System.err.println(pr.stderr); + Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission getenv.USER)")); + Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); + Assert.assertFalse(pr.stdout.length() > 2); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/ReadProperties/resources/ReadProperties1.jnlp Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ReadProperties1.jnlp"> + <information> + <title>read properties using System.getenv()</title> + </information> + <resources> + <jar href="ReadProperties.jar" main="true"/> + </resources> + <application-desc main-class="ReadProperties"> + <argument>user.name</argument> + </application-desc> + + +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/ReadProperties/resources/ReadProperties2.jnlp Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ReadProperties2.jnlp"> + <information> + <title>read properties using System.getenv()</title> + </information> + <resources> + <jar href="ReadProperties.jar" main="true"/> + </resources> + <application-desc main-class="ReadProperties"> + <argument>user.home</argument> + </application-desc> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/ReadProperties/srcs/ReadProperties.java Tue Jun 21 16:22:09 2011 +0200 @@ -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.getProperty(args[0]); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,74 @@ +/* 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 { + System.out.println("connecting ReadProperties request"); + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp"); + System.out.println(pr.stdout); + System.err.println(pr.stderr); + Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.util.PropertyPermission user.name read)")); + Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); + Assert.assertFalse(pr.stdout.length()>2); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + @Test + public void ReadPropertiesLunch2() throws Exception { + System.out.println("connecting ReadProperties request"); + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties2.jnlp"); + System.out.println(pr.stdout); + System.err.println(pr.stderr); + Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.util.PropertyPermission user.home read)")); + Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); + Assert.assertFalse(pr.stdout.length()>2); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/RedirectStreams/resources/RedirectStreams.jnlp Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="RedirectStreams.jnlp"> + <information> + <title>redirect stdin/stdout streams</title> + </information> + <resources> + <jar href="RedirectStreams.jar" main="true"/> + </resources> + <application-desc main-class="RedirectStreams"/> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/RedirectStreams/srcs/RedirectStreams.java Tue Jun 21 16:22:09 2011 +0200 @@ -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")); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,58 @@ +/* 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 ReadPropertiesLunch1() throws Exception { + System.out.println("connecting RedirectStreams request"); + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/RedirectStreams.jnlp"); + System.out.println(pr.stdout); + System.err.println(pr.stderr); + Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission setIO)")); + Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); + Assert.assertFalse(pr.stdout.length() > 2); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/ReplaceSecurityManager/resources/ReplaceSecurityManager.jnlp Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="ReplaceSecurityManager.jnlp"> + <information> + <title>Test replacing security manager</title> + </information> + <resources> + <jar href="ReplaceSecurityManager.jar" main="true"/> + </resources> + <application-desc main-class="ReplaceSecurityManager"/> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/ReplaceSecurityManager/srcs/ReplaceSecurityManager.java Tue Jun 21 16:22:09 2011 +0200 @@ -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); + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,58 @@ +/* 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 { + System.out.println("connecting RedirectStreams request"); + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReplaceSecurityManager.jnlp"); + System.out.println(pr.stdout); + System.err.println(pr.stderr); + Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission setSecurityManager)")); + Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); + Assert.assertFalse(pr.stdout.length() > 2); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/SetContextClassLoader/resources/SetContextClassLoader.jnlp Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" + codebase="./" + href="SetContextClassLoader.jnlp"> + <information> + <title>set context classloader</title> + </information> + <resources> + <jar href="SetContextClassLoader.jar" main="true" download="eager"/> + </resources> + <application-desc main-class="SetContextClassLoader"/> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/SetContextClassLoader/srcs/SetContextClassLoader.java Tue Jun 21 16:22:09 2011 +0200 @@ -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); + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java Tue Jun 21 16:22:09 2011 +0200 @@ -0,0 +1,58 @@ +/* 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 { + System.out.println("connecting RedirectStreams request"); + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SetContextClassLoader.jnlp"); + System.out.println(pr.stdout); + System.err.println(pr.stderr); + Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission setContextClassLoader)")); + Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); + Assert.assertFalse(pr.stdout.length() > 2); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +}