ApplicationRunnerMain { public static void main(String[] args) { ApplicationRunnerCommandLine cmdLine = new ApplicationRunnerCommandLine(); OptionSet options = cmdLine.parser().parse(args); Config orgConfig = cmdLine.loadConfig(options); ApplicationRunnerOperation op = cmdLine.getOperation(options); ApplicationRunnerUtil.invoke(orgConfig, op); }  static void main(String[] args);  }
@Test public void TestRunOperation() { assertEquals(0, TestApplicationRunnerInvocationCounts.runCount); ApplicationRunnerMain.main(new String[]{ "-config", "job.config.loader.factory=org.apache.samza.config.loaders.PropertiesConfigLoaderFactory", "-config", "job.config.loader.properties.path=" + getClass().getResource("/test.properties").getPath(), "-config", String.format("%s=%s", ApplicationConfig.APP_CLASS, MockStreamApplication.class.getName()), "-config", String.format("%s=%s", ApplicationConfig.APP_RUNNER_CLASS, TestApplicationRunnerInvocationCounts.class.getName()), }); assertEquals(1, TestApplicationRunnerInvocationCounts.runCount); }
@Test public void TestKillOperation() { assertEquals(0, TestApplicationRunnerInvocationCounts.killCount); ApplicationRunnerMain.main(new String[]{ "-config", "job.config.loader.factory=org.apache.samza.config.loaders.PropertiesConfigLoaderFactory", "-config", "job.config.loader.properties.path=" + getClass().getResource("/test.properties").getPath(), "-config", String.format("%s=%s", ApplicationConfig.APP_CLASS, MockStreamApplication.class.getName()), "-config", String.format("%s=%s", ApplicationConfig.APP_RUNNER_CLASS, TestApplicationRunnerInvocationCounts.class.getName()), "--operation=kill" }); assertEquals(1, TestApplicationRunnerInvocationCounts.killCount); }
@Test public void TestStatusOperation() { assertEquals(0, TestApplicationRunnerInvocationCounts.statusCount); ApplicationRunnerMain.main(new String[]{ "-config", "job.config.loader.factory=org.apache.samza.config.loaders.PropertiesConfigLoaderFactory", "-config", "job.config.loader.properties.path=" + getClass().getResource("/test.properties").getPath(), "-config", String.format("%s=%s", ApplicationConfig.APP_CLASS, MockStreamApplication.class.getName()), "-config", String.format("%s=%s", ApplicationConfig.APP_RUNNER_CLASS, TestApplicationRunnerInvocationCounts.class.getName()), "--operation=status" }); assertEquals(1, TestApplicationRunnerInvocationCounts.statusCount); }