changeset 932:71a87178ff7e

JNLPClassLoaderTest.java: adapted to permissions attribute
author Jiri Vanek <jvanek@redhat.com>
date Thu, 13 Mar 2014 16:43:45 +0100
parents fdcb91be0d58
children abec2ce76cdb
files ChangeLog tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java
diffstat 2 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Mar 13 16:39:04 2014 +0100
+++ b/ChangeLog	Thu Mar 13 16:43:45 2014 +0100
@@ -1,3 +1,8 @@
+2014-03-13  Jiri Vanek  <jvanek@redhat.com>
+
+	* tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java: adapted
+	to permissions attribute 
+
 2014-03-13  Jiri Vanek  <jvanek@redhat.com>
 
 	Fixing rear deadlock issue
--- a/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java	Thu Mar 13 16:39:04 2014 +0100
+++ b/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java	Thu Mar 13 16:43:45 2014 +0100
@@ -48,15 +48,44 @@
 
 import net.sourceforge.jnlp.LaunchException;
 import net.sourceforge.jnlp.cache.UpdatePolicy;
+import net.sourceforge.jnlp.config.DeploymentConfiguration;
 import net.sourceforge.jnlp.mock.DummyJNLPFileWithJar;
+import net.sourceforge.jnlp.security.appletextendedsecurity.AppletSecurityLevel;
+import net.sourceforge.jnlp.security.appletextendedsecurity.AppletStartupSecuritySettings;
 import net.sourceforge.jnlp.util.FileTestUtils;
 import net.sourceforge.jnlp.util.logging.NoStdOutErrTest;
+import org.junit.AfterClass;
 import org.junit.Assert;
+import org.junit.BeforeClass;
 
 import org.junit.Test;
 
 public class JNLPClassLoaderTest extends NoStdOutErrTest{
 
+    private static AppletSecurityLevel level;
+    public static String askUser;
+    
+    
+    @BeforeClass
+    public static void setPermissions() {
+        level = AppletStartupSecuritySettings.getInstance().getSecurityLevel();
+        JNLPRuntime.getConfiguration().setProperty(DeploymentConfiguration.KEY_SECURITY_LEVEL, AppletSecurityLevel.ALLOW_UNSIGNED.toChars());
+    }
+
+    @AfterClass
+    public static void resetPermissions() {
+        JNLPRuntime.getConfiguration().setProperty(DeploymentConfiguration.KEY_SECURITY_LEVEL, level.toChars());
+    }
+    @BeforeClass
+    public static void noDialogs(){
+        askUser = JNLPRuntime.getConfiguration().getProperty(DeploymentConfiguration.KEY_SECURITY_PROMPT_USER); 
+       JNLPRuntime.getConfiguration().setProperty(DeploymentConfiguration.KEY_SECURITY_PROMPT_USER, Boolean.toString(false)); 
+    }
+    
+    @AfterClass
+    public static void restoreDialogs(){
+       JNLPRuntime.getConfiguration().setProperty(DeploymentConfiguration.KEY_SECURITY_PROMPT_USER, askUser); 
+    }
     /* Note: Only does file leak testing for now. */
     @Test
     public void constructorFileLeakTest() throws Exception {