当前位置: 首页>>代码示例>>Java>>正文


Java PlatformTestCase类代码示例

本文整理汇总了Java中com.intellij.testFramework.PlatformTestCase的典型用法代码示例。如果您正苦于以下问题:Java PlatformTestCase类的具体用法?Java PlatformTestCase怎么用?Java PlatformTestCase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PlatformTestCase类属于com.intellij.testFramework包,在下文中一共展示了PlatformTestCase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doCreateRealModule

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
@Override
protected Module doCreateRealModule(String moduleName) {
  //todo[nik] reuse code from PlatformTestCase
  final VirtualFile baseDir = myProject.getBaseDir();
  Assert.assertNotNull(baseDir);
  final File moduleFile = new File(baseDir.getPath().replace('/', File.separatorChar), moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
  PlatformTestCase.myFilesToDelete.add(moduleFile);
  return new WriteAction<Module>() {
    @Override
    protected void run(@NotNull Result<Module> result) throws Throwable {
      Module module = ModuleManager.getInstance(myProject)
        .newModule(FileUtil.toSystemIndependentName(moduleFile.getAbsolutePath()), getModuleType().getId());
      module.getModuleFile();
      result.setResult(module);
    }
  }.execute().getResultObject();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:BaseCompilerTestCase.java

示例2: doCreateRealModule

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
@Override
protected Module doCreateRealModule(String moduleName) {
  if (useExternalCompiler()) {
    //todo[nik] reuse code from PlatformTestCase
    final VirtualFile baseDir = myProject.getBaseDir();
    Assert.assertNotNull(baseDir);
    final File moduleFile = new File(baseDir.getPath().replace('/', File.separatorChar), moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
    PlatformTestCase.myFilesToDelete.add(moduleFile);
    return new WriteAction<Module>() {
      @Override
      protected void run(Result<Module> result) throws Throwable {
        Module module = ModuleManager.getInstance(myProject)
          .newModule(FileUtil.toSystemIndependentName(moduleFile.getAbsolutePath()), getModuleType().getId());
        module.getModuleFile();
        result.setResult(module);
      }
    }.execute().getResultObject();
  }
  return super.doCreateRealModule(moduleName);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:BaseCompilerTestCase.java

示例3: setUp

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
  PlatformTestCase.initPlatformLangPrefix();
  super.setUp();
  myModule = context.mock(Module.class, "myModule");
  context.checking(new Expectations() {{
    allowing(myModule).getName(); will(returnValue("my-module"));
  }});
  myManager = new ModuleRunConfigurationManager(myModule, new MyRunManagerImpl());

  mySettings = createSettings("my-module-run", new MyModuleBasedConfiguration("my-module-run-config", getProject(), myModule));
  final List<? extends RunnerAndConfigurationSettings> configs = ContainerUtil.newArrayList(
    createSettings("other-run", context.mock(RunConfiguration.class, "other-run-run-config")),
    createSettings("other-module-run", new MyModuleBasedConfiguration("other-module-run-config", getProject(), getModule())),
    mySettings
  );
  myConfigurations = Collections.unmodifiableCollection(configs);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:ModuleRunConfigurationManagerTest.java

示例4: doTest

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
protected void doTest(final PerformAction performAction, final String testName) throws Exception {
  String path = getTestDataPath() + getTestRoot() + testName;

  String pathBefore = path + "/before";
  final VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, pathBefore, PlatformTestCase.myFilesToDelete, false);
  prepareProject(rootDir);
  PsiDocumentManager.getInstance(myProject).commitAllDocuments();

  String pathAfter = path + "/after";
  final VirtualFile rootAfter = LocalFileSystem.getInstance().findFileByPath(pathAfter.replace(File.separatorChar, '/'));

  performAction.performAction(rootDir, rootAfter);
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    public void run() {
      myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
    }
  });

  FileDocumentManager.getInstance().saveAllDocuments();

  if (myDoCompare) {
    PlatformTestUtil.assertDirectoriesEqual(rootAfter, rootDir);
  }
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:25,代码来源:MultiFileTestCase.java

示例5: getInstance

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
public static synchronized IdeaTestApplication getInstance(@Nullable final String configPath) {
  if (ourInstance == null) {
    PlatformTestCase.doAutodetectPlatformPrefix();
    new IdeaTestApplication();
    PluginManagerCore.getPlugins();
    ApplicationManagerEx.getApplicationEx().load(configPath);
  }
  return (IdeaTestApplication)ourInstance;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:IdeaTestApplication.java

示例6: testPreserveCustomTemplates

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
public void testPreserveCustomTemplates() throws Exception {
  myTemplateManager.addTemplate("foo", "txt");
  myTemplateManager.setTemplates(FileTemplateManager.DEFAULT_TEMPLATES_CATEGORY, Arrays.asList(myTemplateManager.getAllTemplates()));
  assertNotNull(myTemplateManager.getTemplate("foo.txt"));

  File foo = PlatformTestCase.createTempDir("foo");
  final Project project = ProjectManager.getInstance().createProject("foo", foo.getPath());;
  try {
    assertNotNull(project);
    assertNotNull(FileTemplateManager.getInstance(project).getTemplate("foo.txt"));
  }
  finally {
    closeProject(project);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:LightFileTemplatesTest.java

示例7: testSurviveOnProjectReopen

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
public void testSurviveOnProjectReopen() throws Exception {
  File foo = PlatformTestCase.createTempDir("foo");
  Project reloaded = null;
  final Project project = ProjectManager.getInstance().createProject("foo", foo.getPath());;
  try {
    assertNotNull(project);
    FileTemplateManager manager = FileTemplateManager.getInstance(project);
    manager.setCurrentScheme(manager.getProjectScheme());
    FileTemplate template = manager.getTemplate(TEST_TEMPLATE_TXT);
    assertEquals(HI_THERE, template.getText());
    String newText = "good bye";
    template.setText(newText);
    assertEquals(newText, manager.getTemplate(TEST_TEMPLATE_TXT).getText());

    PlatformTestUtil.saveProject(project);
    closeProject(project);

    reloaded = ProjectManager.getInstance().loadAndOpenProject(foo.getPath());
    assertNotNull(reloaded);
    manager = FileTemplateManager.getInstance(reloaded);
    assertEquals(manager.getProjectScheme(), manager.getCurrentScheme());
    //manager.setCurrentScheme(FileTemplatesScheme.DEFAULT);
    //manager.setCurrentScheme(manager.getProjectScheme()); // enforce reloading
    assertEquals(newText, manager.getTemplate(TEST_TEMPLATE_TXT).getText());
  }
  finally {
    closeProject(project);
    closeProject(reloaded);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:LightFileTemplatesTest.java

示例8: setUp

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
public void setUp() throws Exception {
    myTestRoot = new File(FileUtil.getTempDirectory(), "testRoot");
    PlatformTestCase.myFilesToDelete.add(myTestRoot);
    checkTestRootIsEmpty(myTestRoot);

    EdtTestUtil.runInEdtAndWait(() -> super.setUp());
    myTestRootFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(myTestRoot);
    this.refresh();

    myTestStartedIndicator = enableDebugLogging();

    myProjectRoot = myProject.getBaseDir();
    myProjectPath = myProjectRoot.getPath();

    changeListManager = (ChangeListManagerImpl) ChangeListManager.getInstance(myProject);

    myGitSettings = GitVcsSettings.getInstance(myProject);
    myGitSettings.getAppSettings().setPathToGit("git");

    myDialogManager = ServiceManager.getService(DialogManager.class);
    myVcsNotifier = ServiceManager.getService(myProject, VcsNotifier.class);

    myGitRepositoryManager = GitUtil.getRepositoryManager(myProject);
    myGit = ServiceManager.getService(Git.class);
    myVcs = GitVcs.getInstance(myProject);
    myVcs.doActivate();

    addSilently();
    removeSilently();
}
 
开发者ID:JChrist,项目名称:gitextender,代码行数:31,代码来源:TestingUtil.java

示例9: setUpProject

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
private void setUpProject() throws Exception {
  new WriteCommandAction.Simple(null) {
    @Override
    protected void run() throws Throwable {
      File projectFile = FileUtil.createTempFile(myName+"_", PROJECT_FILE_SUFFIX);
      FileUtil.delete(projectFile);
      myFilesToDelete.add(projectFile);

      LocalFileSystem.getInstance().refreshAndFindFileByIoFile(projectFile);
      ByteArrayOutputStream buffer = new ByteArrayOutputStream();
      new Throwable(projectFile.getPath()).printStackTrace(new PrintStream(buffer));
      myProject = PlatformTestCase.createProject(projectFile, buffer.toString());

      for (ModuleFixtureBuilder moduleFixtureBuilder: myModuleFixtureBuilders) {
        moduleFixtureBuilder.getFixture().setUp();
      }

      StartupManagerImpl sm = (StartupManagerImpl)StartupManager.getInstance(myProject);
      sm.runStartupActivities();
      sm.startCacheUpdate();
      sm.runPostStartupActivities();

      ProjectManagerEx.getInstanceEx().openTestProject(myProject);
      LightPlatformTestCase.clearUncommittedDocuments(myProject);
    }
  }.execute().throwException();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:HeavyIdeaTestFixtureImpl.java

示例10: setUpProject

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
private void setUpProject() throws Exception {
  new WriteCommandAction.Simple(null) {
    @Override
    protected void run() throws Throwable {
      File projectDir = FileUtil.createTempDirectory(myName + "_", "project");
      FileUtil.delete(projectDir);
      myFilesToDelete.add(projectDir);

      LocalFileSystem.getInstance().refreshAndFindFileByIoFile(projectDir);
      ByteArrayOutputStream buffer = new ByteArrayOutputStream();
      new Throwable(projectDir.getPath()).printStackTrace(new PrintStream(buffer));
      myProject = PlatformTestCase.createProject(projectDir, buffer.toString());

      for (ModuleFixtureBuilder moduleFixtureBuilder : myModuleFixtureBuilders) {
        moduleFixtureBuilder.getFixture().setUp();
      }

      StartupManagerImpl sm = (StartupManagerImpl)StartupManager.getInstance(myProject);
      sm.runStartupActivities();
      sm.startCacheUpdate();
      sm.runPostStartupActivities();

      ProjectManagerEx.getInstanceEx().openTestProject(myProject);
      LightPlatformTestCase.clearUncommittedDocuments(myProject);
    }
  }.execute().throwException();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:28,代码来源:HeavyIdeaTestFixtureImpl.java

示例11: setFileText

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
public void setFileText(@NotNull final VirtualFile file, @NotNull final String text) throws IOException {
  PlatformTestCase.setFileText(file, text);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:AbstractVcsTestCase.java

示例12: setBinaryContent

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
public static void setBinaryContent(final VirtualFile file, final byte[] content) {
  PlatformTestCase.setBinaryContent(file, content);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:AbstractVcsTestCase.java

示例13: tearDown

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
@Override
protected void tearDown() throws Exception {
  try {
    if (myFixture != null) {
      try {
        if (CAN_SYNC_PROJECTS) {
          Project project = myFixture.getProject();
          // Since we don't really open the project, but we manually register listeners in the gradle importer
          // by explicitly calling AndroidGradleProjectComponent#configureGradleProject, we need to counteract
          // that here, otherwise the testsuite will leak
          if (Projects.isGradleProject(project)) {
            AndroidGradleProjectComponent projectComponent = ServiceManager.getService(project, AndroidGradleProjectComponent.class);
            projectComponent.projectClosed();
          }
        }
      }
      finally {
        myFixture.tearDown();
        myFixture = null;
      }
    }

    if (CAN_SYNC_PROJECTS) {
      GradleProjectImporter.ourSkipSetupFromTest = false;
    }

    ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
    Project[] openProjects = projectManager.getOpenProjects();
    if (openProjects.length > 0) {
      PlatformTestCase.closeAndDisposeProjectAndCheckThatNoOpenProjects(openProjects[0]);
    }
  }
  finally {
    try {
      assertEquals(0, ProjectManager.getInstance().getOpenProjects().length);
    }
    finally {
      super.tearDown();
    }

    // In case other test cases rely on the builtin (incomplete) SDK, restore
    if (ourPreviousSdkData != null) {
      setSdkData(ourPreviousSdkData);
      ourPreviousSdkData = null;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:AndroidGradleTestCase.java

示例14: initPlatformPrefix

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
private static void initPlatformPrefix() {
  PlatformTestCase.autodetectPlatformPrefix();
}
 
开发者ID:ktisha,项目名称:TheRPlugin,代码行数:4,代码来源:TheRTestCase.java

示例15: SpellcheckerInspectionTestCase

import com.intellij.testFramework.PlatformTestCase; //导入依赖的package包/类
@SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors")
protected SpellcheckerInspectionTestCase() {
  PlatformTestCase.initPlatformLangPrefix();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:SpellcheckerInspectionTestCase.java


注:本文中的com.intellij.testFramework.PlatformTestCase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。