From be1ec11d56e96e956f96acbbe582105205bb165f Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 26 Feb 2015 15:44:35 +0100 Subject: [PATCH] Cleanup (more slow tests skipped locally) --- .../com/intellij/index/IndexTest.groovy | 32 +++++++++++-------- .../testSrc/com/intellij/psi/MiscPsiTest.java | 4 ++- .../psi/PsiModificationTrackerTest.java | 4 ++- .../psi/impl/file/impl/PsiEventsTest.java | 11 ++----- .../SmartPsiElementPointersTest.java | 6 ++-- 5 files changed, 29 insertions(+), 28 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/index/IndexTest.groovy b/java/java-tests/testSrc/com/intellij/index/IndexTest.groovy index eb769ccfd83f..c09e5916dc25 100644 --- a/java/java-tests/testSrc/com/intellij/index/IndexTest.groovy +++ b/java/java-tests/testSrc/com/intellij/index/IndexTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -14,6 +14,7 @@ * limitations under the License. */ package com.intellij.index + import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.command.impl.CurrentEditorProvider import com.intellij.openapi.command.impl.UndoManagerImpl @@ -39,21 +40,25 @@ import com.intellij.psi.search.GlobalSearchScope import com.intellij.psi.search.PsiSearchHelper import com.intellij.testFramework.IdeaTestUtil import com.intellij.testFramework.PlatformTestUtil +import com.intellij.testFramework.SkipSlowTestLocally import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase import com.intellij.util.indexing.MapIndexStorage import com.intellij.util.indexing.StorageException import com.intellij.util.io.* import org.jetbrains.annotations.NotNull + /** * @author Eugene Zhuravlev - * Date: Dec 12, 2007 + * @since Dec 12, 2007 */ +@SkipSlowTestLocally public class IndexTest extends JavaCodeInsightFixtureTestCase { @Override protected void invokeTestRunnable(@NotNull Runnable runnable) throws Exception { if ("testUndoToFileContentForUnsavedCommittedDocument".equals(getName())) { super.invokeTestRunnable(runnable); - } else { + } + else { WriteCommandAction.runWriteCommandAction(getProject(), runnable); } } @@ -62,7 +67,7 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase { StringIndex index = createIndex(new EnumeratorStringDescriptor()) try { -// build index + // build index index.update("com/ppp/a.java", "a b c d", null); index.update("com/ppp/b.java", "a b g h", null); index.update("com/ppp/c.java", "a z f", null); @@ -84,7 +89,6 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase { assertDataEquals(index.getFilesByWord("e"), "com/ppp/e.java"); // update index - index.update("com/ppp/d.java", "a u y z", "a a u y z"); assertDataEquals(index.getFilesByWord("a"), "com/ppp/a.java", "com/ppp/b.java", "com/ppp/c.java", "com/ppp/d.java", "com/ppp/e.java"); index.update("com/ppp/d.java", "u y z", "a u y z"); @@ -126,10 +130,10 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase { } private static StringIndex createIndex(EnumeratorStringDescriptor keyDescriptor) { - final File storageFile = FileUtil.createTempFile("indextest", "storage"); - final File metaIndexFile = FileUtil.createTempFile("indextest_inputs", "storage"); + final File storageFile = FileUtil.createTempFile("index_test", "storage"); + final File metaIndexFile = FileUtil.createTempFile("index_test_inputs", "storage"); final MapIndexStorage indexStorage = new MapIndexStorage(storageFile, keyDescriptor, new EnumeratorStringDescriptor(), 16 * 1024); - final StringIndex index = new StringIndex(indexStorage, new Factory>>() { + return new StringIndex(indexStorage, new Factory>>() { @Override public PersistentHashMap> create() { try { @@ -139,9 +143,7 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase { throw new RuntimeException(e); } } - }); - index } private static PersistentHashMap> createMetaIndex(File metaIndexFile) throws IOException { @@ -181,6 +183,7 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase { document.deleteString(0, document.getTextLength()); assertNotNull(findClass("Foo")); + //noinspection GroovyUnusedAssignment psiFile = null; PlatformTestUtil.tryGcSoftlyReachableObjects(); assertNull(getPsiManager().getFileManager().getCachedPsiFile(vFile)); @@ -208,6 +211,7 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase { document.insertString(0, " "); //assertNotNull(myJavaFacade.findClass("Foo", scope)); + //noinspection GroovyUnusedAssignment psiFile = null; PlatformTestUtil.tryGcSoftlyReachableObjects(); assertNull(getPsiManager().getFileManager().getCachedPsiFile(vFile)); @@ -321,7 +325,7 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase { PlatformTestUtil.tryGcSoftlyReachableObjects() - def astNode = JavaPsiFacade.getInstance(project).findClass("Foo", scope).node + assert JavaPsiFacade.getInstance(project).findClass("Foo", scope) assert !((FileManagerImpl) psiManager.fileManager).getCachedDirectory(psiFile.virtualFile.parent) assert psiFile.setName("Foo1.java") == psiFile @@ -340,7 +344,7 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase { PlatformTestUtil.tryGcSoftlyReachableObjects() - def astNode = JavaPsiFacade.getInstance(project).findClass("pkg.Foo", scope).node + assert JavaPsiFacade.getInstance(project).findClass("pkg.Foo", scope) def dir = psiFile.virtualFile.parent assert !((FileManagerImpl) psiManager.fileManager).getCachedDirectory(dir) @@ -390,8 +394,9 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase { FileDocumentManager.instance.getDocument(vFile).text = "import zoo.Zoo; class Foo1 {}" assert PsiDocumentManager.getInstance(project).uncommittedDocuments - psiFile = null + //noinspection GroovyUnusedAssignment + psiFile = null PlatformTestUtil.tryGcSoftlyReachableObjects() assert !((PsiManagerEx) psiManager).fileManager.getCachedPsiFile(vFile) @@ -420,5 +425,4 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase { assertNotNull(stubTree) assertEquals(stubTreeHash, stubTree.hashCode()) } - } diff --git a/java/java-tests/testSrc/com/intellij/psi/MiscPsiTest.java b/java/java-tests/testSrc/com/intellij/psi/MiscPsiTest.java index dea9282d67e3..c34996da669c 100644 --- a/java/java-tests/testSrc/com/intellij/psi/MiscPsiTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/MiscPsiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -27,9 +27,11 @@ import com.intellij.pom.java.LanguageLevel; import com.intellij.psi.impl.source.PostprocessReformattingAspect; import com.intellij.psi.impl.source.tree.LazyParseableElement; import com.intellij.testFramework.PlatformTestUtil; +import com.intellij.testFramework.SkipSlowTestLocally; import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; import org.jetbrains.annotations.NotNull; +@SkipSlowTestLocally public class MiscPsiTest extends LightCodeInsightFixtureTestCase { @Override protected void invokeTestRunnable(@NotNull final Runnable runnable) throws Exception { diff --git a/java/java-tests/testSrc/com/intellij/psi/PsiModificationTrackerTest.java b/java/java-tests/testSrc/com/intellij/psi/PsiModificationTrackerTest.java index af66253cb185..6ff994ccea6d 100644 --- a/java/java-tests/testSrc/com/intellij/psi/PsiModificationTrackerTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/PsiModificationTrackerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -30,6 +30,7 @@ import com.intellij.psi.impl.file.impl.FileManagerImpl; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.util.PsiModificationTracker; import com.intellij.testFramework.PlatformTestUtil; +import com.intellij.testFramework.SkipSlowTestLocally; import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase; import com.intellij.util.Processor; import org.jetbrains.annotations.NonNls; @@ -41,6 +42,7 @@ import java.io.IOException; /** * @author Dmitry Avdeev */ +@SkipSlowTestLocally public class PsiModificationTrackerTest extends JavaCodeInsightFixtureTestCase { @Override diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java index 7e496fa39df0..8e76bf4cb914 100644 --- a/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -15,7 +15,6 @@ */ package com.intellij.psi.impl.file.impl; - import com.intellij.ide.IdeEventQueue; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.impl.LaterInvocator; @@ -31,10 +30,7 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.impl.PsiTreeChangeEventImpl; import com.intellij.psi.search.GlobalSearchScope; -import com.intellij.testFramework.LeakHunter; -import com.intellij.testFramework.PlatformTestUtil; -import com.intellij.testFramework.PsiTestCase; -import com.intellij.testFramework.PsiTestUtil; +import com.intellij.testFramework.*; import com.intellij.util.MemoryDumpHelper; import com.intellij.util.Processor; import com.intellij.util.WaitFor; @@ -44,6 +40,7 @@ import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.IOException; +@SkipSlowTestLocally public class PsiEventsTest extends PsiTestCase { private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.file.impl.PsiEventsTest"); @@ -93,8 +90,6 @@ public class PsiEventsTest extends PsiTestCase { } } }); - - //((PsiManagerImpl)myPsiManager).getFileManager().disbleVFSEventsProcessing(); } public void testCreateFile() throws Exception { diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java index 4702973e3daa..a1b4e6cb778f 100644 --- a/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java @@ -39,10 +39,7 @@ import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtil; import com.intellij.psi.util.PsiUtilBase; import com.intellij.psi.xml.XmlTag; -import com.intellij.testFramework.IdeaTestUtil; -import com.intellij.testFramework.PlatformTestCase; -import com.intellij.testFramework.PlatformTestUtil; -import com.intellij.testFramework.PsiTestUtil; +import com.intellij.testFramework.*; import com.intellij.util.FileContentUtil; import gnu.trove.THashSet; import org.junit.Assert; @@ -53,6 +50,7 @@ import java.util.Collections; import java.util.Set; @PlatformTestCase.WrapInCommand +@SkipSlowTestLocally public class SmartPsiElementPointersTest extends CodeInsightTestCase { private VirtualFile myRoot;