mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
IJPL-53: Wrap execution of Cucumber tests into EDT to Write Intent Lock.
GitOrigin-RevId: 0319f5bb4924db54fb7dd8744dd89d0e78a2f0b1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
03d07ac3b8
commit
617302d81a
@@ -2,6 +2,7 @@
|
||||
package com.intellij.cucumber;
|
||||
|
||||
import com.intellij.TestCaseLoader;
|
||||
import com.intellij.ide.IdeEventQueue;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.testFramework.UITestUtil;
|
||||
@@ -70,34 +71,37 @@ public final class CucumberMain {
|
||||
try {
|
||||
UITestUtil.replaceIdeEventQueueSafely();
|
||||
EdtInvocationManager.invokeAndWaitIfNeeded(() -> {
|
||||
try {
|
||||
RuntimeOptions runtimeOptions = new RuntimeOptions(new ArrayList<>(Arrays.asList(argv)));
|
||||
MultiLoader resourceLoader = new MultiLoader(classLoader) {
|
||||
@Override
|
||||
public Iterable<Resource> resources(String path, String suffix) {
|
||||
Iterable<Resource> resources = super.resources(path, suffix);
|
||||
if (!TestCaseLoader.shouldBucketTests() || !".feature".equals(suffix)) {
|
||||
return resources;
|
||||
}
|
||||
|
||||
List<Resource> result = new ArrayList<>();
|
||||
for (Resource resource : resources) {
|
||||
if (TestCaseLoader.matchesCurrentBucket(resource.getPath())) {
|
||||
result.add(resource);
|
||||
IdeEventQueue.getInstance().getRwLockHolder().runWriteIntentReadAction(() -> {
|
||||
try {
|
||||
RuntimeOptions runtimeOptions = new RuntimeOptions(new ArrayList<>(Arrays.asList(argv)));
|
||||
MultiLoader resourceLoader = new MultiLoader(classLoader) {
|
||||
@Override
|
||||
public Iterable<Resource> resources(String path, String suffix) {
|
||||
Iterable<Resource> resources = super.resources(path, suffix);
|
||||
if (!TestCaseLoader.shouldBucketTests() || !".feature".equals(suffix)) {
|
||||
return resources;
|
||||
}
|
||||
|
||||
List<Resource> result = new ArrayList<>();
|
||||
for (Resource resource : resources) {
|
||||
if (TestCaseLoader.matchesCurrentBucket(resource.getPath())) {
|
||||
result.add(resource);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
ResourceLoaderClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
|
||||
Runtime runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
|
||||
runtimeRef.set(runtime);
|
||||
runtime.run();
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
errorRef.set(throwable);
|
||||
Logger.getInstance(CucumberMain.class).error(throwable);
|
||||
}
|
||||
};
|
||||
ResourceLoaderClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
|
||||
Runtime runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
|
||||
runtimeRef.set(runtime);
|
||||
runtime.run();
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
errorRef.set(throwable);
|
||||
Logger.getInstance(CucumberMain.class).error(throwable);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
});
|
||||
}
|
||||
catch (Throwable t) {
|
||||
|
||||
Reference in New Issue
Block a user