Search in sources :

Example 1 with DefaultPluginDescriptor

use of com.intellij.openapi.extensions.DefaultPluginDescriptor in project intellij-community by JetBrains.

the class ExtensionComponentAdapterTest method testUnknownAttributes.

@Test
public void testUnknownAttributes() {
    String name = TestExtensionClassOne.class.getName();
    Element element = readElement("<bean implementation=\"123\"/>");
    DefaultPicoContainer container = new DefaultPicoContainer();
    DefaultPluginDescriptor descriptor = new DefaultPluginDescriptor("test");
    new ExtensionComponentAdapter(name, element, container, descriptor, false).getComponentInstance(container);
}
Also used : DefaultPicoContainer(org.picocontainer.defaults.DefaultPicoContainer) Element(org.jdom.Element) DefaultPluginDescriptor(com.intellij.openapi.extensions.DefaultPluginDescriptor) Test(org.junit.Test)

Example 2 with DefaultPluginDescriptor

use of com.intellij.openapi.extensions.DefaultPluginDescriptor in project android by JetBrains.

the class CaptureServiceTest method testUpdate.

public void testUpdate() throws Exception {
    CaptureService service = CaptureService.getInstance(myProject);
    assertNull(service.getCapturesDirectory());
    VirtualFile projectDir = LocalFileSystem.getInstance().findFileByPath(myProject.getBasePath());
    assertNotNull(projectDir);
    VirtualFile captures = createChildDirectory(projectDir, "captures");
    assertTrue(service.getCaptures().isEmpty());
    createChildData(captures, "data.capture");
    service.update();
    assertTrue(service.getCaptures().isEmpty());
    ExtensionsArea area = Extensions.getRootArea();
    Element element = readElement("  <extensions defaultExtensionNs=\"com.android\">\n" + "    <captureType implementation=\"" + MyCaptureType.class.getName() + "\"/>\n  </extensions>");
    area.registerExtension(new DefaultPluginDescriptor(PluginId.getId("com.android")), element.getChild("captureType"));
    MyCaptureType type = CaptureTypeService.getInstance().getType(MyCaptureType.class);
    service.update();
    assertEquals(1, service.getCaptures().size());
    assertEquals(type, service.getCaptures().iterator().next().getType());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ExtensionsArea(com.intellij.openapi.extensions.ExtensionsArea) Element(org.jdom.Element) DefaultPluginDescriptor(com.intellij.openapi.extensions.DefaultPluginDescriptor)

Aggregations

DefaultPluginDescriptor (com.intellij.openapi.extensions.DefaultPluginDescriptor)2 Element (org.jdom.Element)2 ExtensionsArea (com.intellij.openapi.extensions.ExtensionsArea)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 Test (org.junit.Test)1 DefaultPicoContainer (org.picocontainer.defaults.DefaultPicoContainer)1