@Test public void testInit() throws Exception { boolean error = false; try { ExtensionLoader loader = new ExtensionLoader(null, false, null); } catch (Exception e) { error = true; } Assert.assertTrue(error); Field field = RpcRunningState.class.getDeclaredField("shuttingDown"); field.setAccessible(true); boolean origin = (Boolean) field.get(null); try { field.set(null, true); ExtensionLoader loader = new ExtensionLoader(Filter.class, null); Assert.assertNull(loader.getAllExtensions()); } finally { field.set(null, origin); } error = false; try { ExtensionLoader loader = new ExtensionLoader(NotExtensible.class, false, null); } catch (Exception e) { error = true; } Assert.assertTrue(error); }
public ConcurrentMap<String, ExtensionClass<T>> getAllExtensions() { return all; }
ExtensionLoader { public ConcurrentMap<String, ExtensionClass<T>> getAllExtensions() { return all; } }
ExtensionLoader { public ConcurrentMap<String, ExtensionClass<T>> getAllExtensions() { return all; } ExtensionLoader(Class<T> interfaceClass, ExtensionLoaderListener<T> listener); protected  ExtensionLoader(Class<T> interfaceClass); protected  ExtensionLoader(Class<T> interfaceClass, boolean autoLoad, ExtensionLoaderListener<T> listener); }
ExtensionLoader { public ConcurrentMap<String, ExtensionClass<T>> getAllExtensions() { return all; } ExtensionLoader(Class<T> interfaceClass, ExtensionLoaderListener<T> listener); protected  ExtensionLoader(Class<T> interfaceClass); protected  ExtensionLoader(Class<T> interfaceClass, boolean autoLoad, ExtensionLoaderListener<T> listener); ConcurrentMap<String, ExtensionClass<T>> getAllExtensions(); ExtensionClass<T> getExtensionClass(String alias); T getExtension(String alias); T getExtension(String alias, Class[] argTypes, Object[] args); void loadExtension(Class loadedClass); void addListener(ExtensionLoaderListener<T> listener); }
ExtensionLoader { public ConcurrentMap<String, ExtensionClass<T>> getAllExtensions() { return all; } ExtensionLoader(Class<T> interfaceClass, ExtensionLoaderListener<T> listener); protected  ExtensionLoader(Class<T> interfaceClass); protected  ExtensionLoader(Class<T> interfaceClass, boolean autoLoad, ExtensionLoaderListener<T> listener); ConcurrentMap<String, ExtensionClass<T>> getAllExtensions(); ExtensionClass<T> getExtensionClass(String alias); T getExtension(String alias); T getExtension(String alias, Class[] argTypes, Object[] args); void loadExtension(Class loadedClass); void addListener(ExtensionLoaderListener<T> listener);  }