mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
dom: remove testInternalDomLocksReadConsistency
it takes a lot of time and doesn't seem to check anything useful nowadays
This commit is contained in:
@@ -26,9 +26,7 @@ import com.intellij.semantic.SemService;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.Timings;
|
||||
import com.intellij.util.ConcurrencyUtil;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xml.impl.DomFileElementImpl;
|
||||
import com.intellij.util.xml.impl.DomTestCase;
|
||||
import com.intellij.util.xml.reflect.DomExtender;
|
||||
import com.intellij.util.xml.reflect.DomExtenderEP;
|
||||
@@ -44,65 +42,6 @@ import java.util.concurrent.CountDownLatch;
|
||||
* @author peter
|
||||
*/
|
||||
public class DomConcurrencyStressTest extends DomTestCase {
|
||||
public void testInternalDomLocksReadConsistency() throws Throwable {
|
||||
getDomManager().registerFileDescription(new DomFileDescription(MyElement.class, "a"), getTestRootDisposable());
|
||||
|
||||
registerExtender(MyElement.class, MyExtender.class);
|
||||
|
||||
|
||||
final XmlFile file = createXmlFile("<a attr=\"1\" attr2=\"2\">" +
|
||||
"<foo-child><foo-child/><custom-foo/></foo-child>" +
|
||||
"<bar-child><foo-child/></bar-child>" +
|
||||
"<foo-element>" +
|
||||
" <foo-child/>" +
|
||||
" <foo-child><foo-child attr=\"\"/></foo-child>" +
|
||||
" <custom-foo/>" +
|
||||
" <custom-bar/>" +
|
||||
"</foo-element>" +
|
||||
"<custom-bar/>" +
|
||||
"<custom-bar>" +
|
||||
" <foo-child/>" +
|
||||
" <foo-element/>" +
|
||||
" <foo-element/>" +
|
||||
" <custom-bar/>" +
|
||||
"</custom-bar>" +
|
||||
"<custom-bar attr=\"\">" +
|
||||
" <foo-child/>" +
|
||||
" <some-child/>" +
|
||||
" <custom-bar/>" +
|
||||
"</custom-bar>" +
|
||||
"<child/>" +
|
||||
"<child/>" +
|
||||
"<bool/>" +
|
||||
"</a>");
|
||||
|
||||
final int ITERATIONS = Timings.adjustAccordingToMySpeed(239, true);
|
||||
System.out.println("ITERATIONS =" + ITERATIONS);
|
||||
runThreads(42, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < ITERATIONS; i++) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final DomFileElementImpl<DomElement> element = getDomManager().getFileElement(file);
|
||||
assertNotNull(element);
|
||||
element.getRootElement().accept(new DomElementVisitor() {
|
||||
@Override
|
||||
public void visitDomElement(final DomElement element) {
|
||||
if (DomUtil.hasXml(element)) {
|
||||
element.acceptChildren(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
SemService.getSemService(getProject()).clearCache();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void registerExtender(final Class elementClass, final Class extenderClass) {
|
||||
final DomExtenderEP extenderEP = new DomExtenderEP();
|
||||
@@ -162,25 +101,6 @@ public class DomConcurrencyStressTest extends DomTestCase {
|
||||
|
||||
}
|
||||
|
||||
public static class MyExtender extends DomExtender<MyElement> {
|
||||
private final Random myRandom = new Random();
|
||||
|
||||
@Override
|
||||
public void registerExtensions(@NotNull MyElement myElement, @NotNull DomExtensionsRegistrar registrar) {
|
||||
for (MyElement element : myElement.getFooElements()) {
|
||||
element.getFooElements();
|
||||
}
|
||||
if (myRandom.nextInt(20) < 2) {
|
||||
TimeoutUtil.sleep(1);
|
||||
}
|
||||
registrar.registerFixedNumberChildExtension(new XmlName("custom-foo", null), MyElement.class);
|
||||
myElement.getSomeChild().getFooElements();
|
||||
myElement.getFooChild().getFooChild().getAttr();
|
||||
myElement.getAttr();
|
||||
registrar.registerCollectionChildrenExtension(new XmlName("custom-bar", null), MyElement.class);
|
||||
}
|
||||
}
|
||||
|
||||
public void testBigCustomFile() throws Throwable {
|
||||
final int ITERATIONS = Timings.adjustAccordingToMySpeed(239, true);
|
||||
getDomManager().registerFileDescription(new DomFileDescription<>(MyAllCustomElement.class, "component"), getTestRootDisposable());
|
||||
|
||||
Reference in New Issue
Block a user