@Test public void setup() throws Exception { AtomicInteger passed = new AtomicInteger(); Configuration conf = new Configuration(); conf.set("test", "OK"); RuntimeResourceManager manager = new RuntimeResourceManager(conf) { @Override protected List<RuntimeResource> load() throws IOException { return Arrays.asList(new RuntimeResource() { @Override public void setup(ResourceConfiguration configuration) { passed.incrementAndGet(); assertThat(configuration.get("test", null), is("OK")); } }); } }; manager.setup(); assertThat(passed.get(), is(1)); }
public void setup() throws IOException, InterruptedException { if (LOG.isDebugEnabled()) { LOG.debug("Loading runtime plugins"); } List<? extends RuntimeResource> loaded = load(); this.resources = new ArrayList<>(); for (RuntimeResource resource : loaded) { if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( "Activating runtime plugin: {0}", resource.getClass().getName())); } resource.setup(configuration); resources.add(resource); } if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( "Loaded {0} runtime plugins", resources.size())); } }
RuntimeResourceManager extends Configured { public void setup() throws IOException, InterruptedException { if (LOG.isDebugEnabled()) { LOG.debug("Loading runtime plugins"); } List<? extends RuntimeResource> loaded = load(); this.resources = new ArrayList<>(); for (RuntimeResource resource : loaded) { if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( "Activating runtime plugin: {0}", resource.getClass().getName())); } resource.setup(configuration); resources.add(resource); } if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( "Loaded {0} runtime plugins", resources.size())); } } }
RuntimeResourceManager extends Configured { public void setup() throws IOException, InterruptedException { if (LOG.isDebugEnabled()) { LOG.debug("Loading runtime plugins"); } List<? extends RuntimeResource> loaded = load(); this.resources = new ArrayList<>(); for (RuntimeResource resource : loaded) { if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( "Activating runtime plugin: {0}", resource.getClass().getName())); } resource.setup(configuration); resources.add(resource); } if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( "Loaded {0} runtime plugins", resources.size())); } } RuntimeResourceManager(Configuration configuration); }
RuntimeResourceManager extends Configured { public void setup() throws IOException, InterruptedException { if (LOG.isDebugEnabled()) { LOG.debug("Loading runtime plugins"); } List<? extends RuntimeResource> loaded = load(); this.resources = new ArrayList<>(); for (RuntimeResource resource : loaded) { if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( "Activating runtime plugin: {0}", resource.getClass().getName())); } resource.setup(configuration); resources.add(resource); } if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( "Loaded {0} runtime plugins", resources.size())); } } RuntimeResourceManager(Configuration configuration); void setup(); void cleanup(); }
RuntimeResourceManager extends Configured { public void setup() throws IOException, InterruptedException { if (LOG.isDebugEnabled()) { LOG.debug("Loading runtime plugins"); } List<? extends RuntimeResource> loaded = load(); this.resources = new ArrayList<>(); for (RuntimeResource resource : loaded) { if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( "Activating runtime plugin: {0}", resource.getClass().getName())); } resource.setup(configuration); resources.add(resource); } if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( "Loaded {0} runtime plugins", resources.size())); } } RuntimeResourceManager(Configuration configuration); void setup(); void cleanup(); static final String CONFIGURATION_FILE_NAME; static final String CONFIGURATION_FILE_PATH; }