@Test public void assertGetAvailableJobInstances() { when(jobNodeStorage.getJobNodeChildrenKeys("instances")).thenReturn(Arrays.asList("127.0.0.1@-@0", "127.0.0.2@-@0")); when(serverService.isEnableServer("127.0.0.1")).thenReturn(true); assertThat(instanceService.getAvailableJobInstances(), is(Collections.singletonList(new JobInstance("127.0.0.1@-@0")))); }
public List<JobInstance> getAvailableJobInstances() { List<JobInstance> result = new LinkedList<>(); for (String each : jobNodeStorage.getJobNodeChildrenKeys(InstanceNode.ROOT)) { JobInstance jobInstance = new JobInstance(each); if (serverService.isEnableServer(jobInstance.getIp())) { result.add(new JobInstance(each)); } } return result; }
InstanceService { public List<JobInstance> getAvailableJobInstances() { List<JobInstance> result = new LinkedList<>(); for (String each : jobNodeStorage.getJobNodeChildrenKeys(InstanceNode.ROOT)) { JobInstance jobInstance = new JobInstance(each); if (serverService.isEnableServer(jobInstance.getIp())) { result.add(new JobInstance(each)); } } return result; } }
InstanceService { public List<JobInstance> getAvailableJobInstances() { List<JobInstance> result = new LinkedList<>(); for (String each : jobNodeStorage.getJobNodeChildrenKeys(InstanceNode.ROOT)) { JobInstance jobInstance = new JobInstance(each); if (serverService.isEnableServer(jobInstance.getIp())) { result.add(new JobInstance(each)); } } return result; } InstanceService(final CoordinatorRegistryCenter regCenter, final String jobName); }
InstanceService { public List<JobInstance> getAvailableJobInstances() { List<JobInstance> result = new LinkedList<>(); for (String each : jobNodeStorage.getJobNodeChildrenKeys(InstanceNode.ROOT)) { JobInstance jobInstance = new JobInstance(each); if (serverService.isEnableServer(jobInstance.getIp())) { result.add(new JobInstance(each)); } } return result; } InstanceService(final CoordinatorRegistryCenter regCenter, final String jobName); void persistOnline(); void removeInstance(); void clearTriggerFlag(); List<JobInstance> getAvailableJobInstances(); boolean isLocalJobInstanceExisted(); }
InstanceService { public List<JobInstance> getAvailableJobInstances() { List<JobInstance> result = new LinkedList<>(); for (String each : jobNodeStorage.getJobNodeChildrenKeys(InstanceNode.ROOT)) { JobInstance jobInstance = new JobInstance(each); if (serverService.isEnableServer(jobInstance.getIp())) { result.add(new JobInstance(each)); } } return result; } InstanceService(final CoordinatorRegistryCenter regCenter, final String jobName); void persistOnline(); void removeInstance(); void clearTriggerFlag(); List<JobInstance> getAvailableJobInstances(); boolean isLocalJobInstanceExisted();  }