aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--tests/jnlp_tests/signed/AppletTestSigned/testcases/AppletTestSignedTests.java8
-rw-r--r--tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java14
-rw-r--r--tests/jnlp_tests/signed/MissingJar/testcases/MissingJarTest.java12
-rw-r--r--tests/jnlp_tests/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java4
-rw-r--r--tests/jnlp_tests/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java12
-rw-r--r--tests/jnlp_tests/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java49
-rw-r--r--tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java32
-rw-r--r--tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java4
-rw-r--r--tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java4
-rw-r--r--tests/jnlp_tests/simple/AppletTest/testcases/AppletTestTests.java8
-rw-r--r--tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java4
-rw-r--r--tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java4
-rw-r--r--tests/jnlp_tests/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java4
-rw-r--r--tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java40
-rw-r--r--tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java4
-rw-r--r--tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java8
-rw-r--r--tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java4
-rw-r--r--tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java4
-rw-r--r--tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java4
-rw-r--r--tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java48
-rw-r--r--tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java74
-rw-r--r--tests/jnlp_tests/simple/simpletest1/testcases/SimpleTest1Test.java10
-rw-r--r--tests/jnlp_tests/simple/simpletest2/testcases/SimpleTest2Test.java4
-rw-r--r--tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java93
-rw-r--r--tests/netx/unit/net/sourceforge/jnlp/cache/CacheLRUWrapperTest.java3
-rw-r--r--tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java9
-rw-r--r--tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java5
28 files changed, 155 insertions, 332 deletions
diff --git a/ChangeLog b/ChangeLog
index a9eb326..73a9e82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2012-05-20 Jiri Vanek <[email protected]>
+
+ Get rid of repeated sout/serr in reproducers testcases/unit tests and
+ introduce bottleneck for loging.
+ * tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java:
+ (PROCESS_LOG) static flag for enabling/disabling automatic logging of
+ statically executed processes.
+ (logErrorReprint) (logOutputReprint) (logNoReprint) new methods, to call
+ logging bottleneck.
+ (log) main logging bottleneck, reprint message to according stream with
+ calling test-class and test-method as suffix.
+ (getTestMethod) new method to analyze calling test-method.
+ (executeProcess) enhanced for conditional automatic logging of start of
+ process and outputs of process.
+ * /tests/jnlp_tests/*/*/testcases/*.java : and
+ * /tests/netx/unit/**.java: all System.out replaced by ServerAccess.logOutputReprint
+ and System.err replaced by ServerAccess.logErrorReprint
+
2012-05-25 Adam Domurad <[email protected]>
Changed for-loops over iterators and indices to for-each loops if they
diff --git a/tests/jnlp_tests/signed/AppletTestSigned/testcases/AppletTestSignedTests.java b/tests/jnlp_tests/signed/AppletTestSigned/testcases/AppletTestSignedTests.java
index 15682c5..3fe1886 100644
--- a/tests/jnlp_tests/signed/AppletTestSigned/testcases/AppletTestSignedTests.java
+++ b/tests/jnlp_tests/signed/AppletTestSigned/testcases/AppletTestSignedTests.java
@@ -51,11 +51,7 @@ public class AppletTestSignedTests {
@Test
public void AppletTestSignedTest() throws Exception {
- System.out.println("connecting AppletTestSigned request");
- System.err.println("connecting AppletTestSigned request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/AppletTestSigned.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
evaluateSignedApplet(pr);
Assert.assertFalse(pr.wasTerminated);
Assert.assertEquals((Integer) 0, pr.returnValue);
@@ -82,13 +78,9 @@ public class AppletTestSignedTests {
@Test
public void AppletTestSignedFirefoxTest() throws Exception {
- System.out.println("connecting AppletTestSigned in firefox request");
- System.err.println("connecting AppletTestSigned in firefox request");
ServerAccess.PROCESS_TIMEOUT = 30 * 1000;
try {
ServerAccess.ProcessResult pr = server.executeBrowser("/AppletTestSigned.html");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
evaluateSignedApplet(pr);
Assert.assertTrue(pr.wasTerminated);
//Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null
diff --git a/tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java b/tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java
index 9b1fe29..76a8cc8 100644
--- a/tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java
+++ b/tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java
@@ -258,11 +258,7 @@ public class CacheReproducerTest {
@Override
public void run() {
try {
- System.out.println("connecting deadlocktest request");
- System.err.println("connecting deadlocktest request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(verbosed, "/deadlocktest.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
@@ -271,8 +267,6 @@ public class CacheReproducerTest {
t.start();
Thread.sleep(1000);
pr = tryToClearcache();
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String q = "Can not clear cache at this time";
Assert.assertTrue("Stderr should contain " + q + ", but did not.", pr.stderr.contains(q));
assertCacheIsNotEmpty();
@@ -338,8 +332,6 @@ public class CacheReproducerTest {
}
private static void clearAndEvaluateCache(boolean force) throws Exception {
- System.out.println("clearing cache");
- System.err.println("clearing cache");
if (force) {
if (netxLock.isFile()) {
boolean b = netxLock.delete();
@@ -458,11 +450,7 @@ public class CacheReproducerTest {
}
private static ServerAccess.ProcessResult runSimpleTest1(List<String> args, String s) throws Exception {
- System.out.println("connecting " + s + " request");
- System.err.println("connecting " + s + " request");
ServerAccess.ProcessResult pr2 = server.executeJavawsHeadless(args, "/" + s + ".jnlp");
- System.out.println(pr2.stdout);
- System.err.println(pr2.stderr);
return pr2;
}
@@ -483,8 +471,6 @@ public class CacheReproducerTest {
private static ProcessResult tryToClearcache() throws Exception {
ServerAccess.ProcessResult pr1 = ServerAccess.executeProcess(clear);
- System.out.println(pr1.stdout);
- System.err.println(pr1.stderr);
return pr1;
}
}
diff --git a/tests/jnlp_tests/signed/MissingJar/testcases/MissingJarTest.java b/tests/jnlp_tests/signed/MissingJar/testcases/MissingJarTest.java
index df23788..dc8bb77 100644
--- a/tests/jnlp_tests/signed/MissingJar/testcases/MissingJarTest.java
+++ b/tests/jnlp_tests/signed/MissingJar/testcases/MissingJarTest.java
@@ -50,8 +50,6 @@ public class MissingJarTest {
private final List<String> l = Collections.unmodifiableList(Arrays.asList(new String[]{"-Xtrustall"}));
private void evaluateResult(ProcessResult pr) {
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String c = "only fixed classloader can initialize this app";
Assert.assertTrue("stdout should contains `" + c + "`, but didn't ", pr.stdout.contains(c));
String cc = "ClassNotFoundException";
@@ -62,33 +60,25 @@ public class MissingJarTest {
@Test
public void MissingJarTest1() throws Exception {
- System.out.println("connecting MissingJar1 request");
- System.err.println("connecting MissingJar1 request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar.jnlp");
evaluateResult(pr);
}
@Test
public void MissingJarTest2() throws Exception {
- System.out.println("connecting MissingJar2 request");
- System.err.println("connecting MissingJar2 request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar2.jnlp");
evaluateResult(pr);
}
@Test
public void MissingJarTest3() throws Exception {
- System.out.println("connecting MissingJar3 request");
- System.err.println("connecting MissingJar3 request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar3.jnlp");
evaluateResult(pr);
}
@Test
public void MissingJarTest4() throws Exception {
- System.out.println("connecting MissingJar4 request");
- System.err.println("connecting MissingJar4 request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar4.jnlp");
evaluateResult(pr);
}
-} \ No newline at end of file
+}
diff --git a/tests/jnlp_tests/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java b/tests/jnlp_tests/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java
index 9fbd62e..8f9455d 100644
--- a/tests/jnlp_tests/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java
+++ b/tests/jnlp_tests/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java
@@ -52,11 +52,7 @@ public class ReadPropertiesBySignedHackTest {
@Test
public void ReadPropertiesBySignedHackWithjoutXtrustAll() throws Exception {
//no request for permissions
- System.out.println("connecting ReadPropertiesBySignedHack request");
- System.err.println("connecting ReadPropertiesBySignedHack request");
ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadPropertiesBySignedHack.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="java.lang.SecurityException: class \"ReadProperties\"'s signer information does not match signer information of other classes in the same package";
Assert.assertTrue("Stderr should contains "+s+" but did not",pr.stderr.contains(s));
String ss="ClassNotFoundException";
diff --git a/tests/jnlp_tests/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java b/tests/jnlp_tests/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java
index 8b62925..6b389e3 100644
--- a/tests/jnlp_tests/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java
+++ b/tests/jnlp_tests/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java
@@ -53,11 +53,7 @@ public class ReadPropertiesSignedTest {
@Test
public void ReadSignedPropertiesWithoutPermissionsWithXtrustAll() throws Exception {
//no request for permissions
- System.out.println("connecting ReadPropertiesSigned1 request");
- System.err.println("connecting ReadPropertiesSigned1 request");
ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadPropertiesSigned1.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
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));
@@ -69,11 +65,7 @@ public class ReadPropertiesSignedTest {
@Test
public void ReadSignedPropertiesWithPermissionsWithXtrustAll() throws Exception {
//request for allpermissions
- System.out.println("connecting ReadPropertiesSigned2 request");
- System.err.println("connecting ReadPropertiesSigned2 request");
ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadPropertiesSigned2.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
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));
@@ -84,11 +76,7 @@ public class ReadPropertiesSignedTest {
@Test
public void EnsureXtrustallNotAffectingUnsignedBehaviour() throws Exception {
- System.err.println("connecting ReadPropertiesSigned3 request");
- System.out.println("connecting ReadPropertiesSigned3 request");
ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadProperties1.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
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));
diff --git a/tests/jnlp_tests/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java b/tests/jnlp_tests/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java
index 03fcfe0..658876d 100644
--- a/tests/jnlp_tests/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java
+++ b/tests/jnlp_tests/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java
@@ -53,8 +53,6 @@ public class SpacesCanBeEverywhereTestsSigned {
@Test
@NeedsDisplay
public void SpacesCanBeEverywhereLocalAppletTestsJnlp2Signed() throws Exception {
- System.out.println("connecting NotOnly spaces can kill ěščřž too signed.jnlp request");
- System.err.println("connecting NotOnly spaces can kill ěščřž too signed.jnlp request");
List<String> commands=new ArrayList<String>(1);
commands.add(server.getJavawsLocation());
commands.add(server.getDir()+"/NotOnly spaces can kill ěščřž too signed.jnlp");
@@ -83,8 +81,6 @@ public class SpacesCanBeEverywhereTestsSigned {
* only on ocal files, and probably only from test run - it can be ignored
*/
ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands);
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Signed spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "xception";
@@ -97,11 +93,7 @@ public class SpacesCanBeEverywhereTestsSigned {
@Test
@NeedsDisplay
public void SpacesCanBeEverywhereRemoteAppletTestsJnlp2Signed() throws Exception {
- System.out.println("connecting NotOnly spaces can kill ěščřž too signed.jnlp request");
- System.err.println("connecting NotOnly spaces can kill ěščřž too signed.jnlp request");
ServerAccess.ProcessResult pr = server.executeJavaws("/NotOnly%20spaces%20can%20kill%20%C4%9B%C5%A1%C4%8D%C5%99%C5%BE%20too%20signed.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Signed spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "xception";
@@ -113,11 +105,7 @@ public class SpacesCanBeEverywhereTestsSigned {
@Test
@NeedsDisplay
public void SpacesCanBeEverywhereRemoteAppletTestsHtml2Signed() throws Exception {
- System.out.println("connecting spaces applet Tests signed.html request");
- System.err.println("connecting spaces applet Tests signed.html request");
ServerAccess.ProcessResult pr = server.executeBrowser("/spaces+applet+Tests+signed.html");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Signed spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "xception";
@@ -129,11 +117,7 @@ public class SpacesCanBeEverywhereTestsSigned {
@Bug(id={"PR811","http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016144.html"})
@Test
public void SpacesCanBeEverywhereRemoteTests1Signed() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereRemoteTests1 signed request");
- System.err.println("connecting SpacesCanBeEverywhereRemoteTests1 signed request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere1%20signed.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s = "Good simple javaws exapmle";
Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -145,11 +129,7 @@ public class SpacesCanBeEverywhereTestsSigned {
@Bug(id="PR811")
@Test
public void SpacesCanBeEverywhereRemoteTests2Signed() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereRemoteTests2 signed request");
- System.err.println("connecting SpacesCanBeEverywhereRemoteTests2 signed request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Signed spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -161,11 +141,7 @@ public class SpacesCanBeEverywhereTestsSigned {
@Bug(id="PR811")
@Test
public void SpacesCanBeEverywhereRemoteTests2Signed_withQuery1() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereRemoteTests2 signed request");
- System.err.println("connecting SpacesCanBeEverywhereRemoteTests2 signed request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp?test=20");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Signed spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -177,11 +153,8 @@ public class SpacesCanBeEverywhereTestsSigned {
@Bug(id="PR811")
@Test
public void SpacesCanBeEverywhereRemoteTests2Signed_withQuery2() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereRemoteTests2 signed request");
- System.err.println("connecting SpacesCanBeEverywhereRemoteTests2 signed request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp?test%3D20");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
+
String s="Signed spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -193,11 +166,7 @@ public class SpacesCanBeEverywhereTestsSigned {
@Bug(id="PR811")
@Test
public void SpacesCanBeEverywhereRemoteTests3Signed() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereRemoteTests3signed request");
- System.err.println("connecting SpacesCanBeEverywhereRemoteTests3signed request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SpacesCanBeEverywhere1signed.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Signed spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -210,15 +179,11 @@ public class SpacesCanBeEverywhereTestsSigned {
@Bug(id="PR804")
@Test
public void SpacesCanBeEverywhereLocalTests1Signed() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereLocalTests1 request");
- System.err.println("connecting SpacesCanBeEverywhereLocalTests1 request");
List<String> commands=new ArrayList<String>(4);
commands.add(server.getJavawsLocation());
commands.add(ServerAccess.HEADLES_OPTION);
commands.add("Spaces can be everywhere1.jnlp");
ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir());
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s = "Good simple javaws exapmle";
Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -230,15 +195,11 @@ public class SpacesCanBeEverywhereTestsSigned {
@Bug(id="PR804")
@Test
public void SpacesCanBeEverywhereLocalTests2Signed() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereLocalTests2 signed request");
- System.err.println("connecting SpacesCanBeEverywhereLocalTests2 signed request");
List<String> commands=new ArrayList<String>(4);
commands.add(server.getJavawsLocation());
commands.add(ServerAccess.HEADLES_OPTION);
commands.add("Spaces can be everywhere2 signed.jnlp");
ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir());
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Signed spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -250,15 +211,11 @@ public class SpacesCanBeEverywhereTestsSigned {
@Bug(id="PR804")
@Test
public void SpacesCanBeEverywhereLocalTests4Signed() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereLocalTests2 signed request");
- System.err.println("connecting SpacesCanBeEverywhereLocalTests2 signed request");
List<String> commands=new ArrayList<String>(4);
commands.add(server.getJavawsLocation());
commands.add(ServerAccess.HEADLES_OPTION);
commands.add(server.getDir()+"/Spaces can be everywhere2 signed.jnlp");
ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands);
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Signed spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -270,15 +227,11 @@ public class SpacesCanBeEverywhereTestsSigned {
@Bug(id="PR804")
@Test
public void SpacesCanBeEverywhereLocalTests3Signed() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereLocalTests3signed request");
- System.err.println("connecting SpacesCanBeEverywhereLocalTests3signed request");
List<String> commands=new ArrayList<String>(4);
commands.add(server.getJavawsLocation());
commands.add(ServerAccess.HEADLES_OPTION);
commands.add("SpacesCanBeEverywhere1signed.jnlp");
ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir());
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Signed spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
diff --git a/tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java b/tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java
index b72b828..e9952ff 100644
--- a/tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java
+++ b/tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java
@@ -101,11 +101,7 @@ public class AccessClassInPackageTest {
@Test
public void AccessClassInPackageJAVAXJNLP() throws Exception {
- System.out.println("AccessClassInPackageJAVAXJNLP");
- System.err.println("AccessClassInPackageJAVAXJNLP");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[0]);
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
commonPitfall(pr);
testShouldPass(pr, pass[0]);
testShouldNOTFail(pr, badExceptions[0]);
@@ -113,11 +109,7 @@ public class AccessClassInPackageTest {
@Test
public void AccessClassInPackageSELF() throws Exception {
- System.out.println("AccessClassInPackageSELF");
- System.err.println("AccessClassInPackageSELF");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[1]);
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
commonPitfall(pr);
testShouldPass(pr, pass[1]);
testShouldNOTFail(pr, badExceptions[1]);
@@ -125,11 +117,7 @@ public class AccessClassInPackageTest {
@Test
public void AccessClassInPackageNETSF() throws Exception {
- System.out.println("AccessClassInPackageNETSF");
- System.err.println("AccessClassInPackageNETSF");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[2]);
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
commonPitfall(pr);
testShouldFail(pr, badExceptions[2]);
testShouldNOTPass(pr, pass[2]);
@@ -137,11 +125,7 @@ public class AccessClassInPackageTest {
@Test
public void AccessClassInPackageSUNSEC() throws Exception {
- System.out.println("AccessClassInPackageSUNSEC");
- System.err.println("AccessClassInPackageSUNSEC");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[3]);
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
commonPitfall(pr);
commonPitfall(pr);
testShouldFail(pr, badExceptions[3]);
@@ -151,11 +135,7 @@ public class AccessClassInPackageTest {
//now signed vaiants
@Test
public void AccessClassInPackageSignedJAVAXJNLP() throws Exception {
- System.out.println("AccessClassInPackageSignedJAVAXJNLP");
- System.err.println("AccessClassInPackageSignedJAVAXJNLP");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[0]);
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
commonPitfall(pr);
testShouldPass(pr, pass[0]);
testShouldNOTFail(pr, badExceptions[0]);
@@ -163,11 +143,7 @@ public class AccessClassInPackageTest {
@Test
public void AccessClassInPackageSignedSELF() throws Exception {
- System.out.println("AccessClassInPackageSignedSELF");
- System.err.println("AccessClassInPackageSignedSELF");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[1]);
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
commonPitfall(pr);
testShouldPass(pr, pass[1]);
testShouldNOTFail(pr, badExceptions[1]);
@@ -175,11 +151,7 @@ public class AccessClassInPackageTest {
@Test
public void AccessClassInPackageSignedNETSF() throws Exception {
- System.out.println("AccessClassInPackageSignedNETSF");
- System.err.println("AccessClassInPackageSignedNETSF");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[2]);
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
commonPitfall(pr);
testShouldPass(pr, pass[2]);
testShouldNOTFail(pr, badExceptions[2]);
@@ -187,11 +159,7 @@ public class AccessClassInPackageTest {
@Test
public void AccessClassInPackageSignedSUNSEC() throws Exception {
- System.out.println("AccessClassInPackageSignedSUNSEC");
- System.err.println("AccessClassInPackageSignedSUNSEC");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[3]);
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
commonPitfall(pr);
testShouldPass(pr, pass[3]);
testShouldNOTFail(pr, badExceptions[3]);
diff --git a/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java b/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java
index 217ed4d..165276a 100644
--- a/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java
+++ b/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java
@@ -46,11 +46,7 @@ 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);
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";
diff --git a/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java b/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java
index 6769884..0372f4c 100644
--- a/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java
+++ b/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java
@@ -48,11 +48,7 @@ public class AllStackTracesTest {
@Test
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);
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";
diff --git a/tests/jnlp_tests/simple/AppletTest/testcases/AppletTestTests.java b/tests/jnlp_tests/simple/AppletTest/testcases/AppletTestTests.java
index bba36ce..d93d6f4 100644
--- a/tests/jnlp_tests/simple/AppletTest/testcases/AppletTestTests.java
+++ b/tests/jnlp_tests/simple/AppletTest/testcases/AppletTestTests.java
@@ -47,11 +47,7 @@ public class AppletTestTests {
@Test
public void AppletTest() throws Exception {
- System.out.println("connecting AppletTest request");
- System.err.println("connecting AppletTest request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/AppletTest.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
evaluateApplet(pr);
Assert.assertFalse(pr.wasTerminated);
Assert.assertEquals((Integer) 0, pr.returnValue);
@@ -78,13 +74,9 @@ public class AppletTestTests {
@Test
public void AppletInFirefoxTest() throws Exception {
- System.out.println("connecting AppletInFirefoxTest request");
- System.err.println("connecting AppletInFirefoxTest request");
server.PROCESS_TIMEOUT = 30 * 1000;
try {
ServerAccess.ProcessResult pr = server.executeBrowser("/appletAutoTests.html");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
pr.process.destroy();
evaluateApplet(pr);
Assert.assertTrue(pr.wasTerminated);
diff --git a/tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java b/tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java
index 095d87d..f2c71af 100644
--- a/tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java
+++ b/tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java
@@ -47,11 +47,7 @@ public class CheckServicesTests {
@Test
public void CheckServices() throws Exception {
- System.out.println("connecting CheckServices request");
- System.err.println("connecting CheckServices request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/CheckServices.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s0 = "Codebase for applet was found in constructor";
Assert.assertTrue("CheckServices stdout should contain `" + s0 + "' bud didn't.", pr.stdout.contains(s0));
String s1 = "Codebase for applet was found in init()";
diff --git a/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java b/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java
index aa40df0..46b7300 100644
--- a/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java
+++ b/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java
@@ -46,11 +46,7 @@ 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);
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";
diff --git a/tests/jnlp_tests/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java b/tests/jnlp_tests/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java
index c34bdd3..b760441 100644
--- a/tests/jnlp_tests/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java
+++ b/tests/jnlp_tests/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java
@@ -45,11 +45,7 @@ public class InformationTitleVendorParserTest {
private static ServerAccess server = new ServerAccess();
public void runTest(String jnlpName, String exceptionMessage) throws Exception {
- System.out.println("connecting InformationTitleVendorParser request, testing " + jnlpName);
- System.err.println("connecting InformationTitleVendorParser request, testing " + jnlpName);
ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/" + jnlpName + ".jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s1 = "Good simple javaws exapmle";
Assert.assertFalse("test" + jnlpName + " stdout should not contain " + s1 + " but did.", pr.stdout.contains(s1));
// Looking for "Could not read or parse the JNLP file. (${DESCRIPTION})"
diff --git a/tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java b/tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java
index f691b17..47baa6f 100644
--- a/tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java
+++ b/tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java
@@ -85,11 +85,7 @@ public class ManifestedJar1Test {
*/
public void manifestedJar1nothing2nothingNoAppDesc() throws Exception {
String id = "ManifestedJar-1nothing2nothingNoAppDesc";
- System.out.println("connecting " + id + " request");
- System.err.println("connecting " + id + " request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
assertManifestedJar1(id, pr);
assertNotDead(id, pr);
}
@@ -101,11 +97,7 @@ public class ManifestedJar1Test {
@Test
public void manifestedJar1noAppDesc() throws Exception {
String id = "ManifestedJar-1noAppDesc";
- System.out.println("connecting " + id + " request");
- System.err.println("connecting " + id + " request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
assertManifestedJar1(id, pr);
assertNotDead(id, pr);
}
@@ -117,11 +109,7 @@ public class ManifestedJar1Test {
@Test
public void manifestedJar1mainNoAppDesc() throws Exception {
String id = "ManifestedJar-1mainNoAppDesc";
- System.out.println("connecting " + id + " request");
- System.err.println("connecting " + id + " request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
assertManifestedJar1(id, pr);
assertNotDead(id, pr);
}
@@ -133,11 +121,7 @@ public class ManifestedJar1Test {
@Test
public void ManifestedJar1mainHaveAppDesc() throws Exception {
String id = "ManifestedJar-1mainHaveAppDesc";
- System.out.println("connecting " + id + " request");
- System.err.println("connecting " + id + " request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
assertManifestedJar2(id, pr);
assertNotDead(id, pr);
}
@@ -149,11 +133,7 @@ public class ManifestedJar1Test {
@Test
public void ManifestedJar1main2nothingNoAppDesc() throws Exception {
String id = "ManifestedJar-1main2nothingNoAppDesc";
- System.out.println("connecting " + id + " request");
- System.err.println("connecting " + id + " request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
assertManifestedJar2(id, pr);
assertNotDead(id, pr);
}
@@ -165,11 +145,7 @@ public class ManifestedJar1Test {
@Test
public void manifestedJar1main2nothingNoAppDesc() throws Exception {
String id = "ManifestedJar-1main2nothingNoAppDesc";
- System.out.println("connecting " + id + " request");
- System.err.println("connecting " + id + " request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
assertManifestedJar2(id, pr);
assertNotDead(id, pr);
}
@@ -184,11 +160,7 @@ public class ManifestedJar1Test {
@Test
public void manifestedJar1main2mainNoAppDesc() throws Exception {
String id = "ManifestedJar-1main2mainNoAppDesc";
- System.out.println("connecting " + id + " request");
- System.err.println("connecting " + id + " request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
assertManifestedJar1(id, pr);
assertNotDead(id, pr);
}
@@ -202,11 +174,7 @@ public class ManifestedJar1Test {
@Test
public void manifestedJar1main2mainAppDesc() throws Exception {
String id = "ManifestedJar-1main2mainAppDesc";
- System.out.println("connecting " + id + " request");
- System.err.println("connecting " + id + " request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
assertNotManifestedJar1(id, pr);
assertNotManifestedJar2(id, pr);
assertNotDead(id, pr);
@@ -221,11 +189,7 @@ public class ManifestedJar1Test {
@Test
public void manifestedJar1noAppDescAtAll() throws Exception {
String id = "ManifestedJar-1noAppDescAtAll";
- System.out.println("connecting " + id + " request");
- System.err.println("connecting " + id + " request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
assertNotManifestedJar1(id, pr);
assertNotManifestedJar2(id, pr);
assertAppError(id, pr);
@@ -244,11 +208,7 @@ public class ManifestedJar1Test {
@Test
public void manifestedJar1nothing2nothingAppDesc() throws Exception {
String id = "ManifestedJar-1nothing2nothingAppDesc";
- System.out.println("connecting " + id + " request");
- System.err.println("connecting " + id + " request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
assertNotManifestedJar2(id, pr);
assertNotManifestedJar1(id, pr);
assertNotDead(id, pr);
diff --git a/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java b/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java
index 15d39a8..5d82da4 100644
--- a/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java
+++ b/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java
@@ -46,11 +46,7 @@ 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);
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";
diff --git a/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java b/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java
index 69c5244..dfe9590 100644
--- a/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java
+++ b/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java
@@ -47,11 +47,7 @@ public class ReadPropertiesTest {
@Test
public void ReadPropertiesLunch1() throws Exception {
- 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);
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";
@@ -63,11 +59,7 @@ public class ReadPropertiesTest {
@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 = "(?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";
diff --git a/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java b/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java
index b030e6b..1d745c7 100644
--- a/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java
+++ b/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java
@@ -45,11 +45,7 @@ public class RedirectStreamsTest {
@Test
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);
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";
diff --git a/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java b/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java
index 871b0ae..73bbd9d 100644
--- a/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java
+++ b/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java
@@ -45,11 +45,7 @@ public class ReplaceSecurityManagerTest {
@Test
public void ReplaceSecurityManagerLunch1() throws Exception {
- 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);
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";
diff --git a/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java b/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java
index 5547d32..f45aedb 100644
--- a/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java
+++ b/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java
@@ -45,11 +45,7 @@ public class SetContextClassLoaderTest {
@Test
public void SetContextClassLoader1() throws Exception {
- 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);
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";
diff --git a/tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java b/tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java
index 3b6cbf3..3741757 100644
--- a/tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java
+++ b/tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java
@@ -53,8 +53,6 @@ public class SpacesCanBeEverywhereTests {
@Test
@NeedsDisplay
public void SpacesCanBeEverywhereLocalAppletTestsJnlp2() throws Exception {
- System.out.println("connecting NotOnly spaces can kill ěščřž too.jnlp request");
- System.err.println("connecting NotOnly spaces can kill ěščřž too.jnlp request");
List<String> commands=new ArrayList<String>(1);
commands.add(server.getJavawsLocation());
commands.add(server.getDir()+"/NotOnly spaces can kill ěščřž too.jnlp");
@@ -83,8 +81,6 @@ public class SpacesCanBeEverywhereTests {
* only on ocal files, and probably only from test run - it can be ignored
*/
ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands);
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "xception";
@@ -97,11 +93,7 @@ public class SpacesCanBeEverywhereTests {
@Test
@NeedsDisplay
public void SpacesCanBeEverywhereRemoteAppletTestsJnlp2() throws Exception {
- System.out.println("connecting NotOnly spaces can kill ěščřž too.jnlp request");
- System.err.println("connecting NotOnly spaces can kill ěščřž too.jnlp request");
ServerAccess.ProcessResult pr = server.executeJavaws("/NotOnly%20spaces%20can%20kill%20%C4%9B%C5%A1%C4%8D%C5%99%C5%BE%20too.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "xception";
@@ -113,11 +105,7 @@ public class SpacesCanBeEverywhereTests {
@Test
@NeedsDisplay
public void SpacesCanBeEverywhereRemoteAppletTestsHtml2() throws Exception {
- System.out.println("connecting spaces applet Tests.html request");
- System.err.println("connecting spaces applet Tests.html request");
ServerAccess.ProcessResult pr = server.executeBrowser("/spaces+applet+Tests.html");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "xception";
@@ -129,11 +117,7 @@ public class SpacesCanBeEverywhereTests {
@Bug(id={"PR811","http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016144.html"})
@Test
public void SpacesCanBeEverywhereRemoteTests1() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereRemoteTests1 request");
- System.err.println("connecting SpacesCanBeEverywhereRemoteTests1 request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere1.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s = "Good simple javaws exapmle";
Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -145,11 +129,7 @@ public class SpacesCanBeEverywhereTests {
@Bug(id="PR811")
@Test
public void SpacesCanBeEverywhereRemoteTests2() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereRemoteTests2 request");
- System.err.println("connecting SpacesCanBeEverywhereRemoteTests2 request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -161,11 +141,7 @@ public class SpacesCanBeEverywhereTests {
@Bug(id="PR811")
@Test
public void SpacesCanBeEverywhereRemoteTests2_withQuery1() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereRemoteTests2 request");
- System.err.println("connecting SpacesCanBeEverywhereRemoteTests2 request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp?test=10");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -178,11 +154,7 @@ public class SpacesCanBeEverywhereTests {
@Bug(id="PR811")
@Test
public void SpacesCanBeEverywhereRemoteTests2_withQuery2() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereRemoteTests2 request");
- System.err.println("connecting SpacesCanBeEverywhereRemoteTests2 request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp?test%3D10");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -194,11 +166,7 @@ public class SpacesCanBeEverywhereTests {
@Bug(id="PR811")
@Test
public void SpacesCanBeEverywhereRemoteTests3() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereRemoteTests3 request");
- System.err.println("connecting SpacesCanBeEverywhereRemoteTests3 request");
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SpacesCanBeEverywhere1.jnlp");
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -211,15 +179,11 @@ public class SpacesCanBeEverywhereTests {
@Bug(id="PR804")
@Test
public void SpacesCanBeEverywhereLocalTests1() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereLocalTests1 request");
- System.err.println("connecting SpacesCanBeEverywhereLocalTests1 request");
List<String> commands=new ArrayList<String>(4);
commands.add(server.getJavawsLocation());
commands.add(ServerAccess.HEADLES_OPTION);
commands.add("Spaces can be everywhere1.jnlp");
ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir());
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s = "Good simple javaws exapmle";
Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -231,15 +195,11 @@ public class SpacesCanBeEverywhereTests {
@Bug(id="PR804")
@Test
public void SpacesCanBeEverywhereLocalTests2() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereLocalTests2 request");
- System.err.println("connecting SpacesCanBeEverywhereLocalTests2 request");
List<String> commands=new ArrayList<String>(4);
commands.add(server.getJavawsLocation());
commands.add(ServerAccess.HEADLES_OPTION);
commands.add("Spaces can be everywhere2.jnlp");
ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir());
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -251,15 +211,11 @@ public class SpacesCanBeEverywhereTests {
@Bug(id="PR804")
@Test
public void SpacesCanBeEverywhereLocalTests4() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereLocalTests2 request");
- System.err.println("connecting SpacesCanBeEverywhereLocalTests2 request");
List<String> commands=new ArrayList<String>(4);
commands.add(server.getJavawsLocation());
commands.add(ServerAccess.HEADLES_OPTION);
commands.add(server.getDir()+"/Spaces can be everywhere2.jnlp");
ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands);
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
@@ -271,15 +227,11 @@ public class SpacesCanBeEverywhereTests {
@Bug(id="PR804")
@Test
public void SpacesCanBeEverywhereLocalTests3() throws Exception {
- System.out.println("connecting SpacesCanBeEverywhereLocalTests3 request");
- System.err.println("connecting SpacesCanBeEverywhereLocalTests3 request");
List<String> commands=new ArrayList<String>(4);
commands.add(server.getJavawsLocation());
commands.add(ServerAccess.HEADLES_OPTION);
commands.add("SpacesCanBeEverywhere1.jnlp");
ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir());
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
String s="Spaces can be everywhere.jsr was launched correctly";
Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s));
String cc = "ClassNotFoundException";
diff --git a/tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java b/tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java
index d7bd340..b3d8fdb 100644
--- a/tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java
+++ b/tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java
@@ -55,7 +55,7 @@ public class DeadLockTestTest {
@BeforeClass
public static void printJavas() throws Exception {
- System.out.println("Currently runnng javas1 " + countJavaInstances());
+ ServerAccess.logOutputReprint("Currently runnng javas1 " + countJavaInstances());
}
@@ -71,15 +71,11 @@ public class DeadLockTestTest {
public void testDeadLockTestTerminatedBody(String jnlp) throws Exception {
List<String> before = countJavaInstances();
- System.out.println("java1 "+jnlp+" : " + before.size());
- System.out.println("connecting " + jnlp + " request");
- System.err.println("connecting " + jnlp + " request");
+ ServerAccess.logOutputReprint("java1 "+jnlp+" : " + before.size());
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, jnlp);
- System.out.println(pr.stdout);
- System.err.println(pr.stderr);
assertDeadlockTestLaunched(pr);
List<String> after = countJavaInstances();
- System.out.println("java2 "+jnlp+" : " + after.size());
+ ServerAccess.logOutputReprint("java2 "+jnlp+" : " + after.size());
String ss="This process is hanging more than 30s. Should be killed";
Assert.assertFalse("stdout shoud not contains: "+ss+", but did",pr.stdout.contains(ss));
// Assert.assertTrue(pr.stderr.contains("xception"));, exception is thrown by engine,not by application
@@ -87,7 +83,7 @@ public class DeadLockTestTest {
Assert.assertEquals(null, pr.returnValue);//killed process have no value
killDiff(before, after);
List<String> afterKill = countJavaInstances();
- System.out.println("java3 "+jnlp+" : " + afterKill.size());
+ ServerAccess.logOutputReprint("java3 "+jnlp+" : " + afterKill.size());
Assert.assertEquals("assert that just old javas remians", 0, (before.size() - afterKill.size()));
}
@@ -99,25 +95,21 @@ public class DeadLockTestTest {
@Test
public void testSimpletest1lunchFork() throws Exception {
- System.out.println("connecting " + deadlocktest_1 + " request");
- System.err.println("connecting " + deadlocktest_1 + " request");
List<String> before = countJavaInstances();
- System.out.println("java4: " + before.size());
+ ServerAccess.logOutputReprint("java4: " + before.size());
BackgroundDeadlock bd = new BackgroundDeadlock(deadlocktest_1, null);
bd.start();
Thread.sleep(ServerAccess.PROCESS_TIMEOUT * 2 / 3);
List<String> during = countJavaInstances();
- System.out.println("java5: " + during.size());
+ ServerAccess.logOutputReprint("java5: " + during.size());
waitForBackgroundDeadlock(bd);
List<String> after = countJavaInstances();
- System.out.println("java6: " + after.size());
+ ServerAccess.logOutputReprint("java6: " + after.size());
Assert.assertNotNull("proces inside background deadlock cant be null. It was.", bd.getPr());
- System.out.println(bd.getPr().stdout);
- System.err.println(bd.getPr().stderr);
assertDeadlockTestLaunched(bd.getPr());
killDiff(before, during);
List<String> afterKill = countJavaInstances();
- System.out.println("java66: " + afterKill.size());
+ ServerAccess.logOutputReprint("java66: " + afterKill.size());
Assert.assertEquals("assert that just old javas remians", 0, (before.size() - afterKill.size()));
// div by two is caused by jav in java process hierarchy
Assert.assertEquals("launched JVMs must be exactly 2, was " + (during.size() - before.size()) / 2, 2, (during.size() - before.size()) / 2);
@@ -125,25 +117,21 @@ public class DeadLockTestTest {
@Test
public void testSimpletest1lunchNoFork() throws Exception {
- System.out.println("connecting " + deadlocktest_1 + " Xnofork request");
- System.err.println("connecting " + deadlocktest_1 + " Xnofork request");
List<String> before = countJavaInstances();
- System.out.println("java7: " + before.size());
+ ServerAccess.logOutputReprint("java7: " + before.size());
BackgroundDeadlock bd = new BackgroundDeadlock(deadlocktest_1, Arrays.asList(new String[]{"-Xnofork"}));
bd.start();
Thread.sleep(ServerAccess.PROCESS_TIMEOUT * 2 / 3);
List<String> during = countJavaInstances();
- System.out.println("java8: " + during.size());
+ ServerAccess.logOutputReprint("java8: " + during.size());
waitForBackgroundDeadlock(bd);
List<String> after = countJavaInstances();
- System.out.println("java9: " + after.size());
+ ServerAccess.logOutputReprint("java9: " + after.size());
Assert.assertNotNull("proces inside background deadlock cant be null. It was.", bd.getPr());
- System.out.println(bd.getPr().stdout);
- System.err.println(bd.getPr().stderr);
assertDeadlockTestLaunched(bd.getPr());
killDiff(before, during);
List<String> afterKill = countJavaInstances();
- System.out.println("java99: " + afterKill.size());
+ ServerAccess.logOutputReprint("java99: " + afterKill.size());
Assert.assertEquals("assert that just old javas remians", 0, (before.size() - afterKill.size()));
// div by two is caused by jav in java process hierarchy
Assert.assertEquals("launched JVMs must be exactly 1, was " + (during.size() - before.size()) / 2, 1, (during.size() - before.size()) / 2);
@@ -168,12 +156,15 @@ public class DeadLockTestTest {
if (old.contains(string)) {
continue;
}
- System.out.println("Killing " + string);
- ServerAccess.ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"kill", "-9", string}));
+ ServerAccess.logOutputReprint("Killing " + string);
+ ServerAccess.PROCESS_LOG = false;
+ try {
+ ServerAccess.ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"kill", "-9", string}));
+ } finally {
+ ServerAccess.PROCESS_LOG = true;
+ }
result.add(string);
- //System.out.println(pr.stdout);
- // System.err.println(pr.stderr);
- System.out.println("Killed " + string);
+ ServerAccess.logOutputReprint("Killed " + string);
}
return result;
}
@@ -181,23 +172,26 @@ public class DeadLockTestTest {
private static List<String> countJavaInstances() throws Exception {
ensureLinux();
List<String> result = new ArrayList<String>();
- ServerAccess.ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"ps", "-eo", "pid,ppid,stat,fname"}));
- Matcher m = Pattern.compile("\\s*\\d+\\s+\\d+ .+ java\\s*").matcher(pr.stdout);
- //System.out.println(pr.stdout);
- //System.err.println(pr.stderr);
- int i = 0;
- while (m.find()) {
- i++;
- String ss = m.group();
- //System.out.println(i+": "+ss);
- result.add(ss.trim().split("\\s+")[0]);
+ ServerAccess.PROCESS_LOG = false;
+ try {
+ ServerAccess.ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"ps", "-eo", "pid,ppid,stat,fname"}));
+ Matcher m = Pattern.compile("\\s*\\d+\\s+\\d+ .+ java\\s*").matcher(pr.stdout);
+ int i = 0;
+ while (m.find()) {
+ i++;
+ String ss = m.group();
+ //ServerAccess.logOutputReprint(i+": "+ss);
+ result.add(ss.trim().split("\\s+")[0]);
+ }
+ } finally {
+ ServerAccess.PROCESS_LOG = true;
}
return result;
}
public static void main(String[] args) throws Exception {
- System.out.println(countJavaInstances());
+ ServerAccess.logOutputReprint(""+countJavaInstances());
}
private void assertDeadlockTestLaunched(ProcessResult pr) {
diff --git a/tests/jnlp_tests/simple/simpletest1/testcases/SimpleTest1Test.java b/tests/jnlp_tests/simple/simpletest1/testcases/SimpleTest1Test.java
index 6c15791..abc1592 100644
--- a/tests/jnlp_tests/simple/simpletest1/testcases/SimpleTest1Test.java
+++ b/tests/jnlp_tests/simple/simpletest1/testcases/SimpleTest1Test.java
@@ -49,11 +49,7 @@ 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);
String s="Good simple javaws exapmle";
Assert.assertTrue("testSimpletest1lunchOk stdout should contains "+s+" bud didn't",pr.stdout.contains(s));
String ss="xception";
@@ -62,8 +58,4 @@ public class SimpleTest1Test {
Assert.assertEquals((Integer)0, pr.returnValue);
}
-
-
-
-
- }
+ }
diff --git a/tests/jnlp_tests/simple/simpletest2/testcases/SimpleTest2Test.java b/tests/jnlp_tests/simple/simpletest2/testcases/SimpleTest2Test.java
index 1e0843f..9a77da4 100644
--- a/tests/jnlp_tests/simple/simpletest2/testcases/SimpleTest2Test.java
+++ b/tests/jnlp_tests/simple/simpletest2/testcases/SimpleTest2Test.java
@@ -47,11 +47,7 @@ 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("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));
diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java
index 0ca3a56..106f1f6 100644
--- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java
+++ b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java
@@ -116,6 +116,10 @@ public class ServerAccess {
* all terminated processes are stored here. As wee need to 'wait' to termination to be finished.
*/
private static Set<Thread> terminated = new HashSet<Thread>();
+ /**
+ * this flag is indicating whether output of executeProcess should be logged. By default true.
+ */
+ public static boolean PROCESS_LOG = true;
/**
* main method of this class prints out random free port
@@ -720,9 +724,87 @@ public class ServerAccess {
return executeProcess(args, dir, null, null);
}
- public static ProcessResult executeProcess(final List<String> args,File dir,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception {
+ private static String createConnectionMessage(ThreadedProcess t) {
+ return "Connecting " + t.getCommandLine();
+ }
+
+ /**
+ * Proceed message s to logging with request to reprint to System.err
+ * @param s
+ */
+ public static void logErrorReprint(String s) {
+ log(s, false, true);
+ }
+
+ /**
+ * Proceed message s to logging with request to reprint to System.out
+ * @param s
+ */
+ public static void logOutputReprint(String s) {
+ log(s, true, false);
+ }
+
+ /**
+ * Proceed message s to logging withhout request to reprint
+ * @param s
+ */
+ public static void logNoReprint(String s) {
+ log(s, false, false);
+ }
+
+ private static void log(String message, boolean printToOut, boolean printToErr) {
+ String idded;
+ StackTraceElement ste = getTestMethod();
+ String fullId = ste.getClassName() + "." + ste.getMethodName();
+ if (message.contains("\n")) {
+ idded = fullId + ": \n" + message + "\n" + fullId + " ---";
+ } else {
+ idded = fullId + ": " + message;
- ThreadedProcess t = new ThreadedProcess(args,dir);
+ }
+ if (printToOut) {
+ System.out.println(idded);
+ }
+ if (printToErr) {
+ System.err.println(idded);
+ }
+ }
+
+ private static StackTraceElement getTestMethod() {
+ return getTestMethod(Thread.currentThread().getStackTrace());
+ }
+
+ private static StackTraceElement getTestMethod(StackTraceElement[] stack) {
+ //0 is always thread
+ //1 is net.sourceforge.jnlp.ServerAccess
+ StackTraceElement result = stack[1];
+ String baseClass = stack[1].getClassName();
+ int i = 2;
+ for (; i < stack.length; i++) {
+ result = stack[i];//at least moving up
+ if (!baseClass.equals(stack[i].getClassName())) {
+ break;
+ }
+ }
+ //now we are out of net.sourceforge.jnlp.ServerAccess
+ //method we need (the test) is highest from following class
+ baseClass = stack[i].getClassName();
+ for (; i < stack.length; i++) {
+ if (!baseClass.equals(stack[i].getClassName())) {
+ break;
+ }
+ result = stack[i];
+ }
+
+ return result;
+ }
+
+ public static ProcessResult executeProcess(final List<String> args, File dir, ContentReaderListener stdoutl, ContentReaderListener stderrl) throws Exception {
+ ThreadedProcess t = new ThreadedProcess(args, dir);
+ if (PROCESS_LOG) {
+ String connectionMesaage = createConnectionMessage(t);
+ log(connectionMesaage, true, true);
+ }
ProcessAssasin pa = new ProcessAssasin(t, PROCESS_TIMEOUT);
pa.start();
t.start();
@@ -753,7 +835,12 @@ public class ServerAccess {
pa.setCanRun(false);
// System.out.println(t.getP().exitValue()); when process is killed, this throws exception
- return new ProcessResult(crs.getContent(), cre.getContent(), t.getP(), pa.wasTerminated(), t.getExitCode(), null);
+ ProcessResult pr=new ProcessResult(crs.getContent(), cre.getContent(), t.getP(), pa.wasTerminated(), t.getExitCode(), null);
+ if (PROCESS_LOG) {
+ log(pr.stdout, true, false);
+ log(pr.stderr, false, true);
+ }
+ return pr;
}
/**
diff --git a/tests/netx/unit/net/sourceforge/jnlp/cache/CacheLRUWrapperTest.java b/tests/netx/unit/net/sourceforge/jnlp/cache/CacheLRUWrapperTest.java
index 7a8dc92..fbc6f95 100644
--- a/tests/netx/unit/net/sourceforge/jnlp/cache/CacheLRUWrapperTest.java
+++ b/tests/netx/unit/net/sourceforge/jnlp/cache/CacheLRUWrapperTest.java
@@ -40,6 +40,7 @@ package net.sourceforge.jnlp.cache;
import static org.junit.Assert.assertTrue;
import java.io.File;
+import net.sourceforge.jnlp.ServerAccess;
import net.sourceforge.jnlp.config.DeploymentConfiguration;
import net.sourceforge.jnlp.runtime.JNLPRuntime;
@@ -90,7 +91,7 @@ public class CacheLRUWrapperTest {
}
double avg = sum / time.length;
- System.err.println("Average = " + avg + "ns");
+ ServerAccess.logErrorReprint("Average = " + avg + "ns");
// wait more than 100 microseconds for noLoops = 1000 and noEntries=1000 is bad
assertTrue("load() must not take longer than 100 µs, but took in avg " + avg/1000 + "µs", avg < 100 * 1000);
diff --git a/tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java b/tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java
index 2e2602a..85d323f 100644
--- a/tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java
+++ b/tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java
@@ -48,6 +48,7 @@ import net.sourceforge.jnlp.LaunchException;
import net.sourceforge.jnlp.ParseException;
import net.sourceforge.jnlp.ResourcesDesc;
import net.sourceforge.jnlp.SecurityDesc;
+import net.sourceforge.jnlp.ServerAccess;
import net.sourceforge.jnlp.runtime.JNLPClassLoader;
import net.sourceforge.jnlp.runtime.JNLPClassLoader.CodeBaseClassLoader;
@@ -86,13 +87,13 @@ public class CodeBaseClassLoaderTest {
classLoader.findResource("net/sourceforge/jnlp/about/Main.class");
stopTime = System.nanoTime();
long timeOnFirstTry = stopTime - startTime;
- System.err.println(timeOnFirstTry);
+ ServerAccess.logErrorReprint(""+timeOnFirstTry);
startTime = System.nanoTime();
classLoader.findResource("net/sourceforge/jnlp/about/Main.class");
stopTime = System.nanoTime();
long timeOnSecondTry = stopTime - startTime;
- System.err.println(timeOnSecondTry);
+ ServerAccess.logErrorReprint(""+timeOnSecondTry);
assertTrue(timeOnSecondTry < (timeOnFirstTry / 10));
}
@@ -128,13 +129,13 @@ public class CodeBaseClassLoaderTest {
classLoader.findResource("net/sourceforge/jnlp/about/Main_FOO_.class");
stopTime = System.nanoTime();
long timeOnFirstTry = stopTime - startTime;
- System.err.println(timeOnFirstTry);
+ ServerAccess.logErrorReprint(""+timeOnFirstTry);
startTime = System.nanoTime();
classLoader.findResource("net/sourceforge/jnlp/about/Main_FOO_.class");
stopTime = System.nanoTime();
long timeOnSecondTry = stopTime - startTime;
- System.err.println(timeOnSecondTry);
+ ServerAccess.logErrorReprint(""+timeOnSecondTry);
assertTrue(timeOnSecondTry < (timeOnFirstTry / 10));
}
diff --git a/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java b/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java
index 5bd12d6..4771085 100644
--- a/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java
+++ b/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java
@@ -41,6 +41,7 @@ import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
+import net.sourceforge.jnlp.ServerAccess;
import org.junit.Assert;
import org.junit.Test;
@@ -72,13 +73,13 @@ public class BASE64EncoderTest {
// sun.misc.BASE64Encoder e1 = new sun.misc.BASE64Encoder();
// e1.encode(data, out1);
// byte[] encoded1 = out1.toByteArray();
-// System.out.println(Arrays.toString(encoded1));
+// ServerAccess.logErrorReprint(Arrays.toString(encoded1));
ByteArrayOutputStream out2 = new ByteArrayOutputStream();
BASE64Encoder e2 = new BASE64Encoder();
e2.encodeBuffer(data, out2);
byte[] encoded2 = out2.toByteArray();
Assert.assertArrayEquals(encoded, encoded2);
-// System.out.println(Arrays.toString(encoded2));
+// ServerAccess.logErrorReprint(Arrays.toString(encoded2));