@Test public void should_return_empty() { Instance instance = Instance.create(InstanceId.of("id")) .register(Registration.create("test", wireMock.url("/mgmt/health")) .managementUrl(wireMock.url("/mgmt")) .build()); wireMock.stubFor(options(urlEqualTo("/mgmt/stats")).willReturn(aResponse().withStatus(HttpStatus.NOT_FOUND_404))); ProbeEndpointsStrategy strategy = new ProbeEndpointsStrategy(instanceWebClient, new String[]{"metrics:stats"}); StepVerifier.create(strategy.detectEndpoints(instance)) .verifyComplete(); }
@Override public Mono<Endpoints> detectEndpoints(Instance instance) { return Flux.fromIterable(endpoints) .flatMap(endpoint -> detectEndpoint(instance, endpoint)) .collectList() .flatMap(this::convert); }
ProbeEndpointsStrategy implements EndpointDetectionStrategy { @Override public Mono<Endpoints> detectEndpoints(Instance instance) { return Flux.fromIterable(endpoints) .flatMap(endpoint -> detectEndpoint(instance, endpoint)) .collectList() .flatMap(this::convert); } }
ProbeEndpointsStrategy implements EndpointDetectionStrategy { @Override public Mono<Endpoints> detectEndpoints(Instance instance) { return Flux.fromIterable(endpoints) .flatMap(endpoint -> detectEndpoint(instance, endpoint)) .collectList() .flatMap(this::convert); } ProbeEndpointsStrategy(InstanceWebClient instanceWebClient, String[] endpoints); }
ProbeEndpointsStrategy implements EndpointDetectionStrategy { @Override public Mono<Endpoints> detectEndpoints(Instance instance) { return Flux.fromIterable(endpoints) .flatMap(endpoint -> detectEndpoint(instance, endpoint)) .collectList() .flatMap(this::convert); } ProbeEndpointsStrategy(InstanceWebClient instanceWebClient, String[] endpoints); @Override Mono<Endpoints> detectEndpoints(Instance instance); }
ProbeEndpointsStrategy implements EndpointDetectionStrategy { @Override public Mono<Endpoints> detectEndpoints(Instance instance) { return Flux.fromIterable(endpoints) .flatMap(endpoint -> detectEndpoint(instance, endpoint)) .collectList() .flatMap(this::convert); } ProbeEndpointsStrategy(InstanceWebClient instanceWebClient, String[] endpoints); @Override Mono<Endpoints> detectEndpoints(Instance instance);  }