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


Java JavaModuleFixtureBuilder.addSourceContentRoot方法代码示例

本文整理汇总了Java中com.intellij.testFramework.builders.JavaModuleFixtureBuilder.addSourceContentRoot方法的典型用法代码示例。如果您正苦于以下问题:Java JavaModuleFixtureBuilder.addSourceContentRoot方法的具体用法?Java JavaModuleFixtureBuilder.addSourceContentRoot怎么用?Java JavaModuleFixtureBuilder.addSourceContentRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.testFramework.builders.JavaModuleFixtureBuilder的用法示例。


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

示例1: setUp

import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  final TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getName());
  myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture());
  final JavaModuleFixtureBuilder moduleFixtureBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
  if (toAddSourceRoot()) {
    moduleFixtureBuilder.addSourceContentRoot(myFixture.getTempDirPath());
  } else {
    moduleFixtureBuilder.addContentRoot(myFixture.getTempDirPath());
  }
  tuneFixture(moduleFixtureBuilder);    

  myFixture.setUp();
  myFixture.setTestDataPath(getTestDataPath());
  myModule = moduleFixtureBuilder.getFixture().getModule();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:JavaCodeInsightFixtureTestCase.java

示例2: ModuleBuilder

import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入方法依赖的package包/类
public ModuleBuilder(@NotNull final TestFixtureBuilder<IdeaProjectTestFixture> host,
                     @NotNull final String name,
                     @NotNull final String[] path) throws Exception {
  myHost = host;
  final
  JavaModuleFixtureBuilder bld = host.addModule(JavaModuleFixtureBuilder.class);
  bld.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15);
  bld.addSourceContentRoot(testDataPath(path));
  myModule = bld.getFixture();
  myModule.setUp();
  new WriteAction<Void>() {
    @Override
    protected void run(Result<Void> result) throws Throwable {
      final ModifiableModuleModel model = ModuleManager.getInstance(project()).getModifiableModel();
      try {
        model.renameModule(module(), name);
      } catch (ModuleWithNameAlreadyExists moduleWithNameAlreadyExists) {
        model.dispose();
        Assert.fail();
        return;
      }
      model.commit();
    }
  }.execute();
}
 
开发者ID:jonnyzzz,项目名称:IDEA.Dependencies,代码行数:26,代码来源:AnalyzerTestCase.java

示例3: setUp

import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  final TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getName());
  myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture());
  final JavaModuleFixtureBuilder moduleFixtureBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
  moduleFixtureBuilder.addSourceContentRoot(myFixture.getTempDirPath());
  tuneFixture(moduleFixtureBuilder);    

  myFixture.setUp();
  myFixture.setTestDataPath(getTestDataPath());
  myModule = moduleFixtureBuilder.getFixture().getModule();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:JavaCodeInsightFixtureTestCase.java

示例4: setUp

import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  final TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getTestName(false));
  myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture());
  final JavaModuleFixtureBuilder moduleFixtureBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
  moduleFixtureBuilder.addSourceContentRoot(myFixture.getTempDirPath());
  tuneFixture(moduleFixtureBuilder);    

  myFixture.setUp();
  myFixture.setTestDataPath(getTestDataPath());
  myModule = moduleFixtureBuilder.getFixture().getModule();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:15,代码来源:JavaCodeInsightFixtureTestCase.java

示例5: setUp

import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
  super.setUp();
  final TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder =
    IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getName());
  myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture());

  final JavaModuleFixtureBuilder appModuleBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
  String appModuleDir = myFixture.getTempDirPath() + "/app";
  new File(appModuleDir).mkdir();
  AndroidTestCase.tuneModule(appModuleBuilder, appModuleDir);

  final JavaModuleFixtureBuilder libModuleBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
  String libModuleDir = myFixture.getTempDirPath() + "/lib";
  new File(libModuleDir).mkdir();

  libModuleBuilder.addContentRoot(libModuleDir);
  new File(libModuleDir + "/src/").mkdir();
  libModuleBuilder.addSourceRoot("src");

  final JavaModuleFixtureBuilder libGenModuleBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
  String libGenModule = myFixture.getTempDirPath() + "/lib/gen";
  new File(libGenModule).mkdir();
  libGenModuleBuilder.addSourceContentRoot(libGenModule);

  myFixture.setUp();
  myFixture.enableInspections(AndroidDomInspection.class);

  myFixture.setTestDataPath(AndroidTestCase.getAbsoluteTestDataPath());

  myAppModule = appModuleBuilder.getFixture().getModule();
  myLibModule = libModuleBuilder.getFixture().getModule();
  myLibGenModule = libGenModuleBuilder.getFixture().getModule();

  // Manifest must exist before facet is added
  final VirtualFile manifest =
    myFixture.copyFileToProject(SdkConstants.FN_ANDROID_MANIFEST_XML, SdkConstants.FN_ANDROID_MANIFEST_XML);
  final VirtualFile manifest2 =
    myFixture.copyFileToProject(SdkConstants.FN_ANDROID_MANIFEST_XML, "app/" + SdkConstants.FN_ANDROID_MANIFEST_XML);
  final VirtualFile manifest3 =
    myFixture.copyFileToProject(BASE_PATH + "LibAndroidManifest.xml", "lib/" + SdkConstants.FN_ANDROID_MANIFEST_XML);

  myAppFacet = AndroidTestCase.addAndroidFacet(myAppModule, getDefaultTestSdkPath(), getDefaultPlatformDir());
  myLibFacet = AndroidTestCase.addAndroidFacet(myLibModule, getDefaultTestSdkPath(), getDefaultPlatformDir());
  myLibFacet.setLibraryProject(true);

  ModuleRootModificationUtil.addDependency(myAppModule, myLibModule);
  ModuleRootModificationUtil.addDependency(myLibModule, myLibGenModule);

  // Manifest files will be recreated using createInitialStructure or other custom code in each test case

  WriteCommandAction.runWriteCommandAction(null, new Runnable() {
    @Override
    public void run() {
      try {
        manifest.delete(this);
        manifest2.delete(this);
        manifest3.delete(this);
      }
      catch (IOException e) {
        fail("Could not delete default manifest");
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:66,代码来源:AndroidLibraryProjectTest.java


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