don't spawn gazillions of threads in tests

This commit is contained in:
peter
2017-09-05 09:54:35 +02:00
parent fc29f45c53
commit bbb5710b32
4 changed files with 5 additions and 5 deletions
@@ -598,7 +598,7 @@ public class LaterInvocatorTest extends PlatformTestCase {
public void testDispatchInvocationEventsVsInvokeLaterFromBgThreadRace() {
Application app = ApplicationManager.getApplication();
app.invokeAndWait(() -> {
for (int i = 0; i < 1000; i++) {
for (int i = 0; i < 20; i++) {
AtomicBoolean executed = new AtomicBoolean();
app.executeOnPooledThread(() -> app.invokeLater(EmptyRunnable.INSTANCE));
app.invokeLater(() -> executed.set(true));
@@ -663,8 +663,8 @@ public class FileDocumentManagerImplTest extends PlatformTestCase {
List<Future> futures = new ArrayList<>();
for (VirtualFile file : files) {
assertNull(fdm.getCachedDocument(file));
for (int i = 0; i < 30; i++) {
futures.add(ApplicationManager.getApplication().executeOnPooledThread((Runnable)() -> ReadAction.run(() -> {
for (int i = 0; i < 2; i++) {
futures.add(ApplicationManager.getApplication().executeOnPooledThread(() -> ReadAction.run(() -> {
Document document = fdm.getDocument(file);
assertEquals(file, fdm.getFile(document));
})));
@@ -63,7 +63,7 @@ class CachedValuesTest extends LightPlatformTestCase {
calcCount.set(0)
dependency.incModificationCount()
List<Future> jobs = (0..<10).collect {
List<Future> jobs = (0..<4).collect {
ApplicationManager.application.executeOnPooledThread {
for (i in 0..10) {
assert 'result' == getCached()
@@ -100,7 +100,7 @@ public class DomIncludesTest extends LightCodeInsightFixtureTestCase {
final PsiFile fileD = createFile("d.xml", textD);
final String textE = "<xxx><boy/><child/><boy/><child/><boy/><child/><boy/><child/><boy/><child/><boy/><child/></xxx>";
final PsiFile fileE = createFile("e.xml", textE);
final int threadCount = 100;
final int threadCount = 20;
final int iterationCount = Timings.adjustAccordingToMySpeed(100, true);
System.out.println("iterationCount = " + iterationCount);