ResourcePluginManager { public void initialize(Context context) throws YarnException, ClassNotFoundException { Configuration conf = context.getConf(); String[] plugins = getPluginsFromConfig(conf); Map<String, ResourcePlugin> pluginMap = Maps.newHashMap(); if (plugins != null) { pluginMap = initializePlugins(conf, context, plugins); } boolean pluggableDeviceFrameworkEnabled = conf.getBoolean( YarnConfiguration.NM_PLUGGABLE_DEVICE_FRAMEWORK_ENABLED, YarnConfiguration.DEFAULT_NM_PLUGGABLE_DEVICE_FRAMEWORK_ENABLED); if (pluggableDeviceFrameworkEnabled) { initializePluggableDevicePlugins(context, conf, pluginMap); } else { LOG.info("The pluggable device framework is not enabled." + " If you want, please set true to {}", YarnConfiguration.NM_PLUGGABLE_DEVICE_FRAMEWORK_ENABLED); } configuredPlugins = Collections.unmodifiableMap(pluginMap); }  void initialize(Context context); void initializePluggableDevicePlugins(Context context,
      Configuration configuration,
      Map<String, ResourcePlugin> pluginMap); @VisibleForTesting // Check if the implemented interfaces' signature is compatible void checkInterfaceCompatibility(Class<?> expectedClass,
      Class<?> actualClass); @VisibleForTesting boolean isConfiguredResourceName(String resourceName); @VisibleForTesting void setDeviceMappingManager(
      DeviceMappingManager deviceMappingManager); DeviceMappingManager getDeviceMappingManager(); void cleanup(); synchronized Map<String, ResourcePlugin> getNameToPlugins();  }
@Test(timeout = 30000) public void testResourcePluginManagerInitialization() throws Exception { final ResourcePluginManager rpm = stubResourcePluginmanager(); nm = new ResourcePluginMockNM(rpm); nm.init(conf); verify(rpm).initialize( any(Context.class)); }