diff options
12 files changed, 515 insertions, 17 deletions
@@ -1,10 +1,42 @@ +2013-08-15 Andrew Azores <[email protected]> + + * netx/net/sourceforge/jnlp/ParserSettings.java: (globalParserSettings) + static ParserSettings instance to store settings. + (setGlobalParserSettingsFromArgs) Determine, store, and return + globalParserSettings. (getGlobalParserSettings) return stored + ParserSettings + * netx/net/sourceforge/jnlp/PluginBridge.java: (extensionJars) stores list + of JNLP extensions. (getResources) returns this list + * netx/net/sourceforge/jnlp/runtime/Boot.java: minor refactor to use + ParserSettings.setGlobalParserSettingsFromArgs() + + * tests/netx/unit/net/sourceforge/jnlp/ParserSettingsTest.java: ensure + that ParserSettings.setGlobalParserSettingsFromArgs() works as intended + + * tests/reproducers/custom/ExtensionJnlpsInApplet/testcases/ExtensionJnlpsInAppletTest.java: + tests browser launch of HTML file with embedded JNLP applet referencing + extension JNLP + * tests/reproducers/custom/ExtensionJnlpsInApplet/resources/ExtensionJnlpHelper.jnlp: + same + * tests/reproducers/custom/ExtensionJnlpsInApplet/resources/ExtensionJnlpTest.html: + same + * tests/reproducers/custom/ExtensionJnlpsInApplet/resources/ExtensionJnlpTestApplet.jnlp: + same + * tests/reproducers/custom/ExtensionJnlpsInApplet/srcs/ExtensionJnlpHelper.java: + same + * tests/reproducers/custom/ExtensionJnlpsInApplet/srcs/ExtensionJnlpTestApplet.java: + same + * tests/reproducers/custom/ExtensionJnlpsInApplet/srcs/Makefile: same + 2013-08-13 Andrew Azores <[email protected]> + * tests/test-extensions/net/sourceforge/jnlp/TinyHttpdImpl.java: no longer sends HTTP 400 BAD REQUEST messages * test/test-extensions-tests/net/sourceforge/jnlp/TinyHttpdImplTest.java: removed "bad request" test 2013-08-12 Andrew Azores <[email protected]> + * tests/test-extensions/net/sourceforge/jnlp/TinyHttpdImpl.java: refactored * tests/test-extensions/net/sourceforge/jnlp/ServerLauncher.java: TinyHttpdImpl constructor changed, reflecting this here diff --git a/netx/net/sourceforge/jnlp/ParserSettings.java b/netx/net/sourceforge/jnlp/ParserSettings.java index de781d9..b698bd4 100644 --- a/netx/net/sourceforge/jnlp/ParserSettings.java +++ b/netx/net/sourceforge/jnlp/ParserSettings.java @@ -37,6 +37,9 @@ exception statement from your version. package net.sourceforge.jnlp; +import java.util.Arrays; +import java.util.List; + /** * Contains settings to be used by the Parser while parsing JNLP files. * @@ -44,6 +47,8 @@ package net.sourceforge.jnlp; */ public class ParserSettings { + private static ParserSettings globalParserSettings = new ParserSettings(); + private final boolean isStrict; private final boolean extensionAllowed; private final boolean malformedXmlAllowed; @@ -75,4 +80,32 @@ public class ParserSettings { return isStrict; } -}
\ No newline at end of file + /** + * Return the global parser settings in use. + */ + public static ParserSettings getGlobalParserSettings() { + return globalParserSettings; + } + + /** + * Set the global ParserSettings to match the given settings. + */ + public static void setGlobalParserSettings(ParserSettings parserSettings) { + globalParserSettings = parserSettings; + } + + /** + * Return the ParserSettings to be used according to arguments specified + * at boot on the command line. These settings are also stored so they + * can be retrieved at a later time. + */ + public static ParserSettings setGlobalParserSettingsFromArgs(String[] cmdArgs) { + List<String> argList = Arrays.asList(cmdArgs); + boolean strict = argList.contains("-strict"); + boolean malformedXmlAllowed = !argList.contains("-xml"); + + globalParserSettings = new ParserSettings(strict, true, malformedXmlAllowed); + return globalParserSettings; + } + +} diff --git a/netx/net/sourceforge/jnlp/PluginBridge.java b/netx/net/sourceforge/jnlp/PluginBridge.java index 9163404..4f4c8f1 100644 --- a/netx/net/sourceforge/jnlp/PluginBridge.java +++ b/netx/net/sourceforge/jnlp/PluginBridge.java @@ -26,18 +26,18 @@ import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.net.URL; import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; -import java.util.Locale; import java.util.List; -import java.util.ArrayList; +import java.util.Locale; import java.util.Map; import java.util.Set; -import sun.misc.BASE64Decoder; - import net.sourceforge.jnlp.runtime.JNLPRuntime; +import sun.misc.BASE64Decoder; /** * Allows reuse of code that expects a JNLPFile object, @@ -47,6 +47,7 @@ public class PluginBridge extends JNLPFile { private PluginParameters params; private Set<String> jars = new HashSet<String>(); + private List<ExtensionDesc> extensionJars = new ArrayList<ExtensionDesc>(); //Folders can be added to the code-base through the archive tag private List<String> codeBaseFolders = new ArrayList<String>(); private String[] cacheJars = new String[0]; @@ -90,6 +91,7 @@ public class PluginBridge extends JNLPFile { this.codeBase = codebase; this.sourceLocation = documentBase; this.params = params; + this.parserSettings = ParserSettings.getGlobalParserSettings(); if (params.getJNLPHref() != null) { useJNLPHref = true; @@ -122,6 +124,9 @@ public class PluginBridge extends JNLPFile { String fileName = jarDesc.getLocation().toExternalForm(); this.jars.add(fileName); } + + // Store any extensions listed in the JNLP file to be returned later on, namely in getResources() + extensionJars = Arrays.asList(jnlpFile.getResources().getExtensions()); } catch (MalformedURLException e) { // Don't fail because we cannot get the jnlp file. Parameters are optional not required. // it is the site developer who should ensure that file exist. @@ -308,6 +313,8 @@ public class PluginBridge extends JNLPFile { return result; } catch (MalformedURLException ex) { /* Ignored */ } + } else if (launchType.equals(ExtensionDesc.class)) { + return (List<T>) extensionJars; // this list is populated when the PluginBridge is first constructed } return sharedResources.getResources(launchType); } diff --git a/netx/net/sourceforge/jnlp/runtime/Boot.java b/netx/net/sourceforge/jnlp/runtime/Boot.java index fcd87b8..81d19c1 100644 --- a/netx/net/sourceforge/jnlp/runtime/Boot.java +++ b/netx/net/sourceforge/jnlp/runtime/Boot.java @@ -214,18 +214,8 @@ public final class Boot implements PrivilegedAction<Void> { extra.put("arguments", getOptions("-arg")); extra.put("parameters", getOptions("-param")); extra.put("properties", getOptions("-property")); - boolean strict = false; - boolean malformedXmlAllowed = true; - if (null != getOption("-strict")) { - strict = true; - } - - if (null != getOption("-xml")) { - malformedXmlAllowed = false; - } - - ParserSettings settings = new ParserSettings(strict, true, malformedXmlAllowed); + ParserSettings settings = ParserSettings.setGlobalParserSettingsFromArgs(args); try { Launcher launcher = new Launcher(false); 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!")); + } + +} |