MacroBasePipelineCommand extends ConfiguredCommand<MacroBaseConf> { @Override protected void run(Bootstrap<MacroBaseConf> bootstrap, Namespace namespace, MacroBaseConf configuration) throws Exception { configuration.loadSystemProperties(); Class c = Class.forName(configuration.getString(MacroBaseConf.PIPELINE_NAME)); Object ao = c.newInstance(); if (!(ao instanceof Pipeline)) { log.error("{} is not an instance of Pipeline! Exiting..."); return; } List<AnalysisResult> results = ((Pipeline) ao).initialize(configuration).run(); MacroBase.reporter.report(); log.info("Result: {}", results); } MacroBasePipelineCommand();   }
@Test public void testPipelineRuns() throws Exception { MacroBaseConf conf = new MacroBaseConf(); conf.set(MacroBaseConf.PIPELINE_NAME, "macrobase.runtime.command.MacroBasePipelineCommandTest"); MacroBasePipelineCommand cmd1 = new MacroBasePipelineCommand(); cmd1.run(null, new Namespace(new HashMap<>()), conf); assertFalse(MacroBaseMockPipeline.initialized); TestCase.assertFalse(MacroBaseMockPipeline.ran); conf.set(MacroBaseConf.PIPELINE_NAME, "macrobase.runtime.command.MacroBaseMockPipeline"); MacroBasePipelineCommand cmd2 = new MacroBasePipelineCommand(); cmd2.run(null, new Namespace(new HashMap<>()), conf); assertTrue(MacroBaseMockPipeline.initialized); assertTrue(MacroBaseMockPipeline.ran); MacroBaseMockPipeline.initialized = false; MacroBaseMockPipeline.ran = false; MacroBasePipelineCommand cmd3 = new MacroBasePipelineCommand(); cmd3.run(null, new Namespace(new HashMap<>()), conf); assertTrue(MacroBaseMockPipeline.initialized); assertTrue(MacroBaseMockPipeline.ran); }