diff options
author | Jiri Vanek <[email protected]> | 2013-11-25 16:54:23 +0100 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2013-11-25 16:54:23 +0100 |
commit | b8da03fd7a7aac183acebf7ccd26196ccafca9bc (patch) | |
tree | 945106c698d36e154761be126d24fd53848bccd7 | |
parent | 18e9c2de7a762336e0b558f3007340d5eb2e9e44 (diff) |
Removed most of checks to no output from reproducers
15 files changed, 59 insertions, 33 deletions
@@ -1,5 +1,27 @@ 2013-11-25 Jiri Vanek <[email protected]> + * netx/net/sourceforge/jnlp/JNLPFile.java: (TITLE_NOT_FOUND) new constant + holding the no title found string to be reused. (getTitleFromManifest) + Now using that constant. + * netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java: adding window + erro message moved to be debug only. + * ests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java: + Added (clean) mechanism to filter out TITLE_NOT_FOUND + * tests/reproducers/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java: + * tests/reproducers/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java: + * tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java: + * tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java + * tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java + * tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java + * tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java + * tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java + * tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java + * tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java + * tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java + Removed checks for emty outputs + +2013-11-25 Jiri Vanek <[email protected]> + * netx/net/sourceforge/jnlp/ResourcesDesc.java: (getMainJAR) throw an RuntimeException when more then one main jar is specified. Preventing app to start. diff --git a/netx/net/sourceforge/jnlp/JNLPFile.java b/netx/net/sourceforge/jnlp/JNLPFile.java index 65c4538..acf510f 100644 --- a/netx/net/sourceforge/jnlp/JNLPFile.java +++ b/netx/net/sourceforge/jnlp/JNLPFile.java @@ -134,6 +134,8 @@ public class JNLPFile { /** important manifests' attributes */ private final ManifestsAttributes manifestsAttributes = new ManifestsAttributes(); + public static final String TITLE_NOT_FOUND = "Application title was not found in manifest. Check with application vendor"; + { // initialize defaults if security allows try { @@ -340,7 +342,7 @@ public class JNLPFile { public String getTitleFromManifest() { String inManifestTitle = getManifestsAttributes().getApplicationName(); if (inManifestTitle == null && getManifestsAttributes().isLoader()){ - OutputController.getLogger().log(OutputController.Level.WARNING_ALL,"Application title was not found in manifest. Check with application vendor"); + OutputController.getLogger().log(OutputController.Level.WARNING_ALL, TITLE_NOT_FOUND); } return inManifestTitle; } diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java index d3ba810..dc1989a 100644 --- a/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java +++ b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java @@ -344,7 +344,7 @@ class JNLPSecurityManager extends AWTSecurityManager { if (app != null && window instanceof Window) { Window w = (Window) window; - OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "SM: app: " + app.getTitle() + " is adding a window: " + window + " with appContext " + AppContext.getAppContext()); + OutputController.getLogger().log(OutputController.Level.ERROR_DEBUG, "SM: app: " + app.getTitle() + " is adding a window: " + window + " with appContext " + AppContext.getAppContext()); weakWindows.add(w); // for mapping window -> app weakApplications.add(app); diff --git a/tests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java b/tests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java index 40beca0..053e8fa 100644 --- a/tests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java +++ b/tests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java @@ -37,6 +37,7 @@ import java.net.MalformedURLException; import java.net.URL; +import net.sourceforge.jnlp.JNLPFile; import net.sourceforge.jnlp.ProcessResult; import org.junit.Assert; import org.junit.Test; @@ -70,6 +71,9 @@ public class RemoteApplicationSettings { URL u; + public String clean(String s){ + return s.replaceAll("\\s*" + JNLPFile.TITLE_NOT_FOUND + "\\s*", "").trim(); + } @Override public URL getUrl() { return u; @@ -88,8 +92,8 @@ public class RemoteApplicationSettings { @Override public void evaluate(ProcessResult pr) { - Assert.assertTrue(stdoutEmpty, pr.stdout.length() == 0); - Assert.assertTrue(pr.stderr.length() == 0 || pr.stderr.contains(IllegalStateException.class.getName())); + Assert.assertTrue(stdoutEmpty, clean(pr.stdout).length() == 0); + Assert.assertTrue(clean(pr.stderr).length() == 0 || pr.stderr.contains(IllegalStateException.class.getName())); } } @@ -102,8 +106,8 @@ public class RemoteApplicationSettings { @Override public void evaluate(ProcessResult pr) { - Assert.assertTrue(stdoutEmpty, pr.stdout.length() == 0); - Assert.assertTrue(pr.stderr.length() == 0 || pr.stderr.contains("Cannot grant permissions to unsigned jars. Application requested security permissions, but jars are not signed")); + Assert.assertTrue(stdoutEmpty, clean(pr.stdout).length() == 0); + Assert.assertTrue(clean(pr.stderr).length() == 0 || pr.stderr.contains("Cannot grant permissions to unsigned jars. Application requested security permissions, but jars are not signed")); } } @@ -116,7 +120,7 @@ public class RemoteApplicationSettings { @Override public void evaluate(ProcessResult pr) { - Assert.assertTrue(stdout, pr.stdout.length() == 0); + Assert.assertTrue(stdout, clean(pr.stdout).length() == 0); Assert.assertTrue(pr.stderr.contains("Splash closed")); Assert.assertFalse(pr.stderr.contains("Exception")); @@ -131,10 +135,8 @@ public class RemoteApplicationSettings { @Override public void evaluate(ProcessResult pr) { - Assert.assertTrue(pr.stdout.length() > 0); - Assert.assertTrue(pr.stderr.length() > 0); - Assert.assertFalse(pr.stderr.contains("Exception")); - Assert.assertFalse(pr.stdout.contains("Exception")); + Assert.assertTrue(pr.stdout.length() == 0); + Assert.assertTrue(pr.stderr.length() == 0); } } @@ -153,35 +155,49 @@ public class RemoteApplicationSettings { } } - public static class Arbores extends NoOutputs { + public abstract static class NearlyNoOutputs extends StringBasedURL { + + public NearlyNoOutputs(String r) { + super(r); + } + + @Override + public void evaluate(ProcessResult pr) { + Assert.assertTrue(stdoutEmpty, clean(pr.stdout).length() == 0); + Assert.assertTrue(stderrEmpty, clean(pr.stderr).length() == 0); + + } + } + + public static class Arbores extends NearlyNoOutputs { public Arbores() { super("http://www.arbores.ca/AnnuityCalc.jnlp"); } } - public static class PhetSims extends NoOutputs { + public static class PhetSims extends NearlyNoOutputs { public PhetSims() { super("http://phetsims.colorado.edu/sims/circuit-construction-kit/circuit-construction-kit-dc_en.jnlp"); } } - public static class TopCoder extends NoOutputs { + public static class TopCoder extends NearlyNoOutputs { public TopCoder() { super("http://www.topcoder.com/contest/arena/ContestAppletProd.jnlp"); } } - public static class SunSwingDemo extends NoOutputs { + public static class SunSwingDemo extends NearlyNoOutputs { public SunSwingDemo() throws MalformedURLException { super("http://java.sun.com/docs/books/tutorialJWS/uiswing/events/ex6/ComponentEventDemo.jnlp"); } } - public static class ArboresDeposit extends NoOutputs { + public static class ArboresDeposit extends NearlyNoOutputs { public ArboresDeposit() throws MalformedURLException { super("http://www.arbores.ca/Deposit.jnlp"); @@ -192,8 +208,8 @@ public class RemoteApplicationSettings { @Override public void evaluate(ProcessResult pr) { - Assert.assertTrue(stdoutEmpty, pr.stdout.length() == 0); - Assert.assertTrue(pr.stderr.length() == 0 || (pr.stderr.contains("Cannot read File Manager history data file,") + Assert.assertTrue(stdoutEmpty, clean(pr.stdout).length() == 0); + Assert.assertTrue(clean(pr.stderr).length() == 0 || (clean(pr.stderr).contains("Cannot read File Manager history data file,") && pr.stderr.contains("FileMgr will be initialized with default options"))); } @@ -203,7 +219,7 @@ public class RemoteApplicationSettings { } } - public static class FuseSwing extends NoOutputs { + public static class FuseSwing extends NearlyNoOutputs { public FuseSwing() { super("http://www.progx.org/users/Gfx/apps/fuse-swing-demo.jnlp"); diff --git a/tests/reproducers/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java b/tests/reproducers/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java index e0d9488..dc69a26 100644 --- a/tests/reproducers/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java +++ b/tests/reproducers/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java @@ -58,7 +58,6 @@ public class ReadPropertiesBySignedHackTest { Assert.assertTrue("Stderr should contains "+s+" but did not",pr.stderr.contains(s)); String ss="ClassNotFoundException"; Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); - Assert.assertTrue("stdout lenght should be <2 but was "+pr.stdout.length(),pr.stdout.length()<2); // /home/user or /root or eanything else :( Assert.assertFalse("should not be terminated but was",pr.wasTerminated); Assert.assertEquals((Integer)0, pr.returnValue); } diff --git a/tests/reproducers/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java b/tests/reproducers/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java index ee74183..9c1b6fa 100644 --- a/tests/reproducers/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java +++ b/tests/reproducers/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java @@ -58,7 +58,6 @@ public class ReadPropertiesSignedTest { Assert.assertTrue("Stderr should match "+accessMatcher+" but did not",pr.stderr.matches(accessMatcher)); String ss="ClassNotFoundException"; Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); - Assert.assertTrue("stdout lenght should be <2 but was "+pr.stdout.length(),pr.stdout.length()<2); // /home/user or /root or eanything else :( Assert.assertFalse("should not be terminated but was",pr.wasTerminated); Assert.assertEquals((Integer)0, pr.returnValue); } @@ -70,7 +69,6 @@ public class ReadPropertiesSignedTest { Assert.assertFalse("Stderr should NOT match "+accessMatcher+" but did",pr.stderr.matches(accessMatcher)); String ss="ClassNotFoundException"; Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); - Assert.assertTrue("stdout lenght should be >= but was "+pr.stdout.length(),pr.stdout.length()>=4); // /home/user or /root or eanything else :( Assert.assertFalse("should not be terminated but was",pr.wasTerminated); Assert.assertEquals((Integer)0, pr.returnValue); } @@ -81,7 +79,6 @@ public class ReadPropertiesSignedTest { Assert.assertTrue("Stderr should match "+accessMatcher+" but did not",pr.stderr.matches(accessMatcher)); String ss="ClassNotFoundException"; Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); - Assert.assertFalse("stdout lenght should not be >2 but was "+pr.stdout.length(),pr.stdout.length()>2); Assert.assertFalse("should not be terminated but was",pr.wasTerminated); Assert.assertEquals((Integer)0, pr.returnValue); ProcessResult pr2=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp"); diff --git a/tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java b/tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java index a83cc08..c95b5ff 100644 --- a/tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java +++ b/tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java @@ -61,7 +61,6 @@ public class AddShutdownHookTest extends BrowserTest { ProcessResult pr = server.executeJavawsHeadless(null, "/AddShutdownHook.jnlp"); Assert.assertTrue("stderr " + mr.toPassingString(), mr.evaluate(pr.stderr)); Assert.assertFalse("stderr " + cnf.toFailingString(), cnf.evaluate(pr.stderr)); - 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.assertFalse("stderr " + cf.toFailingString(), cf.evaluate(pr.stderr)); Assert.assertEquals((Integer) 0, pr.returnValue); diff --git a/tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java b/tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java index cb0f92e..37a99f8 100644 --- a/tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java +++ b/tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java @@ -54,7 +54,6 @@ public class AllStackTracesTest { 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); Assert.assertFalse("AllStackTracesTest1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer)0, pr.returnValue); } diff --git a/tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java b/tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java index 2de9f5a..91babeb 100644 --- a/tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java +++ b/tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java @@ -52,7 +52,6 @@ public class CreateClassLoaderTest { 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); Assert.assertFalse("CreateClassLoaderLunch1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer) 0, pr.returnValue); } diff --git a/tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java b/tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java index a755944..f44b0b1 100644 --- a/tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java +++ b/tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java @@ -51,7 +51,6 @@ public class ReadEnvironmentTest { 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); Assert.assertFalse("ReadEnvironmentLunch1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer) 0, pr.returnValue); } diff --git a/tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java b/tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java index 9244529..6398b80 100644 --- a/tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java +++ b/tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java @@ -52,7 +52,6 @@ public class ReadPropertiesTest { 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); Assert.assertFalse("ReadPropertiesLunch1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer)0, pr.returnValue); } @@ -64,7 +63,6 @@ public class ReadPropertiesTest { 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); Assert.assertFalse("ReadPropertiesLunch2 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer)0, pr.returnValue); } diff --git a/tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java b/tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java index 71934e5..d9d952d 100644 --- a/tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java +++ b/tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java @@ -51,7 +51,6 @@ public class RedirectStreamsTest { 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); Assert.assertFalse("RedirectStreams should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer) 0, pr.returnValue); } diff --git a/tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java b/tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java index 6ea120c..518a24c 100644 --- a/tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java +++ b/tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java @@ -51,7 +51,6 @@ public class ReplaceSecurityManagerTest { 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); Assert.assertFalse("ReplaceSecurityManagerLunch1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer) 0, pr.returnValue); } diff --git a/tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java b/tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java index 0796db7..f2d2648 100644 --- a/tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java +++ b/tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java @@ -51,7 +51,6 @@ public class SetContextClassLoaderTest { 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); Assert.assertFalse("SetContextClassLoader1 should not be terminated, but was",pr.wasTerminated); Assert.assertEquals((Integer) 0, pr.returnValue); } diff --git a/tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java b/tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java index 16dffb4..e0131aa 100644 --- a/tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java +++ b/tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java @@ -49,7 +49,6 @@ public class SimpleTest2Test { @Test public void testSimpletest2lunchException() throws Exception { ProcessResult pr=server.executeJavawsHeadless(null,"/simpletest2.jnlp"); - 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"; |