Skip to content

Commit 656ab5a

Browse files
committed
Bumping versions
1 parent 4a2c6d8 commit 656ab5a

File tree

292 files changed

+5624
-3084
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

292 files changed

+5624
-3084
lines changed

spring-cloud-gateway-integration-tests/grpc/src/main/java/org/springframework/cloud/gateway/tests/grpc/GRPCApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static class HelloService extends HelloServiceGrpc.HelloServiceImplBase {
107107
public void hello(HelloRequest request, StreamObserver<HelloResponse> responseObserver) {
108108
if ("failWithRuntimeException!".equals(request.getFirstName())) {
109109
StatusRuntimeException exception = Status.FAILED_PRECONDITION.withDescription("Invalid firstName")
110-
.asRuntimeException();
110+
.asRuntimeException();
111111
responseObserver.onError(exception);
112112
responseObserver.onCompleted();
113113
return;

spring-cloud-gateway-integration-tests/grpc/src/test/java/org/springframework/cloud/gateway/tests/grpc/GRPCApplicationTests.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,19 @@ public void gRPCUnaryCallShouldReturnResponse() throws SSLException {
5959
ManagedChannel channel = createSecuredChannel(gatewayPort);
6060

6161
final HelloResponse response = HelloServiceGrpc.newBlockingStub(channel)
62-
.hello(HelloRequest.newBuilder().setFirstName("Sir").setLastName("FromClient").build());
62+
.hello(HelloRequest.newBuilder().setFirstName("Sir").setLastName("FromClient").build());
6363

6464
Assertions.assertThat(response.getGreeting()).isEqualTo("Hello, Sir FromClient");
6565
}
6666

6767
private ManagedChannel createSecuredChannel(int port) throws SSLException {
6868
TrustManager[] trustAllCerts = createTrustAllTrustManager();
6969

70-
return NettyChannelBuilder.forAddress("localhost", port).useTransportSecurity()
71-
.sslContext(GrpcSslContexts.forClient().trustManager(trustAllCerts[0]).build()).negotiationType(TLS)
72-
.build();
70+
return NettyChannelBuilder.forAddress("localhost", port)
71+
.useTransportSecurity()
72+
.sslContext(GrpcSslContexts.forClient().trustManager(trustAllCerts[0]).build())
73+
.negotiationType(TLS)
74+
.build();
7375
}
7476

7577
@Test
@@ -78,7 +80,7 @@ public void gRPCUnaryCallShouldHandleRuntimeException() throws SSLException {
7880

7981
try {
8082
HelloServiceGrpc.newBlockingStub(channel)
81-
.hello(HelloRequest.newBuilder().setFirstName("failWithRuntimeException!").build());
83+
.hello(HelloRequest.newBuilder().setFirstName("failWithRuntimeException!").build());
8284
}
8385
catch (StatusRuntimeException e) {
8486
Assertions.assertThat(FAILED_PRECONDITION.getCode()).isEqualTo(e.getStatus().getCode());

spring-cloud-gateway-integration-tests/grpc/src/test/java/org/springframework/cloud/gateway/tests/grpc/JsonToGrpcApplicationTests.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ public void shouldConvertFromJSONToGRPC() {
7474
configurer.addRoute(grpcServerPort, "/json/hello",
7575
"JsonToGrpc=file:src/main/proto/hello.pb,file:src/main/proto/hello.proto,HelloService,hello");
7676

77-
String response = restTemplate.postForEntity("https://localhost:" + this.gatewayPort + "/json/hello",
78-
"{\"firstName\":\"Duff\", \"lastName\":\"McKagan\"}", String.class).getBody();
77+
String response = restTemplate
78+
.postForEntity("https://localhost:" + this.gatewayPort + "/json/hello",
79+
"{\"firstName\":\"Duff\", \"lastName\":\"McKagan\"}", String.class)
80+
.getBody();
7981

8082
Assertions.assertThat(response).isNotNull();
8183
Assertions.assertThat(response).contains("{\"greeting\":\"Hello, Duff McKagan\"}");
@@ -94,7 +96,9 @@ private RestTemplate createUnsecureClient() {
9496
NoopHostnameVerifier.INSTANCE);
9597

9698
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
97-
.register("https", sslSocketFactory).register("http", new PlainConnectionSocketFactory()).build();
99+
.register("https", sslSocketFactory)
100+
.register("http", new PlainConnectionSocketFactory())
101+
.build();
98102

99103
HttpClientConnectionManager connectionManager = new BasicHttpClientConnectionManager(socketFactoryRegistry);
100104
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(connectionManager).build();

spring-cloud-gateway-integration-tests/grpc/src/test/java/org/springframework/cloud/gateway/tests/grpc/RouteConfigurer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ private RestTemplate createUnsecureClient() {
101101
NoopHostnameVerifier.INSTANCE);
102102

103103
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
104-
.register("https", sslSocketFactory).register("http", new PlainConnectionSocketFactory()).build();
104+
.register("https", sslSocketFactory)
105+
.register("http", new PlainConnectionSocketFactory())
106+
.build();
105107

106108
HttpClientConnectionManager connectionManager = new BasicHttpClientConnectionManager(socketFactoryRegistry);
107109
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(connectionManager).build();

spring-cloud-gateway-integration-tests/http2/src/main/java/org/springframework/cloud/gateway/tests/http2/Http2Application.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ public String hello() {
5454

5555
@Bean
5656
public RouteLocator myRouteLocator(RouteLocatorBuilder builder) {
57-
return builder.routes().route(r -> r.path("/myprefix/**").filters(f -> f.stripPrefix(1)).uri("lb://myservice"))
58-
.route(r -> r.path("/nossl/**").filters(f -> f.stripPrefix(1)).uri("lb://nossl"))
59-
.route(r -> r.path("/neverssl/**").filters(f -> f.stripPrefix(1)).uri("http://neverssl.com"))
60-
.route(r -> r.path("/httpbin/**").uri("https://nghttp2.org")).build();
57+
return builder.routes()
58+
.route(r -> r.path("/myprefix/**").filters(f -> f.stripPrefix(1)).uri("lb://myservice"))
59+
.route(r -> r.path("/nossl/**").filters(f -> f.stripPrefix(1)).uri("lb://nossl"))
60+
.route(r -> r.path("/neverssl/**").filters(f -> f.stripPrefix(1)).uri("http://neverssl.com"))
61+
.route(r -> r.path("/httpbin/**").uri("https://nghttp2.org"))
62+
.build();
6163
}
6264

6365
public static void main(String[] args) {

spring-cloud-gateway-integration-tests/http2/src/test/java/org/springframework/cloud/gateway/tests/http2/Http2ApplicationTests.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,17 @@ public static void assertResponse(String uri, String expected) {
7474

7575
static HttpClient getHttpClient() {
7676
return HttpClient
77-
.create(ConnectionProvider.builder("test").maxConnections(100)
78-
.pendingAcquireTimeout(Duration.ofMillis(0)).pendingAcquireMaxCount(-1).build())
79-
.protocol(HttpProtocol.HTTP11, HttpProtocol.H2).secure(sslContextSpec -> {
80-
Http2SslContextSpec clientSslCtxt = Http2SslContextSpec.forClient()
81-
.configure(builder -> builder.trustManager(InsecureTrustManagerFactory.INSTANCE));
82-
sslContextSpec.sslContext(clientSslCtxt);
83-
});
77+
.create(ConnectionProvider.builder("test")
78+
.maxConnections(100)
79+
.pendingAcquireTimeout(Duration.ofMillis(0))
80+
.pendingAcquireMaxCount(-1)
81+
.build())
82+
.protocol(HttpProtocol.HTTP11, HttpProtocol.H2)
83+
.secure(sslContextSpec -> {
84+
Http2SslContextSpec clientSslCtxt = Http2SslContextSpec.forClient()
85+
.configure(builder -> builder.trustManager(InsecureTrustManagerFactory.INSTANCE));
86+
sslContextSpec.sslContext(clientSslCtxt);
87+
});
8488
}
8589

8690
}

spring-cloud-gateway-integration-tests/http2/src/test/java/org/springframework/cloud/gateway/tests/http2/nossl/NosslTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ public void http2TerminationWorks(CapturedOutput output) {
6464
System.err.println("nossl.port = " + nosslPort);
6565
Hooks.onOperatorDebug();
6666
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(NosslConfiguration.class)
67-
.properties("server.port=" + nosslPort).profiles("nossl").run()) {
67+
.properties("server.port=" + nosslPort)
68+
.profiles("nossl")
69+
.run()) {
6870
String uri = "https://localhost:" + port + "/nossl";
6971
String expected = "nossl";
7072
assertResponse(uri, expected);

spring-cloud-gateway-integration-tests/mvc-failure-analyzer/src/main/java/org/springframework/cloud/gateway/sample/MvcFailureAnalyzerApplication.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ public String hello() {
4747
@Bean
4848
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
4949
public RouteLocator myRouteLocator(RouteLocatorBuilder builder) {
50-
return builder.routes().route(r -> r.path("/myprefix/**").filters(f -> f.stripPrefix(1)).uri("lb://myservice"))
51-
.build();
50+
return builder.routes()
51+
.route(r -> r.path("/myprefix/**").filters(f -> f.stripPrefix(1)).uri("lb://myservice"))
52+
.build();
5253
}
5354

5455
}

spring-cloud-gateway-integration-tests/mvc-failure-analyzer/src/test/java/org/springframework/cloud/gateway/sample/MvcFailureAnalyzerApplicationTests.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ public class MvcFailureAnalyzerApplicationTests {
4040
@Test
4141
public void exceptionThrown(CapturedOutput output) {
4242
assertThatThrownBy(() -> new SpringApplication(MvcFailureAnalyzerApplication.class).run("--server.port=0"))
43-
.hasRootCauseInstanceOf(MvcFoundOnClasspathException.class);
43+
.hasRootCauseInstanceOf(MvcFoundOnClasspathException.class);
4444
assertThat(output).contains(MvcFoundOnClasspathFailureAnalyzer.MESSAGE,
4545
MvcFoundOnClasspathFailureAnalyzer.ACTION);
4646
}
4747

4848
@Test
4949
public void exceptionNotThrownWhenDisabled(CapturedOutput output) {
5050
assertThatCode(() -> new SpringApplication(MvcFailureAnalyzerApplication.class)
51-
.run("--spring.cloud.gateway.enabled=false", "--server.port=0")).doesNotThrowAnyException();
51+
.run("--spring.cloud.gateway.enabled=false", "--server.port=0")).doesNotThrowAnyException();
5252
assertThat(output).doesNotContain(MvcFoundOnClasspathFailureAnalyzer.MESSAGE,
5353
MvcFoundOnClasspathFailureAnalyzer.ACTION);
5454
}
@@ -57,11 +57,16 @@ public void exceptionNotThrownWhenDisabled(CapturedOutput output) {
5757
public void exceptionNotThrownWhenReactiveTypeSet(CapturedOutput output) {
5858
assertThatCode(() -> {
5959
ConfigurableApplicationContext context = new SpringApplication(MvcFailureAnalyzerApplication.class)
60-
.run("--spring.main.web-application-type=reactive", "--server.port=0", "--debug=true");
60+
.run("--spring.main.web-application-type=reactive", "--server.port=0", "--debug=true");
6161
Integer port = context.getEnvironment().getProperty("local.server.port", Integer.class);
6262
WebTestClient client = WebTestClient.bindToServer().baseUrl("http://localhost:" + port).build();
63-
client.get().uri("/myprefix/hello").exchange().expectStatus().isOk().expectBody(String.class)
64-
.isEqualTo("Hello");
63+
client.get()
64+
.uri("/myprefix/hello")
65+
.exchange()
66+
.expectStatus()
67+
.isOk()
68+
.expectBody(String.class)
69+
.isEqualTo("Hello");
6570
context.close();
6671
}).doesNotThrowAnyException();
6772
assertThat(output).doesNotContain(MvcFoundOnClasspathFailureAnalyzer.MESSAGE,

spring-cloud-gateway-mvc/src/main/java/org/springframework/cloud/gateway/mvc/ProxyExchange.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ public void forward(String path) {
280280
HttpServletRequest request = this.webRequest.getNativeRequest(HttpServletRequest.class);
281281
HttpServletResponse response = this.webRequest.getNativeResponse(HttpServletResponse.class);
282282
try {
283-
request.getRequestDispatcher(path).forward(new BodyForwardingHttpServletRequest(request, response),
284-
response);
283+
request.getRequestDispatcher(path)
284+
.forward(new BodyForwardingHttpServletRequest(request, response), response);
285285
}
286286
catch (Exception e) {
287287
throw new IllegalStateException("Cannot forward request", e);
@@ -363,8 +363,9 @@ private void addHeaders(HttpHeaders headers) {
363363
ArrayList<String> headerNames = new ArrayList<>();
364364
webRequest.getHeaderNames().forEachRemaining(headerNames::add);
365365
Set<String> filteredKeys = filterHeaderKeys(headerNames);
366-
filteredKeys.stream().filter(key -> !headers.containsKey(key))
367-
.forEach(header -> headers.addAll(header, Arrays.asList(webRequest.getHeaderValues(header))));
366+
filteredKeys.stream()
367+
.filter(key -> !headers.containsKey(key))
368+
.forEach(header -> headers.addAll(header, Arrays.asList(webRequest.getHeaderValues(header))));
368369
}
369370

370371
private BodyBuilder headers(BodyBuilder builder) {
@@ -382,8 +383,9 @@ private Set<String> filterHeaderKeys(HttpHeaders headers) {
382383

383384
private Set<String> filterHeaderKeys(Collection<String> headerNames) {
384385
final Set<String> excludedHeaders = this.excluded != null ? this.excluded : Collections.emptySet();
385-
return headerNames.stream().filter(header -> !excludedHeaders.contains(header.toLowerCase()))
386-
.collect(Collectors.toSet());
386+
return headerNames.stream()
387+
.filter(header -> !excludedHeaders.contains(header.toLowerCase()))
388+
.collect(Collectors.toSet());
387389
}
388390

389391
private void proxy() {

0 commit comments

Comments
 (0)