From 00de95280ceb4ddf5169b2650b2065ff52d50302 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Mon, 31 Aug 2009 16:57:52 +0400 Subject: [PATCH] spellchecker finds its testdata after move --- .../openapi/application/PluginPathManager.java | 10 ++++++++++ .../ClassNameWithMistakesInspectionTest.java | 3 +-- .../inspection/CommentsWithMistakesInspectionTest.java | 2 +- .../DocCommentWithMistakesInspectionTest.java | 2 +- .../FieldNameWithMistakesInspectionTest.java | 2 +- .../spellchecker/inspection/GroovyFileWithTypos.java | 2 +- .../spellchecker/inspection/JSFileWithTypos.java | 2 +- .../LocalVariableWithMistakesInspectionTest.java | 2 +- .../MethodNameWithMistakesInspectionTest.java | 2 +- .../inspection/SpellcheckerInspectionTestCase.java | 4 ++++ .../inspection/StringWithMistakesInspectionTest.java | 2 +- .../inspection/XmlWithMistakesInspectionTest.java | 2 +- 12 files changed, 24 insertions(+), 11 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/application/PluginPathManager.java b/platform/platform-impl/src/com/intellij/openapi/application/PluginPathManager.java index fad8bcd1e299..8874d228d932 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/PluginPathManager.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/PluginPathManager.java @@ -17,4 +17,14 @@ public class PluginPathManager { } return new File(homePath, "plugins/" + pluginName).getPath(); } + + public static String getPluginHomePathRelative(String pluginName) { + String homePath = PathManager.getHomePath(); + final String relativePath = "/community/plugins/" + pluginName; + File candidate = new File(homePath, relativePath); + if (candidate.isDirectory()) { + return relativePath; + } + return "/plugins/" + pluginName; + } } diff --git a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/ClassNameWithMistakesInspectionTest.java b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/ClassNameWithMistakesInspectionTest.java index adce59a47c2b..fd6f0b123167 100644 --- a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/ClassNameWithMistakesInspectionTest.java +++ b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/ClassNameWithMistakesInspectionTest.java @@ -7,9 +7,8 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider; * User: Ekaterina Shliakhovetskaja */ public class ClassNameWithMistakesInspectionTest extends SpellcheckerInspectionTestCase { - protected String getBasePath() { - return "/plugins/spellchecker/tests/testData/inspection/classNameWithMistakes"; + return getSpellcheckerTestDataPath() + "/inspection/classNameWithMistakes"; } public void testJava() throws Throwable { diff --git a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/CommentsWithMistakesInspectionTest.java b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/CommentsWithMistakesInspectionTest.java index 2adb08eae0a9..7bb8c6acbe27 100644 --- a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/CommentsWithMistakesInspectionTest.java +++ b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/CommentsWithMistakesInspectionTest.java @@ -10,7 +10,7 @@ public class CommentsWithMistakesInspectionTest extends SpellcheckerInspectionTe protected String getBasePath() { - return "/plugins/spellchecker/tests/testData/inspection/commentsWithMistakes"; + return getSpellcheckerTestDataPath() + "/inspection/commentsWithMistakes"; } public void testJava() throws Throwable { diff --git a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/DocCommentWithMistakesInspectionTest.java b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/DocCommentWithMistakesInspectionTest.java index 7ad88612f644..c0d9fe8550b0 100644 --- a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/DocCommentWithMistakesInspectionTest.java +++ b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/DocCommentWithMistakesInspectionTest.java @@ -10,7 +10,7 @@ public class DocCommentWithMistakesInspectionTest extends SpellcheckerInspection protected String getBasePath() { - return "/plugins/spellchecker/tests/testData/inspection/docCommentWithMistakes"; + return getSpellcheckerTestDataPath() + "/inspection/docCommentWithMistakes"; } public void testJava() throws Throwable { diff --git a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/FieldNameWithMistakesInspectionTest.java b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/FieldNameWithMistakesInspectionTest.java index 6ec00a7940a9..874e9a245d03 100644 --- a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/FieldNameWithMistakesInspectionTest.java +++ b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/FieldNameWithMistakesInspectionTest.java @@ -10,7 +10,7 @@ public class FieldNameWithMistakesInspectionTest extends SpellcheckerInspectionT protected String getBasePath() { - return "/plugins/spellchecker/tests/testData/inspection/fieldNameWithMistakes"; + return getSpellcheckerTestDataPath() + "/inspection/fieldNameWithMistakes"; } public void testJava() throws Throwable { diff --git a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/GroovyFileWithTypos.java b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/GroovyFileWithTypos.java index f7c5573fad74..2daa862cdda8 100644 --- a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/GroovyFileWithTypos.java +++ b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/GroovyFileWithTypos.java @@ -9,7 +9,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider; public class GroovyFileWithTypos extends SpellcheckerInspectionTestCase { protected String getBasePath() { - return "/plugins/spellchecker/tests/testData/inspection/groovy"; + return getSpellcheckerTestDataPath() + "/inspection/groovy"; } public void testGroovy() throws Throwable { diff --git a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/JSFileWithTypos.java b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/JSFileWithTypos.java index 91921ed75fab..806c45937b39 100644 --- a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/JSFileWithTypos.java +++ b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/JSFileWithTypos.java @@ -9,7 +9,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider; public class JSFileWithTypos extends SpellcheckerInspectionTestCase { protected String getBasePath() { - return "/plugins/spellchecker/tests/testData/inspection/js"; + return getSpellcheckerTestDataPath() + "/inspection/js"; } public void testJS() throws Throwable { diff --git a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/LocalVariableWithMistakesInspectionTest.java b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/LocalVariableWithMistakesInspectionTest.java index 9ed239c21220..3844c17a69c2 100644 --- a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/LocalVariableWithMistakesInspectionTest.java +++ b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/LocalVariableWithMistakesInspectionTest.java @@ -9,7 +9,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider; public class LocalVariableWithMistakesInspectionTest extends SpellcheckerInspectionTestCase { protected String getBasePath() { - return "/plugins/spellchecker/tests/testData/inspection/localVariableNameWithMistakes"; + return getSpellcheckerTestDataPath() + "/inspection/localVariableNameWithMistakes"; } public void testJava() throws Throwable { diff --git a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/MethodNameWithMistakesInspectionTest.java b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/MethodNameWithMistakesInspectionTest.java index cf2e0afafa46..68fada785ae3 100644 --- a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/MethodNameWithMistakesInspectionTest.java +++ b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/MethodNameWithMistakesInspectionTest.java @@ -9,7 +9,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider; public class MethodNameWithMistakesInspectionTest extends SpellcheckerInspectionTestCase { protected String getBasePath() { - return "/plugins/spellchecker/tests/testData/inspection/methodNameWithMistakes"; + return getSpellcheckerTestDataPath() + "/inspection/methodNameWithMistakes"; } public void testJava() throws Throwable { diff --git a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/SpellcheckerInspectionTestCase.java b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/SpellcheckerInspectionTestCase.java index 3eff43cd0fb2..02625c7da226 100644 --- a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/SpellcheckerInspectionTestCase.java +++ b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/SpellcheckerInspectionTestCase.java @@ -2,11 +2,15 @@ package com.intellij.spellchecker.inspection; import com.intellij.codeInspection.LocalInspectionTool; import com.intellij.openapi.application.PathManager; +import com.intellij.openapi.application.PluginPathManager; import com.intellij.openapi.util.io.FileUtil; import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase; import org.jetbrains.annotations.NonNls; public abstract class SpellcheckerInspectionTestCase extends JavaCodeInsightFixtureTestCase { + protected static String getSpellcheckerTestDataPath() { + return PluginPathManager.getPluginHomePathRelative("spellchecker") + "/testData"; + } @NonNls protected String DATA_PATH = FileUtil.toSystemIndependentName(PathManager.getHomePath()) + "/plugins/spellchecker/core/tests/testData"; diff --git a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/StringWithMistakesInspectionTest.java b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/StringWithMistakesInspectionTest.java index dfbbad7f5925..99e85650d380 100644 --- a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/StringWithMistakesInspectionTest.java +++ b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/StringWithMistakesInspectionTest.java @@ -10,7 +10,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider; public class StringWithMistakesInspectionTest extends SpellcheckerInspectionTestCase { protected String getBasePath() { - return "/plugins/spellchecker/tests/testData/inspection/stringWithMistakes"; + return getSpellcheckerTestDataPath() + "/inspection/stringWithMistakes"; } diff --git a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/XmlWithMistakesInspectionTest.java b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/XmlWithMistakesInspectionTest.java index 51c04c9a8780..677087cc3085 100644 --- a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/XmlWithMistakesInspectionTest.java +++ b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/XmlWithMistakesInspectionTest.java @@ -9,7 +9,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider; public class XmlWithMistakesInspectionTest extends SpellcheckerInspectionTestCase { protected String getBasePath() { - return "/plugins/spellchecker/tests/testData/inspection/xmlWithMistakes"; + return getSpellcheckerTestDataPath() + "/inspection/xmlWithMistakes"; }