dom.fileDescription extension point not loaded in unit-tests?

I finally figured the cause for my highlighting tests not doing anything with my DOM-Model/inspections.. I need to manually register my DomFileDescription??!?I'm using exactly the setup-code from Struts Assistant/Spring Plugin, why does it work there? Is there some additional trigger in my run configuration required?

EDIT: it seems all stuff from extensions is not loaded by default.. howto?

9 comments
Comment actions Permalink

I finally figured the cause for my highlighting tests not doing anything with my DOM-Model/inspections.. I need to manually register my DomFileDescription??!?I'm using exactly the setup-code from Struts Assistant/Spring Plugin, why does it work there? Is there some additional trigger in my run configuration required?


They should, at least if your plugin is loaded at all and DomManager is
created. Are you sure that anything in your plugin works in these tests?

0
Comment actions Permalink

I hate to bump my own threads, but could please somebody give me a hint? I'm virtually unable to provide any decent tests for my plugin unless this issue is solved.

Thanks,
Yann

0
Comment actions Permalink

It's hard to tell actually. My tests can load (my own) extensions just fine when using com.intellij.testFramework.fixtures.IdeaTestFixtureFactory & friends.

Sascha

0
Comment actions Permalink

Hello Sascha,

hm my code does that as well, here's the relevant part:

 projectBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder();

    final T moduleBuilder = projectBuilder.addModule((Class) JavaModuleFixtureBuilder.class);

    myFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture());
    myFixture.setTestDataPath(getTestDataPath());

    configureModule(moduleBuilder);
    myFixture.enableInspections(new Struts2ModelInspection());

    myFixture.setUp();

    myProject = myFixture.getProject();

    final DomFileDescription[] domFileDescriptions = ApplicationManager.getApplication().getExtensions(DomFileDescription.EP_NAME);
    System.out.println("domFileDescriptions.length = " + domFileDescriptions.length);

//    final DomManager domManager = myProject.getComponent(DomManager.class);
//    domManager.registerFileDescription(new StrutsDomFileDescription());

    myModuleTestFixture = moduleBuilder.getFixture();
    myModule = myModuleTestFixture.getModule();
]]>


-



domFileDescriptions is always empty

Message was edited by:
Yann Cébron

0
Comment actions Permalink

Strange. Pretty much same code works for me:

 projectBuilder = factory.createFixtureBuilder();

    CodeInsightTestFixture myFixture = factory.createCodeInsightFixture(projectBuilder.getFixture());
    myFixture.setTestDataPath("testData");

    myFixture.setUp();
  }

  public void testSomething() {
    final DomFileDescription[] domFileDescriptions = Extensions.getExtensions(DomFileDescription.EP_NAME);
    assertTrue(domFileDescriptions.length > 0);
  }
}
]]>


Note that using myProject.getExtensions() (instead of Extensions.getExtensions()) bails out with

"java.lang.IllegalArgumentException: Missing extension point: com.intellij.dom.fileDescription in area com.intellij.openapi.project.impl.ProjectImpl@6245a4"

Although DomManagerImpl seems to use that.

Maybe it's something about your plugin.xml or the test's classpath.

Sascha

0
Comment actions Permalink

Your test bails out here with a NPE. My plugin.xml is nearly identical to Struts Assistant, nothing special here.



  com.intellij.struts2
  Struts 2
  
  

  
   

  0.3

    com.intellij.javaee

    JavaScript

  LINEAS Informationstechnik GmbH
  

  

  
    

        

[...]
]]>


Here's my classpath - I don't see anything suspicious

0
Comment actions Permalink

OK, I think it's the dependency: If I add "com.intellij.javaee]]>" to my descriptor, the test fails as well, although nothing indicates that there's a problem with the dependency.

Unfortunately I have no clue what might be causing this... :(

Sascha

0
Comment actions Permalink

Damn, that really sucks.. well I can live with commenting it out for now, the problem will ofcourse arise again when I really must use stuff from there.. Thanks a lot!

Yann

0
Comment actions Permalink

Ok, figured it: one should add dependencies JARs in IDEA JDK, then it works.. I didn't notice it because I'm not using javaee-impl.jar in my plugin yet

0

Please sign in to leave a comment.