Ant finds its testdata after move

This commit is contained in:
Dmitry Jemerov
2009-08-31 16:43:16 +04:00
parent 81c007433d
commit c0cb5a05ba
7 changed files with 32 additions and 15 deletions
@@ -0,0 +1,20 @@
package com.intellij.openapi.application;
import java.io.File;
/**
* @author yole
*/
public class PluginPathManager {
private PluginPathManager() {
}
public static String getPluginHomePath(String pluginName) {
String homePath = PathManager.getHomePath();
File candidate = new File(homePath, "community/plugins/" + pluginName);
if (candidate.isDirectory()) {
return candidate.getPath();
}
return new File(homePath, "plugins/" + pluginName).getPath();
}
}
@@ -6,16 +6,13 @@ import com.intellij.codeInsight.lookup.Lookup;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.codeInsight.lookup.impl.TestLookupManager;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.testFramework.LightCodeInsightTestCase;
/**
* @author zhzhot
*/
public class AntCompletionTest extends LightCodeInsightTestCase {
protected String getTestDataPath() {
return PathManager.getHomePath() + "/plugins/ant/tests/data/psi/completion/";
return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/completion/";
}
public void testSimpleProperty() throws Exception {
@@ -10,7 +10,7 @@
*/
package com.intellij.lang.ant;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.testFramework.fixtures.CodeInsightTestFixture;
import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
import com.intellij.testFramework.fixtures.JavaTestFixtureFactory;
@@ -24,7 +24,7 @@ public class AntMultiFileCompletionTest extends TestCase {
private CodeInsightTestFixture myFixture;
protected String getTestDataPath() {
return PathManager.getHomePath() + "/plugins/ant/tests/data/psi/completion/";
return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/completion/";
}
public void testPropertyCompletion() throws Throwable {
@@ -4,7 +4,7 @@
package com.intellij.lang.ant;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.testFramework.ParsingTestCase;
public class AntParsingTest extends ParsingTestCase {
@@ -14,7 +14,7 @@ public class AntParsingTest extends ParsingTestCase {
}
protected String getTestDataPath() {
return PathManager.getHomePath() + "/plugins/ant/tests/data";
return PluginPathManager.getPluginHomePath("ant") + "/tests/data";
}
public void testSingleProject() throws Exception {
@@ -2,7 +2,7 @@ package com.intellij.lang.ant;
import com.intellij.codeInsight.TargetElementUtilBase;
import com.intellij.lang.ant.psi.AntFile;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
@@ -115,7 +115,7 @@ public class AntRenameTest extends LightCodeInsightTestCase {
}
protected String getTestDataPath() {
return PathManager.getHomePath().replace('\\', '/') + "/plugins/ant/tests/data/psi/rename/";
return PluginPathManager.getPluginHomePath("ant").replace('\\', '/') + "/tests/data/psi/rename/";
}
private void doTest() throws Exception {
@@ -6,7 +6,7 @@ import com.intellij.lang.ant.psi.AntProperty;
import com.intellij.lang.ant.psi.AntTarget;
import com.intellij.lang.ant.psi.AntTask;
import com.intellij.lang.ant.psi.impl.reference.AntPropertyReference;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;
@@ -249,7 +249,7 @@ public class AntResolveTest extends ResolveTestCase {
}
protected String getTestDataPath() {
return PathManager.getHomePath() + "/plugins/ant/tests/data/psi/resolve/";
return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/resolve/";
}
private PsiReference configure() throws Exception {
@@ -2,7 +2,7 @@ package com.intellij.lang.ant;
import com.intellij.lang.ant.psi.AntFile;
import com.intellij.lang.ant.psi.introspection.AntTypeDefinition;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiFile;
@@ -21,7 +21,7 @@ public class CustomTypesTest extends ParsingTestCase {
}
protected String getTestDataPath() {
return PathManager.getHomePath() + "/plugins/ant/tests/data/psi/customTypes";
return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/customTypes";
}
public void testAntCustomTask() throws Exception {