@Test public void testActiveWithDuplicatesSegments() { List<EventProcessorInfo.SegmentStatus> eventTrackerInfoList = asList(newBuilder().setSegmentId(1) .setOnePartOf(2).build(), newBuilder().setSegmentId(1) .setOnePartOf(4).build()); MissingTrackers warning = new MissingTrackers(eventTrackerInfoList); assertTrue(warning.active()); }
@Override public boolean active() { double completion = 0; Set<Integer> ids = new HashSet<>(); for (SegmentStatus info : trackerInfos) { int segmentId = info.getSegmentId(); if (!ids.contains(segmentId))completion += 1d/info.getOnePartOf(); ids.add(segmentId); } return completion < 1; }
MissingTrackers implements Warning { @Override public boolean active() { double completion = 0; Set<Integer> ids = new HashSet<>(); for (SegmentStatus info : trackerInfos) { int segmentId = info.getSegmentId(); if (!ids.contains(segmentId))completion += 1d/info.getOnePartOf(); ids.add(segmentId); } return completion < 1; } }
MissingTrackers implements Warning { @Override public boolean active() { double completion = 0; Set<Integer> ids = new HashSet<>(); for (SegmentStatus info : trackerInfos) { int segmentId = info.getSegmentId(); if (!ids.contains(segmentId))completion += 1d/info.getOnePartOf(); ids.add(segmentId); } return completion < 1; } MissingTrackers(Iterable<SegmentStatus> trackerInfos); }
MissingTrackers implements Warning { @Override public boolean active() { double completion = 0; Set<Integer> ids = new HashSet<>(); for (SegmentStatus info : trackerInfos) { int segmentId = info.getSegmentId(); if (!ids.contains(segmentId))completion += 1d/info.getOnePartOf(); ids.add(segmentId); } return completion < 1; } MissingTrackers(Iterable<SegmentStatus> trackerInfos); @Override boolean active(); @Override String message(); }
MissingTrackers implements Warning { @Override public boolean active() { double completion = 0; Set<Integer> ids = new HashSet<>(); for (SegmentStatus info : trackerInfos) { int segmentId = info.getSegmentId(); if (!ids.contains(segmentId))completion += 1d/info.getOnePartOf(); ids.add(segmentId); } return completion < 1; } MissingTrackers(Iterable<SegmentStatus> trackerInfos); @Override boolean active(); @Override String message();  }