summaryrefslogtreecommitdiff
path: root/xml/dom-tests
diff options
context:
space:
mode:
Diffstat (limited to 'xml/dom-tests')
-rw-r--r--xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java2
-rw-r--r--xml/dom-tests/tests/com/intellij/util/xml/DomIncludesTest.java42
-rw-r--r--xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java4
-rw-r--r--xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java20
-rw-r--r--xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubTest.java11
-rw-r--r--xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubUsingTest.java9
6 files changed, 54 insertions, 34 deletions
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java
index 89229bf889c5..efd932523d86 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java
@@ -206,7 +206,7 @@ public class DomChildrenTest extends DomTestCase {
assertTrue(child2.isValid());
assertEquals(element, child2.getParent());
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
+ WriteCommandAction.runWriteCommandAction(null, new Runnable() {
public void run() {
child2.undefine();
assertFalse(child2.isValid());
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomIncludesTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomIncludesTest.java
index 3de62d6660d5..095c9d40b050 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/DomIncludesTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/DomIncludesTest.java
@@ -1,12 +1,23 @@
/*
- * Copyright (c) 2000-2005 by JetBrains s.r.o. All Rights Reserved.
- * Use is subject to license terms.
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.intellij.util.xml;
import com.intellij.codeInsight.navigation.actions.GotoDeclarationAction;
-import com.intellij.concurrency.JobLauncher;
import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.PomTargetPsiElement;
@@ -110,23 +121,23 @@ public class DomIncludesTest extends CodeInsightFixtureTestCase {
final AtomicReference<Exception> ex = new AtomicReference<Exception>();
for (int j = 0; j < threadCount; j++) {
- JobLauncher.getInstance().submitToJobThread(0, new Runnable() {
+ ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
try {
- for (int k = 0; k < iterationCount; k++) {
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- public void run() {
+ for (int k = 0; k < iterationCount; k++) {
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ public void run() {
final List<Boy> boys = rootElement.getBoys();
Thread.yield();
final List<Child> children = rootElement.getChildren();
Thread.yield();
assertEquals(boys, rootElement.getBoys());
assertEquals(children, rootElement.getChildren());
- }
- });
- Thread.yield();
- }
+ }
+ });
+ Thread.yield();
+ }
}
catch (Exception e) {
ex.set(e);
@@ -139,7 +150,7 @@ public class DomIncludesTest extends CodeInsightFixtureTestCase {
}
for (int i = 0; i < iterationCount; i++) {
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
+ WriteCommandAction.runWriteCommandAction(null, new Runnable() {
public void run() {
fileB.getViewProvider().getDocument().insertString(0, " ");
fileD.getViewProvider().getDocument().insertString(0, " ");
@@ -147,16 +158,15 @@ public class DomIncludesTest extends CodeInsightFixtureTestCase {
}
});
Thread.sleep(10);
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
- public void run() {
+ WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
fileC.getViewProvider().getDocument().insertString(0, " ");
fileE.getViewProvider().getDocument().insertString(0, " ");
PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); //clear xinclude caches
}
});
Thread.sleep(10);
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
- public void run() {
+ WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+
fileB.getViewProvider().getDocument().setText(textB);
fileC.getViewProvider().getDocument().setText(textC);
fileD.getViewProvider().getDocument().setText(textD);
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java b/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java
index 2f7f2fefcd90..41c6b49fd168 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java
@@ -15,7 +15,7 @@
*/
package com.intellij.util.xml.impl;
-import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.psi.xml.XmlTag;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.xml.DomElement;
@@ -123,7 +123,7 @@ public class IncrementalUpdateEventsTest extends DomTestCase {
private void deleteTag(final int index) throws IncorrectOperationException {
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
+ WriteCommandAction.runWriteCommandAction(null, new Runnable() {
public void run() {
myElement.getXmlTag().getSubTags()[index].delete();
}
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java b/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java
index 7d69ccfa93a9..3ad475aa67b3 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.intellij.util.xml.impl;
import com.intellij.openapi.application.ApplicationManager;
@@ -357,7 +372,7 @@ public class TreeIncrementalUpdateTest extends DomTestCase {
final XmlTag tag = element.getXmlTag();
final XmlTag childTag = tag.getSubTags()[0];
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
+ WriteCommandAction.runWriteCommandAction(null, new Runnable() {
public void run() {
childTag.delete();
}
@@ -376,8 +391,7 @@ public class TreeIncrementalUpdateTest extends DomTestCase {
final Sepulka element = createElement("<a><foo/><bar/></a>", Sepulka.class);
final List<MyElement> list = element.getCustomChildren();
final XmlTag tag = element.getXmlTag();
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
- public void run() {
+ WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
tag.getSubTags()[0].delete();
tag.getSubTags()[0].delete();
}
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubTest.java b/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubTest.java
index 54983ba62ad1..d0c2174c01d0 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import com.intellij.psi.impl.PsiManagerImpl;
import com.intellij.psi.stubs.ObjectStubTree;
import com.intellij.psi.stubs.StubTreeLoader;
import com.intellij.psi.xml.XmlFile;
+import com.intellij.testFramework.TestDataFile;
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
import com.intellij.util.xml.DomElement;
@@ -62,11 +63,11 @@ public abstract class DomStubTest extends LightCodeInsightFixtureTestCase {
return "/xml/dom-tests/testData/stubs";
}
- protected ElementStub getRootStub(String filePath) {
+ protected ElementStub getRootStub(@TestDataFile String filePath) {
return getRootStub(filePath, myFixture);
}
- public static ElementStub getRootStub(String filePath, JavaCodeInsightTestFixture fixture) {
+ public static ElementStub getRootStub(@TestDataFile String filePath, JavaCodeInsightTestFixture fixture) {
PsiFile psiFile = fixture.configureByFile(filePath);
StubTreeLoader loader = StubTreeLoader.getInstance();
@@ -79,12 +80,12 @@ public abstract class DomStubTest extends LightCodeInsightFixtureTestCase {
return root;
}
- protected void doBuilderTest(String file, String stubText) {
+ protected void doBuilderTest(@TestDataFile String file, String stubText) {
ElementStub stub = getRootStub(file);
assertEquals(stubText, DebugUtil.stubTreeToString(stub));
}
- protected <T extends DomElement> DomFileElement<T> prepare(String path, Class<T> domClass) {
+ protected <T extends DomElement> DomFileElement<T> prepare(@TestDataFile String path, Class<T> domClass) {
XmlFile file = prepareFile(path);
DomFileElement<T> fileElement = DomManager.getDomManager(getProject()).getFileElement(file, domClass);
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubUsingTest.java b/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubUsingTest.java
index 92afd1cff478..085960fcb45b 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubUsingTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubUsingTest.java
@@ -114,12 +114,7 @@ public class DomStubUsingTest extends DomStubTest {
public void testFileLoading() throws Exception {
XmlFile file = prepareFile("foo.xml");
- ((PsiManagerImpl)getPsiManager()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL);
- try {
- DomManager.getDomManager(getProject()).getFileElement(file, Foo.class);
- }
- finally {
- ((PsiManagerImpl)getPsiManager()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE);
- }
+ ((PsiManagerImpl)getPsiManager()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, myTestRootDisposable);
+ DomManager.getDomManager(getProject()).getFileElement(file, Foo.class);
}
}