RemoteApplicationRunner implements ApplicationRunner { ApplicationStatus getApplicationStatus(JobConfig jobConfig) { JobRunner runner = new JobRunner(jobConfig); ApplicationStatus status = runner.status(); LOG.debug("Status is {} for job {}", new Object[]{status, jobConfig.getName()}); return status; } RemoteApplicationRunner(SamzaApplication app, Config config); @Override void run(ExternalContext externalContext); @Override void kill(); @Override ApplicationStatus status(); @Override void waitForFinish(); @Override boolean waitForFinish(Duration timeout);  }
@Test public void testGetStatus() { Map<String, String> m = new HashMap<>(); m.put(JobConfig.JOB_NAME, "jobName"); m.put(JobConfig.STREAM_JOB_FACTORY_CLASS, MockStreamJobFactory.class.getName()); m.put(JobConfig.JOB_ID, "newJob"); StreamApplication userApp = appDesc -> { }; runner = spy(new RemoteApplicationRunner(userApp, new MapConfig(m))); Assert.assertEquals(ApplicationStatus.New, runner.getApplicationStatus(new JobConfig(new MapConfig(m)))); m.put(JobConfig.JOB_ID, "runningJob"); runner = spy(new RemoteApplicationRunner(userApp, new MapConfig(m))); Assert.assertEquals(ApplicationStatus.Running, runner.getApplicationStatus(new JobConfig(new MapConfig(m)))); }