diff options
author | Jiri Vanek <[email protected]> | 2012-05-22 14:21:10 +0200 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2012-05-22 14:21:10 +0200 |
commit | a2cc992a123651041d9890200d8040e188fc9c96 (patch) | |
tree | b8a8c37d582ec8a20f002a5dc77867ccc2391d25 /tests/jnlp_tests/simple | |
parent | baf6d67419d5ab954dbb335962c4c9a9a2492106 (diff) |
Fixed security tests to pass both jdk6 and 7
Diffstat (limited to 'tests/jnlp_tests/simple')
8 files changed, 19 insertions, 19 deletions
diff --git a/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java b/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java index aeac369..217ed4d 100644 --- a/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java +++ b/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java @@ -51,8 +51,8 @@ public class AddShutdownHookTest { ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/AddShutdownHook.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - String s="java.security.AccessControlException: access denied (java.lang.RuntimePermission shutdownHooks)"; - Assert.assertTrue("stderr should contains "+s+" but didn't",pr.stderr.contains(s)); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "shutdownHooks" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); String cc="ClassNotFoundException"; Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); diff --git a/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java b/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java index 75d9830..6769884 100644 --- a/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java +++ b/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java @@ -53,8 +53,8 @@ public class AllStackTracesTest { ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/AllStackTraces.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - String c="java.security.AccessControlException: access denied (java.lang.RuntimePermission getStackTrace)"; - Assert.assertTrue("stderr should contains `"+c+"`, but didn't ",pr.stderr.contains(c)); + String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "getStackTrace" + ".*"; + Assert.assertTrue("stderr should match `"+c+"`, but didn't ",pr.stderr.matches(c)); String cc="ClassNotFoundException"; Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did ",pr.stderr.contains(cc)); Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); diff --git a/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java b/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java index 8e7ea7c..aa40df0 100644 --- a/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java +++ b/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java @@ -51,8 +51,8 @@ public class CreateClassLoaderTest { ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/CreateClassLoader.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - String s="java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)"; - Assert.assertTrue("Stderr should contains "+s+" but didn't",pr.stderr.contains(s)); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "createClassLoader" + ".*"; + Assert.assertTrue("Stderr should match "+s+" but didn't",pr.stderr.matches(s)); String cc="ClassNotFoundException"; Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); diff --git a/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java b/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java index b14e170..15d39a8 100644 --- a/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java +++ b/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java @@ -51,8 +51,8 @@ public class ReadEnvironmentTest { ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReadEnvironment.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - String s="java.security.AccessControlException: access denied (java.lang.RuntimePermission getenv.USER)"; - Assert.assertTrue("stderr should contains "+s+"but didn't",pr.stderr.contains(s)); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "getenv.USER" + ".*"; + Assert.assertTrue("stderr should match"+s+"but didn't",pr.stderr.matches(s)); String cc="ClassNotFoundException"; Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); diff --git a/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java b/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java index 1c22bb6..69c5244 100644 --- a/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java +++ b/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java @@ -52,8 +52,8 @@ public class ReadPropertiesTest { ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - String s="java.security.AccessControlException: access denied (java.util.PropertyPermission user.name read)"; - Assert.assertTrue("stderr should contains "+s+" but didn't",pr.stderr.contains(s)); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.name.{0,5}read" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); String cc="ClassNotFoundException"; Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); @@ -61,15 +61,15 @@ public class ReadPropertiesTest { Assert.assertEquals((Integer)0, pr.returnValue); } - @Test + @Test public void ReadPropertiesLunch2() throws Exception { System.out.println("connecting ReadProperties2 request"); System.err.println("connecting ReadProperties2 request"); ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties2.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - String s="java.security.AccessControlException: access denied (java.util.PropertyPermission user.home read)"; - Assert.assertTrue("stderr should contains "+s+" but didn't",pr.stderr.contains(s)); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.home.{0,5}read" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); String cc="ClassNotFoundException"; Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); diff --git a/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java b/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java index 31e6bcd..b030e6b 100644 --- a/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java +++ b/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java @@ -50,8 +50,8 @@ public class RedirectStreamsTest { ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/RedirectStreams.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - String s="java.security.AccessControlException: access denied (java.lang.RuntimePermission setIO)"; - Assert.assertTrue("Stderr should contains "+s+" but didn't",pr.stderr.contains(s)); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setIO" + ".*"; + Assert.assertTrue("Stderr should match "+s+" but didn't",pr.stderr.matches(s)); String cc="ClassNotFoundException"; Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); diff --git a/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java b/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java index 0e9e402..871b0ae 100644 --- a/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java +++ b/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java @@ -50,8 +50,8 @@ public class ReplaceSecurityManagerTest { ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReplaceSecurityManager.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - String s="java.security.AccessControlException: access denied (java.lang.RuntimePermission setSecurityManager)"; - Assert.assertTrue("stderr should contains "+s+" but didn't",pr.stderr.contains(s)); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setSecurityManager" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); String cc="ClassNotFoundException"; Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); diff --git a/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java b/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java index 4f7aed0..5547d32 100644 --- a/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java +++ b/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java @@ -50,8 +50,8 @@ public class SetContextClassLoaderTest { ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SetContextClassLoader.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - String s="java.security.AccessControlException: access denied (java.lang.RuntimePermission setContextClassLoader)"; - Assert.assertTrue("stderr should contains "+s+" but didn't",pr.stderr.contains(s)); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setContextClassLoader" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); String cc="ClassNotFoundException"; Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); |