@Test public void assertGetCrashedJobBriefInfo() { when(regCenter.get("/test_job/config")).thenReturn(LifecycleYamlConstants.getSimpleJobYaml("test_job", "desc")); JobBriefInfo jobBrief = jobStatisticsAPI.getJobBriefInfo("test_job"); assertThat(jobBrief.getStatus(), is(JobBriefInfo.JobStatus.CRASHED)); }
@Override public JobBriefInfo getJobBriefInfo(final String jobName) { JobNodePath jobNodePath = new JobNodePath(jobName); JobBriefInfo result = new JobBriefInfo(); result.setJobName(jobName); String jobConfigYaml = regCenter.get(jobNodePath.getConfigNodePath()); if (null == jobConfigYaml) { return null; } JobConfiguration jobConfig = YamlEngine.unmarshal(jobConfigYaml, JobConfigurationPOJO.class).toJobConfiguration(); result.setDescription(jobConfig.getDescription()); result.setCron(jobConfig.getCron()); result.setInstanceCount(getJobInstanceCount(jobName)); result.setShardingTotalCount(jobConfig.getShardingTotalCount()); result.setStatus(getJobStatus(jobName)); return result; }
JobStatisticsAPIImpl implements JobStatisticsAPI { @Override public JobBriefInfo getJobBriefInfo(final String jobName) { JobNodePath jobNodePath = new JobNodePath(jobName); JobBriefInfo result = new JobBriefInfo(); result.setJobName(jobName); String jobConfigYaml = regCenter.get(jobNodePath.getConfigNodePath()); if (null == jobConfigYaml) { return null; } JobConfiguration jobConfig = YamlEngine.unmarshal(jobConfigYaml, JobConfigurationPOJO.class).toJobConfiguration(); result.setDescription(jobConfig.getDescription()); result.setCron(jobConfig.getCron()); result.setInstanceCount(getJobInstanceCount(jobName)); result.setShardingTotalCount(jobConfig.getShardingTotalCount()); result.setStatus(getJobStatus(jobName)); return result; } }
JobStatisticsAPIImpl implements JobStatisticsAPI { @Override public JobBriefInfo getJobBriefInfo(final String jobName) { JobNodePath jobNodePath = new JobNodePath(jobName); JobBriefInfo result = new JobBriefInfo(); result.setJobName(jobName); String jobConfigYaml = regCenter.get(jobNodePath.getConfigNodePath()); if (null == jobConfigYaml) { return null; } JobConfiguration jobConfig = YamlEngine.unmarshal(jobConfigYaml, JobConfigurationPOJO.class).toJobConfiguration(); result.setDescription(jobConfig.getDescription()); result.setCron(jobConfig.getCron()); result.setInstanceCount(getJobInstanceCount(jobName)); result.setShardingTotalCount(jobConfig.getShardingTotalCount()); result.setStatus(getJobStatus(jobName)); return result; }  }
JobStatisticsAPIImpl implements JobStatisticsAPI { @Override public JobBriefInfo getJobBriefInfo(final String jobName) { JobNodePath jobNodePath = new JobNodePath(jobName); JobBriefInfo result = new JobBriefInfo(); result.setJobName(jobName); String jobConfigYaml = regCenter.get(jobNodePath.getConfigNodePath()); if (null == jobConfigYaml) { return null; } JobConfiguration jobConfig = YamlEngine.unmarshal(jobConfigYaml, JobConfigurationPOJO.class).toJobConfiguration(); result.setDescription(jobConfig.getDescription()); result.setCron(jobConfig.getCron()); result.setInstanceCount(getJobInstanceCount(jobName)); result.setShardingTotalCount(jobConfig.getShardingTotalCount()); result.setStatus(getJobStatus(jobName)); return result; }  @Override int getJobsTotalCount(); @Override Collection<JobBriefInfo> getAllJobsBriefInfo(); @Override JobBriefInfo getJobBriefInfo(final String jobName); @Override Collection<JobBriefInfo> getJobsBriefInfo(final String ip); }
JobStatisticsAPIImpl implements JobStatisticsAPI { @Override public JobBriefInfo getJobBriefInfo(final String jobName) { JobNodePath jobNodePath = new JobNodePath(jobName); JobBriefInfo result = new JobBriefInfo(); result.setJobName(jobName); String jobConfigYaml = regCenter.get(jobNodePath.getConfigNodePath()); if (null == jobConfigYaml) { return null; } JobConfiguration jobConfig = YamlEngine.unmarshal(jobConfigYaml, JobConfigurationPOJO.class).toJobConfiguration(); result.setDescription(jobConfig.getDescription()); result.setCron(jobConfig.getCron()); result.setInstanceCount(getJobInstanceCount(jobName)); result.setShardingTotalCount(jobConfig.getShardingTotalCount()); result.setStatus(getJobStatus(jobName)); return result; }  @Override int getJobsTotalCount(); @Override Collection<JobBriefInfo> getAllJobsBriefInfo(); @Override JobBriefInfo getJobBriefInfo(final String jobName); @Override Collection<JobBriefInfo> getJobsBriefInfo(final String ip);  }