|
|
@ -36,13 +36,17 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
|
|
|
import org.springframework.boot.test.context.SpringBootTest; |
|
|
|
import org.springframework.boot.test.context.SpringBootTest; |
|
|
|
import org.springframework.boot.test.system.OutputCaptureRule; |
|
|
|
import org.springframework.boot.test.system.OutputCaptureRule; |
|
|
|
import org.springframework.boot.web.server.LocalServerPort; |
|
|
|
import org.springframework.boot.web.server.LocalServerPort; |
|
|
|
|
|
|
|
import org.springframework.cloud.client.DefaultServiceInstance; |
|
|
|
import org.springframework.cloud.gateway.filter.GatewayFilter; |
|
|
|
import org.springframework.cloud.gateway.filter.GatewayFilter; |
|
|
|
import org.springframework.cloud.gateway.filter.factory.RetryGatewayFilterFactory.RetryConfig; |
|
|
|
import org.springframework.cloud.gateway.filter.factory.RetryGatewayFilterFactory.RetryConfig; |
|
|
|
import org.springframework.cloud.gateway.route.RouteLocator; |
|
|
|
import org.springframework.cloud.gateway.route.RouteLocator; |
|
|
|
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder; |
|
|
|
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder; |
|
|
|
import org.springframework.cloud.gateway.test.BaseWebClientTests; |
|
|
|
import org.springframework.cloud.gateway.test.BaseWebClientTests; |
|
|
|
|
|
|
|
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient; |
|
|
|
|
|
|
|
import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Import; |
|
|
|
import org.springframework.context.annotation.Import; |
|
|
|
|
|
|
|
import org.springframework.core.env.Environment; |
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
import org.springframework.http.HttpMethod; |
|
|
|
import org.springframework.http.HttpMethod; |
|
|
|
import org.springframework.http.HttpStatus; |
|
|
|
import org.springframework.http.HttpStatus; |
|
|
@ -173,8 +177,8 @@ public class RetryGatewayFilterFactoryIntegrationTests extends BaseWebClientTest |
|
|
|
@EnableAutoConfiguration |
|
|
|
@EnableAutoConfiguration |
|
|
|
@SpringBootConfiguration |
|
|
|
@SpringBootConfiguration |
|
|
|
@Import(DefaultTestConfig.class) |
|
|
|
@Import(DefaultTestConfig.class) |
|
|
|
// @RibbonClient(name = "badservice2", configuration =
|
|
|
|
@LoadBalancerClient(name = "badservice2", |
|
|
|
// TestBadLoadBalancerConfig.class)
|
|
|
|
configuration = TestBadLoadBalancerConfig.class) |
|
|
|
public static class TestConfig { |
|
|
|
public static class TestConfig { |
|
|
|
|
|
|
|
|
|
|
|
Log log = LogFactory.getLog(getClass()); |
|
|
|
Log log = LogFactory.getLog(getClass()); |
|
|
@ -271,12 +275,14 @@ public class RetryGatewayFilterFactoryIntegrationTests extends BaseWebClientTest |
|
|
|
@LocalServerPort |
|
|
|
@LocalServerPort |
|
|
|
protected int port = 0; |
|
|
|
protected int port = 0; |
|
|
|
|
|
|
|
|
|
|
|
// @Bean
|
|
|
|
@Bean |
|
|
|
// public ServerList<Server> serverList() {
|
|
|
|
public ServiceInstanceListSupplier staticServiceInstanceListSupplier( |
|
|
|
// return new StaticServerList<>(
|
|
|
|
Environment env) { |
|
|
|
// new Server("https", "localhost.domain.doesnot.exist", this.port),
|
|
|
|
return ServiceInstanceListSupplier.fixed(env) |
|
|
|
// new Server("localhost", this.port));
|
|
|
|
.instance(new DefaultServiceInstance("doesnotexist1", "badservice2", |
|
|
|
// }
|
|
|
|
"localhost.domain.doesnot.exist", port, true)) |
|
|
|
|
|
|
|
.instance(port, "badservice2").build(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|