[RFC][icedtea-web]: Fix PR1166 - Embedded JNLP File is not supported in applet tag

Adam Domurad adomurad at redhat.com
Fri Oct 5 12:41:57 PDT 2012


On 10/03/2012 02:10 PM, Saad Mohammad wrote:
> Hi Adam,
>
> Thanks for looking over my patches. I updated the reproducers after your review.
> Along with the attached reproducer, I also added unit test and updated the bug
> fix patch so it is more compatible with tests.
>
> Also, just a note, the reproducers do all pass for me through the test engine.
> Let me know if you are having any trouble.
>
> Thanks.
>
> CHANGELOGS:
> ==============================================================================
> BUG FIX:
>
> 2012-10-03  Saad Mohammad  <smohammad at redhat.com>
>
> 	Fix PR1166: Embedded JNLP File is not supported in applet tag.
> 	* configure.ac: Checks for sun.misc.BASE64Encoder and
> 	sun.misc.BASE64Decoder
> 	* netx/net/sourceforge/jnlp/JNLPFile.java (JNLPFile):
> 	New constructor which accepts inputstream of jnlp file and a
> 	specified codebase.
> 	* netx/net/sourceforge/jnlp/Parser.java (Parser): If parsing of
> 	codebase fails, it will overwrite the codebase with the one passed
> 	in through parameters.
> 	* netx/net/sourceforge/jnlp/PluginBridge.java:
> 	(PluginBridge) Supports embedded jnlp file.
> 	(decodeBase64String) Decodes Base64 strings to byte array.
> ==============================================================================
> REPRODUCER:
>
> 2012-10-03  Saad Mohammad  <smohammad at redhat.com>
>
> 	Added reproducer for PR1166.
> 	* tests/reproducers/simple/EmbeddedJnlpInApplet/resources/EmbeddedJnlp.jnlp:
> 	Launching jnlp file that is used by jnlp_href in applet tag
> 	*
> tests/reproducers/simple/EmbeddedJnlpInApplet/resources/EmbeddedJnlpInAppletNoCodebase.html:
> 	Applet with an embedded jnlp file with no codebase specified
> 	*
> tests/reproducers/simple/EmbeddedJnlpInApplet/resources/EmbeddedJnlpInAppletWithDotCodebase.html:
> 	Applet with an embedded jnlp file with codebase set as a 'dot'
> 	* tests/reproducers/simple/EmbeddedJnlpInApplet/resources/JnlpInApplet.html:
> 	Applet with jnlp_href file.
> 	* tests/reproducers/simple/EmbeddedJnlpInApplet/srcs/EmbeddedJnlp.java:
> 	Simple class that outputs strings.
> 	*
> tests/reproducers/simple/EmbeddedJnlpInApplet/testcases/EmbeddedJnlpInAppletTest.java:
> 	Testcase that tests embedded jnlps in html pages.
>
> ==============================================================================
> UNIT TESTS:
>
> 2012-10-03  Saad Mohammad  <smohammad at redhat.com>
>
> 	* tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java:
> 	Tests the JNLPFile constructor that accepts an InputStream and an alternative
> codebase.
> 	* tests/netx/unit/net/sourceforge/jnlp/ParserTest.java:
> 	Tests if the constructor handles the alternative codebase parameter correctly.
> 	* tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java:
> 	Tests if BASE64 strings are decoded correctly and if PluginBridge is
> constructed with an
> 	embedded jnlp.
>

Reviewing updated reproducer:

> diff --git 
> a/tests/reproducers/simple/EmbeddedJnlpInApplet/resources/EmbeddedJnlp.jnlp 
> b/tests/reproducers/simple/EmbeddedJnlpInApplet/resources/EmbeddedJnlp.jnlp
> new file mode 100644
> --- /dev/null
> +++ 
> b/tests/reproducers/simple/EmbeddedJnlpInApplet/resources/EmbeddedJnlp.jnlp
> @@ -0,0 +1,61 @@
> +<!--
> +
> +This file is part of IcedTea.
> +
> +IcedTea is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 2, or (at your option)
> +any later version.
> +
> +IcedTea is distributed in the hope that it will be useful, but
> +WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with IcedTea; see the file COPYING.  If not, write to the
> +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
> Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give you
> +permission to link this library with independent modules to produce an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version.
> +
> + -->
> +<?xml version="1.0" encoding="utf-8"?>
> +<jnlp spec="1.0" href="EmbeddedJnlp.jnlp">
> +    <information>
> +        <title>SignedAppletTest</title>
> +        <vendor>IcedTea</vendor>
> +        <homepage 
> href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web "/>
> +        <description>SignedAppletTest</description>
> +        <offline/>
> +    </information>
> +    <resources>
> +        <j2se version="1.4+"/>
> +        <jar href="EmbeddedJnlpInApplet.jar"/>
> +    </resources>
> +    <applet-desc
> +      documentBase="."
> +      name="EmbeddedJnlp"
> +      main-class="EmbeddedJnlp"
> +      width="100"
> +      height="100">
> +    </applet-desc>
> +</jnlp>
> +
> +
> +</applet-desc>
> diff --git 
> a/tests/reproducers/simple/EmbeddedJnlpInApplet/resources/EmbeddedJnlpInAppletNoCodebase.html 
> b/tests/reproducers/simple/EmbeddedJnlpInApplet/resources/EmbeddedJnlpInAppletNoCodebase.html
> new file mode 100644
> --- /dev/null
> +++ 
> b/tests/reproducers/simple/EmbeddedJnlpInApplet/resources/EmbeddedJnlpInAppletNoCodebase.html
> @@ -0,0 +1,98 @@
> +<!--
> +
> +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.
> +
> +************************************************************************
> +The embedded file is an exact copy of EmbeddedJnlp.jnlp except there is
> +no codebase attribute within jnlp tag.
> +
> +This can be decoded easily using a web page such as
> +<http://www.motobit.com/util/base64-decoder-encoder.asp>
> +************************************************************************
> + -->
> +<html><head></head><body bgcolor="red">
> +<p>
> +
> +
> +    <applet code="EmbeddedJnlp.class" width="800" height="600">
> +        <param name="jnlp_href" value="EmbeddedJnlpWithNoCodebase.jnlp">
> +        <param name="jnlp_embedded"
> + 
> value="PCEtLQ0KDQpUaGlzIGZpbGUgaXMgcGFydCBvZiBJY2VkVGVhLg0KDQpJY2VkVGVhIGlzIGZyZWUg
> +c29mdHdhcmU7IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkNCml0IHVuZGVy
> +IHRoZSB0ZXJtcyBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UgYXMgcHVibGlzaGVk
> +IGJ5DQp0aGUgRnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9uOyBlaXRoZXIgdmVyc2lvbiAyLCBvciAo
> +YXQgeW91ciBvcHRpb24pDQphbnkgbGF0ZXIgdmVyc2lvbi4NCg0KSWNlZFRlYSBpcyBkaXN0cmli
> +dXRlZCBpbiB0aGUgaG9wZSB0aGF0IGl0IHdpbGwgYmUgdXNlZnVsLCBidX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gIDx2ZW5kb3I+SWNlZFRlYTwvdmVuZG9yPg0KICAgICAgICA8aG9t
> +ZXBhZ2UgaHJlZj0iaHR0cDovL2ljZWR0ZWEuY2xhc3NwYXRoLm9yZy93aWtpL0ljZWRUZWEtV2Vi
> +I1Rlc3RpbmdfSWNlZFRlYS1XZWIgIi8+DQogICAgICAgIDxkZXNjcmlwdGlvbj5TaWduZWRBcHBs
> +ZXRUZXN0PC9kZXNjcmlwdGlvbj4NCiAgICAgICAgPG9mZmxpbmUvPg0KICAgIDwvaW5mb3JtYXRp
> +b24+DQogICAgPHJlc291cmNlcz4NCiAgICAgICAgPGoyc2UgdmVyc2lvbj0iMS40KyIvPg0KICAg
> +ICAgICA8amFyIGhyZWY9IkVtYmVkZGVkSm5scEluQXBwbGV0LmphciIvPg0KICAgIDwvcmVzb3Vy
> +Y2VzPg0KICAgIDxhcHBsZXQtZGVzYw0KICAgICAgZG9jdW1lbnRCYXNlPSIuIg0KICAgICAgbmFt
> +ZT0iRW1iZWRkZWRKbmxwIg0KICAgICAgbWFpbi1jbGFzcz0iRW1iZWRkZWRKbmxwIg0KICAgICAg
> +d2lkdGg9IjEwMCINCiAgICAgIGhlaWdodD0iMTAwIj4NCiAgICA8L2FwcGxldC1kZXNjPg0KPC9q
> +bmxwPg0KDQoNCjwvYXBwbGV0LWRlc2M+">
> +    </applet>
> +
> +</p>
> +</body>
> +</html>
> diff --git 
> a/tests/reproducers/simple/EmbeddedJnlpInApplet/resources/EmbeddedJnlpInAppletWithDotCodebase.html 
> b/tests/reproducers/simple/EmbeddedJnlpInApplet/resources/EmbeddedJnlpInAppletWithDotCodebase.html
> new file mode 100644
> --- /dev/null
> +++ 
> b/tests/reproducers/simple/EmbeddedJnlpInApplet/resources/EmbeddedJnlpInAppletWithDotCodebase.html
> @@ -0,0 +1,98 @@
> +<!--
> +
> +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.
> +
> +
> +************************************************************************
> +The embedded file is an exact copy of EmbeddedJnlp.jnlp.
> +
> +This can be decoded easily using a web page such as
> +<http://www.motobit.com/util/base64-decoder-encoder.asp>
> +************************************************************************
> + -->
> +<html><head></head><body bgcolor="red">
> +<p>
> +
> +
> +    <applet code="EmbeddedJnlp.class" width="800" height="600">
> +        <param name="jnlp_href" value="EmbeddedJnlpWithDotCodebase.jnlp">
> +        <param name="jnlp_embedded"
> + 
> value="PCEtLQ0KDQpUaGlzIGZpbGUgaXMgcGFydCBvZiBJY2VkVGVhLg0KDQpJY2VkVGVhIGlzIGZyZWUg
> +c29mdHdhcmU7IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkNCml0IHVuZGVy
> +IHRoZSB0ZXJtcyBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UgYXMgcHVibGlzaGVk
> +IGJ5DQp0aGUgRnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9u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Pz4NCjxqbmxwIHNwZWM9IjEuMCIgaHJlZj0iRW1iZWRkZWRKbmxwV2l0aERvdENvZGViYXNl
> +LmpubHAiIGNvZGViYXNlPSIuIj4NCiAgICA8aW5mb3JtYXRpb24+DQogICAgICAgIDx0aXRsZT5T
> +aWduZWRBcHBsZXRUZXN0PC90aXRsZT4NCiAgICAgICAgPHZlbmRvcj5JY2VkVGVhPC92ZW5kb3I+
> +DQogICAgICAgIDxob21lcGFnZSBocmVmPSJodHRwOi8vaWNlZHRlYS5jbGFzc3BhdGgub3JnL3dp
> +a2kvSWNlZFRlYS1XZWIjVGVzdGluZ19JY2VkVGVhLVdlYiAiLz4NCiAgICAgICAgPGRlc2NyaXB0
> +aW9uPlNpZ25lZEFwcGxldFRlc3Q8L2Rlc2NyaXB0aW9uPg0KICAgICAgICA8b2ZmbGluZS8+DQog
> +ICAgPC9pbmZvcm1hdGlvbj4NCiAgICA8cmVzb3VyY2VzPg0KICAgICAgICA8ajJzZSB2ZXJzaW9u
> +PSIxLjQrIi8+DQogICAgICAgIDxqYXIgaHJlZj0iRW1iZWRkZWRKbmxwSW5BcHBsZXQuamFyIi8+
> +DQogICAgPC9yZXNvdXJjZXM+DQogICAgPGFwcGxldC1kZXNjDQogICAgICBkb2N1bWVudEJhc2U9
> +Ii4iDQogICAgICBuYW1lPSJFbWJlZGRlZEpubHAiDQogICAgICBtYWluLWNsYXNzPSJFbWJlZGRl
> +ZEpubHAiDQogICAgICB3aWR0aD0iMTAwIg0KICAgICAgaGVpZ2h0PSIxMDAiPg0KICAgIDwvYXBw
> +bGV0LWRlc2M+DQo8L2pubHA+DQoNCg0KPC9hcHBsZXQtZGVzYz4=">
> +    </applet>
> +
> +</p>
> +</body>
> +</html>
> diff --git 
> a/tests/reproducers/simple/EmbeddedJnlpInApplet/resources/JnlpInApplet.html 
> b/tests/reproducers/simple/EmbeddedJnlpInApplet/resources/JnlpInApplet.html
> new file mode 100644
> --- /dev/null
> +++ 
> b/tests/reproducers/simple/EmbeddedJnlpInApplet/resources/JnlpInApplet.html
> @@ -0,0 +1,45 @@
> +<!--
> +
> +This file is part of IcedTea.
> +
> +IcedTea is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 2, or (at your option)
> +any later version.
> +
> +IcedTea is distributed in the hope that it will be useful, but
> +WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with IcedTea; see the file COPYING.  If not, write to the
> +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
> Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give you
> +permission to link this library with independent modules to produce an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version.
> +
> + -->
> +<html><head></head><body bgcolor="red">
> +<p>
> +    <applet code="EmbeddedJnlp.class" width="800" height="600">
> +        <param name="jnlp_href" value="EmbeddedJnlp.jnlp">
> +    </applet>
> +</p>
> +</body>
> +</html>
> diff --git 
> a/tests/reproducers/simple/EmbeddedJnlpInApplet/srcs/EmbeddedJnlp.java 
> b/tests/reproducers/simple/EmbeddedJnlpInApplet/srcs/EmbeddedJnlp.java
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/simple/EmbeddedJnlpInApplet/srcs/EmbeddedJnlp.java
> @@ -0,0 +1,83 @@
> +/* EmbeddedJnlp.java
> +Copyright (C) 2012 Red Hat, Inc.
> +
> +This file is part of IcedTea.
> +
> +IcedTea is free software; you can redistribute it and/or
> +modify it under the terms of the GNU General Public License as 
> published by
> +the Free Software Foundation, version 2.
> +
> +IcedTea is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with IcedTea; see the file COPYING.  If not, write to
> +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
> Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give you
> +permission to link this library with independent modules to produce an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version.
> + */
> +
> +import java.applet.Applet;
> +
> + at SuppressWarnings("serial")
> +public class EmbeddedJnlp extends Applet {
> +
> +    private class Killer extends Thread {
> +
> +        public int n = 2000;
> +
> +        @Override
> +        public void run() {
> +            try {
> +                Thread.sleep(n);
> +                System.out.println("AppletTestSigned killing himself 
> after " + n + " ms of life");

This isn't AppletTestSigned:)

> +                System.out.println("*** APPLET FINISHED ***");
> +                System.exit(0);
> +            } catch (Exception ex) {
> +            }
> +        }
> +    }
> +
> +    private Killer killer;
> +
> +    @Override
> +    public void init() {
> +        System.out.println("Starting EmbeddedJnlp Class");
> +        killer = new Killer();
> +    }
> +
> +    @Override
> +    public void start() {
> +        System.out.println("EmbeddedJnlp was started");
> +        killer.start();
> +        System.out.println("killer was started");
> +    }

I think it'd be simpler (& slightly faster) to not have a killer, and 
simply print APPLET FINISHED in the start() method. The auto-closer will 
'kill' the applet.

>
> +
> +    @Override
> +    public void stop() {
> +        System.out.println("Stopping EmbeddedJnlp");
> +    }
> +
> +    @Override
> +    public void destroy() {
> +        System.out.println("Destroying EmbeddedJnlp");
> +    }
> +}
> diff --git 
> a/tests/reproducers/simple/EmbeddedJnlpInApplet/testcases/EmbeddedJnlpInAppletTest.java 
> b/tests/reproducers/simple/EmbeddedJnlpInApplet/testcases/EmbeddedJnlpInAppletTest.java
> new file mode 100644
> --- /dev/null
> +++ 
> b/tests/reproducers/simple/EmbeddedJnlpInApplet/testcases/EmbeddedJnlpInAppletTest.java
> @@ -0,0 +1,73 @@
> +/* EmbeddedJnlpInAppletTest.java
> +Copyright (C) 2012 Red Hat, Inc.
> +
> +This file is part of IcedTea.
> +
> +IcedTea is free software; you can redistribute it and/or
> +modify it under the terms of the GNU General Public License as 
> published by
> +the Free Software Foundation, version 2.
> +
> +IcedTea is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with IcedTea; see the file COPYING.  If not, write to
> +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
> Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give you
> +permission to link this library with independent modules to produce an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version.
> + */
> +
> +import junit.framework.Assert;
> +import net.sourceforge.jnlp.ProcessResult;
> +import net.sourceforge.jnlp.ServerAccess.AutoClose;
> +import net.sourceforge.jnlp.browsertesting.BrowserTest;
> +import net.sourceforge.jnlp.browsertesting.Browsers;
> +import net.sourceforge.jnlp.closinglisteners.AutoOkClosingListener;
> +import net.sourceforge.jnlp.annotations.TestInBrowsers;
> +import org.junit.Test;
> +
> +public class EmbeddedJnlpInAppletTest extends BrowserTest {
> +
> +    final static String s = 
> AutoOkClosingListener.MAGICAL_OK_CLOSING_STRING;
> +
> +    @Test
> +    @TestInBrowsers(testIn = { Browsers.one })
> +    public void JnlpInApplet() throws Exception {
> +        ProcessResult pr = 
> server.executeBrowser("/JnlpInApplet.html", 
> AutoClose.CLOSE_ON_CORRECT_END);
> +        Assert.assertTrue("EmbeddedJnlp.class was not correctly 
> launched in JnlpInApplet.html:  " + pr.stdout + pr.stderr, 
> pr.stdout.contains(s));
> +    }

Might be an nitpick, but I'd prefer a statement here just saying the 
message you were looking for wasn't found. Listening stdout and stderr 
is something logs_reproducers.html does well already.

> +
> +    @Test
> +    @TestInBrowsers(testIn = { Browsers.one })
> +    public void EmbeddedJnlpInAppletWithADotAsCodebase() throws 
> Exception {
> +        ProcessResult pr = 
> server.executeBrowser("/EmbeddedJnlpInAppletWithDotCodebase.html", 
> AutoClose.CLOSE_ON_CORRECT_END);
> +        Assert.assertTrue("EmbeddedJnlp.class was not correctly 
> launched in EmbeddedJnlpInAppletWithDotCodebase.html:  " + pr.stdout + 
> pr.stderr,
> +                pr.stdout.contains(s));
> +    }
> +
> +    @Test
> +    @TestInBrowsers(testIn = { Browsers.one })
> +    public void EmbeddedJnlpInAppletWithNoCodebase() throws Exception {
> +        ProcessResult pr = 
> server.executeBrowser("/EmbeddedJnlpInAppletWithNoCodebase.html", 
> AutoClose.CLOSE_ON_CORRECT_END);
> +        Assert.assertTrue("EmbeddedJnlp.class was not correctly 
> launched in EmbeddedJnlpInAppletWithNoCodebase.html:  " + pr.stdout + 
> pr.stderr,
> +                pr.stdout.contains(s));
> +    }
> +}
Otherwise, good stuff.

- Adam



More information about the distro-pkg-dev mailing list