Skip to content

Commit 5f550d5

Browse files
committed
Merge branch '1.2.x'
2 parents 9e4d773 + 2a54ef4 commit 5f550d5

File tree

282 files changed

+2688
-2317
lines changed

Some content is hidden

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

282 files changed

+2688
-2317
lines changed

buildSrc/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ ext {
1818
}
1919

2020
dependencies {
21-
checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:${javaFormatVersion}"
21+
checkstyle("com.puppycrawl.tools:checkstyle:${checkstyle.toolVersion}")
22+
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:${javaFormatVersion}")
23+
2224
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
2325
implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:${kotlinVersion}")
2426
implementation("io.spring.javaformat:spring-javaformat-gradle-plugin:${javaFormatVersion}")
2527
}
2628

2729
checkstyle {
28-
def archive = configurations.checkstyle.filter { it.name.startsWith("spring-javaformat-checkstyle")}
29-
config = resources.text.fromArchiveEntry(archive, "io/spring/javaformat/checkstyle/checkstyle.xml")
30-
toolVersion = 8.11
30+
toolVersion = "10.12.4"
3131
}
3232

3333
gradlePlugin {

buildSrc/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
javaFormatVersion=0.0.28
1+
javaFormatVersion=0.0.41

buildSrc/src/main/java/org/springframework/graphql/build/ConventionsPlugin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;
2424

2525
import org.springframework.graphql.build.conventions.DeploymentConventions;
26+
import org.springframework.graphql.build.conventions.FormattingConventions;
2627
import org.springframework.graphql.build.conventions.JavaConventions;
2728
import org.springframework.graphql.build.conventions.KotlinConventions;
2829

@@ -42,6 +43,7 @@ public class ConventionsPlugin implements Plugin<Project> {
4243

4344
@Override
4445
public void apply(Project project) {
46+
new FormattingConventions().apply(project);
4547
new JavaConventions().apply(project);
4648
new KotlinConventions().apply(project);
4749
new DeploymentConventions().apply(project);

buildSrc/src/main/java/org/springframework/graphql/build/conventions/FormattingConventions.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.graphql.build.conventions;
1818

19-
import io.spring.javaformat.gradle.FormatTask;
2019
import io.spring.javaformat.gradle.SpringJavaFormatPlugin;
2120
import org.gradle.api.Project;
2221
import org.gradle.api.artifacts.DependencySet;
@@ -26,8 +25,7 @@
2625

2726
/**
2827
* Conventions that are applied in the presence of the {@link JavaBasePlugin}. When the
29-
* plugin is applied, the {@link SpringJavaFormatPlugin Spring Java Format} and
30-
* {@link CheckstylePlugin Checkstyle}.
28+
* plugin is applied, {@link CheckstylePlugin Checkstyle} is applied and configured.
3129
*
3230
* @author Brian Clozel
3331
*/
@@ -38,14 +36,14 @@ public void apply(Project project) {
3836
}
3937

4038
private void applySpringJavaFormat(Project project) {
41-
project.getPlugins().apply(SpringJavaFormatPlugin.class);
42-
project.getTasks().withType(FormatTask.class, (formatTask) -> formatTask.setEncoding("UTF-8"));
4339
project.getPlugins().apply(CheckstylePlugin.class);
4440
CheckstyleExtension checkstyle = project.getExtensions().getByType(CheckstyleExtension.class);
45-
checkstyle.setToolVersion("8.43");
41+
checkstyle.setToolVersion("10.12.4");
4642
checkstyle.getConfigDirectory().set(project.getRootProject().file("src/checkstyle"));
4743
String version = SpringJavaFormatPlugin.class.getPackage().getImplementationVersion();
4844
DependencySet checkstyleDependencies = project.getConfigurations().getByName("checkstyle").getDependencies();
45+
checkstyleDependencies
46+
.add(project.getDependencies().create("com.puppycrawl.tools:checkstyle:" + checkstyle.getToolVersion()));
4947
checkstyleDependencies
5048
.add(project.getDependencies().create("io.spring.javaformat:spring-javaformat-checkstyle:" + version));
5149
}

spring-graphql-docs/src/main/java/org/springframework/graphql/docs/graalvm/server/GraphQlConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public class GraphQlConfiguration {
3131
@Bean
3232
RuntimeWiringConfigurer customWiringConfigurer(BookRepository bookRepository) { // <1>
3333
DataFetcher<Book> dataFetcher = QuerydslDataFetcher.builder(bookRepository).single();
34-
return wiringBuilder -> wiringBuilder
35-
.type("Query", builder -> builder.dataFetcher("book", dataFetcher)); // <2>
34+
return (wiringBuilder) -> wiringBuilder
35+
.type("Query", (builder) -> builder.dataFetcher("book", dataFetcher)); // <2>
3636
}
3737

3838
}

spring-graphql-docs/src/main/java/org/springframework/graphql/docs/graphiql/configuration/GraphiQlConfiguration.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
@Configuration
2929
public class GraphiQlConfiguration {
3030

31-
@Bean
32-
@Order(0)
33-
public RouterFunction<ServerResponse> graphiQlRouterFunction() {
34-
RouterFunctions.Builder builder = RouterFunctions.route();
35-
ClassPathResource graphiQlPage = new ClassPathResource("graphiql/index.html"); // <1>
36-
GraphiQlHandler graphiQLHandler = new GraphiQlHandler("/graphql", "", graphiQlPage); // <2>
37-
builder = builder.GET("/graphiql", graphiQLHandler::handleRequest); // <3>
38-
return builder.build(); // <4>
39-
}
31+
@Bean
32+
@Order(0)
33+
public RouterFunction<ServerResponse> graphiQlRouterFunction() {
34+
RouterFunctions.Builder builder = RouterFunctions.route();
35+
ClassPathResource graphiQlPage = new ClassPathResource("graphiql/index.html"); // <1>
36+
GraphiQlHandler graphiQLHandler = new GraphiQlHandler("/graphql", "", graphiQlPage); // <2>
37+
builder = builder.GET("/graphiql", graphiQLHandler::handleRequest); // <3>
38+
return builder.build(); // <4>
39+
}
4040
}

spring-graphql-docs/src/main/java/org/springframework/graphql/docs/server/interception/web/RequestErrorInterceptor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ class RequestErrorInterceptor implements WebGraphQlInterceptor {
3030

3131
@Override
3232
public Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, Chain chain) {
33-
return chain.next(request).map(response -> {
33+
return chain.next(request).map((response) -> {
3434
if (response.isValid()) {
3535
return response; // <1>
3636
}
3737

3838
List<GraphQLError> errors = response.getErrors().stream() // <2>
39-
.map(error -> {
39+
.map((error) -> {
4040
GraphqlErrorBuilder<?> builder = GraphqlErrorBuilder.newError();
4141
// ...
4242
return builder.build();
4343
})
4444
.toList();
4545

46-
return response.transform(builder -> builder.errors(errors).build()); // <3>
46+
return response.transform((builder) -> builder.errors(errors).build()); // <3>
4747
});
4848
}
49-
}
49+
}

spring-graphql-docs/src/main/java/org/springframework/graphql/docs/server/interception/web/ResponseHeaderInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ResponseHeaderInterceptor implements WebGraphQlInterceptor {
3333

3434
@Override
3535
public Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, Chain chain) { // <2>
36-
return chain.next(request).doOnNext(response -> {
36+
return chain.next(request).doOnNext((response) -> {
3737
String value = response.getExecutionInput().getGraphQLContext().get("cookieName");
3838
ResponseCookie cookie = ResponseCookie.from("cookieName", value).build();
3939
response.getResponseHeaders().add(HttpHeaders.SET_COOKIE, cookie.toString());

spring-graphql-docs/src/main/java/org/springframework/graphql/docs/server/transports/rsocket/GraphQlRSocketController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ public Mono<Map<String, Object>> handle(Map<String, Object> payload) {
4343
public Flux<Map<String, Object>> handleSubscription(Map<String, Object> payload) {
4444
return this.handler.handleSubscription(payload);
4545
}
46-
}
46+
}

spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/AbstractDirectGraphQlTransport.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
* to a server-side GraphQL handler or service.
4242
*
4343
* @author Rossen Stoyanchev
44-
* @since 1.0.0
4544
*/
4645
abstract class AbstractDirectGraphQlTransport implements GraphQlTransport {
4746

@@ -56,15 +55,15 @@ public Mono<GraphQlResponse> execute(GraphQlRequest request) {
5655
@SuppressWarnings({"ConstantConditions", "unchecked"})
5756
@Override
5857
public Flux<GraphQlResponse> executeSubscription(GraphQlRequest request) {
59-
return executeInternal(toExecutionRequest(request)).flatMapMany(response -> {
58+
return executeInternal(toExecutionRequest(request)).flatMapMany((response) -> {
6059
try {
6160
Object data = response.getData();
6261
AssertionErrors.assertTrue("Not a Publisher: " + data, data instanceof Publisher);
6362

6463
List<ResponseError> errors = response.getErrors();
6564
AssertionErrors.assertTrue("Subscription errors: " + errors, CollectionUtils.isEmpty(errors));
6665

67-
return Flux.from((Publisher<ExecutionResult>) data).map(executionResult ->
66+
return Flux.from((Publisher<ExecutionResult>) data).map((executionResult) ->
6867
new DefaultExecutionGraphQlResponse(response.getExecutionInput(), executionResult));
6968
}
7069
catch (AssertionError ex) {

spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/AbstractGraphQlTesterBuilder.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.graphql.test.tester;
1718

1819
import java.time.Duration;
@@ -35,7 +36,6 @@
3536
import org.springframework.graphql.client.AbstractGraphQlClientBuilder;
3637
import org.springframework.graphql.client.GraphQlClient;
3738
import org.springframework.graphql.client.GraphQlTransport;
38-
import org.springframework.graphql.support.CachingDocumentSource;
3939
import org.springframework.graphql.support.DocumentSource;
4040
import org.springframework.graphql.support.ResourceDocumentSource;
4141
import org.springframework.lang.Nullable;
@@ -51,6 +51,7 @@
5151
* agnostic {@code GraphQlTester}. A transport specific extension can then wrap
5252
* this default tester by extending {@link AbstractDelegatingGraphQlTester}.
5353
*
54+
* @param <B> the type of builder
5455
* @author Rossen Stoyanchev
5556
* @since 1.0.0
5657
* @see AbstractDelegatingGraphQlTester
@@ -86,7 +87,7 @@ private static DocumentSource initDocumentSource() {
8687

8788
@Override
8889
public B errorFilter(Predicate<ResponseError> predicate) {
89-
this.errorFilter = (this.errorFilter != null ? errorFilter.and(predicate) : predicate);
90+
this.errorFilter = (this.errorFilter != null) ? this.errorFilter.and(predicate) : predicate;
9091
return self();
9192
}
9293

@@ -115,6 +116,7 @@ private <T extends B> T self() {
115116
/**
116117
* Allow transport-specific subclass builders to register a JSON Path
117118
* {@link MappingProvider} that matches the JSON encoding/decoding they use.
119+
* @param configurer a function applied to the JSON Path configuration
118120
*/
119121
protected void configureJsonPathConfig(Function<Configuration, Configuration> configurer) {
120122
this.jsonPathConfig = configurer.apply(this.jsonPathConfig);
@@ -123,6 +125,7 @@ protected void configureJsonPathConfig(Function<Configuration, Configuration> co
123125
/**
124126
* Build the default transport-agnostic client that subclasses can then wrap
125127
* with {@link AbstractDelegatingGraphQlTester}.
128+
* @param transport the graphql transport to use
126129
*/
127130
protected GraphQlTester buildGraphQlTester(GraphQlTransport transport) {
128131

@@ -139,12 +142,12 @@ protected GraphQlTester buildGraphQlTester(GraphQlTransport transport) {
139142
* initialize new builder instances with, based on "this" builder.
140143
*/
141144
protected Consumer<AbstractGraphQlTesterBuilder<?>> getBuilderInitializer() {
142-
return builder -> {
145+
return (builder) -> {
143146
if (this.errorFilter != null) {
144147
builder.errorFilter(this.errorFilter);
145148
}
146149
builder.documentSource(this.documentSource);
147-
builder.configureJsonPathConfig(config -> this.jsonPathConfig);
150+
builder.configureJsonPathConfig((config) -> this.jsonPathConfig);
148151
builder.responseTimeout(this.responseTimeout);
149152
};
150153
}
@@ -153,6 +156,7 @@ protected Consumer<AbstractGraphQlTesterBuilder<?>> getBuilderInitializer() {
153156
* For cases where the Tester needs the {@link GraphQlTransport}, we can't use
154157
* transports directly since they are package private, but we can adapt the corresponding
155158
* {@link GraphQlClient} and adapt it to {@code GraphQlTransport}.
159+
* @param client the graphql client to use for extracting the transport
156160
*/
157161
protected static GraphQlTransport asTransport(GraphQlClient client) {
158162
return new GraphQlTransport() {
@@ -180,7 +184,7 @@ public Flux<GraphQlResponse> executeSubscription(GraphQlRequest request) {
180184
}
181185

182186

183-
private static class Jackson2Configurer {
187+
private static final class Jackson2Configurer {
184188

185189
private static final Class<?> defaultJsonProviderType;
186190

spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/DefaultExecutionGraphQlServiceTesterBuilder.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
* wraps an {@code ExecutionGraphQlService}.
3838
*
3939
* @author Rossen Stoyanchev
40-
* @since 1.0.0
4140
*/
4241
final class DefaultExecutionGraphQlServiceTesterBuilder
4342
extends AbstractGraphQlTesterBuilder<DefaultExecutionGraphQlServiceTesterBuilder>
@@ -95,7 +94,7 @@ public ExecutionGraphQlServiceTester build() {
9594

9695
private void registerJsonPathMappingProvider() {
9796
if (this.encoder != null && this.decoder != null) {
98-
configureJsonPathConfig(config -> {
97+
configureJsonPathConfig((config) -> {
9998
EncoderDecoderMappingProvider provider = new EncoderDecoderMappingProvider(
10099
Collections.singletonList(this.encoder), Collections.singletonList(this.decoder));
101100
return config.mappingProvider(provider);
@@ -111,7 +110,7 @@ private GraphQlServiceGraphQlTransport createTransport() {
111110
/**
112111
* Default {@link ExecutionGraphQlServiceTester} implementation.
113112
*/
114-
private static class DefaultExecutionGraphQlServiceTester
113+
private static final class DefaultExecutionGraphQlServiceTester
115114
extends AbstractDelegatingGraphQlTester implements ExecutionGraphQlServiceTester {
116115

117116
private final GraphQlServiceGraphQlTransport transport;

0 commit comments

Comments
 (0)