@Test public void basicHighlights() { Highlights h = new Highlights(); payload = TopoJson.json(h); checkEmptyArrays(); String subdue = JsonUtils.string(payload, TopoJson.SUBDUE); assertEquals("subdue", "", subdue); }
public static ObjectNode json(Highlights highlights) { ObjectNode payload = objectNode(); ArrayNode devices = arrayNode(); ArrayNode hosts = arrayNode(); ArrayNode links = arrayNode(); payload.set(DEVICES, devices); payload.set(HOSTS, hosts); payload.set(LINKS, links); highlights.devices().forEach(dh -> devices.add(json(dh))); highlights.hosts().forEach(hh -> hosts.add(json(hh))); highlights.links().forEach(lh -> links.add(json(lh))); Highlights.Amount toSubdue = highlights.subdueLevel(); if (!toSubdue.equals(Highlights.Amount.ZERO)) { payload.put(SUBDUE, toSubdue.toString()); } int delay = highlights.delayMs(); if (delay > 0) { payload.put(DELAY, delay); } return payload; }
TopoJson { public static ObjectNode json(Highlights highlights) { ObjectNode payload = objectNode(); ArrayNode devices = arrayNode(); ArrayNode hosts = arrayNode(); ArrayNode links = arrayNode(); payload.set(DEVICES, devices); payload.set(HOSTS, hosts); payload.set(LINKS, links); highlights.devices().forEach(dh -> devices.add(json(dh))); highlights.hosts().forEach(hh -> hosts.add(json(hh))); highlights.links().forEach(lh -> links.add(json(lh))); Highlights.Amount toSubdue = highlights.subdueLevel(); if (!toSubdue.equals(Highlights.Amount.ZERO)) { payload.put(SUBDUE, toSubdue.toString()); } int delay = highlights.delayMs(); if (delay > 0) { payload.put(DELAY, delay); } return payload; } }
TopoJson { public static ObjectNode json(Highlights highlights) { ObjectNode payload = objectNode(); ArrayNode devices = arrayNode(); ArrayNode hosts = arrayNode(); ArrayNode links = arrayNode(); payload.set(DEVICES, devices); payload.set(HOSTS, hosts); payload.set(LINKS, links); highlights.devices().forEach(dh -> devices.add(json(dh))); highlights.hosts().forEach(hh -> hosts.add(json(hh))); highlights.links().forEach(lh -> links.add(json(lh))); Highlights.Amount toSubdue = highlights.subdueLevel(); if (!toSubdue.equals(Highlights.Amount.ZERO)) { payload.put(SUBDUE, toSubdue.toString()); } int delay = highlights.delayMs(); if (delay > 0) { payload.put(DELAY, delay); } return payload; } private  TopoJson(); }
TopoJson { public static ObjectNode json(Highlights highlights) { ObjectNode payload = objectNode(); ArrayNode devices = arrayNode(); ArrayNode hosts = arrayNode(); ArrayNode links = arrayNode(); payload.set(DEVICES, devices); payload.set(HOSTS, hosts); payload.set(LINKS, links); highlights.devices().forEach(dh -> devices.add(json(dh))); highlights.hosts().forEach(hh -> hosts.add(json(hh))); highlights.links().forEach(lh -> links.add(json(lh))); Highlights.Amount toSubdue = highlights.subdueLevel(); if (!toSubdue.equals(Highlights.Amount.ZERO)) { payload.put(SUBDUE, toSubdue.toString()); } int delay = highlights.delayMs(); if (delay > 0) { payload.put(DELAY, delay); } return payload; } private  TopoJson(); static ObjectNode highlightsMessage(Highlights highlights); static ObjectNode json(Highlights highlights); static ObjectNode json(PropertyPanel pp); }
TopoJson { public static ObjectNode json(Highlights highlights) { ObjectNode payload = objectNode(); ArrayNode devices = arrayNode(); ArrayNode hosts = arrayNode(); ArrayNode links = arrayNode(); payload.set(DEVICES, devices); payload.set(HOSTS, hosts); payload.set(LINKS, links); highlights.devices().forEach(dh -> devices.add(json(dh))); highlights.hosts().forEach(hh -> hosts.add(json(hh))); highlights.links().forEach(lh -> links.add(json(lh))); Highlights.Amount toSubdue = highlights.subdueLevel(); if (!toSubdue.equals(Highlights.Amount.ZERO)) { payload.put(SUBDUE, toSubdue.toString()); } int delay = highlights.delayMs(); if (delay > 0) { payload.put(DELAY, delay); } return payload; } private  TopoJson(); static ObjectNode highlightsMessage(Highlights highlights); static ObjectNode json(Highlights highlights); static ObjectNode json(PropertyPanel pp);  }