@Test public void shouldSkipFilteredApplications() { this.applicationFilters.add("a"::equalsIgnoreCase); when(this.discoveryClient.getServices()).thenReturn(Arrays.asList("a", "b")); when(this.catalog.getApplications()).thenReturn(Arrays.asList("a")); this.landscapeWatcher.discoverLandscape(); verify(this.discoveryClient).getServices(); verify(this.discoveryClient).getInstances("a"); verifyNoMoreInteractions(this.discoveryClient); verifyZeroInteractions(this.publisher); }
@EventListener({ HeartbeatEvent.class }) public void discoverLandscape() { logger.debug("Discovering landscape"); List<String> applications = this.discoveryClient.getServices() .stream() .filter(this.applicationFilters) .collect(Collectors.toList()); Catalog catalog = this.catalogService.getCatalog(); dispatchEventForDiscoveredApplications(applications, catalog); dispatchEventForDisappearedApplications(applications, catalog); applications.forEach(this::processApplication); }
LandscapeWatcher { @EventListener({ HeartbeatEvent.class }) public void discoverLandscape() { logger.debug("Discovering landscape"); List<String> applications = this.discoveryClient.getServices() .stream() .filter(this.applicationFilters) .collect(Collectors.toList()); Catalog catalog = this.catalogService.getCatalog(); dispatchEventForDiscoveredApplications(applications, catalog); dispatchEventForDisappearedApplications(applications, catalog); applications.forEach(this::processApplication); } }
LandscapeWatcher { @EventListener({ HeartbeatEvent.class }) public void discoverLandscape() { logger.debug("Discovering landscape"); List<String> applications = this.discoveryClient.getServices() .stream() .filter(this.applicationFilters) .collect(Collectors.toList()); Catalog catalog = this.catalogService.getCatalog(); dispatchEventForDiscoveredApplications(applications, catalog); dispatchEventForDisappearedApplications(applications, catalog); applications.forEach(this::processApplication); } LandscapeWatcher(DiscoveryClient discoveryClient, CatalogService catalogService,
			List<ApplicationFilter> applicationFilters,
			List<ApplicationInstanceFilter> applicationInstanceFilters,
			ApplicationEventPublisher publisher); }
LandscapeWatcher { @EventListener({ HeartbeatEvent.class }) public void discoverLandscape() { logger.debug("Discovering landscape"); List<String> applications = this.discoveryClient.getServices() .stream() .filter(this.applicationFilters) .collect(Collectors.toList()); Catalog catalog = this.catalogService.getCatalog(); dispatchEventForDiscoveredApplications(applications, catalog); dispatchEventForDisappearedApplications(applications, catalog); applications.forEach(this::processApplication); } LandscapeWatcher(DiscoveryClient discoveryClient, CatalogService catalogService,
			List<ApplicationFilter> applicationFilters,
			List<ApplicationInstanceFilter> applicationInstanceFilters,
			ApplicationEventPublisher publisher); @EventListener({ HeartbeatEvent.class }) void discoverLandscape(); }
LandscapeWatcher { @EventListener({ HeartbeatEvent.class }) public void discoverLandscape() { logger.debug("Discovering landscape"); List<String> applications = this.discoveryClient.getServices() .stream() .filter(this.applicationFilters) .collect(Collectors.toList()); Catalog catalog = this.catalogService.getCatalog(); dispatchEventForDiscoveredApplications(applications, catalog); dispatchEventForDisappearedApplications(applications, catalog); applications.forEach(this::processApplication); } LandscapeWatcher(DiscoveryClient discoveryClient, CatalogService catalogService,
			List<ApplicationFilter> applicationFilters,
			List<ApplicationInstanceFilter> applicationInstanceFilters,
			ApplicationEventPublisher publisher); @EventListener({ HeartbeatEvent.class }) void discoverLandscape();  }