[RFC][icedtea-web]: Added signed jnlp tests for applications using multiple jars

adomurad adomurad at redhat.com
Tue Jul 17 13:37:41 PDT 2012


Hi Saad. Thanks for the patches! General question, what motivated you to
test these aspects (which all seem to pass?) You'll have to forgive my
ignorance of jnlp templates, I would appreciate a brief elaboration on
the aspects under test here.

Comments inline.

On Wed, 2012-07-04 at 17:05 -0400, Saad Mohammad wrote:
> Hello,
> 
> I have attached the patch that tests the launching of applications which 
> have multiple jars containing signed jnlp files.
> 
> ChangeLog:
> 
> 2012-07-05  Saad Mohammad  <smohammad at redhat.com>
> 
>      Added multiple jars with signed jnlp tests.
>      * 
> tests/reproducers/signed/SignedJarResource/resources/SignedJarResource.jnlp:
>      Launches SignedJarResource class directly.
>      * 
> tests/reproducers/signed/SignedJnlpMultipleJars/resources/MainJarWithMatchingSignedJnlp.jnlp:
>      * 
> tests/reproducers/signed/SignedJnlpMultipleJars/resources/MainJarWithUnmatchingSignedJnlp.jnlp:
>      * 
> tests/reproducers/signed/SignedJnlpMultipleJars/resources/MainJarWithoutSignedJnlp.jnlp:
>      Launching jnlp file that contains multiple jars as its resource.
>      * 
> tests/reproducers/signed/SignedJnlpMultipleJars/srcs/JNLP-INF/APPLICATION.jnlp:
>      Signed jnlp file.
>      * 
> tests/reproducers/signed/SignedJnlpMultipleJars/srcs/SignedJnlpApplication.java:
>      A simple java class that outputs a string.
>      * 
> tests/reproducers/signed/SignedJnlpMultipleJars/testcases/SignedJnlpMultipleJarsTest.java:
>      Testcase that tests the launching of jnlp files containing multple jar
>      as its resources.
>      * 
> tests/reproducers/signed/SignedJnlpResource/resources/SignedJnlpResource.jnlp:
>      Launches SignedJnlpResource class.
>      * 
> tests/reproducers/signed/SignedJnlpResource2/resources/MainJarWithMatchingSignedJnlpTemplate.jnlp:
>      * 
> tests/reproducers/signed/SignedJnlpResource2/resources/MainJarWithUnmatchingSignedJnlpTemplate.jnlp:
>      Launching jnlp file that contains multiple jars as its resource.
>      * 
> tests/reproducers/signed/SignedJnlpResource2/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp:
>      Signed jnlp file.
>      * 
> tests/reproducers/signed/SignedJnlpResource2/srcs/SignedJnlpApplicationTemplate.java:
>      A simple java class that outputs a string.
> 


> /*  SignedJnlpMultipleJarsTest.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.util.Arrays;
> import java.util.Collections;
> import java.util.List;
> import net.sourceforge.jnlp.ServerAccess;
> import org.junit.Assert;
> import org.junit.Test;
> 
> public class SignedJnlpMultipleJarsTest {
> 
>     private static ServerAccess server = new ServerAccess();
>     private final List<String> l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" }));
>     private final String signedJnlpException = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: "
>             + "The signed JNLP file did not match the launching JNLP file. Missing Resource: Signed Application "
>             + "did not match launching JNLP File";
> 
>     @Test
>     public void checkingForRequiredResources() throws Exception {
>         String s = "Running SignedJarResource..";
>         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJarResource.jnlp");
>         Assert.assertTrue("Could not locate SignedJarResource class within SignedJarResource jar", pr.stdout.contains(s));
The failure messages here and below assume too much based on the condition.
> 
>         s = "Running SignedJnlpResource..";
>         pr = server.executeJavawsHeadless(l, "/SignedJnlpResource.jnlp");
>         Assert.assertTrue("Could not locate SignedJnlpResource class within SignedJnlpResource jar", pr.stdout.contains(s));
What functionality does this test exactly ? It seems like SignedJnlpResource more or less just loads a .jar in a fashion that is already well tested.
> 
>         pr = server.executeJavawsHeadless(l, "/MainJarWithMatchingSignedJnlpTemplate.jnlp");
>         s = "Ending signed application_template in main";
>         Assert.assertTrue("Could not locate SignedJnlpApplicationTemplate class within SignedJnlpResource2 jar", pr.stdout.contains(s));

How is MainJarWithMatchingSignedJnlpTemplate.jnlp being used in the test other than this ? 
If this is aiming to test that it runs correctly than it should be its own test imo.

> 
>         pr = server.executeJavawsHeadless(l, "/MainJarWithMatchingSignedJnlp.jnlp");
>         s = "Ending signed application in main";
>         Assert.assertTrue("Could not locate SignedJnlpApplication class within SignedJnlpMultipleJars jar", pr.stdout.contains(


>     }
> 
>     @Test
>     public void mainJarWithUnmatchingSignedJnlpApplication() throws Exception {
>         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MainJarWithUnmatchingSignedJnlp.jnlp");
>         Assert.assertTrue("Stdout should contains " + signedJnlpException + " but did not", pr.stderr.contains(signedJnlpException));
contains -> contain, same below.

>     }
> 
>     @Test
>     public void mainJarWithUnmatchingSignedJnlpTemplate() throws Exception {
>         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MainJarWithUnmatchingSignedJnlpTemplate.jnlp");
>         Assert.assertTrue("Stdout should contains " + signedJnlpException + " but did not", pr.stderr.contains(signedJnlpException));
>     }
> 
>     @Test
>     public void mainJarWithoutSignedJnlp() throws Exception {
>         ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MainJarWithoutSignedJnlp.jnlp");
>         String s = "Running SignedJarResource..";
>         Assert.assertTrue("Stdout should contains " + s + " but did not", pr.stdout.contains(s));
>     }
> 
> }
> 


> diff --git a/tests/reproducers/signed/SignedJarResource/resources/SignedJarResource.jnlp b/tests/reproducers/signed/SignedJarResource/resources/SignedJarResource.jnlp
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/signed/SignedJarResource/resources/SignedJarResource.jnlp
> @@ -0,0 +1,62 @@
> +<!--
> +
> +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.
> +
> +***********************************************************************
> +Launches SignedJarResource directly
> +***********************************************************************
> + -->
> +<?xml version="1.0" encoding="utf-8"?>
> +<jnlp spec="1.0" href="SignedJarResource.jnlp" codebase=".">
> +  <information>
> +    <title>SignedJarResource</title>
> +    <vendor>IcedTea</vendor>
> +    <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
> +    <description>SignedJarResource</description>
> +    <offline/>
> +  </information>
> +
> +  <security>
> +      <all-permissions/>
> +  </security>
> +
> +  <resources>
> +    <j2se version="1.6+"/>
> +    <jar href="SignedJarResource.jar" main="true"/>
> +  </resources>
> +
> +  <application-desc main-class="SignedJarResource">
> +  </application-desc>
> +</jnlp>
What does this JNLP try to test ? It doesn't seem to add any extra testing coverage of features.

> diff --git a/tests/reproducers/signed/SignedJnlpMultipleJars/resources/MainJarWithMatchingSignedJnlp.jnlp b/tests/reproducers/signed/SignedJnlpMultipleJars/resources/MainJarWithMatchingSignedJnlp.jnlp
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/signed/SignedJnlpMultipleJars/resources/MainJarWithMatchingSignedJnlp.jnlp
> @@ -0,0 +1,64 @@
> +<!--
> +
> +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="MainJarWithMatchingSignedJnlp.jnlp" codebase=".">
> +  <information>
> +    <title>Matching Signed JNLP Value</title>
> +    <vendor>IcedTea</vendor>
> +    <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
> +    <description>Matching Signed JNLP Value</description>
> +    <offline/>
> +  </information>
> +
> +  <security>
> +      <all-permissions/>
> +  </security> 
> +
> +   <resources>
> +        <property name="specialProperty" value="icedtea"/>
> +   </resources>
> +
> +  <resources>
> +    <j2se version="1.6+"/>
> +    <jar href="SignedJarResource.jar"/>
> +    <jar href="SignedJnlpResource.jar"/>
> +    <jar href="SignedJnlpMultipleJars.jar"/>
> +  </resources>
> +  <application-desc main-class="SignedJnlpApplication">
> +  </application-desc>
> +</jnlp>
> diff --git a/tests/reproducers/signed/SignedJnlpMultipleJars/resources/MainJarWithUnmatchingSignedJnlp.jnlp b/tests/reproducers/signed/SignedJnlpMultipleJars/resources/MainJarWithUnmatchingSignedJnlp.jnlp
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/signed/SignedJnlpMultipleJars/resources/MainJarWithUnmatchingSignedJnlp.jnlp
> @@ -0,0 +1,64 @@
> +<!--
> +
> +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="MainJarWithUnmatchingSignedJnlp.jnlp" codebase=".">
> +  <information>
> +    <title>DOES NOT Match Signed JNLP Value </title>
> +    <vendor>IcedTea</vendor>
> +    <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
> +    <description>DOES NOT Match Signed JNLP Value</description>
> +    <offline/>
> +  </information>
> +
> +  <security>
> +      <all-permissions/>
> +  </security> 
> +
> +   <resources>
> +        <property name="specialProperty" value="icedtea"/>
> +   </resources>
> +
> +  <resources>
> +    <j2se version="1.6+"/>
> +    <jar href="SignedJarResource.jar"/>
> +    <jar href="SignedJnlpResource.jar"/>
> +    <jar href="SignedJnlpMultipleJars.jar"/>
> +  </resources>
> +  <application-desc main-class="SignedJnlpApplication">
> +  </application-desc>
> +</jnlp>
> diff --git a/tests/reproducers/signed/SignedJnlpMultipleJars/resources/MainJarWithoutSignedJnlp.jnlp b/tests/reproducers/signed/SignedJnlpMultipleJars/resources/MainJarWithoutSignedJnlp.jnlp
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/signed/SignedJnlpMultipleJars/resources/MainJarWithoutSignedJnlp.jnlp
> @@ -0,0 +1,65 @@
> +<!--
> +
> +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="MainJarWithoutSignedJnlp.jnlp" codebase=".">
> +  <information>
> +    <title>Does not have a Signed Jnlp </title>
> +    <vendor>IcedTea</vendor>
> +    <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
> +    <description>Does not have a Signed Jnlp</description>
> +    <offline/>
> +  </information>
> +
> +  <security>
> +      <all-permissions/>
> +  </security> 
> +
> +   <resources>
> +        <property name="specialProperty" value="icedtea"/>
> +   </resources>
> +
> +  <resources>
> +    <j2se version="1.6+"/>
> +    <jar href="SignedJarResource.jar"/>
> +    <jar href="SignedJnlpResource.jar"/>
> +    <jar href="SignedJnlpResource2.jar"/>
> +    <jar href="SignedJnlpMultipleJars.jar"/>
> +  </resources>
> +  <application-desc main-class="SignedJarResource">
> +  </application-desc>
> +</jnlp>
> diff --git a/tests/reproducers/signed/SignedJnlpMultipleJars/srcs/JNLP-INF/APPLICATION.jnlp b/tests/reproducers/signed/SignedJnlpMultipleJars/srcs/JNLP-INF/APPLICATION.jnlp
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/signed/SignedJnlpMultipleJars/srcs/JNLP-INF/APPLICATION.jnlp
> @@ -0,0 +1,64 @@
> +<!--
> +
> +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="MainJarWithMatchingSignedJnlp.jnlp" codebase=".">
> +  <information>
> +    <title>Matching Signed JNLP Value</title>
> +    <vendor>IcedTea</vendor>
> +    <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
> +    <description>Matching Signed JNLP Value</description>
> +    <offline/>
> +  </information>
> +
> +  <security>
> +      <all-permissions/>
> +  </security> 
> +
> +   <resources>
> +        <property name="specialProperty" value="icedtea"/>
> +   </resources>
> +
> +  <resources>
> +    <j2se version="1.6+"/>
> +    <jar href="SignedJarResource.jar"/>
> +    <jar href="SignedJnlpResource.jar"/>
> +    <jar href="SignedJnlpMultipleJars.jar"/>
> +  </resources>
> +  <application-desc main-class="SignedJnlpApplication">
> +  </application-desc>
> +</jnlp>
> diff --git a/tests/reproducers/signed/SignedJnlpMultipleJars/srcs/SignedJnlpApplication.java b/tests/reproducers/signed/SignedJnlpMultipleJars/srcs/SignedJnlpApplication.java
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/signed/SignedJnlpMultipleJars/srcs/SignedJnlpApplication.java
> @@ -0,0 +1,56 @@
> +/* SignedJnlpApplication.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.lang.reflect.*;
> +
> +public class SignedJnlpApplication {
> +
> +    @SuppressWarnings({ "unchecked", "rawtypes" })
> +    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException,
> +            IllegalArgumentException, InvocationTargetException {
> +        System.out.println("Starting signed application in main");
> +
> +        Class c1 = Class.forName("SignedJarResource");
> +        Method m1 = c1.getDeclaredMethod("main", args.getClass());
> +        m1.invoke((Object) null, (Object) args);
> +
> +        Class c2 = Class.forName("SignedJnlpResource");
> +        Method m2 = c2.getDeclaredMethod("main", args.getClass());
> +        m2.invoke((Object) null, (Object) args);
> +
> +        System.out.println("Ending signed application in main");
> +    }
> +}
> 
> diff --git a/tests/reproducers/signed/SignedJnlpResource/resources/SignedJnlpResource.jnlp b/tests/reproducers/signed/SignedJnlpResource/resources/SignedJnlpResource.jnlp
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/signed/SignedJnlpResource/resources/SignedJnlpResource.jnlp
> @@ -0,0 +1,62 @@
> +<!--
> +
> +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.
> +
> +***********************************************************************
> +Launches signed jnlp resource by using MatchingSignedJnlpExtension
> +***********************************************************************
> + -->
> +<?xml version="1.0" encoding="utf-8"?>
> +<jnlp spec="1.0" href="SignedJnlpResource.jnlp" codebase=".">
> +  <information>
> +    <title>SignedJnlpResource</title>
> +    <vendor>IcedTea</vendor>
> +    <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
> +    <description>SignedJnlpResource</description>
> +    <offline/>
> +  </information>
> +
> +  <security>
> +      <all-permissions/>
> +  </security>
> +
> +  <resources>
> +    <j2se version="1.6+"/>
> +    <extension name="MatchingSignedJnlpExtension"   href="./MatchingSignedJnlpExtension.jnlp"/>
> +  </resources>
> +
> +  <application-desc main-class="SignedJnlpResource">
> +  </application-desc>
> +</jnlp>
> diff --git a/tests/reproducers/signed/SignedJnlpResource2/resources/MainJarWithMatchingSignedJnlpTemplate.jnlp b/tests/reproducers/signed/SignedJnlpResource2/resources/MainJarWithMatchingSignedJnlpTemplate.jnlp
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/signed/SignedJnlpResource2/resources/MainJarWithMatchingSignedJnlpTemplate.jnlp
> @@ -0,0 +1,64 @@
> +<!--
> +
> +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="MainJarWithMatchingSignedJnlpTemplate.jnlp" codebase=".">
> +  <information>
> +    <title>Matching Signed Template Value</title>
> +    <vendor>IcedTea</vendor>
> +    <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
> +    <description>Matching Signed Template Value</description>
> +    <offline/>
> +  </information>
> +
> +  <security>
> +      <all-permissions/>
> +  </security> 
> +
> +   <resources>
> +        <property name="specialProperty" value="icedtea"/>
> +   </resources>
> +
> +  <resources>
> +    <j2se version="1.6+"/>
> +    <jar href="SignedJnlpResource2.jar"/>
> +    <jar href="SignedJarResource.jar"/>
> +    <jar href="SignedJnlpResource.jar"/>
> +  </resources>
> +  <application-desc main-class="SignedJnlpApplicationTemplate">
> +  </application-desc>
> +</jnlp>
> diff --git a/tests/reproducers/signed/SignedJnlpResource2/resources/MainJarWithUnmatchingSignedJnlpTemplate.jnlp b/tests/reproducers/signed/SignedJnlpResource2/resources/MainJarWithUnmatchingSignedJnlpTemplate.jnlp
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/signed/SignedJnlpResource2/resources/MainJarWithUnmatchingSignedJnlpTemplate.jnlp
> @@ -0,0 +1,64 @@
> +<!--
> +
> +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="MainJarWithUnmatchingSignedJnlpTemplate.jnlp" codebase=".">
> +  <information>
> +    <title>DOES NOT Match Signed Jnlp Template</title>
> +    <vendor>IcedTea</vendor>
> +    <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
> +    <description>DOES NOT Match Signed Jnlp Template</description>
> +    <offline/>
> +  </information>
> +
> +  <security>
> +      <all-permissions/>
> +  </security> 
> +
> +   <resources>
> +        <property name="specialProperty" value="icedtea"/>
> +   </resources>
> +
> +  <resources>
> +    <j2se version="1.6+"/>
> +    <jar href="SignedJnlpResource2.jar"/>
> +    <jar href="SignedJarResource.jar"/>
> +    <jar href="SignedJnlpResource.jar"/>
> +  </resources>
> +  <application-desc main-class="SignedJnlpApplicationTemplate">
> +  </application-desc>
> +</jnlp>
> diff --git a/tests/reproducers/signed/SignedJnlpResource2/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp b/tests/reproducers/signed/SignedJnlpResource2/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/signed/SignedJnlpResource2/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp
> @@ -0,0 +1,64 @@
> +<!--
> +
> +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="*" codebase="*">
> +  <information>
> +    <title>Matching Signed Template Value</title>
> +    <vendor>IcedTea</vendor>
> +    <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
> +    <description>Matching Signed Template Value</description>
> +    <offline/>
> +  </information>
> +
> +  <security>
> +      <all-permissions/>
> +  </security> 
> +
> +   <resources>
> +        <property name="*" value="icedtea"/>
> +   </resources>
> +
> +  <resources>
> +    <j2se version="1.6+"/>
> +    <jar href="*"/>
> +    <jar href="*"/>
> +    <jar href="*"/>
> +  </resources>
> +  <application-desc main-class="*">
> +  </application-desc>
> +</jnlp>
> diff --git a/tests/reproducers/signed/SignedJnlpResource2/srcs/SignedJnlpApplicationTemplate.java b/tests/reproducers/signed/SignedJnlpResource2/srcs/SignedJnlpApplicationTemplate.java
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/signed/SignedJnlpResource2/srcs/SignedJnlpApplicationTemplate.java
> @@ -0,0 +1,56 @@
> +/* SignedJnlpApplicationTemplate.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.lang.reflect.*;
> +
> +public class SignedJnlpApplicationTemplate {
> +
> +    @SuppressWarnings({ "unchecked", "rawtypes" })
> +    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException,
> +            IllegalArgumentException, InvocationTargetException {
> +        System.out.println("Starting signed application_template in main");
> +
> +        Class c1 = Class.forName("SignedJarResource");
> +        Method m1 = c1.getDeclaredMethod("main", args.getClass());
> +        m1.invoke((Object) null, (Object) args);
> +
> +        Class c2 = Class.forName("SignedJnlpResource");
> +        Method m2 = c2.getDeclaredMethod("main", args.getClass());
> +        m2.invoke((Object) null, (Object) args);
> +
> +        System.out.println("Ending signed application_template in main");
> +    }
> +}





More information about the distro-pkg-dev mailing list