Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-02-25 16:21:57 +0000
committerSteffen Pingel2012-02-25 16:21:57 +0000
commit1bf14249cc6a754c34f54d5803a6eaff2e50abd3 (patch)
tree83410433222d395eae8b30be89a646b0d53e6d62 /org.eclipse.mylyn.commons.sdk.util
parent043239bad41124c00ca8cde9f75e262379fd05f2 (diff)
downloadorg.eclipse.mylyn.commons-1bf14249cc6a754c34f54d5803a6eaff2e50abd3.tar.gz
org.eclipse.mylyn.commons-1bf14249cc6a754c34f54d5803a6eaff2e50abd3.tar.xz
org.eclipse.mylyn.commons-1bf14249cc6a754c34f54d5803a6eaff2e50abd3.zip
RESOLVED - bug 351100: fix failing tests for Mylyn 3.7
https://bugs.eclipse.org/bugs/show_bug.cgi?id=351100 Change-Id: Idbea9040c07cc03c7639d18b7058fcea5916688f
Diffstat (limited to 'org.eclipse.mylyn.commons.sdk.util')
-rw-r--r--org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/ManagedTestSuite.java33
1 files changed, 24 insertions, 9 deletions
diff --git a/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/ManagedTestSuite.java b/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/ManagedTestSuite.java
index d3817fa7..3f653c05 100644
--- a/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/ManagedTestSuite.java
+++ b/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/ManagedTestSuite.java
@@ -21,6 +21,7 @@ import java.util.Map.Entry;
import java.util.Properties;
import java.util.Timer;
import java.util.TimerTask;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
import junit.framework.AssertionFailedError;
@@ -78,7 +79,10 @@ public class ManagedTestSuite extends TestSuite {
private class Listener implements TestListener {
- private DumpThreadTask task;
+ /**
+ * Tests may execute in parallel and hence multiple dump threads maybe scheduled concurrently.
+ */
+ private final ConcurrentHashMap<Test, DumpThreadTask> taskByTest = new ConcurrentHashMap<Test, ManagedTestSuite.DumpThreadTask>();
private final Timer timer = new Timer(true);
@@ -100,11 +104,15 @@ public class ManagedTestSuite extends TestSuite {
}
public void dumpResults(TestResult result) {
- System.err.println();
- dumpList("Failures: ", result.failures());
+ if (result.failureCount() > 0) {
+ System.err.println();
+ dumpList("Failures: ", result.failures());
+ }
- System.err.println();
- dumpList("Errors: ", result.errors());
+ if (result.errorCount() > 0) {
+ System.err.println();
+ dumpList("Errors: ", result.errors());
+ }
int failedCount = result.errorCount() + result.failureCount();
System.err.println();
@@ -112,15 +120,22 @@ public class ManagedTestSuite extends TestSuite {
}
public void endTest(Test test) {
+ DumpThreadTask task = taskByTest.remove(test);
if (task != null) {
task.cancel();
- task = null;
}
}
public void startTest(Test test) {
- System.err.println("Running " + test.toString());
- task = new DumpThreadTask(test);
+ startTest(test, false);
+ }
+
+ public void startTest(Test test, boolean silent) {
+ if (!silent) {
+ System.err.println("Running " + test.toString());
+ }
+ DumpThreadTask task = new DumpThreadTask(test);
+ taskByTest.put(test, task);
timer.schedule(task, DELAY);
}
@@ -158,7 +173,7 @@ public class ManagedTestSuite extends TestSuite {
public String toString() {
return "ShutdownWatchdog";
}
- });
+ }, true);
}
private static void dumpSystemInfo() {

Back to the top