@Nullable private static File getPluginDir(IdeaPluginDescriptor plugin) { String pluginDirName = StringUtil.getShortName(plugin.getPluginId().getIdString()); String extraDir = System.getProperty("idea.external.build.development.plugins.dir"); if (extraDir != null) { File extraDirFile = new File(extraDir, pluginDirName); if (extraDirFile.isDirectory()) { return extraDirFile; } } File pluginHome = PluginPathManager.getPluginHome(pluginDirName); if (!pluginHome.isDirectory() && StringUtil.isCapitalized(pluginDirName)) { pluginHome = PluginPathManager.getPluginHome(StringUtil.decapitalize(pluginDirName)); } return pluginHome.isDirectory() ? pluginHome : null; }
@BeforeMethod public void setUp() throws Exception { JavaTestFixtureFactory.getFixtureFactory(); // registers Java module fixture builder final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory(); final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder(getClass().getSimpleName()); myFixture = fixtureFactory.createTempDirTestFixture(); myFixture.setUp(); FileUtil.copyDir(new File(PluginPathManager.getPluginHomePath("testng") + "/testData/runConfiguration/module1"), new File(myFixture.getTempDirPath()), false); myProjectFixture = testFixtureBuilder.getFixture(); final JavaModuleFixtureBuilder javaModuleFixtureBuilder = testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class); javaModuleFixtureBuilder.addContentRoot(myFixture.getTempDirPath()).addSourceRoot("src"); javaModuleFixtureBuilder.addLibrary("testng", PathUtil.getJarPathForClass(AfterMethod.class)); myProjectFixture.setUp(); }
@BeforeClass private void loadEthalonAnnotations() throws IOException { myPluginRoot = new File(PluginPathManager.getPluginHomePath(HgVcs.VCS_NAME)); myAnnotateDataDir = new File(myPluginRoot, "testData/annotate"); myOutputsDir = new File(myAnnotateDataDir, "outputs"); final File etalonFile = new File(myAnnotateDataDir, "etalon"); XStream xStream = new XStream(); FileReader reader = new FileReader(etalonFile); try { myAnnotations = (List<HgAnnotationLine>) xStream.fromXML(reader); } finally { reader.close(); } }
@BeforeMethod public void setUp() throws Exception { UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { try { final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory(); final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder(getClass().getSimpleName()); myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(testFixtureBuilder.getFixture()); final String dataPath = PluginPathManager.getPluginHomePath("testng") + "/testData"; myFixture.setTestDataPath(dataPath); final JavaModuleFixtureBuilder builder = testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class); builder.addContentRoot(myFixture.getTempDirPath()).addSourceRoot(""); // builder.addContentRoot(dataPath); builder.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15); myFixture.setUp(); final JavaPsiFacade facade = JavaPsiFacade.getInstance(myFixture.getProject()); myLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel(); LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5); } catch (Exception e) { throw new RuntimeException(e); } } }); }
@Override protected void setUp() throws Exception { super.setUp(); final File testRoot = new File(PluginPathManager.getPluginHomePath("eclipse") + "/testData", "eml"); assertTrue(testRoot.getAbsolutePath(), testRoot.isDirectory()); final File currentTestRoot = new File(testRoot, getTestName(true)); assertTrue(currentTestRoot.getAbsolutePath(), currentTestRoot.isDirectory()); VirtualFile vTestRoot = LocalFileSystem.getInstance().findFileByIoFile(currentTestRoot); copyDirContentsTo(vTestRoot, getProject().getBaseDir()); }
@Override protected void setUp() throws Exception { super.setUp(); final File testRoot = new File(PluginPathManager.getPluginHomePath("eclipse") + "/testData", "round"); assertTrue(testRoot.getAbsolutePath(), testRoot.isDirectory()); final File currentTestRoot = new File(testRoot, getTestName(true)); assertTrue(currentTestRoot.getAbsolutePath(), currentTestRoot.isDirectory()); final VirtualFile vTestRoot = LocalFileSystem.getInstance().findFileByIoFile(currentTestRoot); copyDirContentsTo(vTestRoot, getProject().getBaseDir()); }
@Override protected void setUp() throws Exception { super.setUp(); final File testRoot = new File(PluginPathManager.getPluginHomePath("eclipse") + "/testData/iml"); assertTrue(testRoot.getAbsolutePath(), testRoot.isDirectory()); final File currentTestRoot = new File(testRoot, getTestName(true)); assertTrue(currentTestRoot.getAbsolutePath(), currentTestRoot.isDirectory()); VirtualFile vTestRoot = LocalFileSystem.getInstance().findFileByIoFile(currentTestRoot); copyDirContentsTo(vTestRoot, getProject().getBaseDir()); }
@Override protected void setUp() throws Exception { super.setUp(); String root = PluginPathManager.getPluginHomePath("ui-designer") + "/testData/binding/" + getTestName(true); PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17()); myTestProjectRoot = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete); }
@Override protected void setUp() throws Exception { super.setUp(); String root = PluginPathManager.getPluginHomePath("ui-designer") + "/testData/sourceCodeGenerator/" + getTestName(true); PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17()); myTestProjectRoot = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete); myGenerator = new FormSourceCodeGenerator(getProject()); }
@Parameterized.Parameters(name = "{0}") public static Collection<Object[]> data() { File pluginRoot = new File(PluginPathManager.getPluginHomePath("git4idea")); File dataDir = new File(new File(pluginRoot, "testData"), "repo"); File[] testCases = dataDir.listFiles(FileUtilRt.ALL_DIRECTORIES); return ContainerUtil.map(testCases, new Function<File, Object[]>() { @Override public Object[] fun(File file) { return new Object[] { file.getName(), file }; } }); }
@BeforeMethod protected void setUp(final Method testMethod) throws Exception { // setting hg executable String exec = System.getenv(HG_EXECUTABLE_PATH); if (exec != null) { myClientBinaryPath = new File(exec); } if (exec == null || !myClientBinaryPath.exists()) { final File pluginRoot = new File(PluginPathManager.getPluginHomePath(HgVcs.VCS_NAME)); myClientBinaryPath = new File(pluginRoot, "testData/bin"); } myMainRepo = initRepositories(); myProjectDir = new File(myMainRepo.getDirFixture().getTempDirPath()); UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { try { initProject(myProjectDir, testMethod.getName()); activateVCS(HgVcs.VCS_NAME); } catch (Exception e) { e.printStackTrace(); } } }); myChangeListManager = new HgTestChangeListManager(myProject); myTraceClient = true; doActionSilently(VcsConfiguration.StandardConfirmation.ADD); doActionSilently(VcsConfiguration.StandardConfirmation.REMOVE); }
private static String findInSources(String programName, String unixExec, String winExec) { File pluginRoot = new File(PluginPathManager.getPluginHomePath("hg4idea")); File bin = new File(pluginRoot, FileUtil.toSystemDependentName("testData/bin")); File exec = new File(bin, SystemInfo.isWindows ? winExec : unixExec); if (exec.exists() && exec.canExecute()) { debug("Using " + programName + " from test data"); return exec.getPath(); } return null; }
@Override public void setUp() throws Exception { super.setUp(); myHgDir = new File(myRepository.getPath(), ".hg"); assertTrue(myHgDir.exists()); File pluginRoot = new File(PluginPathManager.getPluginHomePath("hg4idea")); String pathToHg = "testData/repo/dot_hg"; File testHgDir = new File(pluginRoot, FileUtil.toSystemDependentName(pathToHg)); File cacheDir = new File(testHgDir, "cache"); File testDirStateFile = new File(testHgDir, "dirstate"); File testBranchFile = new File(testHgDir, "branch"); File testBookmarkFile = new File(testHgDir, "bookmarks"); File testCurrentBookmarkFile = new File(testHgDir, "bookmarks.current"); File testTagFile = new File(testHgDir.getParentFile(), ".hgtags"); File testLocalTagFile = new File(testHgDir, "localtags"); FileUtil.copyDir(cacheDir, new File(myHgDir, "cache")); FileUtil.copy(testBranchFile, new File(myHgDir, "branch")); FileUtil.copy(testDirStateFile, new File(myHgDir, "dirstate")); FileUtil.copy(testBookmarkFile, new File(myHgDir, "bookmarks")); FileUtil.copy(testCurrentBookmarkFile, new File(myHgDir, "bookmarks.current")); FileUtil.copy(testTagFile, new File(myHgDir.getParentFile(), ".hgtags")); FileUtil.copy(testLocalTagFile, new File(myHgDir, "localtags")); myRepositoryReader = new HgRepositoryReader(myVcs, myHgDir); myBranches = readBranches(); myBookmarks = readRefs(testBookmarkFile); myTags = readRefs(testTagFile); myLocalTags = readRefs(testLocalTagFile); }
private static void setUpHgrc(@NotNull VirtualFile repositoryRoot) throws IOException { cd(".hg"); File pluginRoot = new File(PluginPathManager.getPluginHomePath("hg4idea")); String pathToHgrc = "testData\\repo\\dot_hg"; File hgrcFile = new File(new File(pluginRoot, FileUtil.toSystemIndependentName(pathToHgrc)), "hgrc"); File hgrc = new File(new File(repositoryRoot.getPath(), ".hg"), "hgrc"); FileUtil.appendToFile(hgrc, FileUtil.loadFile(hgrcFile)); assertTrue(hgrc.exists()); repositoryRoot.refresh(false, true); }
@Before public void setUp() throws Exception { super.setUp(); //PlatformTestCase.initPlatformLangPrefix(); File pluginRoot = new File(PluginPathManager.getPluginHomePath("svn4idea")); if (!pluginRoot.isDirectory()) { // try standalone mode Class aClass = Svn17TestCase.class; String rootPath = PathManager.getResourceRoot(aClass, "/" + aClass.getName().replace('.', '/') + ".class"); pluginRoot = new File(rootPath).getParentFile().getParentFile().getParentFile(); } myWorkingCopyRoot = new File(pluginRoot, "testData/move2unv"); myLocks = new SvnTestWriteOperationLocks(new WorkingCopy(myWorkingCopyRoot, SVNURL.parseURIEncoded("http://a.b.c"), true)); }
@Before public void setUp() throws Exception { final Ref<Exception> ex = new Ref<Exception>(); Runnable runnable = new Runnable() { public void run() { try { CreateClassFixTest.super.setUp(); final JavaTestFixtureFactory fixtureFactory = JavaTestFixtureFactory.getFixtureFactory(); final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = JavaTestFixtureFactory.createFixtureBuilder(getClass().getSimpleName()); myFixture = fixtureFactory.createCodeInsightFixture(testFixtureBuilder.getFixture()); myFixture.setTestDataPath(PluginPathManager.getPluginHomePath("devkit") + "/testData"); testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class) .addContentRoot(myFixture.getTempDirPath()).addSourceRoot(getSourceRoot()); myFixture.setUp(); myFixture.enableInspections(new RegistrationProblemsInspection()); } catch (Exception e) { ex.set(e); } } }; invokeTestRunnable(runnable); final Exception exception = ex.get(); if (exception != null) { throw exception; } }
private static String getAgentJarPath() { final String userDefined = System.getProperty(GROOVY_HOTSWAP_AGENT_PATH); if (userDefined != null && new File(userDefined).exists()) { return userDefined; } final File ourJar = new File(PathUtil.getJarPathForClass(GroovyHotSwapper.class)); if (ourJar.isDirectory()) { //development mode return PluginPathManager.getPluginHomePath("groovy") + "/hotswap/gragent.jar"; } final File pluginDir = ourJar.getParentFile(); return pluginDir.getPath() + File.separator + "agent" + File.separator + "gragent.jar"; }
@Override protected void setUp() throws Exception { super.setUp(); myFixture.setTestDataPath(PluginPathManager.getPluginHomePath("java-decompiler") + "/plugin/testData"); }
@Override protected String getBasePath() { return PluginPathManager.getPluginHomePathRelative("testng") + "/testData/references"; }
@NotNull @Override protected String getTestDataPath() { return PluginPathManager.getPluginHomePath("javaFX") + "/testData"; }
@NotNull @Override protected String getTestDataPath() { return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/"; }
@NotNull @Override protected String getTestDataPath() { return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/asserts_without_messages/"; }
@Override protected String getBasePath() { return PluginPathManager.getPluginHomePathRelative("testng") + "/testData/junit"; }
@NonNls protected String getTestDataPath() { return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection"; }
@NotNull @Override protected String getTestDataPath() { return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/dependsOn/"; }
@Override protected String getBasePath() { return PluginPathManager.getPluginHomePathRelative("testng") + "/testData/configuration"; }
@Override protected void setUpModule() { super.setUpModule(); PsiTestUtil.addLibrary(getModule(), "javafx", PluginPathManager.getPluginHomePath("javaFX") + "/testData", "jfxrt.jar"); }
@NotNull @Override protected String getTestDataPath() { return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/dataProvider/"; }
@Override public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) { PsiTestUtil.addLibrary(module, model, "javafx", PluginPathManager.getPluginHomePath("javaFX") + "/testData", "jfxrt.jar"); PsiTestUtil.addLibrary(module, model, "javafx", PluginPathManager.getPluginHomePath("javaFX") + "/testData", "groovy-1.8.0.jar"); super.configureModule(module, model, contentEntry); }
@NotNull @Override protected String getTestDataPath() { return PluginPathManager.getPluginHomePath("javaFX") + "/testData/intentions/collapseToAttr/"; }
private static String getTestDataPath() { return PluginPathManager.getPluginHomePath("eclipse") + "/testData/import/settings/"; }
private static String getOriginalTestDataPath() { String sourcesDir = System.getProperty("maven.sources.dir", PluginPathManager.getPluginHomePath("maven")); return FileUtil.toSystemIndependentName(sourcesDir + "/src/test/data"); }
@Override protected String getTestDataPath() { return PluginPathManager.getPluginHomePath("maven") + "/src/test/data/inspections"; }
protected String getMyTestDataPath() { return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/customTypes"; }
@Override protected String getTestDataPath() { return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi"; }
@Override protected String getTestDataPath() { return PluginPathManager.getPluginHomePath("ant") + "/tests/data/highlighting/"; }
@NotNull @Override protected String getTestDataPath() { return PluginPathManager.getPluginHomePath("ant").replace('\\', '/') + "/tests/data/psi/rename/"; }
@Override protected String getTestDataPath() { return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/resolve/"; }
protected String getTestDataPath() { return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/completion/"; }