use of com.dangdang.ddframe.job.statistics.type.job.JobTypeStatistics in project elastic-job by dangdangdotcom.
the class StatisticManager method getJobTypeStatistics.
/**
* 获取作业类型统计数据.
*
* @return 作业类型统计数据对象
*/
public JobTypeStatistics getJobTypeStatistics() {
int scriptJobCnt = 0;
int simpleJobCnt = 0;
int dataflowJobCnt = 0;
for (CloudJobConfiguration each : configurationService.loadAll()) {
if (JobType.SCRIPT.equals(each.getTypeConfig().getJobType())) {
scriptJobCnt++;
} else if (JobType.SIMPLE.equals(each.getTypeConfig().getJobType())) {
simpleJobCnt++;
} else if (JobType.DATAFLOW.equals(each.getTypeConfig().getJobType())) {
dataflowJobCnt++;
}
}
return new JobTypeStatistics(scriptJobCnt, simpleJobCnt, dataflowJobCnt);
}
use of com.dangdang.ddframe.job.statistics.type.job.JobTypeStatistics in project elastic-job by dangdangdotcom.
the class CloudJobRestfulApiTest method assertGetJobTypeStatistics.
@Test
public void assertGetJobTypeStatistics() throws Exception {
String result = sentGetRequest("http://127.0.0.1:19000/job/statistics/jobs/type");
JobTypeStatistics jobTypeStatistics = GsonFactory.getGson().fromJson(result, JobTypeStatistics.class);
assertThat(jobTypeStatistics.getSimpleJobCount(), is(0));
assertThat(jobTypeStatistics.getDataflowJobCount(), is(0));
assertThat(jobTypeStatistics.getScriptJobCount(), is(0));
}
Aggregations