@Test public void tick() { NetworkWatcherService w = makeService(); w.addWatch(Endpoint.of(new SwitchId(1), 1), 1); w.addWatch(Endpoint.of(new SwitchId(1), 2), 1); w.addWatch(Endpoint.of(new SwitchId(2), 1), 2); w.addWatch(Endpoint.of(new SwitchId(2), 1), 2); w.addWatch(Endpoint.of(new SwitchId(2), 2), 3); assertThat(w.getConfirmedPackets().size(), is(0)); assertThat(w.getTimeouts().size(), is(3)); verify(carrier, times(5)).sendDiscovery(any(DiscoverIslCommandData.class)); w.confirmation(Endpoint.of(new SwitchId(1), 1), 0); w.confirmation(Endpoint.of(new SwitchId(2), 1), 2); assertThat(w.getConfirmedPackets().size(), is(2)); w.tick(100); assertThat(w.getConfirmedPackets().size(), is(0)); verify(carrier).discoveryFailed(eq(Endpoint.of(new SwitchId(1), 1)), eq(0L), anyLong()); verify(carrier).discoveryFailed(eq(Endpoint.of(new SwitchId(2), 1)), eq(2L), anyLong()); verify(carrier, times(2)).discoveryFailed(any(Endpoint.class), anyLong(), anyLong()); assertThat(w.getTimeouts().size(), is(0)); }
public void tick() { tick(now()); }
NetworkWatcherService { public void tick() { tick(now()); } }
NetworkWatcherService { public void tick() { tick(now()); } NetworkWatcherService(
            IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime, Integer taskId); @VisibleForTesting  NetworkWatcherService(
            Clock clock, IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime,
            Integer taskId); }
NetworkWatcherService { public void tick() { tick(now()); } NetworkWatcherService(
            IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime, Integer taskId); @VisibleForTesting  NetworkWatcherService(
            Clock clock, IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime,
            Integer taskId); void addWatch(Endpoint endpoint); void removeWatch(Endpoint endpoint); void tick(); void confirmation(Endpoint endpoint, long packetNo); void discovery(IslInfoData discoveryEvent); void roundTripDiscovery(Endpoint endpoint, long packetId); }
NetworkWatcherService { public void tick() { tick(now()); } NetworkWatcherService(
            IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime, Integer taskId); @VisibleForTesting  NetworkWatcherService(
            Clock clock, IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime,
            Integer taskId); void addWatch(Endpoint endpoint); void removeWatch(Endpoint endpoint); void tick(); void confirmation(Endpoint endpoint, long packetNo); void discovery(IslInfoData discoveryEvent); void roundTripDiscovery(Endpoint endpoint, long packetId);  }