changeset 1275:f53190734752

Added tests for single signed jar with manifest containing trusted-only * tests/reproducers/custom/MixedSigningAndTrustedOnly/testcases/MixedSigningAndTrustedOnly.java: added checks for complete filure and launchException * tests/reproducers/custom/MixedSigningAndTrustedOnly/testcases/MixedSigningAndTrustedOnlyBSmanifest.java: single signed jar with manifest containing trusted-only. File is same as MixedSigningAndTrustedOnlyBS1, but four reproducers of jnlpApp and jnlpApplet without security correctly dont run.
author Jiri Vanek <jvanek@redhat.com>
date Wed, 29 Jul 2015 18:08:16 +0200
parents 56dcf17761bb
children e09b5c8bf3cb
files ChangeLog tests/reproducers/custom/MixedSigningAndTrustedOnly/testcases/MixedSigningAndTrustedOnly.java tests/reproducers/custom/MixedSigningAndTrustedOnly/testcases/MixedSigningAndTrustedOnlyBSmanifest.java
diffstat 3 files changed, 210 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jul 29 15:54:18 2015 +0200
+++ b/ChangeLog	Wed Jul 29 18:08:16 2015 +0200
@@ -1,3 +1,13 @@
+2015-07-29  Jiri Vanek  <jvanek@redhat.com>
+
+	Added tests for single signed jar with manifest containing trusted-only
+	* tests/reproducers/custom/MixedSigningAndTrustedOnly/testcases/MixedSigningAndTrustedOnly.java:
+	added checks for complete filure and launchException
+	* tests/reproducers/custom/MixedSigningAndTrustedOnly/testcases/MixedSigningAndTrustedOnlyBSmanifest.java:
+	 single signed jar with manifest containing trusted-only. File is same as
+	MixedSigningAndTrustedOnlyBS1, but four reproducers of  jnlpApp and jnlpApplet
+	without security correctly don't run.
+
 2015-07-29  Jiri Vanek  <jvanek@redhat.com>
 
 	replaced Trusted-only by Trusted-Only, cosmetic change in TrustedOnlyAttribute reproducer
--- a/tests/reproducers/custom/MixedSigningAndTrustedOnly/testcases/MixedSigningAndTrustedOnly.java	Wed Jul 29 15:54:18 2015 +0200
+++ b/tests/reproducers/custom/MixedSigningAndTrustedOnly/testcases/MixedSigningAndTrustedOnly.java	Wed Jul 29 18:08:16 2015 +0200
@@ -330,6 +330,21 @@
         Assert.assertFalse(pr.stdout.contains(RESTRICTED21));
         Assert.assertFalse(pr.stdout.contains(RESTRICTED22));
     }
+    
+    static void assertLaunchException(ProcessResult pr) {
+        Assert.assertTrue(pr.stderr.contains("net.sourceforge.jnlp.LaunchException"));
+    }
+    
+     static void assertNone(ProcessResult pr) {
+        Assert.assertFalse(pr.stdout.contains(NORMAL11));
+        Assert.assertFalse(pr.stdout.contains(NORMAL12));
+        Assert.assertFalse(pr.stdout.contains(NORMAL21));
+        Assert.assertFalse(pr.stdout.contains(NORMAL22));
+        Assert.assertFalse(pr.stdout.contains(RESTRICTED11));
+        Assert.assertFalse(pr.stdout.contains(RESTRICTED12));
+        Assert.assertFalse(pr.stdout.contains(RESTRICTED21));
+        Assert.assertFalse(pr.stdout.contains(RESTRICTED22));
+    }
 
     static DeploymentPropertiesModifier setDeploymentPropertiesImpl() throws IOException {
         DeploymentPropertiesModifier q = new DeploymentPropertiesModifier();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/custom/MixedSigningAndTrustedOnly/testcases/MixedSigningAndTrustedOnlyBSmanifest.java	Wed Jul 29 18:08:16 2015 +0200
@@ -0,0 +1,185 @@
+/* 
+ 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 MixedSigningAndTrustedOnlyPackage;
+
+import net.sourceforge.jnlp.ProcessResult;
+import net.sourceforge.jnlp.ServerAccess.AutoClose;
+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.AutoErrorClosingListener;
+import net.sourceforge.jnlp.closinglisteners.AutoOkClosingListener;
+
+import org.junit.Test;
+
+import static MixedSigningAndTrustedOnlyPackage.MixedSigningAndTrustedOnly.*;
+import java.io.IOException;
+import net.sourceforge.jnlp.tools.DeploymentPropertiesModifier;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+
+/**
+ * 
+ * Very simple tests. Basic behavior. jnlp and html with single signed jar, no trusted-only  manifest 
+ */
+public class MixedSigningAndTrustedOnlyBSmanifest extends BrowserTest {
+
+
+    private static DeploymentPropertiesModifier q;
+    
+    @BeforeClass
+    public static void setDeploymentProperties() throws IOException{
+        q = setDeploymentPropertiesImpl();
+    }
+    
+    @AfterClass
+    public static void resetDeploymentPropertiesmanifest() throws IOException{
+        q.restoreProperties();
+    }
+    
+    @NeedsDisplay
+    @Test
+    @TestInBrowsers(testIn = {Browsers.one})
+    public void htmlC1AllCommandsBSmanifest() throws Exception {
+        String file = prepareFile(FileType.HTML, C1, new Archives[]{BSM},
+                new String[]{COMMAND_C1_NORMAL, COMMAND_C2_NORMAL, COMMAND_C1_RESTRICT, COMMAND_C2_RESTRICT}, false);
+        ProcessResult pr = server.executeBrowser(file, AutoClose.CLOSE_ON_BOTH);
+        assertAllOk(pr);
+    }
+    
+    @NeedsDisplay
+    @Test
+    public void jnlpHtmlC1AllCommandsBSmanifest() throws Exception {
+        String file = prepareFile(FileType.HTML, C1, new Archives[]{BSM},
+                new String[]{COMMAND_C1_NORMAL, COMMAND_C2_NORMAL, COMMAND_C1_RESTRICT, COMMAND_C2_RESTRICT}, false);
+        ProcessResult pr = server.executeJavaws(HTML, file, new AutoOkClosingListener(), new AutoErrorClosingListener());
+        assertAllOk(pr);
+    }
+
+    @Test
+    public void jnlpAppC1AllCommandsBSnosecmanifest() throws Exception {
+        String file = prepareFile(FileType.JNLP_APP, C1, new Archives[]{BSM},
+                new String[]{COMMAND_C1_NORMAL, COMMAND_C2_NORMAL, COMMAND_C1_RESTRICT, COMMAND_C2_RESTRICT}, false);
+        ProcessResult pr = server.executeJavaws(HEADLESS, file, new AutoOkClosingListener(), new AutoErrorClosingListener());
+        assertNone(pr); //trusted-only: true is prohibiting this from start at all. Signed, but not requesting all permissions.
+        //stupid, but yeah.
+        assertLaunchException(pr);
+    }
+
+    @Test
+    @NeedsDisplay
+    public void jnlpAppletC1AllCommandsBSnosecmanifest() throws Exception {
+        String file = prepareFile(FileType.JNLP_APPLET, C1, new Archives[]{BSM},
+                new String[]{COMMAND_C1_NORMAL, COMMAND_C2_NORMAL, COMMAND_C1_RESTRICT, COMMAND_C2_RESTRICT}, false);
+        ProcessResult pr = server.executeJavaws(file, new AutoOkClosingListener(), new AutoErrorClosingListener());
+        assertNone(pr); //trusted-only: true is prohibiting this from start at all. Signed, but not requesting all permissions.
+        //stupid, but yeah.
+        assertLaunchException(pr);
+    }
+
+    @Test
+    public void jnlpAppC1AllCommandsBSsecmanifest() throws Exception {
+        String file = prepareFile(FileType.JNLP_APP, C1, new Archives[]{BSM},
+                new String[]{COMMAND_C1_NORMAL, COMMAND_C2_NORMAL, COMMAND_C1_RESTRICT, COMMAND_C2_RESTRICT}, true);
+        ProcessResult pr = server.executeJavaws(HEADLESS, file, new AutoOkClosingListener(), new AutoErrorClosingListener());
+    }
+
+    @Test
+    @NeedsDisplay
+    public void jnlpAppletC1AllCommandsBSsecmanifest() throws Exception {
+        String file = prepareFile(FileType.JNLP_APPLET, C1, new Archives[]{BSM},
+                new String[]{COMMAND_C1_NORMAL, COMMAND_C2_NORMAL, COMMAND_C1_RESTRICT, COMMAND_C2_RESTRICT}, true);
+        ProcessResult pr = server.executeJavaws(file, new AutoOkClosingListener(), new AutoErrorClosingListener());
+    }
+
+    @NeedsDisplay
+    @Test
+    @TestInBrowsers(testIn = {Browsers.one})
+    public void htmlCc2llCommandsBSmanifest() throws Exception {
+        String file = prepareFile(FileType.HTML, C2, new Archives[]{BSM},
+                new String[]{COMMAND_C1_NORMAL, COMMAND_C2_NORMAL, COMMAND_C1_RESTRICT, COMMAND_C2_RESTRICT}, false);
+        ProcessResult pr = server.executeBrowser(file, AutoClose.CLOSE_ON_BOTH);
+    }
+    
+    @NeedsDisplay
+    @Test
+    public void jnlphtmlCc2llCommandsBSmanifest() throws Exception {
+        String file = prepareFile(FileType.HTML, C2, new Archives[]{BSM},
+                new String[]{COMMAND_C1_NORMAL, COMMAND_C2_NORMAL, COMMAND_C1_RESTRICT, COMMAND_C2_RESTRICT}, false);
+        ProcessResult pr = server.executeJavaws(HTML, file, new AutoOkClosingListener(), new AutoErrorClosingListener());
+    }
+
+    @Test
+    public void jnlpAppC2AllCommandsBSnosecmanifest() throws Exception {
+        String file = prepareFile(FileType.JNLP_APP, C2, new Archives[]{BSM},
+                new String[]{COMMAND_C1_NORMAL, COMMAND_C2_NORMAL, COMMAND_C1_RESTRICT, COMMAND_C2_RESTRICT}, false);
+        ProcessResult pr = server.executeJavaws(HEADLESS, file, new AutoOkClosingListener(), new AutoErrorClosingListener());
+        assertNone(pr); //trusted-only: true is prohibiting this from start at all. Signed, but not requesting all permissions.
+        //stupid, but yeah.
+        assertLaunchException(pr);
+    }
+
+    @Test
+    @NeedsDisplay
+    public void jnlpAppletC2AllCommandsBSnosecmanifest() throws Exception {
+        String file = prepareFile(FileType.JNLP_APPLET, C2, new Archives[]{BSM},
+                new String[]{COMMAND_C1_NORMAL, COMMAND_C2_NORMAL, COMMAND_C1_RESTRICT, COMMAND_C2_RESTRICT}, false);
+        ProcessResult pr = server.executeJavaws(file, new AutoOkClosingListener(), new AutoErrorClosingListener());
+        assertNone(pr); //trusted-only: true is prohibiting this from start at all. Signed, but not requesting all permissions.
+        //stupid, but yeah.
+        assertLaunchException(pr);
+    }
+
+    @Test
+    public void jnlpAppC2AllCommandsBSsecmanifest() throws Exception {
+        String file = prepareFile(FileType.JNLP_APP, C2, new Archives[]{BSM},
+                new String[]{COMMAND_C1_NORMAL, COMMAND_C2_NORMAL, COMMAND_C1_RESTRICT, COMMAND_C2_RESTRICT}, true);
+        ProcessResult pr = server.executeJavaws(HEADLESS, file, new AutoOkClosingListener(), new AutoErrorClosingListener());
+    }
+
+    @Test
+    @NeedsDisplay
+    public void jnlpAppletC2AllCommandsBSsecmanifest() throws Exception {
+        String file = prepareFile(FileType.JNLP_APPLET, C2, new Archives[]{BSM},
+                new String[]{COMMAND_C1_NORMAL, COMMAND_C2_NORMAL, COMMAND_C1_RESTRICT, COMMAND_C2_RESTRICT}, true);
+        ProcessResult pr = server.executeJavaws(file, new AutoOkClosingListener(), new AutoErrorClosingListener());
+    }
+
+
+}