@Test public void testNodeKeyEquals() { Flow flow1 = TEST_FLOW; Flow flow2 = TEST_FLOW.toBuilder().setDstIp(Ip.parse("2.2.2.2")).build(); Hop hop1 = HopTestUtils.acceptedHop("hop1"); Hop hop2 = HopTestUtils.acceptedHop("hop2"); new EqualsTester() .addEqualityGroup(new NodeKey(flow1, hop1), new NodeKey(flow1, hop1)) .addEqualityGroup(new NodeKey(flow2, hop1)) .addEqualityGroup(new NodeKey(flow1, hop2)) .testEquals(); }
public TraceDag build() { if (_builtTraceDag != null) { return _builtTraceDag; } if (_rootBuilder != null) { buildRoot(); } Map<Node, Integer> nodeIds = new HashMap<>(); List<TraceDag.Node> dagNodes = new ArrayList<>(_nodeMap.size()); List<Integer> rootIds = _roots.stream() .map(root -> root.buildTraceDagNode(nodeIds, dagNodes)) .collect(ImmutableList.toImmutableList()); return _builtTraceDag = new TraceDag(dagNodes, rootIds); }
DagTraceRecorder implements TraceRecorder { public TraceDag build() { if (_builtTraceDag != null) { return _builtTraceDag; } if (_rootBuilder != null) { buildRoot(); } Map<Node, Integer> nodeIds = new HashMap<>(); List<TraceDag.Node> dagNodes = new ArrayList<>(_nodeMap.size()); List<Integer> rootIds = _roots.stream() .map(root -> root.buildTraceDagNode(nodeIds, dagNodes)) .collect(ImmutableList.toImmutableList()); return _builtTraceDag = new TraceDag(dagNodes, rootIds); } }
DagTraceRecorder implements TraceRecorder { public TraceDag build() { if (_builtTraceDag != null) { return _builtTraceDag; } if (_rootBuilder != null) { buildRoot(); } Map<Node, Integer> nodeIds = new HashMap<>(); List<TraceDag.Node> dagNodes = new ArrayList<>(_nodeMap.size()); List<Integer> rootIds = _roots.stream() .map(root -> root.buildTraceDagNode(nodeIds, dagNodes)) .collect(ImmutableList.toImmutableList()); return _builtTraceDag = new TraceDag(dagNodes, rootIds); } DagTraceRecorder(@Nonnull Flow flow); }
DagTraceRecorder implements TraceRecorder { public TraceDag build() { if (_builtTraceDag != null) { return _builtTraceDag; } if (_rootBuilder != null) { buildRoot(); } Map<Node, Integer> nodeIds = new HashMap<>(); List<TraceDag.Node> dagNodes = new ArrayList<>(_nodeMap.size()); List<Integer> rootIds = _roots.stream() .map(root -> root.buildTraceDagNode(nodeIds, dagNodes)) .collect(ImmutableList.toImmutableList()); return _builtTraceDag = new TraceDag(dagNodes, rootIds); } DagTraceRecorder(@Nonnull Flow flow); @Override boolean tryRecordPartialTrace(List<HopInfo> hops); @Override void recordTrace(List<HopInfo> hops); TraceDag build(); }
DagTraceRecorder implements TraceRecorder { public TraceDag build() { if (_builtTraceDag != null) { return _builtTraceDag; } if (_rootBuilder != null) { buildRoot(); } Map<Node, Integer> nodeIds = new HashMap<>(); List<TraceDag.Node> dagNodes = new ArrayList<>(_nodeMap.size()); List<Integer> rootIds = _roots.stream() .map(root -> root.buildTraceDagNode(nodeIds, dagNodes)) .collect(ImmutableList.toImmutableList()); return _builtTraceDag = new TraceDag(dagNodes, rootIds); } DagTraceRecorder(@Nonnull Flow flow); @Override boolean tryRecordPartialTrace(List<HopInfo> hops); @Override void recordTrace(List<HopInfo> hops); TraceDag build();  }