@Override public Iterator<String> iterator() { return getResourceReport(controller, 10000).getServices().iterator(); } }, 3, 120);
@Override public List<String> getServices(String flowName) { List<String> services = Lists.newArrayList(); try { Iterable<TwillController> controllers = lookupFlow(flowName); for (TwillController controller : controllers) { ResourceReport report = controller.getResourceReport(); sleepForZK(report); services.addAll(report.getServices()); } } catch (Exception e) { LOG.warn(e.getMessage(), e); } return services; }
@Override public JsonElement serialize(ResourceReport src, Type typeOfSrc, JsonSerializationContext context) { JsonObject json = new JsonObject(); json.addProperty("appMasterId", src.getApplicationId()); json.add("appMasterResources", context.serialize(src.getAppMasterResources(), TwillRunResources.class)); json.add("runnableResources", context.serialize( src.getResources(), new TypeToken<Map<String, Collection<TwillRunResources>>>() { }.getType())); json.add("services", context.serialize( src.getServices(), new TypeToken<List<String>>() { }.getType())); return json; }
@Override public JsonElement serialize(ResourceReport src, Type typeOfSrc, JsonSerializationContext context) { JsonObject json = new JsonObject(); json.addProperty("appMasterId", src.getApplicationId()); json.add("appMasterResources", context.serialize(src.getAppMasterResources(), TwillRunResources.class)); json.add("runnableResources", context.serialize( src.getResources(), new TypeToken<Map<String, Collection<TwillRunResources>>>() { }.getType())); json.add("services", context.serialize( src.getServices(), new TypeToken<List<String>>() { }.getType())); return json; }
liveInfo.addServices(report.getServices()); return liveInfo;
liveInfo.addServices(report.getServices()); return liveInfo;
Assert.assertEquals(ImmutableSet.of("echo", "echo1", "echo2"), ImmutableSet.copyOf(report.getServices()));