use of com.dangdang.ddframe.job.cloud.scheduler.state.running.RunningService in project elastic-job by dangdangdotcom.
the class CloudJobRestfulApiTest method assertFindAllRunningTasks.
@Test
public void assertFindAllRunningTasks() throws Exception {
RunningService runningService = new RunningService(getRegCenter());
TaskContext actualTaskContext = TaskContext.from(TaskNode.builder().build().getTaskNodeValue());
when(getRegCenter().get("/config/job/" + actualTaskContext.getMetaInfo().getJobName())).thenReturn(CloudJsonConstants.getJobJson());
runningService.add(actualTaskContext);
assertThat(sentGetRequest("http://127.0.0.1:19000/job/tasks/running"), is(GsonFactory.getGson().toJson(Lists.newArrayList(actualTaskContext))));
}
use of com.dangdang.ddframe.job.cloud.scheduler.state.running.RunningService in project elastic-job by dangdangdotcom.
the class SchedulerEngineTest method setUp.
@Before
public void setUp() throws NoSuchFieldException {
schedulerEngine = new SchedulerEngine(taskScheduler, facadeService, new JobEventBus(), frameworkIDService, statisticManager);
ReflectionUtils.setFieldValue(schedulerEngine, "facadeService", facadeService);
when(facadeService.load("test_job")).thenReturn(Optional.of(CloudJobConfigurationBuilder.createCloudJobConfiguration("test_job")));
new RunningService(Mockito.mock(CoordinatorRegistryCenter.class)).clear();
}
Aggregations