Search in sources :

Example 6 with DefaultPicoContainer

use of org.picocontainer.defaults.DefaultPicoContainer in project intellij-community by JetBrains.

the class ExtensionsAreaTest method testGetComponentAdapterDoesntDuplicateAdapters.

@Test
public void testGetComponentAdapterDoesntDuplicateAdapters() throws Exception {
    MutablePicoContainer picoContainer = new ExtensionsAreaImpl("foo", null, new DefaultPicoContainer(), new Extensions.SimpleLogProvider()).getPicoContainer();
    picoContainer.registerComponentImplementation("runnable", ExtensionsAreaTest.class);
    List adapters = picoContainer.getComponentAdaptersOfType(ExtensionsAreaTest.class);
    assertEquals(1, adapters.size());
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer) DefaultPicoContainer(org.picocontainer.defaults.DefaultPicoContainer) List(java.util.List) Test(org.junit.Test)

Example 7 with DefaultPicoContainer

use of org.picocontainer.defaults.DefaultPicoContainer in project intellij-community by JetBrains.

the class ExtensionsImplTest method testExtensionsNamespaces.

@Test
public void testExtensionsNamespaces() {
    ExtensionsAreaImpl extensionsArea = new ExtensionsAreaImpl(new DefaultPicoContainer(), new Extensions.SimpleLogProvider());
    extensionsArea.registerExtensionPoint("plugin.ep1", TestExtensionClassOne.class.getName(), ExtensionPoint.Kind.BEAN_CLASS);
    extensionsArea.registerExtension("plugin", ExtensionComponentAdapterTest.readElement("<plugin:ep1 xmlns:plugin=\"plugin\" order=\"LAST\"><text>3</text></plugin:ep1>"));
    extensionsArea.registerExtension("plugin", ExtensionComponentAdapterTest.readElement("<ep1 xmlns=\"plugin\" order=\"FIRST\"><text>1</text></ep1>"));
    extensionsArea.registerExtension("plugin", ExtensionComponentAdapterTest.readElement("<extension point=\"plugin.ep1\"><text>2</text></extension>"));
    ExtensionPoint extensionPoint = extensionsArea.getExtensionPoint("plugin.ep1");
    TestExtensionClassOne[] extensions = (TestExtensionClassOne[]) extensionPoint.getExtensions();
    assertEquals(3, extensions.length);
    assertEquals("1", extensions[0].getText());
    assertEquals("2", extensions[1].getText());
    assertEquals("3", extensions[2].getText());
}
Also used : DefaultPicoContainer(org.picocontainer.defaults.DefaultPicoContainer) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 DefaultPicoContainer (org.picocontainer.defaults.DefaultPicoContainer)7 MutablePicoContainer (org.picocontainer.MutablePicoContainer)2 DefaultPluginDescriptor (com.intellij.openapi.extensions.DefaultPluginDescriptor)1 List (java.util.List)1 Element (org.jdom.Element)1