How to use a extension point other plugin?

In a plugin has testng extension point:

    <extensionPoints >
      <extensionPoint qualifiedName="com.theoryinpractice.testng.listener" interface="org.testng.IDEATestNGListener"/>
    </extensionPoints>

I want to use this extension point as follows:

     <extensions defaultExtensionNs="TestNG-J">
        <com.theoryinpractice.testng.listener implementation="org.example.MyTestNGListener" />
    </extensions>

But it did not work. What am I doing wrong?

(If there are errors, I'm sorry, did the translation from Google Translate)

8 comments
Comment actions Permalink

defaultExtensionNs must have FQN prefix of EP, not plugin ID:

  <extensions defaultExtensionNs="com.theoryinpractice.testng">
    <listener implementation="YourListenerFQN"/>
  </extensions>

0
Comment actions Permalink

Thanks for the answer. But now I have another problem. My plugin.xml file:
     <idea-plugin version="2">
          ... ... ...
          <depends>com.intellij.modules.lang</depends>
          <depends>TestNG-J</depends>
          ... ... ...
          <extensions defaultExtensionNs="com.theoryinpractice.testng">
               <listener implementation="org.example.MyIDEATestNGListener" />
          </extensions>
     </idea-plugin>

When running testng tests, tests are not run, that's the exception:

java.lang.ArrayStoreException
      at java.util.ArrayList.toArray(ArrayList.java:306)
      at com.intellij.openapi.extensions.impl.ExtensionPointImpl.getExtensions(ExtensionPointImpl.java:177)
      at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:105)
      at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:86)
      at com.theoryinpractice.testng.configuration.TestNGRunnableState.createJavaParameters(TestNGRunnableState.java:303)
      at com.intellij.execution.configurations.JavaCommandLineState.getJavaParameters(JavaCommandLineState.java:35)
      at com.intellij.execution.impl.DefaultJavaProgramRunner.doExecute(DefaultJavaProgramRunner.java:68)
      at com.intellij.execution.runners.GenericProgramRunner$1.execute(GenericProgramRunner.java:90)
      at com.intellij.execution.impl.ExecutionManagerImpl$2.run(ExecutionManagerImpl.java:194)
      at com.intellij.openapi.project.DumbServiceImpl.runWhenSmart(DumbServiceImpl.java:94)
      at com.intellij.execution.impl.ExecutionManagerImpl$1$1.run(ExecutionManagerImpl.java:162)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
      at java.awt.EventQueue.access$000(EventQueue.java:84)
      at java.awt.EventQueue$1.run(EventQueue.java:602)
      at java.awt.EventQueue$1.run(EventQueue.java:600)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:611)
      at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:673)
      at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:498)
      at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:333)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

     [  19379]  ERROR - com.intellij.ide.IdeEventQueue - IntelliJ IDEA 12.0.1  Build #IC-123.94
     [  19379]  ERROR - com.intellij.ide.IdeEventQueue - JDK: 1.6.0_26
     [  19379]  ERROR - com.intellij.ide.IdeEventQueue - VM: Java HotSpot(TM) 64-Bit Server VM
     [  19379]  ERROR - com.intellij.ide.IdeEventQueue - Vendor: Sun Microsystems Inc.
     [  19379]  ERROR - com.intellij.ide.IdeEventQueue - OS: Linux
     [  19379]  ERROR - com.intellij.ide.IdeEventQueue - Last Action: Run

0
Comment actions Permalink

First, please upgrade to 12.1.6 or 13.0 as latest releases.

How do you run TestNG config? Is your plugin properly installed in the running IDE instance?

0
Comment actions Permalink

In the usual way, in the test method Ctrl+Shift+F10. Yes, if delete this line in plugin.xml file:
     <depends>TestNG-J</depends>
tests are run normally.

0
Comment actions Permalink

Just to make sure, your updated plugin with correct EP declaration is definitely correctly installed in the IDE instance where you start TestNG run configuration?
If yes, could you provide your plugin's sources?

0
Comment actions Permalink

How do you build distribution of your plugin? Please verify _every_ required compile dependency library (testng.jar,br.eti.kinoshita.testlink-java-api, commons-lang, ...) is included in resulting ZIP.

0
Comment actions Permalink

All the problem is solved, thank you for the good answers. It turned into an assembly horrible library testng.jar, junit.jar and testng-plugin.jar. I removed them, now everything works.

0

Please sign in to leave a comment.