Browse Source

Refactor and add javadocs.

pull/995/head
Olga MaciaszekSharma 3 years ago
parent
commit
bc42390206
  1. 3
      spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java
  2. 1
      spring-cloud-loadbalancer/src/test/java/org/springframework/cloud/loadbalancer/core/HealthCheckServiceInstanceListSupplierTests.java
  3. 12
      spring-cloud-loadbalancer/src/test/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSuppliersTestUtils.java

3
spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java

@ -48,6 +48,7 @@ import org.springframework.web.util.UriComponentsBuilder; @@ -48,6 +48,7 @@ import org.springframework.web.util.UriComponentsBuilder;
* @author Spencer Gibb
* @author Olga Maciaszek-Sharma
* @author Zhiguo Chen
* @author Sabyasachi Bhattacharya
*/
public final class ServiceInstanceListSupplierBuilder {
@ -311,7 +312,7 @@ public final class ServiceInstanceListSupplierBuilder { @@ -311,7 +312,7 @@ public final class ServiceInstanceListSupplierBuilder {
}));
}
private String getUri(ServiceInstance serviceInstance, String healthCheckPath) {
static String getUri(ServiceInstance serviceInstance, String healthCheckPath) {
if (StringUtils.hasText(healthCheckPath)) {
String path = healthCheckPath.startsWith("/") ? healthCheckPath : "/" + healthCheckPath;
return serviceInstance.getUri().toString() + path;

1
spring-cloud-loadbalancer/src/test/java/org/springframework/cloud/loadbalancer/core/HealthCheckServiceInstanceListSupplierTests.java

@ -62,6 +62,7 @@ import static org.springframework.cloud.loadbalancer.core.ServiceInstanceListSup @@ -62,6 +62,7 @@ import static org.springframework.cloud.loadbalancer.core.ServiceInstanceListSup
* @author Olga Maciaszek-Sharma
* @author Roman Matiushchenko
* @author Roman Chigvintsev
* @author Sabyasachi Bhattacharya
*/
@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = HealthCheckServiceInstanceListSupplierTests.TestApplication.class,

12
spring-cloud-loadbalancer/src/test/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSuppliersTestUtils.java

@ -23,15 +23,17 @@ import reactor.core.publisher.Mono; @@ -23,15 +23,17 @@ import reactor.core.publisher.Mono;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.http.HttpStatus;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.util.UriComponentsBuilder;
import static org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplierBuilder.getUri;
/**
* A utility class for {@link ServiceInstanceListSupplier} tests.
*
* @author Olga Maciaszek-Sharma
* @author Sabyasachi Bhattacharya
* @since 3.0.0
*/
final class ServiceInstanceListSuppliersTestUtils {
@ -59,12 +61,4 @@ final class ServiceInstanceListSuppliersTestUtils { @@ -59,12 +61,4 @@ final class ServiceInstanceListSuppliersTestUtils {
});
}
private static String getUri(ServiceInstance serviceInstance, String healthCheckPath) {
if (StringUtils.hasText(healthCheckPath)) {
String path = healthCheckPath.startsWith("/") ? healthCheckPath : "/" + healthCheckPath;
return serviceInstance.getUri().toString() + path;
}
return serviceInstance.getUri().toString();
}
}

Loading…
Cancel
Save