Java Code Examples for com.intellij.testFramework.PsiTestUtil#addLibrary()

The following examples show how to use com.intellij.testFramework.PsiTestUtil#addLibrary() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CamelLightCodeInsightFixtureTestCaseIT.java    From camel-idea-plugin with Apache License 2.0 6 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    if (!ignoreCamelCoreLib) {
        PsiTestUtil.addLibrary(myFixture.getProjectDisposable(), myFixture.getModule(), "Maven: " + CAMEL_CORE_MAVEN_ARTIFACT, mavenArtifacts[0].getParent(), mavenArtifacts[0].getName());
    }
    ApplicationManager
        .getApplication()
        .executeOnPooledThread(() -> ApplicationManager.getApplication().runReadAction(() -> {
            disposeOnTearDown(ServiceManager.getService(getModule().getProject(), CamelCatalogService.class));
            disposeOnTearDown(ServiceManager.getService(getModule().getProject(), CamelService.class));
            disposeOnTearDown(ServiceManager.getService(CamelPreferenceService.class));
            disposeOnTearDown(ServiceManager.getService(CamelIdeaUtils.class));
            disposeOnTearDown(ServiceManager.getService(IdeaUtils.class));
            disposeOnTearDown(ServiceManager.getService(JavaMethodUtils.class));
        }));

    ServiceManager.getService(getModule().getProject(), CamelService.class).setCamelPresent(true);
}
 
Example 2
Source File: RPiJavaModuleBuilder.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 5 votes vote down vote up
private void addJarFiles(Module module) {
    if (jarsToAdd == null) {
        return;
    }

    for (final File fileEntry : jarsToAdd) {
        if (!fileEntry.isDirectory() && Files.getFileExtension(fileEntry.getName()).contains("jar")) {
            PsiTestUtil.addLibrary(module, fileEntry.getName(), fileEntry.getParentFile().getPath(), fileEntry.getName());
        }
    }
}
 
Example 3
Source File: JavaCamelBeanReferenceSmartCompletionTestIT.java    From camel-idea-plugin with Apache License 2.0 4 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    PsiTestUtil.addLibrary(myFixture.getProjectDisposable(), getModule(), "Maven: " + SPRING_CONTEXT_MAVEN_ARTIFACT, springMavenArtifacts[0].getParent(), springMavenArtifacts[0].getName());
}
 
Example 4
Source File: CamelInspectJavaSimpleTestIT.java    From camel-idea-plugin with Apache License 2.0 4 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    File[] mavenArtifacts =  Maven.resolver().resolve(CAMEL_CORE_MAVEN_ARTIFACT).withoutTransitivity().asFile();
    PsiTestUtil.addLibrary(myFixture.getProjectDisposable(), myFixture.getModule(), "Maven: " + CAMEL_CORE_MAVEN_ARTIFACT, mavenArtifacts[0].getParent(), mavenArtifacts[0].getName());
}
 
Example 5
Source File: CamelInspectXmlSimpleTestIT.java    From camel-idea-plugin with Apache License 2.0 4 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    File[] mavenArtifacts =  Maven.resolver().resolve(CAMEL_CORE_MAVEN_ARTIFACT).withoutTransitivity().asFile();
    PsiTestUtil.addLibrary(myFixture.getProjectDisposable(), myFixture.getModule(), "Maven: " + CAMEL_CORE_MAVEN_ARTIFACT, mavenArtifacts[0].getParent(), mavenArtifacts[0].getName());
}
 
Example 6
Source File: CamelInspectJavaJSonPathTestIT.java    From camel-idea-plugin with Apache License 2.0 4 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    File[] mavenArtifacts = Maven.resolver().resolve(CAMEL_JSONPATH_MAVEN_ARTIFACT).withTransitivity().asFile();
    PsiTestUtil.addLibrary(myFixture.getProjectDisposable(), myFixture.getModule(), "Maven: " + CAMEL_JSONPATH_MAVEN_ARTIFACT, mavenArtifacts[0].getParent(), mavenArtifacts[0].getName());
}
 
Example 7
Source File: CamelBeanMethodReferenceTest.java    From camel-idea-plugin with Apache License 2.0 4 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    PsiTestUtil.addLibrary(myFixture.getProjectDisposable(), myFixture.getModule(), "Maven: " + SPRING_CONTEXT_MAVEN_ARTIFACT, springMavenArtifacts[0].getParent(), springMavenArtifacts[0].getName());
}
 
Example 8
Source File: LombokTestUtil.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private static void loadLibrary(@NotNull Disposable projectDisposable, @NotNull Module module, String libraryName,
                                String libraryJarName) {
  final String lombokLibPath = PathUtil.toSystemIndependentName(new File(THIRD_PARTY_LIB_DIRECTORY).getAbsolutePath());
  VfsRootAccess.allowRootAccess(projectDisposable, lombokLibPath);
  PsiTestUtil.addLibrary(projectDisposable, module, libraryName, lombokLibPath, libraryJarName);
}