Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2016-08-12 08:50:00 +0000
committerAndrey Loskutov2016-08-19 07:24:41 +0000
commit36cf11dd466102e4d772a27044ed9a6f652b7ff7 (patch)
tree53b76d7325a3b23736bce7461a07421f9fdd1606
parentbb9627e9963967d8e328d39e7164aae5f2bd6392 (diff)
downloadeclipse.platform.debug-I20160823-0759.tar.gz
eclipse.platform.debug-I20160823-0759.tar.xz
eclipse.platform.debug-I20160823-0759.zip
Bug 489546 - trying to stabilize the test caseI20160824-1429I20160823-1359I20160823-0759
Change-Id: Ia70bc6d1eb87b7ba453354ee80c03fe12ab3251a Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java
index 1761c70e5..02fdf43d2 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java
@@ -10,12 +10,11 @@
*******************************************************************************/
package org.eclipse.debug.tests.console;
-import java.util.ArrayList;
-import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -81,6 +80,7 @@ public class ConsoleManagerTests extends TestCase {
manager.showConsoleView(firstConsole);
waitForJobs();
processUIEvents(100);
+ ConsoleMock.allShownConsoles.set(0);
}
@Override
@@ -129,13 +129,8 @@ public class ConsoleManagerTests extends TestCase {
executorService.shutdown();
executorService.awaitTermination(1, TimeUnit.MINUTES);
- List<ConsoleMock> shown = new ArrayList<>();
- for (ConsoleMock console : consoles) {
- if (console.showCalled > 0) {
- shown.add(console);
- }
- }
- assertEquals("Only " + shown.size() + " consoles were shown from " + count, count, shown.size()); //$NON-NLS-1$ //$NON-NLS-2$
+ int shown = ConsoleMock.allShownConsoles.intValue();
+ assertEquals("Only " + shown + " consoles were shown from " + count, count, shown); //$NON-NLS-1$ //$NON-NLS-2$
}
private void processUIEvents(final long millis) {
@@ -185,11 +180,13 @@ public class ConsoleManagerTests extends TestCase {
*/
static final class ConsoleMock implements IConsole {
MessagePage page;
- volatile int showCalled;
+ final AtomicInteger showCalled;
final int number;
+ final static AtomicInteger allShownConsoles = new AtomicInteger();
public ConsoleMock(int number) {
this.number = number;
+ showCalled = new AtomicInteger();
}
@Override
@@ -229,8 +226,11 @@ public class ConsoleManagerTests extends TestCase {
getControl().addListener(SWT.Show, new Listener() {
@Override
public void handleEvent(Event event) {
- showCalled++;
- System.out.println("Shown: " + ConsoleMock.this); //$NON-NLS-1$
+ int count = showCalled.incrementAndGet();
+ if (count == 1) {
+ count = allShownConsoles.incrementAndGet();
+ System.out.println("Shown: " + ConsoleMock.this + ", overall: " + count); //$NON-NLS-1$ //$NON-NLS-2$
+ }
}
});
}

Back to the top