Search in sources :

Example 6 with Extension

use of org.datanucleus.plugin.Extension in project datanucleus-core by datanucleus.

the class PluginParserTest method testParseSymbolicName.

public void testParseSymbolicName() {
    ClassLoaderResolver clr = new ClassLoaderResolverImpl();
    NonManagedPluginRegistry mgr = new NonManagedPluginRegistry(clr, "EXCEPTION", true);
    Bundle bundle1 = mgr.registerBundle(clr.getResource("/org/datanucleus/samples/plugin/MANIFEST1.MF", null));
    mgr.registerExtensionsForPlugin(clr.getResource("/org/datanucleus/samples/plugin/plugin1expoint.xml", null), bundle1);
    assertEquals(2, mgr.getExtensionPoints().length);
    assertNull(mgr.getExtensionPoint("testID"));
    assertNull(mgr.getExtensionPoint("testID2"));
    assertNotNull(mgr.getExtensionPoint("org.datanucleus.plugin.test1.testID"));
    assertNotNull(mgr.getExtensionPoint("org.datanucleus.plugin.test1.testID2"));
    Bundle bundle2 = mgr.registerBundle(clr.getResource("/org/datanucleus/samples/plugin/MANIFEST2.MF", null));
    mgr.registerExtensionsForPlugin(clr.getResource("/org/datanucleus/samples/plugin/plugin1expoint.xml", null), bundle2);
    assertEquals(4, mgr.getExtensionPoints().length);
    assertNotNull(mgr.getExtensionPoint("org.datanucleus.plugin.test2.testID"));
    assertNotNull(mgr.getExtensionPoint("org.datanucleus.plugin.test2.testID2"));
    Extension[] ex = mgr.getExtensionPoint("org.datanucleus.plugin.test2.testID").getExtensions();
    assertEquals(ex.length, 0);
/*assertEquals("org.datanucleus.plugin.test2",ex[ex.length-1].getPlugin().getSymbolicName());*/
}
Also used : Extension(org.datanucleus.plugin.Extension) NonManagedPluginRegistry(org.datanucleus.plugin.NonManagedPluginRegistry) Bundle(org.datanucleus.plugin.Bundle) ClassLoaderResolver(org.datanucleus.ClassLoaderResolver) ClassLoaderResolverImpl(org.datanucleus.ClassLoaderResolverImpl)

Aggregations

Extension (org.datanucleus.plugin.Extension)6 ExtensionPoint (org.datanucleus.plugin.ExtensionPoint)4 ArrayList (java.util.ArrayList)3 NucleusException (org.datanucleus.exceptions.NucleusException)3 Bundle (org.datanucleus.plugin.Bundle)3 List (java.util.List)2 ClassLoaderResolver (org.datanucleus.ClassLoaderResolver)2 ClassLoaderResolverImpl (org.datanucleus.ClassLoaderResolverImpl)2 ConfigurationElement (org.datanucleus.plugin.ConfigurationElement)2 NonManagedPluginRegistry (org.datanucleus.plugin.NonManagedPluginRegistry)2 Element (org.w3c.dom.Element)2 NodeList (org.w3c.dom.NodeList)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URL (java.net.URL)1 Map (java.util.Map)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1