diff options
Diffstat (limited to 'tests')
8 files changed, 436 insertions, 0 deletions
diff --git a/tests/netx/unit/net/sourceforge/jnlp/ParserSettingsTest.java b/tests/netx/unit/net/sourceforge/jnlp/ParserSettingsTest.java new file mode 100644 index 0000000..3445952 --- /dev/null +++ b/tests/netx/unit/net/sourceforge/jnlp/ParserSettingsTest.java @@ -0,0 +1,74 @@ +/* ParserSettingsTest.java + Copyright (C) 2013 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. +*/ + +package net.sourceforge.jnlp; + +import org.junit.Assert; +import org.junit.Test; + +import net.sourceforge.jnlp.ParserSettings; + +public class ParserSettingsTest { + + @Test + public void testDefaultSettings() { + Assert.assertNotNull("Default parser settings should not be null", ParserSettings.getGlobalParserSettings()); + } + + @Test + public void testNoArgsSameAsDefault() { + ParserSettings defaultSettings, noArgs; + defaultSettings = new ParserSettings(); + noArgs = ParserSettings.setGlobalParserSettingsFromArgs(new String[0]); + + Assert.assertTrue("isExtensionAllowed should have been equal", defaultSettings.isExtensionAllowed() == noArgs.isExtensionAllowed()); + Assert.assertTrue("isStrict should have been equal", defaultSettings.isStrict() == noArgs.isStrict()); + Assert.assertTrue("isMalformedXmlAllowed should have been equal", defaultSettings.isMalformedXmlAllowed() == noArgs.isMalformedXmlAllowed()); + } + + @Test + public void testWithArgs() { + ParserSettings settings = ParserSettings.setGlobalParserSettingsFromArgs(new String[] { + "-strict", + "-xml", + }); + Assert.assertTrue("isStrict should have been true", settings.isStrict() == true); + Assert.assertTrue("isMalformedXmlAllowed should have been false", settings.isMalformedXmlAllowed() == false); + Assert.assertTrue("isExtensionAllowed should have been true", settings.isExtensionAllowed() == true); + } + +} diff --git a/tests/reproducers/custom/ExtensionJnlpsInApplet/resources/ExtensionJnlpHelper.jnlp b/tests/reproducers/custom/ExtensionJnlpsInApplet/resources/ExtensionJnlpHelper.jnlp new file mode 100644 index 0000000..7d7d702 --- /dev/null +++ b/tests/reproducers/custom/ExtensionJnlpsInApplet/resources/ExtensionJnlpHelper.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="ExtensionJnlpHelper.jnlp" codebase="."> + <information> + <title>ExtensionJnlpHelper</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>PR974 Test</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="ExtensionJnlpHelper.jar"/> + </resources> + <application-desc main-class="ExtensionJnlpHelper"/> +</jnlp> diff --git a/tests/reproducers/custom/ExtensionJnlpsInApplet/resources/ExtensionJnlpTest.html b/tests/reproducers/custom/ExtensionJnlpsInApplet/resources/ExtensionJnlpTest.html new file mode 100644 index 0000000..aeedfe0 --- /dev/null +++ b/tests/reproducers/custom/ExtensionJnlpsInApplet/resources/ExtensionJnlpTest.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 width="640" height="480" code="ExtensionJnlpTestApplet"> + <param name="jnlp_href" value="ExtensionJnlpTestApplet.jnlp"> + </applet> +</body> +</html> diff --git a/tests/reproducers/custom/ExtensionJnlpsInApplet/resources/ExtensionJnlpTestApplet.jnlp b/tests/reproducers/custom/ExtensionJnlpsInApplet/resources/ExtensionJnlpTestApplet.jnlp new file mode 100644 index 0000000..a2acb3f --- /dev/null +++ b/tests/reproducers/custom/ExtensionJnlpsInApplet/resources/ExtensionJnlpTestApplet.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="ExtensionJnlpTestApplet.jnlp" codebase="."> + <information> + <title>ExtensionJnlpTestApplet</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>PR974 Test</description> + <offline/> + </information> + <resources> + <j2se version="1.4+"/> + <jar href="ExtensionJnlpTestApplet.jar"/> + <extension name="ExtensionJnlpHelper" href="./ExtensionJnlpHelper.jnlp"/> + </resources> + <applet-desc + name="ExtensionJnlpTestApplet" + main-class="ExtensionJnlpTestApplet" + width="640" + height="480"> + </applet-desc> +</jnlp> diff --git a/tests/reproducers/custom/ExtensionJnlpsInApplet/srcs/ExtensionJnlpHelper.java b/tests/reproducers/custom/ExtensionJnlpsInApplet/srcs/ExtensionJnlpHelper.java new file mode 100644 index 0000000..1704b4e --- /dev/null +++ b/tests/reproducers/custom/ExtensionJnlpsInApplet/srcs/ExtensionJnlpHelper.java @@ -0,0 +1,42 @@ +/* ExtensionJnlpHelper.java +Copyright (C) 2013 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 ExtensionJnlpHelper { + public static String help() { + return "Helper!"; + } +} diff --git a/tests/reproducers/custom/ExtensionJnlpsInApplet/srcs/ExtensionJnlpTestApplet.java b/tests/reproducers/custom/ExtensionJnlpsInApplet/srcs/ExtensionJnlpTestApplet.java new file mode 100644 index 0000000..26b34f8 --- /dev/null +++ b/tests/reproducers/custom/ExtensionJnlpsInApplet/srcs/ExtensionJnlpTestApplet.java @@ -0,0 +1,55 @@ +/* ExtensionJnlpTestApplet.java +Copyright (C) 2013 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.*; + +public class ExtensionJnlpTestApplet extends Applet { + + private static final String appletCloseString = "*** APPLET FINISHED ***"; + + public static void main(String[] args) { + System.out.println("Running as standalone application"); + System.out.println(ExtensionJnlpHelper.help()); + System.out.println(appletCloseString); + } + + public void start() { + System.out.println("Applet test running!"); + System.out.println(ExtensionJnlpHelper.help()); + System.out.println(appletCloseString); + } +} diff --git a/tests/reproducers/custom/ExtensionJnlpsInApplet/srcs/Makefile b/tests/reproducers/custom/ExtensionJnlpsInApplet/srcs/Makefile new file mode 100644 index 0000000..0b96f29 --- /dev/null +++ b/tests/reproducers/custom/ExtensionJnlpsInApplet/srcs/Makefile @@ -0,0 +1,34 @@ +TESTNAME=ExtensionJnlpsInApplet + +SRC_FILES=ExtensionJnlpHelper.java ExtensionJnlpTestApplet.java +RESOURCE_FILES=ExtensionJnlpTest.html ExtensionJnlpTestApplet.jnlp ExtensionJnlpHelper.jnlp +ENTRYPOINT_CLASSES=ExtensionJnlpHelper ExtensionJnlpTestApplet + +JAVAC_CLASSPATH=$(TEST_EXTENSIONS_DIR):$(NETX_DIR)/lib/classes.jar +JAVAC=$(BOOT_DIR)/bin/javac +JAR=$(BOOT_DIR)/bin/jar + +TMPDIR:=$(shell mktemp -d) + +prepare-reproducer: + echo PREPARING REPRODUCER $(TESTNAME) + + $(JAVAC) -d $(TMPDIR) -classpath $(JAVAC_CLASSPATH) $(SRC_FILES) + + cd ../resources; \ + cp $(RESOURCE_FILES) $(REPRODUCERS_TESTS_SERVER_DEPLOYDIR); \ + cd -; \ + ls; \ + for CLASS in $(ENTRYPOINT_CLASSES); \ + do \ + cd $(TMPDIR); \ + $(JAR) cfe "$$CLASS.jar" "$$CLASS" "$$CLASS.class"; \ + cd -;\ + mv $(TMPDIR)/"$$CLASS.jar" $(REPRODUCERS_TESTS_SERVER_DEPLOYDIR); \ + done; \ + + echo PREPARED REPRODUCER $(TESTNAME), removing $(TMPDIR) + rm -rf $(TMPDIR) + +clean-reproducer: + echo NOTHING TO CLEAN FOR $(TESTNAME) diff --git a/tests/reproducers/custom/ExtensionJnlpsInApplet/testcases/ExtensionJnlpsInAppletTest.java b/tests/reproducers/custom/ExtensionJnlpsInApplet/testcases/ExtensionJnlpsInAppletTest.java new file mode 100644 index 0000000..ebb6905 --- /dev/null +++ b/tests/reproducers/custom/ExtensionJnlpsInApplet/testcases/ExtensionJnlpsInAppletTest.java @@ -0,0 +1,73 @@ +/* ExtensionJnlpsInAppletTest.java +Copyright (C) 2013 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.ServerAccess.AutoClose; +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 net.sourceforge.jnlp.closinglisteners.AutoOkClosingListener; + +import org.junit.Assert; +import org.junit.Test; + +public class ExtensionJnlpsInAppletTest extends BrowserTest { + + private static final String appletCloseString = AutoOkClosingListener.MAGICAL_OK_CLOSING_STRING; + + @Test + @NeedsDisplay + @TestInBrowsers(testIn={Browsers.one}) + public void testExtensionJnlpsInAppletLaunch() throws Exception { + ProcessResult pr = server.executeBrowser("ExtensionJnlpTest.html", AutoClose.CLOSE_ON_CORRECT_END); + Assert.assertTrue("stdout should contain \"" + appletCloseString + "\" but did not", pr.stdout.contains(appletCloseString)); + Assert.assertTrue("stdout should contain \"Applet test running\" but did not", pr.stdout.contains("Applet test running")); + } + + @Test + @NeedsDisplay + @TestInBrowsers(testIn={Browsers.one}) + @Bug(id="PR974") + public void testExtensionJnlpsInAppletHelper() throws Exception { + ProcessResult pr = server.executeBrowser("ExtensionJnlpTest.html", AutoClose.CLOSE_ON_CORRECT_END); + Assert.assertTrue("stdout should contain \"" + appletCloseString + "\" but did not", pr.stdout.contains(appletCloseString)); + Assert.assertTrue("stdout should contain \"Helper!\" but did not", pr.stdout.contains("Helper!")); + } + +} |