diff options
author | Jiri Vanek <[email protected]> | 2011-09-15 15:27:40 +0200 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2011-09-15 15:27:40 +0200 |
commit | 451529c4953d24e031f747fe1dee6cd8b1bb7574 (patch) | |
tree | 7b8f8f44f9fc1b7ca29eea9ebec80932638f82d7 | |
parent | cf26e6d0b7e266f9866e5c608c56814e831cdb07 (diff) |
current reproducers (see changelog) done more verbose
13 files changed, 101 insertions, 56 deletions
@@ -1,3 +1,11 @@ +2011-09-15 Jiri Vanek <[email protected]> + + * tests/jnlp_tests/: all current reproducers (AccessClassInPackage + AddShutdownHook AllStackTraces CreateClassLoader deadlocktest + ReadEnvironment ReadProperties RedirectStreams ReplaceSecurityManager + SetContextClassLoader simpletest1 simpletest2) junit's asserts are enchanted + for reason, so junit assertion exception message is much clearer. + 2011-09-13 Deepak Bhole <[email protected]> PR782: Support building against npapi-sdk as well diff --git a/tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java b/tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java index 1c46a91..c1166d0 100644 --- a/tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java +++ b/tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java @@ -47,13 +47,17 @@ public class AccessClassInPackageTest { @Test public void AccessClassInPackageTestLunch1() throws Exception { System.out.println("connecting AccessClassInPackageTest request"); + System.err.println("connecting AccessClassInPackageTest request"); ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/AccessClassInPackage.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.security.internal.spec)")); - Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); - Assert.assertFalse(pr.stdout.length() > 2); - Assert.assertFalse(pr.wasTerminated); + String c="java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.security.internal.spec)"; + Assert.assertTrue("stderr should contains `"+c+"`, but didn't ",pr.stderr.contains(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); + Assert.assertFalse("AccessClassInPackageTestLunch1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer) 0, pr.returnValue); } + } diff --git a/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java b/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java index 244a9d3..aeac369 100644 --- a/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java +++ b/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java @@ -47,13 +47,16 @@ public class AddShutdownHookTest { @Test public void AddShutdownHookTestLunch1() throws Exception { System.out.println("connecting AddShutdownHook request"); + System.err.println("connecting AddShutdownHook request"); ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/AddShutdownHook.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission shutdownHooks)")); - Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); - Assert.assertFalse(pr.stdout.length() > 2); - Assert.assertFalse(pr.wasTerminated); + 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 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); + Assert.assertFalse("AddShutdownHookTestLunch1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer) 0, pr.returnValue); } } diff --git a/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java b/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java index 2ebac58..75d9830 100644 --- a/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java +++ b/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java @@ -47,15 +47,18 @@ public class AllStackTracesTest { @Test - public void AddShutdownHookTestLunch1() throws Exception { + public void AllStackTracesTest1() throws Exception { System.out.println("connecting AllStackTraces request"); + System.err.println("connecting AllStackTraces request"); ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/AllStackTraces.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission getStackTrace)")); - Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); - Assert.assertFalse(pr.stdout.length()>2); - Assert.assertFalse(pr.wasTerminated); + 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 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); + Assert.assertFalse("AllStackTracesTest1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer)0, pr.returnValue); } diff --git a/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java b/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java index 872a75a..8e7ea7c 100644 --- a/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java +++ b/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java @@ -47,13 +47,16 @@ public class CreateClassLoaderTest { @Test public void CreateClassLoaderLunch1() throws Exception { System.out.println("connecting CreateClassLoader request"); + System.err.println("connecting CreateClassLoader request"); ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/CreateClassLoader.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)")); - Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); - Assert.assertFalse(pr.stdout.length() > 2); - Assert.assertFalse(pr.wasTerminated); + 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 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); + Assert.assertFalse("CreateClassLoaderLunch1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer) 0, pr.returnValue); } } diff --git a/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java b/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java index 3e0510e..b14e170 100644 --- a/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java +++ b/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java @@ -47,13 +47,16 @@ public class ReadEnvironmentTest { @Test public void ReadEnvironmentLunch1() throws Exception { System.out.println("connecting ReadEnvironment request"); + System.err.println("connecting ReadEnvironment request"); ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReadEnvironment.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission getenv.USER)")); - Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); - Assert.assertFalse(pr.stdout.length() > 2); - Assert.assertFalse(pr.wasTerminated); + 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 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); + Assert.assertFalse("ReadEnvironmentLunch1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer) 0, pr.returnValue); } } diff --git a/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java b/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java index f316643..1c22bb6 100644 --- a/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java +++ b/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java @@ -44,31 +44,36 @@ public class ReadPropertiesTest { private static ServerAccess server = new ServerAccess(); - - + @Test public void ReadPropertiesLunch1() throws Exception { - System.out.println("connecting ReadProperties request"); + System.out.println("connecting ReadProperties1 request"); + System.err.println("connecting ReadProperties1 request"); ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.util.PropertyPermission user.name read)")); - Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); - Assert.assertFalse(pr.stdout.length()>2); - Assert.assertFalse(pr.wasTerminated); + 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 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); + Assert.assertFalse("ReadPropertiesLunch1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer)0, pr.returnValue); } @Test public void ReadPropertiesLunch2() throws Exception { - System.out.println("connecting ReadProperties request"); + 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); - Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.util.PropertyPermission user.home read)")); - Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); - Assert.assertFalse(pr.stdout.length()>2); - Assert.assertFalse(pr.wasTerminated); + 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 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); + Assert.assertFalse("ReadPropertiesLunch2 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer)0, pr.returnValue); } } diff --git a/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java b/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java index 8042fc6..31e6bcd 100644 --- a/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java +++ b/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java @@ -44,15 +44,18 @@ public class RedirectStreamsTest { private static ServerAccess server = new ServerAccess(); @Test - public void ReadPropertiesLunch1() throws Exception { + public void RedirectStreamsTest1() throws Exception { System.out.println("connecting RedirectStreams request"); + System.err.println("connecting RedirectStreams request"); ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/RedirectStreams.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission setIO)")); - Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); - Assert.assertFalse(pr.stdout.length() > 2); - Assert.assertFalse(pr.wasTerminated); + 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 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); + Assert.assertFalse("RedirectStreams should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer) 0, pr.returnValue); } } diff --git a/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java b/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java index bbd8faa..0e9e402 100644 --- a/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java +++ b/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java @@ -45,14 +45,17 @@ public class ReplaceSecurityManagerTest { @Test public void ReplaceSecurityManagerLunch1() throws Exception { - System.out.println("connecting RedirectStreams request"); + System.out.println("connecting ReplaceSecurityManager request"); + System.err.println("connecting ReplaceSecurityManager request"); ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReplaceSecurityManager.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission setSecurityManager)")); - Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); - Assert.assertFalse(pr.stdout.length() > 2); - Assert.assertFalse(pr.wasTerminated); + 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 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); + Assert.assertFalse("ReplaceSecurityManagerLunch1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer) 0, pr.returnValue); } } diff --git a/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java b/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java index cceabe4..4f7aed0 100644 --- a/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java +++ b/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java @@ -45,14 +45,17 @@ public class SetContextClassLoaderTest { @Test public void SetContextClassLoader1() throws Exception { - System.out.println("connecting RedirectStreams request"); + System.out.println("connecting SetContextClassLoader request"); + System.err.println("connecting SetContextClassLoader request"); ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SetContextClassLoader.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - Assert.assertTrue(pr.stderr.contains("java.security.AccessControlException: access denied (java.lang.RuntimePermission setContextClassLoader)")); - Assert.assertFalse(pr.stderr.contains("ClassNotFoundException")); - Assert.assertFalse(pr.stdout.length() > 2); - Assert.assertFalse(pr.wasTerminated); + 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 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); + Assert.assertFalse("SetContextClassLoader1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer) 0, pr.returnValue); } } diff --git a/tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java b/tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java index ce8c7b5..fa823f0 100644 --- a/tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java +++ b/tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java @@ -49,12 +49,13 @@ public class DeadLockTestTest { @Test public void testDeadLockTestTerminated() throws Exception { System.out.println("connecting deadlocktest request"); + System.err.println("connecting deadlocktest request"); ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/deadlocktest.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); Assert.assertFalse(pr.stdout.contains("This process is hanging more then 30s. Should be killed")); // Assert.assertTrue(pr.stderr.contains("xception"));, exception is thrown by engine,not by application - Assert.assertTrue(pr.wasTerminated); + Assert.assertTrue("testDeadLockTestTerminated should be terminated, but wasn't",pr.wasTerminated); Assert.assertEquals(null, pr.returnValue);//killed process have no value } diff --git a/tests/jnlp_tests/simple/simpletest1/testcases/SimpleTest1Test.java b/tests/jnlp_tests/simple/simpletest1/testcases/SimpleTest1Test.java index 04181ab..6c15791 100644 --- a/tests/jnlp_tests/simple/simpletest1/testcases/SimpleTest1Test.java +++ b/tests/jnlp_tests/simple/simpletest1/testcases/SimpleTest1Test.java @@ -50,11 +50,14 @@ public class SimpleTest1Test { @Test public void testSimpletest1lunchOk() throws Exception { System.out.println("connecting simpletest1 request"); + System.err.println("connecting simpletest1 request"); ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/simpletest1.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - Assert.assertTrue(pr.stdout.contains("Good simple javaws exapmle")); - Assert.assertFalse(pr.stderr.contains("xception")); + String s="Good simple javaws exapmle"; + Assert.assertTrue("testSimpletest1lunchOk stdout should contains "+s+" bud didn't",pr.stdout.contains(s)); + String ss="xception"; + Assert.assertFalse("testSimpletest1lunchOk stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); Assert.assertFalse(pr.wasTerminated); Assert.assertEquals((Integer)0, pr.returnValue); } @@ -63,4 +66,4 @@ public class SimpleTest1Test { - }
\ No newline at end of file + } diff --git a/tests/jnlp_tests/simple/simpletest2/testcases/SimpleTest2Test.java b/tests/jnlp_tests/simple/simpletest2/testcases/SimpleTest2Test.java index 4c376ea..1e0843f 100644 --- a/tests/jnlp_tests/simple/simpletest2/testcases/SimpleTest2Test.java +++ b/tests/jnlp_tests/simple/simpletest2/testcases/SimpleTest2Test.java @@ -48,13 +48,16 @@ public class SimpleTest2Test { @Test public void testSimpletest2lunchException() throws Exception { System.out.println("connecting simpletest2 request"); + System.err.println("connecting simpletest2 request"); ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/simpletest2.jnlp"); System.out.println(pr.stdout); System.err.println(pr.stderr); - Assert.assertTrue(pr.stdout.trim().length() < 1); - Assert.assertTrue(pr.stderr.contains("Correct exception")); - Assert.assertTrue(pr.stderr.contains("Exception")); - Assert.assertFalse(pr.wasTerminated); + Assert.assertTrue("stdout should be < 1 , but was "+pr.stdout.trim().length(),pr.stdout.trim().length() < 1); + String s="Correct exception"; + Assert.assertTrue("stderr should contains "+s+" but didn't",pr.stderr.contains(s)); + String ss="Exception"; + Assert.assertTrue("stderr should contains "+ss+" but did not",pr.stderr.contains(ss)); + Assert.assertFalse("testSimpletest2lunchException should not be terminated, but was",pr.wasTerminated); //Assert.assertFalse(0==pr.returnValue);exception and still returned 0? } |