diff --git a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQLAutoConfiguration.java b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQlAutoConfiguration.java similarity index 81% rename from graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQLAutoConfiguration.java rename to graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQlAutoConfiguration.java index fe24b341..cd90a57f 100644 --- a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQLAutoConfiguration.java +++ b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQlAutoConfiguration.java @@ -29,22 +29,22 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ResourceLoader; import org.springframework.graphql.execution.DataFetcherExceptionResolver; -import org.springframework.graphql.execution.GraphQLSource; +import org.springframework.graphql.execution.GraphQlSource; @Configuration @ConditionalOnClass(GraphQL.class) -@ConditionalOnMissingBean(GraphQLSource.class) -@EnableConfigurationProperties(GraphQLProperties.class) -public class GraphQLAutoConfiguration { +@ConditionalOnMissingBean(GraphQlSource.class) +@EnableConfigurationProperties(GraphQlProperties.class) +public class GraphQlAutoConfiguration { @Bean - public GraphQLSource graphQLSource(GraphQLSource.Builder builder) { + public GraphQlSource graphQlSource(GraphQlSource.Builder builder) { return builder.build(); } @Configuration - @ConditionalOnMissingBean(GraphQLSource.Builder.class) - static class GraphQLSourceConfiguration { + @ConditionalOnMissingBean(GraphQlSource.Builder.class) + static class GraphQlSourceConfiguration { @Bean @ConditionalOnMissingBean @@ -55,13 +55,13 @@ public class GraphQLAutoConfiguration { } @Bean - public GraphQLSource.Builder graphQLSourceBuilder( - GraphQLProperties properties, RuntimeWiring runtimeWiring, + public GraphQlSource.Builder graphQlSourceBuilder( + GraphQlProperties properties, RuntimeWiring runtimeWiring, ObjectProvider exceptionResolversProvider, ResourceLoader resourceLoader, ObjectProvider instrumentationsProvider) { String schemaLocation = properties.getSchema().getLocation(); - return GraphQLSource.builder() + return GraphQlSource.builder() .schemaResource(resourceLoader.getResource(schemaLocation)) .runtimeWiring(runtimeWiring) .exceptionResolvers(exceptionResolversProvider.orderedStream().collect(Collectors.toList())) diff --git a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQLProperties.java b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQlProperties.java similarity index 98% rename from graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQLProperties.java rename to graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQlProperties.java index cc1fc121..30753a8f 100644 --- a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQLProperties.java +++ b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQlProperties.java @@ -20,7 +20,7 @@ import java.time.Duration; import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "spring.graphql") -public class GraphQLProperties { +public class GraphQlProperties { /** * Path at which to expose a GraphQL request HTTP endpoint. diff --git a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQLServiceAutoConfiguration.java b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQlServiceAutoConfiguration.java similarity index 72% rename from graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQLServiceAutoConfiguration.java rename to graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQlServiceAutoConfiguration.java index c6110158..0a7e00f1 100644 --- a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQLServiceAutoConfiguration.java +++ b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQlServiceAutoConfiguration.java @@ -22,20 +22,20 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.graphql.GraphQLService; -import org.springframework.graphql.execution.ExecutionGraphQLService; -import org.springframework.graphql.execution.GraphQLSource; +import org.springframework.graphql.GraphQlService; +import org.springframework.graphql.execution.ExecutionGraphQlService; +import org.springframework.graphql.execution.GraphQlSource; @Configuration @ConditionalOnClass(GraphQL.class) -@ConditionalOnMissingBean(GraphQLService.class) -@AutoConfigureAfter(GraphQLAutoConfiguration.class) -public class GraphQLServiceAutoConfiguration { +@ConditionalOnMissingBean(GraphQlService.class) +@AutoConfigureAfter(GraphQlAutoConfiguration.class) +public class GraphQlServiceAutoConfiguration { @Bean @ConditionalOnMissingBean - public GraphQLService graphQLService(GraphQLSource graphQLSource) { - return new ExecutionGraphQLService(graphQLSource); + public GraphQlService graphQlService(GraphQlSource graphQlSource) { + return new ExecutionGraphQlService(graphQlSource); } } diff --git a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/WebFluxGraphQLAutoConfiguration.java b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/WebFluxGraphQlAutoConfiguration.java similarity index 77% rename from graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/WebFluxGraphQLAutoConfiguration.java rename to graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/WebFluxGraphQlAutoConfiguration.java index 84d091fb..9279137a 100644 --- a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/WebFluxGraphQLAutoConfiguration.java +++ b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/WebFluxGraphQlAutoConfiguration.java @@ -35,12 +35,12 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; -import org.springframework.graphql.GraphQLService; -import org.springframework.graphql.execution.GraphQLSource; -import org.springframework.graphql.web.WebGraphQLHandler; +import org.springframework.graphql.GraphQlService; +import org.springframework.graphql.execution.GraphQlSource; +import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.web.WebInterceptor; -import org.springframework.graphql.web.webflux.GraphQLHttpHandler; -import org.springframework.graphql.web.webflux.GraphQLWebSocketHandler; +import org.springframework.graphql.web.webflux.GraphQlHttpHandler; +import org.springframework.graphql.web.webflux.GraphQlWebSocketHandler; import org.springframework.http.MediaType; import org.springframework.http.codec.ServerCodecConfigurer; import org.springframework.web.reactive.HandlerMapping; @@ -56,28 +56,28 @@ import static org.springframework.web.reactive.function.server.RequestPredicates @Configuration @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) @ConditionalOnClass(GraphQL.class) -@ConditionalOnBean(GraphQLSource.class) -@AutoConfigureAfter(GraphQLAutoConfiguration.class) -public class WebFluxGraphQLAutoConfiguration { +@ConditionalOnBean(GraphQlSource.class) +@AutoConfigureAfter(GraphQlAutoConfiguration.class) +public class WebFluxGraphQlAutoConfiguration { - private static final Log logger = LogFactory.getLog(WebFluxGraphQLAutoConfiguration.class); + private static final Log logger = LogFactory.getLog(WebFluxGraphQlAutoConfiguration.class); @Bean @ConditionalOnMissingBean - public WebGraphQLHandler webGraphQLHandler(ObjectProvider interceptors, GraphQLService service) { + public WebGraphQlHandler webGraphQlHandler(ObjectProvider interceptors, GraphQlService service) { return WebInterceptor.createHandler(interceptors.orderedStream().collect(Collectors.toList()), service); } @Bean @ConditionalOnMissingBean - public GraphQLHttpHandler graphQLHttpHandler(WebGraphQLHandler webGraphQLHandler) { - return new GraphQLHttpHandler(webGraphQLHandler); + public GraphQlHttpHandler graphQlHttpHandler(WebGraphQlHandler webGraphQlHandler) { + return new GraphQlHttpHandler(webGraphQlHandler); } @Bean - public RouterFunction graphQLEndpoint(GraphQLHttpHandler handler, GraphQLSource graphQLSource, - GraphQLProperties properties, ResourceLoader resourceLoader) { + public RouterFunction graphQlEndpoint(GraphQlHttpHandler handler, GraphQlSource graphQlSource, + GraphQlProperties properties, ResourceLoader resourceLoader) { String path = properties.getPath(); Resource resource = resourceLoader.getResource("classpath:graphiql/index.html"); @@ -90,7 +90,7 @@ public class WebFluxGraphQLAutoConfiguration { if (properties.getSchema().getPrinter().isEnabled()) { SchemaPrinter schemaPrinter = new SchemaPrinter(); builder = builder.GET(path + properties.getSchema().getPrinter().getPath(), - req -> ServerResponse.ok().contentType(MediaType.TEXT_PLAIN).bodyValue(schemaPrinter.print(graphQLSource.schema()))); + req -> ServerResponse.ok().contentType(MediaType.TEXT_PLAIN).bodyValue(schemaPrinter.print(graphQlSource.schema()))); } return builder.build(); } @@ -100,23 +100,23 @@ public class WebFluxGraphQLAutoConfiguration { @Bean @ConditionalOnMissingBean - public GraphQLWebSocketHandler graphQLWebSocketHandler( - WebGraphQLHandler webGraphQLHandler, GraphQLProperties properties, ServerCodecConfigurer configurer) { + public GraphQlWebSocketHandler graphQlWebSocketHandler( + WebGraphQlHandler webGraphQlHandler, GraphQlProperties properties, ServerCodecConfigurer configurer) { - return new GraphQLWebSocketHandler( - webGraphQLHandler, configurer, properties.getWebsocket().getConnectionInitTimeout()); + return new GraphQlWebSocketHandler( + webGraphQlHandler, configurer, properties.getWebsocket().getConnectionInitTimeout()); } @Bean - public HandlerMapping graphQLWebSocketEndpoint( - GraphQLWebSocketHandler graphQLWebSocketHandler, GraphQLProperties properties) { + public HandlerMapping graphQlWebSocketEndpoint( + GraphQlWebSocketHandler graphQlWebSocketHandler, GraphQlProperties properties) { String path = properties.getWebsocket().getPath(); if (logger.isInfoEnabled()) { logger.info("GraphQL endpoint WebSocket " + path); } WebSocketHandlerMapping handlerMapping = new WebSocketHandlerMapping(); - handlerMapping.setUrlMap(Collections.singletonMap(path, graphQLWebSocketHandler)); + handlerMapping.setUrlMap(Collections.singletonMap(path, graphQlWebSocketHandler)); handlerMapping.setOrder(-2); // Ahead of HTTP endpoint ("routerFunctionMapping" bean) return handlerMapping; } diff --git a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/WebMvcGraphQLAutoConfiguration.java b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/WebMvcGraphQlAutoConfiguration.java similarity index 80% rename from graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/WebMvcGraphQLAutoConfiguration.java rename to graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/WebMvcGraphQlAutoConfiguration.java index 3b782f8b..941225a7 100644 --- a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/WebMvcGraphQLAutoConfiguration.java +++ b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/WebMvcGraphQlAutoConfiguration.java @@ -39,12 +39,12 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; -import org.springframework.graphql.GraphQLService; -import org.springframework.graphql.execution.GraphQLSource; -import org.springframework.graphql.web.WebGraphQLHandler; +import org.springframework.graphql.GraphQlService; +import org.springframework.graphql.execution.GraphQlSource; +import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.web.WebInterceptor; -import org.springframework.graphql.web.webmvc.GraphQLHttpHandler; -import org.springframework.graphql.web.webmvc.GraphQLWebSocketHandler; +import org.springframework.graphql.web.webmvc.GraphQlHttpHandler; +import org.springframework.graphql.web.webmvc.GraphQlWebSocketHandler; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; @@ -63,28 +63,28 @@ import static org.springframework.web.servlet.function.RequestPredicates.content @Configuration @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnClass(GraphQL.class) -@ConditionalOnBean(GraphQLSource.class) -@AutoConfigureAfter(GraphQLAutoConfiguration.class) -public class WebMvcGraphQLAutoConfiguration { +@ConditionalOnBean(GraphQlSource.class) +@AutoConfigureAfter(GraphQlAutoConfiguration.class) +public class WebMvcGraphQlAutoConfiguration { - private static final Log logger = LogFactory.getLog(WebMvcGraphQLAutoConfiguration.class); + private static final Log logger = LogFactory.getLog(WebMvcGraphQlAutoConfiguration.class); @Bean @ConditionalOnMissingBean - public WebGraphQLHandler webGraphQLHandler(ObjectProvider interceptors, GraphQLService service) { + public WebGraphQlHandler webGraphQlHandler(ObjectProvider interceptors, GraphQlService service) { return WebInterceptor.createHandler(interceptors.orderedStream().collect(Collectors.toList()), service); } @Bean @ConditionalOnMissingBean - public GraphQLHttpHandler graphQLHttpHandler(WebGraphQLHandler webGraphQLHandler) { - return new GraphQLHttpHandler(webGraphQLHandler); + public GraphQlHttpHandler graphQlHttpHandler(WebGraphQlHandler webGraphQlHandler) { + return new GraphQlHttpHandler(webGraphQlHandler); } @Bean - public RouterFunction graphQLRouterFunction(GraphQLHttpHandler handler, GraphQLSource graphQLSource, - GraphQLProperties properties, ResourceLoader resourceLoader) { + public RouterFunction graphQlRouterFunction(GraphQlHttpHandler handler, GraphQlSource graphQlSource, + GraphQlProperties properties, ResourceLoader resourceLoader) { String path = properties.getPath(); Resource resource = resourceLoader.getResource("classpath:graphiql/index.html"); @@ -97,7 +97,7 @@ public class WebMvcGraphQLAutoConfiguration { if (properties.getSchema().getPrinter().isEnabled()) { SchemaPrinter schemaPrinter = new SchemaPrinter(); builder = builder.GET(path + properties.getSchema().getPrinter().getPath(), - req -> ServerResponse.ok().contentType(MediaType.TEXT_PLAIN).body(schemaPrinter.print(graphQLSource.schema()))); + req -> ServerResponse.ok().contentType(MediaType.TEXT_PLAIN).body(schemaPrinter.print(graphQlSource.schema()))); } return builder.build(); } @@ -109,20 +109,20 @@ public class WebMvcGraphQLAutoConfiguration { @Bean @ConditionalOnMissingBean - public GraphQLWebSocketHandler graphQLWebSocketHandler( - WebGraphQLHandler webGraphQLHandler, GraphQLProperties properties, HttpMessageConverters converters) { + public GraphQlWebSocketHandler graphQlWebSocketHandler( + WebGraphQlHandler webGraphQlHandler, GraphQlProperties properties, HttpMessageConverters converters) { HttpMessageConverter converter = converters.getConverters().stream() .filter(candidate -> candidate.canRead(Map.class, MediaType.APPLICATION_JSON)) .findFirst() .orElseThrow(() -> new IllegalStateException("No JSON converter")); - return new GraphQLWebSocketHandler( - webGraphQLHandler, converter, properties.getWebsocket().getConnectionInitTimeout()); + return new GraphQlWebSocketHandler( + webGraphQlHandler, converter, properties.getWebsocket().getConnectionInitTimeout()); } @Bean - public HandlerMapping graphQLWebSocketMapping(GraphQLWebSocketHandler handler, GraphQLProperties properties) { + public HandlerMapping graphQlWebSocketMapping(GraphQlWebSocketHandler handler, GraphQlProperties properties) { String path = properties.getWebsocket().getPath(); if (logger.isInfoEnabled()) { logger.info("GraphQL endpoint WebSocket " + path); diff --git a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/DefaultGraphQLTagsProvider.java b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/DefaultGraphQlTagsProvider.java similarity index 75% rename from graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/DefaultGraphQLTagsProvider.java rename to graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/DefaultGraphQlTagsProvider.java index 8ad8282a..c47c4b8c 100644 --- a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/DefaultGraphQLTagsProvider.java +++ b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/DefaultGraphQlTagsProvider.java @@ -26,19 +26,19 @@ import graphql.schema.DataFetcher; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.Tags; -public class DefaultGraphQLTagsProvider implements GraphQLTagsProvider { +public class DefaultGraphQlTagsProvider implements GraphQlTagsProvider { - private final List contributors; + private final List contributors; - public DefaultGraphQLTagsProvider(List contributors) { + public DefaultGraphQlTagsProvider(List contributors) { this.contributors = contributors; } @Override public Iterable getExecutionTags(InstrumentationExecutionParameters parameters, ExecutionResult result, Throwable exception) { - Tags tags = Tags.of(GraphQLTags.executionOutcome(result, exception)); - for (GraphQLTagsContributor contributor : this.contributors) { + Tags tags = Tags.of(GraphQlTags.executionOutcome(result, exception)); + for (GraphQlTagsContributor contributor : this.contributors) { tags = tags.and(contributor.getExecutionTags(parameters, result, exception)); } return tags; @@ -46,8 +46,8 @@ public class DefaultGraphQLTagsProvider implements GraphQLTagsProvider { @Override public Iterable getErrorTags(InstrumentationExecutionParameters parameters, GraphQLError error) { - Tags tags = Tags.of(GraphQLTags.errorType(error), GraphQLTags.errorPath(error)); - for (GraphQLTagsContributor contributor : this.contributors) { + Tags tags = Tags.of(GraphQlTags.errorType(error), GraphQlTags.errorPath(error)); + for (GraphQlTagsContributor contributor : this.contributors) { tags = tags.and(contributor.getErrorTags(parameters, error)); } return tags; @@ -55,8 +55,8 @@ public class DefaultGraphQLTagsProvider implements GraphQLTagsProvider { @Override public Iterable getDataFetchingTags(DataFetcher dataFetcher, InstrumentationFieldFetchParameters parameters, Throwable exception) { - Tags tags = Tags.of(GraphQLTags.dataFetchingOutcome(exception), GraphQLTags.dataFetchingPath(parameters)); - for (GraphQLTagsContributor contributor : this.contributors) { + Tags tags = Tags.of(GraphQlTags.dataFetchingOutcome(exception), GraphQlTags.dataFetchingPath(parameters)); + for (GraphQlTagsContributor contributor : this.contributors) { tags = tags.and(contributor.getDataFetchingTags(dataFetcher, parameters, exception)); } return tags; diff --git a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLMetricsAutoConfiguration.java b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlMetricsAutoConfiguration.java similarity index 79% rename from graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLMetricsAutoConfiguration.java rename to graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlMetricsAutoConfiguration.java index 2d5a91fd..9e843d1c 100644 --- a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLMetricsAutoConfiguration.java +++ b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlMetricsAutoConfiguration.java @@ -40,18 +40,18 @@ import org.springframework.context.annotation.Configuration; @AutoConfigureAfter({MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class, SimpleMetricsExportAutoConfiguration.class}) @ConditionalOnBean(MeterRegistry.class) -@EnableConfigurationProperties(GraphQLMetricsProperties.class) -public class GraphQLMetricsAutoConfiguration { +@EnableConfigurationProperties(GraphQlMetricsProperties.class) +public class GraphQlMetricsAutoConfiguration { @Bean - @ConditionalOnMissingBean(GraphQLTagsProvider.class) - public DefaultGraphQLTagsProvider graphQLTagsProvider(ObjectProvider contributors) { - return new DefaultGraphQLTagsProvider(contributors.orderedStream().collect(Collectors.toList())); + @ConditionalOnMissingBean(GraphQlTagsProvider.class) + public DefaultGraphQlTagsProvider graphQlTagsProvider(ObjectProvider contributors) { + return new DefaultGraphQlTagsProvider(contributors.orderedStream().collect(Collectors.toList())); } @Bean - public GraphQLMetricsInstrumentation graphQLMetricsInstrumentation(MeterRegistry meterRegistry, - GraphQLTagsProvider tagsProvider, GraphQLMetricsProperties properties) { - return new GraphQLMetricsInstrumentation(meterRegistry, tagsProvider, properties.getAutotime()); + public GraphQlMetricsInstrumentation graphQlMetricsInstrumentation(MeterRegistry meterRegistry, + GraphQlTagsProvider tagsProvider, GraphQlMetricsProperties properties) { + return new GraphQlMetricsInstrumentation(meterRegistry, tagsProvider, properties.getAutotime()); } } diff --git a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLMetricsInstrumentation.java b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlMetricsInstrumentation.java similarity index 95% rename from graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLMetricsInstrumentation.java rename to graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlMetricsInstrumentation.java index 87079185..c7660c6f 100644 --- a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLMetricsInstrumentation.java +++ b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlMetricsInstrumentation.java @@ -32,15 +32,15 @@ import io.micrometer.core.instrument.Timer; import org.springframework.boot.actuate.metrics.AutoTimer; -public class GraphQLMetricsInstrumentation extends SimpleInstrumentation { +public class GraphQlMetricsInstrumentation extends SimpleInstrumentation { private final MeterRegistry registry; - private final GraphQLTagsProvider tagsProvider; + private final GraphQlTagsProvider tagsProvider; private final AutoTimer autoTimer; - public GraphQLMetricsInstrumentation(MeterRegistry registry, GraphQLTagsProvider tagsProvider, AutoTimer autoTimer) { + public GraphQlMetricsInstrumentation(MeterRegistry registry, GraphQlTagsProvider tagsProvider, AutoTimer autoTimer) { this.registry = registry; this.tagsProvider = tagsProvider; this.autoTimer = autoTimer; diff --git a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLMetricsProperties.java b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlMetricsProperties.java similarity index 97% rename from graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLMetricsProperties.java rename to graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlMetricsProperties.java index 207d5402..27f0974d 100644 --- a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLMetricsProperties.java +++ b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlMetricsProperties.java @@ -24,7 +24,7 @@ import org.springframework.boot.context.properties.NestedConfigurationProperty; * This class could be merged with {@link org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties} */ @ConfigurationProperties("management.metrics.graphql") -public class GraphQLMetricsProperties { +public class GraphQlMetricsProperties { /** * Auto-timed queries settings. diff --git a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLTags.java b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlTags.java similarity index 98% rename from graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLTags.java rename to graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlTags.java index 8e916b66..c88007fe 100644 --- a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLTags.java +++ b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlTags.java @@ -32,7 +32,7 @@ import io.micrometer.core.instrument.Tag; * * @author Brian Clozel */ -public final class GraphQLTags { +public final class GraphQlTags { private static final Tag OUTCOME_SUCCESS = Tag.of("outcome", "SUCCESS"); diff --git a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLTagsContributor.java b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlTagsContributor.java similarity index 96% rename from graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLTagsContributor.java rename to graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlTagsContributor.java index 8da71ed9..6cf29d2b 100644 --- a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLTagsContributor.java +++ b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlTagsContributor.java @@ -23,7 +23,7 @@ import graphql.execution.instrumentation.parameters.InstrumentationFieldFetchPar import graphql.schema.DataFetcher; import io.micrometer.core.instrument.Tag; -public interface GraphQLTagsContributor { +public interface GraphQlTagsContributor { Iterable getExecutionTags(InstrumentationExecutionParameters parameters, ExecutionResult result, Throwable exception); diff --git a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLTagsProvider.java b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlTagsProvider.java similarity index 97% rename from graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLTagsProvider.java rename to graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlTagsProvider.java index 79e30d6c..01ca371f 100644 --- a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQLTagsProvider.java +++ b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/actuate/metrics/GraphQlTagsProvider.java @@ -23,7 +23,7 @@ import graphql.execution.instrumentation.parameters.InstrumentationFieldFetchPar import graphql.schema.DataFetcher; import io.micrometer.core.instrument.Tag; -public interface GraphQLTagsProvider { +public interface GraphQlTagsProvider { Iterable getExecutionTags(InstrumentationExecutionParameters parameters, ExecutionResult result, Throwable exception); diff --git a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/package-info.java b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/package-info.java index 495b8015..0a71cc38 100644 --- a/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/package-info.java +++ b/graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/package-info.java @@ -1,7 +1,7 @@ /** * Auto-configuration classes to configure - * {@link org.springframework.graphql.execution.GraphQLSource}, - * {@link org.springframework.graphql.GraphQLService}, and HTTP and WebSocket + * {@link org.springframework.graphql.execution.GraphQlSource}, + * {@link org.springframework.graphql.GraphQlService}, and HTTP and WebSocket * endpoints. */ @NonNullApi diff --git a/graphql-spring-boot-starter/src/main/resources/META-INF/spring.factories b/graphql-spring-boot-starter/src/main/resources/META-INF/spring.factories index 26047ae3..c2134a89 100644 --- a/graphql-spring-boot-starter/src/main/resources/META-INF/spring.factories +++ b/graphql-spring-boot-starter/src/main/resources/META-INF/spring.factories @@ -1,6 +1,6 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.springframework.graphql.boot.actuate.metrics.GraphQLMetricsAutoConfiguration,\ -org.springframework.graphql.boot.GraphQLAutoConfiguration,\ -org.springframework.graphql.boot.GraphQLServiceAutoConfiguration,\ -org.springframework.graphql.boot.WebFluxGraphQLAutoConfiguration,\ -org.springframework.graphql.boot.WebMvcGraphQLAutoConfiguration +org.springframework.graphql.boot.actuate.metrics.GraphQlMetricsAutoConfiguration,\ +org.springframework.graphql.boot.GraphQlAutoConfiguration,\ +org.springframework.graphql.boot.GraphQlServiceAutoConfiguration,\ +org.springframework.graphql.boot.WebFluxGraphQlAutoConfiguration,\ +org.springframework.graphql.boot.WebMvcGraphQlAutoConfiguration diff --git a/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/GraphQLAutoConfigurationTests.java b/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/GraphQlAutoConfigurationTests.java similarity index 74% rename from graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/GraphQLAutoConfigurationTests.java rename to graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/GraphQlAutoConfigurationTests.java index e90fe7d7..4f2087e4 100644 --- a/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/GraphQLAutoConfigurationTests.java +++ b/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/GraphQlAutoConfigurationTests.java @@ -23,17 +23,17 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource; -import org.springframework.graphql.execution.GraphQLSource; +import org.springframework.graphql.execution.GraphQlSource; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link GraphQLAutoConfiguration} + * Tests for {@link GraphQlAutoConfiguration} */ -class GraphQLAutoConfigurationTests { +class GraphQlAutoConfigurationTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(GraphQLAutoConfiguration.class)); + .withConfiguration(AutoConfigurations.of(GraphQlAutoConfiguration.class)); @Test @@ -48,26 +48,26 @@ class GraphQLAutoConfigurationTests { void shouldCreateBuilderWithSdl() { contextRunner .withPropertyValues("spring.graphql.schema.location:classpath:books/schema.graphqls") - .run((context) -> assertThat(context).hasSingleBean(GraphQLSource.class)); + .run((context) -> assertThat(context).hasSingleBean(GraphQlSource.class)); } @Test void shouldUseProgrammaticallyDefinedBuilder() { contextRunner .withPropertyValues("spring.graphql.schema.location:classpath:books/schema.graphqls") - .withUserConfiguration(CustomGraphQLBuilderConfiguration.class) + .withUserConfiguration(CustomGraphQlBuilderConfiguration.class) .run((context) -> { - assertThat(context).hasBean("customGraphQLSourceBuilder"); - assertThat(context).hasSingleBean(GraphQLSource.Builder.class); + assertThat(context).hasBean("customGraphQlSourceBuilder"); + assertThat(context).hasSingleBean(GraphQlSource.Builder.class); }); } @Configuration - static class CustomGraphQLBuilderConfiguration { + static class CustomGraphQlBuilderConfiguration { @Bean - public GraphQLSource.Builder customGraphQLSourceBuilder() { - return GraphQLSource.builder().schemaResource(new ClassPathResource("books/schema.graphqls")); + public GraphQlSource.Builder customGraphQlSourceBuilder() { + return GraphQlSource.builder().schemaResource(new ClassPathResource("books/schema.graphqls")); } } diff --git a/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/GraphQLDataFetchers.java b/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/GraphQlDataFetchers.java similarity index 96% rename from graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/GraphQLDataFetchers.java rename to graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/GraphQlDataFetchers.java index 9adf6447..69db2da3 100644 --- a/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/GraphQLDataFetchers.java +++ b/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/GraphQlDataFetchers.java @@ -6,7 +6,7 @@ import java.util.List; import graphql.schema.DataFetcher; import reactor.core.publisher.Flux; -public class GraphQLDataFetchers { +public class GraphQlDataFetchers { private static List books = Arrays.asList( new Book("book-1", "GraphQL for beginners", 100, "John GraphQL"), diff --git a/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/WebFluxApplicationContextTests.java b/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/WebFluxApplicationContextTests.java index b10d99ab..4109b4b4 100644 --- a/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/WebFluxApplicationContextTests.java +++ b/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/WebFluxApplicationContextTests.java @@ -42,8 +42,8 @@ class WebFluxApplicationContextTests { private static final AutoConfigurations AUTO_CONFIGURATIONS = AutoConfigurations.of( HttpHandlerAutoConfiguration.class, WebFluxAutoConfiguration.class, CodecsAutoConfiguration.class, JacksonAutoConfiguration.class, - GraphQLAutoConfiguration.class, GraphQLServiceAutoConfiguration.class, - WebFluxGraphQLAutoConfiguration.class); + GraphQlAutoConfiguration.class, GraphQlServiceAutoConfiguration.class, + WebFluxGraphQlAutoConfiguration.class); private static final String BASE_URL = "https://spring.example.org/graphql"; @@ -141,7 +141,7 @@ class WebFluxApplicationContextTests { public RuntimeWiringCustomizer bookDataFetcher() { return (runtimeWiring) -> runtimeWiring.type(newTypeWiring("Query") - .dataFetcher("bookById", GraphQLDataFetchers.getBookByIdDataFetcher())); + .dataFetcher("bookById", GraphQlDataFetchers.getBookByIdDataFetcher())); } } diff --git a/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/WebMvcApplicationContextTests.java b/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/WebMvcApplicationContextTests.java index beab8dc6..f772ccfb 100644 --- a/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/WebMvcApplicationContextTests.java +++ b/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/WebMvcApplicationContextTests.java @@ -33,7 +33,6 @@ import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import static graphql.schema.idl.TypeRuntimeWiring.newTypeWiring; @@ -50,11 +49,11 @@ class WebMvcApplicationContextTests { public static final AutoConfigurations AUTO_CONFIGURATIONS = AutoConfigurations.of( DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, JacksonAutoConfiguration.class, - GraphQLAutoConfiguration.class, GraphQLServiceAutoConfiguration.class, - WebMvcGraphQLAutoConfiguration.class); + GraphQlAutoConfiguration.class, GraphQlServiceAutoConfiguration.class, + WebMvcGraphQlAutoConfiguration.class); @Test - void endpointHandlesGraphQLQuery() { + void endpointHandlesGraphQlQuery() { testWith(mockMvc -> { String query = "{" + " bookById(id: \\\"book-1\\\"){ " + @@ -139,7 +138,7 @@ class WebMvcApplicationContextTests { @Bean public RuntimeWiringCustomizer bookDataFetcher() { return (builder) -> builder.type(newTypeWiring("Query") - .dataFetcher("bookById", GraphQLDataFetchers.getBookByIdDataFetcher())); + .dataFetcher("bookById", GraphQlDataFetchers.getBookByIdDataFetcher())); } } diff --git a/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/actuate/metrics/GraphQLTagsTests.java b/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/actuate/metrics/GraphQlTagsTests.java similarity index 83% rename from graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/actuate/metrics/GraphQLTagsTests.java rename to graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/actuate/metrics/GraphQlTagsTests.java index 29823bef..39f034f6 100644 --- a/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/actuate/metrics/GraphQLTagsTests.java +++ b/graphql-spring-boot-starter/src/test/java/org/springframework/graphql/boot/actuate/metrics/GraphQlTagsTests.java @@ -30,21 +30,21 @@ import org.springframework.graphql.test.tester.TestExecutionResult; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link GraphQLTags} + * Tests for {@link GraphQlTags} * * @author Brian Clozel */ -class GraphQLTagsTests { +class GraphQlTagsTests { @Test void executionOutcomeShouldSucceed() { - Tag outcomeTag = GraphQLTags.executionOutcome(new TestExecutionResult(), null); + Tag outcomeTag = GraphQlTags.executionOutcome(new TestExecutionResult(), null); assertThat(outcomeTag.getValue()).isEqualTo("SUCCESS"); } @Test void executionOutcomeShouldErrorWhenExceptionThrown() { - Tag outcomeTag = GraphQLTags.executionOutcome(new TestExecutionResult(), new IllegalArgumentException("test error")); + Tag outcomeTag = GraphQlTags.executionOutcome(new TestExecutionResult(), new IllegalArgumentException("test error")); assertThat(outcomeTag.getValue()).isEqualTo("ERROR"); } @@ -52,40 +52,40 @@ class GraphQLTagsTests { void executionOutcomeShouldErrorWhenResponseErrors() { ExecutionResultImpl.Builder builder = new ExecutionResultImpl.Builder(); builder.addError(GraphqlErrorBuilder.newError().message("Invalid query").build()); - Tag outcomeTag = GraphQLTags.executionOutcome(builder.build(), null); + Tag outcomeTag = GraphQlTags.executionOutcome(builder.build(), null); assertThat(outcomeTag.getValue()).isEqualTo("ERROR"); } @Test void errorTypeShouldBeDefinedIfPresent() { GraphQLError error = GraphqlErrorBuilder.newError().errorType(ErrorType.DataFetchingException).message("test error").build(); - Tag errorTypeTag = GraphQLTags.errorType(error); + Tag errorTypeTag = GraphQlTags.errorType(error); assertThat(errorTypeTag.getValue()).isEqualTo("DataFetchingException"); } @Test void errorPathShouldUseJsonPathFormat() { GraphQLError error = GraphqlErrorBuilder.newError().path(Arrays.asList("project", "name")).message("test error").build(); - Tag errorPathTag = GraphQLTags.errorPath(error); + Tag errorPathTag = GraphQlTags.errorPath(error); assertThat(errorPathTag.getValue()).isEqualTo("$.project.name"); } @Test void errorPathShouldUseJsonPathFormatForIndices() { GraphQLError error = GraphqlErrorBuilder.newError().path(Arrays.asList("issues", "42", "title")).message("test error").build(); - Tag errorPathTag = GraphQLTags.errorPath(error); + Tag errorPathTag = GraphQlTags.errorPath(error); assertThat(errorPathTag.getValue()).isEqualTo("$.issues[*].title"); } @Test void dataFetchingOutcomeShouldBeSuccessfulIfNoException() { - Tag fetchingOutcomeTag = GraphQLTags.dataFetchingOutcome(null); + Tag fetchingOutcomeTag = GraphQlTags.dataFetchingOutcome(null); assertThat(fetchingOutcomeTag.getValue()).isEqualTo("SUCCESS"); } @Test void dataFetchingOutcomeShouldBeErrorIfException() { - Tag fetchingOutcomeTag = GraphQLTags.dataFetchingOutcome(new IllegalStateException("error state")); + Tag fetchingOutcomeTag = GraphQlTags.dataFetchingOutcome(new IllegalStateException("error state")); assertThat(fetchingOutcomeTag.getValue()).isEqualTo("ERROR"); } diff --git a/samples/webflux-websocket/src/test/java/io/spring/sample/graphql/QueryTests.java b/samples/webflux-websocket/src/test/java/io/spring/sample/graphql/QueryTests.java index 8ad291b3..f6141713 100644 --- a/samples/webflux-websocket/src/test/java/io/spring/sample/graphql/QueryTests.java +++ b/samples/webflux-websocket/src/test/java/io/spring/sample/graphql/QueryTests.java @@ -21,8 +21,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.graphql.web.WebGraphQLHandler; -import org.springframework.graphql.test.tester.GraphQLTester; +import org.springframework.graphql.web.WebGraphQlHandler; +import org.springframework.graphql.test.tester.GraphQlTester; /** * GraphQL query tests directly via {@link GraphQL}. @@ -30,19 +30,19 @@ import org.springframework.graphql.test.tester.GraphQLTester; @SpringBootTest public class QueryTests { - private GraphQLTester graphQLTester; + private GraphQlTester graphQlTester; @BeforeEach - public void setUp(@Autowired WebGraphQLHandler handler) { - this.graphQLTester = GraphQLTester.create(webInput -> + public void setUp(@Autowired WebGraphQlHandler handler) { + this.graphQlTester = GraphQlTester.create(webInput -> handler.handle(webInput).contextWrite(context -> context.put("name", "James"))); } @Test void greetingMono() { - this.graphQLTester.query("{greetingMono}") + this.graphQlTester.query("{greetingMono}") .execute() .path("greetingMono") .entity(String.class) @@ -51,7 +51,7 @@ public class QueryTests { @Test void greetingsFlux() { - this.graphQLTester.query("{greetingsFlux}") + this.graphQlTester.query("{greetingsFlux}") .execute() .path("greetingsFlux") .entityList(String.class) diff --git a/samples/webflux-websocket/src/test/java/io/spring/sample/graphql/SubscriptionTests.java b/samples/webflux-websocket/src/test/java/io/spring/sample/graphql/SubscriptionTests.java index 9bd8505a..633d114b 100644 --- a/samples/webflux-websocket/src/test/java/io/spring/sample/graphql/SubscriptionTests.java +++ b/samples/webflux-websocket/src/test/java/io/spring/sample/graphql/SubscriptionTests.java @@ -23,8 +23,8 @@ import reactor.test.StepVerifier; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.graphql.web.WebGraphQLHandler; -import org.springframework.graphql.test.tester.GraphQLTester; +import org.springframework.graphql.web.WebGraphQlHandler; +import org.springframework.graphql.test.tester.GraphQlTester; /** * GraphQL subscription tests directly via {@link GraphQL}. @@ -32,12 +32,12 @@ import org.springframework.graphql.test.tester.GraphQLTester; @SpringBootTest public class SubscriptionTests { - private GraphQLTester graphQLTester; + private GraphQlTester graphQlTester; @BeforeEach - public void setUp(@Autowired WebGraphQLHandler handler) { - this.graphQLTester = GraphQLTester.create(webInput -> + public void setUp(@Autowired WebGraphQlHandler handler) { + this.graphQlTester = GraphQlTester.create(webInput -> handler.handle(webInput).contextWrite(context -> context.put("name", "James"))); } @@ -46,7 +46,7 @@ public class SubscriptionTests { void subscriptionWithEntityPath() { String query = "subscription { greetings }"; - Flux result = this.graphQLTester.query(query) + Flux result = this.graphQlTester.query(query) .executeSubscription() .toFlux("greetings", String.class); @@ -63,7 +63,7 @@ public class SubscriptionTests { void subscriptionWithResponseSpec() { String query = "subscription { greetings }"; - Flux result = this.graphQLTester.query(query) + Flux result = this.graphQlTester.query(query) .executeSubscription() .toFlux(); diff --git a/samples/webmvc-http/src/test/java/io/spring/sample/graphql/project/MockMvcGraphQLTests.java b/samples/webmvc-http/src/test/java/io/spring/sample/graphql/project/MockMvcGraphQlTests.java similarity index 89% rename from samples/webmvc-http/src/test/java/io/spring/sample/graphql/project/MockMvcGraphQLTests.java rename to samples/webmvc-http/src/test/java/io/spring/sample/graphql/project/MockMvcGraphQlTests.java index 3bd54a22..8893d6a4 100644 --- a/samples/webmvc-http/src/test/java/io/spring/sample/graphql/project/MockMvcGraphQLTests.java +++ b/samples/webmvc-http/src/test/java/io/spring/sample/graphql/project/MockMvcGraphQlTests.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.graphql.test.tester.GraphQLTester; +import org.springframework.graphql.test.tester.GraphQlTester; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.client.MockMvcWebTestClient; @@ -33,15 +33,15 @@ import static org.assertj.core.api.Assertions.assertThat; */ @SpringBootTest @AutoConfigureMockMvc -public class MockMvcGraphQLTests { +public class MockMvcGraphQlTests { - private GraphQLTester graphQLTester; + private GraphQlTester graphQlTester; @BeforeEach public void setUp(@Autowired MockMvc mockMvc) { WebTestClient client = MockMvcWebTestClient.bindTo(mockMvc).baseUrl("/graphql").build(); - this.graphQLTester = GraphQLTester.create(client); + this.graphQlTester = GraphQlTester.create(client); } @@ -55,7 +55,7 @@ public class MockMvcGraphQLTests { " }" + "}"; - this.graphQLTester.query(query) + this.graphQlTester.query(query) .execute() .path("project.releases[*].version") .entityList(String.class) @@ -71,7 +71,7 @@ public class MockMvcGraphQLTests { " }" + "}"; - this.graphQLTester.query(query) + this.graphQlTester.query(query) .execute() .path("project") .matchesJson("{\"repositoryUrl\":\"http://github.com/spring-projects/spring-framework\"}"); @@ -87,7 +87,7 @@ public class MockMvcGraphQLTests { " }" + "}"; - this.graphQLTester.query(query) + this.graphQlTester.query(query) .execute() .path("project") .entity(Project.class) diff --git a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/DefaultGraphQLTester.java b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/DefaultGraphQlTester.java similarity index 95% rename from spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/DefaultGraphQLTester.java rename to spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/DefaultGraphQlTester.java index 31ff4d8c..49cdf37e 100644 --- a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/DefaultGraphQLTester.java +++ b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/DefaultGraphQlTester.java @@ -43,7 +43,7 @@ import reactor.core.publisher.Flux; import org.springframework.core.ParameterizedTypeReference; import org.springframework.graphql.RequestInput; -import org.springframework.graphql.web.WebGraphQLHandler; +import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.web.WebInput; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -60,14 +60,14 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; /** - * Default implementation of {@link GraphQLTester}. + * Default implementation of {@link GraphQlTester}. */ -class DefaultGraphQLTester implements GraphQLTester { +class DefaultGraphQlTester implements GraphQlTester { private static final boolean jackson2Present; static { - ClassLoader classLoader = DefaultGraphQLTester.class.getClassLoader(); + ClassLoader classLoader = DefaultGraphQlTester.class.getClassLoader(); jackson2Present = ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", classLoader) && ClassUtils.isPresent("com.fasterxml.jackson.core.JsonGenerator", classLoader); } @@ -78,12 +78,12 @@ class DefaultGraphQLTester implements GraphQLTester { private final Configuration jsonPathConfig; - DefaultGraphQLTester(WebTestClient client) { + DefaultGraphQlTester(WebTestClient client) { this.jsonPathConfig = initJsonPathConfig(); this.requestStrategy = new WebTestClientRequestStrategy(client, this.jsonPathConfig); } - DefaultGraphQLTester(WebGraphQLHandler handler) { + DefaultGraphQlTester(WebGraphQlHandler handler) { this.jsonPathConfig = initJsonPathConfig(); this.requestStrategy = new DirectRequestStrategy(handler, this.jsonPathConfig); } @@ -107,12 +107,12 @@ class DefaultGraphQLTester implements GraphQLTester { /** * Perform a request with the given {@link RequestInput} container. */ - GraphQLTester.ResponseSpec execute(RequestInput input); + GraphQlTester.ResponseSpec execute(RequestInput input); /** * Perform a subscription with the given {@link RequestInput} container. */ - GraphQLTester.SubscriptionSpec executeSubscription(RequestInput input); + GraphQlTester.SubscriptionSpec executeSubscription(RequestInput input); } @@ -182,12 +182,12 @@ class DefaultGraphQLTester implements GraphQLTester { private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(5); - private final WebGraphQLHandler graphQLHandler; + private final WebGraphQlHandler graphQlHandler; private final Configuration jsonPathConfig; - public DirectRequestStrategy(WebGraphQLHandler handler, Configuration jsonPathConfig) { - this.graphQLHandler = handler; + public DirectRequestStrategy(WebGraphQlHandler handler, Configuration jsonPathConfig) { + this.graphQlHandler = handler; this.jsonPathConfig = jsonPathConfig; } @@ -213,7 +213,7 @@ class DefaultGraphQLTester implements GraphQLTester { private ExecutionResult executeInternal(RequestInput input) { WebInput webInput = new WebInput(DEFAULT_URL, DEFAULT_HEADERS, input.toMap(), null); - ExecutionResult result = this.graphQLHandler.handle(webInput).block(DEFAULT_TIMEOUT); + ExecutionResult result = this.graphQlHandler.handle(webInput).block(DEFAULT_TIMEOUT); Assert.notNull(result, "Expected ExecutionResult"); return result; } @@ -269,20 +269,20 @@ class DefaultGraphQLTester implements GraphQLTester { @Override public ResponseSpec execute() { RequestInput input = new RequestInput(this.query, this.operationName, this.variables); - return DefaultGraphQLTester.this.requestStrategy.execute(input); + return DefaultGraphQlTester.this.requestStrategy.execute(input); } @Override public void executeAndVerify() { RequestInput input = new RequestInput(this.query, this.operationName, this.variables); - ResponseSpec spec = DefaultGraphQLTester.this.requestStrategy.execute(input); + ResponseSpec spec = DefaultGraphQlTester.this.requestStrategy.execute(input); spec.path("$.errors").valueIsEmpty(); } @Override public SubscriptionSpec executeSubscription() { RequestInput input = new RequestInput(this.query, this.operationName, this.variables); - return DefaultGraphQLTester.this.requestStrategy.executeSubscription(input); + return DefaultGraphQlTester.this.requestStrategy.executeSubscription(input); } } @@ -291,11 +291,11 @@ class DefaultGraphQLTester implements GraphQLTester { private static final Predicate MATCH_ALL_PREDICATE = error -> true; - private final List errors; + private final List errors; private final Consumer assertDecorator; - ErrorsContainer(List errors, Consumer assertDecorator) { + ErrorsContainer(List errors, Consumer assertDecorator) { Assert.notNull(errors, "`errors` is required"); Assert.notNull(assertDecorator, "`assertDecorator` is required"); this.errors = errors; @@ -317,7 +317,7 @@ class DefaultGraphQLTester implements GraphQLTester { public void verifyErrors() { - List unexpected = + List unexpected = this.errors.stream().filter(error -> !error.isExpected()).collect(Collectors.toList()); this.assertDecorator.accept(() -> AssertionErrors.assertTrue( @@ -346,10 +346,10 @@ class DefaultGraphQLTester implements GraphQLTester { this.jsonContent = this.documentContext.jsonString(); } - private static List readErrors(DocumentContext documentContext) { + private static List readErrors(DocumentContext documentContext) { Assert.notNull(documentContext, "DocumentContext is required"); try { - return documentContext.read(ERRORS_PATH, new TypeRef>() {}); + return documentContext.read(ERRORS_PATH, new TypeRef>() {}); } catch (PathNotFoundException ex) { return Collections.emptyList(); diff --git a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/GraphQLTester.java b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/GraphQlTester.java similarity index 93% rename from spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/GraphQLTester.java rename to spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/GraphQlTester.java index dbdf78ce..e8abd8fc 100644 --- a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/GraphQLTester.java +++ b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/GraphQlTester.java @@ -24,14 +24,14 @@ import graphql.GraphQLError; import reactor.core.publisher.Flux; import org.springframework.core.ParameterizedTypeReference; -import org.springframework.graphql.web.WebGraphQLHandler; +import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.lang.Nullable; import org.springframework.test.web.reactive.server.WebTestClient; /** * Main entry point for testing GraphQL with requests performed either as an * HTTP client via {@link WebTestClient} or directly via a - * {@link WebGraphQLHandler}. + * {@link WebGraphQlHandler}. * * *

GraphQL requests to Spring MVC without an HTTP server: @@ -40,12 +40,12 @@ import org.springframework.test.web.reactive.server.WebTestClient; * @AutoConfigureMockMvc * public class MyTests { * - * private GraphQLTester graphQLTester; + * private GraphQlTester graphQlTester; * * @BeforeEach * public void setUp(@Autowired MockMvc mockMvc) { * WebTestClient client = MockMvcWebTestClient.bindTo(mockMvc).baseUrl("/graphql").build(); - * this.graphQLTester = GraphQLTester.create(client); + * this.graphQlTester = GraphQlTester.create(client); * } * * @@ -55,11 +55,11 @@ import org.springframework.test.web.reactive.server.WebTestClient; * @AutoConfigureWebTestClient * public class MyTests { * - * private GraphQLTester graphQLTester; + * private GraphQlTester graphQlTester; * * @BeforeEach * public void setUp(@Autowired WebTestClient client) { - * this.graphQLTester = GraphQLTester.create(client); + * this.graphQlTester = GraphQlTester.create(client); * } * * @@ -68,28 +68,28 @@ import org.springframework.test.web.reactive.server.WebTestClient; * @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) * public class MyTests { * - * private GraphQLTester graphQLTester; + * private GraphQlTester graphQlTester; * * @BeforeEach * public void setUp(@Autowired WebTestClient client) { - * this.graphQLTester = GraphQLTester.create(client); + * this.graphQlTester = GraphQlTester.create(client); * } * * - *

GraphQL requests to any {@link WebGraphQLHandler}: + *

GraphQL requests to any {@link WebGraphQlHandler}: *

  * @SpringBootTest
  * public class MyTests {
  *
- *  private GraphQLTester graphQLTester;
+ *  private GraphQlTester graphQlTester;
  *
  *  @BeforeEach
  *  public void setUp(@Autowired WebGraphQLHandler handler) {
- *      this.graphQLTester = GraphQLTester.create(handler);
+ *      this.graphQlTester = GraphQlTester.create(handler);
  *  }
  * 
*/ -public interface GraphQLTester { +public interface GraphQlTester { /** * Prepare to perform a GraphQL request with the given operation which may @@ -102,25 +102,25 @@ public interface GraphQLTester { /** - * Create a {@code GraphQLTester} that performs GraphQL requests as an HTTP + * Create a {@code GraphQlTester} that performs GraphQL requests as an HTTP * client through the given {@link WebTestClient}. Depending on how the * {@code WebTestClient} is set up, tests may be with or without a server. * See setup examples in class-level Javadoc. * @param client the web client to perform requests with - * @return the created {@code GraphQLTester} instance + * @return the created {@code GraphQlTester} instance */ - static GraphQLTester create(WebTestClient client) { - return new DefaultGraphQLTester(client); + static GraphQlTester create(WebTestClient client) { + return new DefaultGraphQlTester(client); } /** - * Create a {@code GraphQLTester} that performs GraphQL requests through - * the given {@link WebGraphQLHandler}. + * Create a {@code GraphQlTester} that performs GraphQL requests through + * the given {@link WebGraphQlHandler}. * @param handler the handler to execute requests with - * @return the created {@code GraphQLTester} instance + * @return the created {@code GraphQlTester} instance */ - static GraphQLTester create(WebGraphQLHandler handler) { - return new DefaultGraphQLTester(handler); + static GraphQlTester create(WebGraphQlHandler handler) { + return new DefaultGraphQlTester(handler); } diff --git a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestExecutionResult.java b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestExecutionResult.java index c5347a07..7a6572fc 100644 --- a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestExecutionResult.java +++ b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestExecutionResult.java @@ -47,7 +47,7 @@ public class TestExecutionResult implements ExecutionResult { return (T) this.data; } - public void setErrors(List errors) { + public void setErrors(List errors) { this.errors = new ArrayList<>(errors); } diff --git a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestGraphQLError.java b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestGraphQlError.java similarity index 98% rename from spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestGraphQLError.java rename to spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestGraphQlError.java index 02ef5d4a..9afb0e91 100644 --- a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestGraphQLError.java +++ b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestGraphQlError.java @@ -29,7 +29,7 @@ import graphql.language.SourceLocation; /** * {@link GraphQLError} with setters to use for deserialization. */ -class TestGraphQLError implements GraphQLError { +class TestGraphQlError implements GraphQLError { private String message; diff --git a/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/GraphQLTesterTests.java b/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/GraphQlTesterTests.java similarity index 84% rename from spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/GraphQLTesterTests.java rename to spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/GraphQlTesterTests.java index 41358bed..94bfb660 100644 --- a/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/GraphQLTesterTests.java +++ b/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/GraphQlTesterTests.java @@ -40,7 +40,7 @@ import org.mockito.ArgumentCaptor; import reactor.core.publisher.Mono; import org.springframework.core.ParameterizedTypeReference; -import org.springframework.graphql.web.WebGraphQLHandler; +import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.web.WebInput; import org.springframework.graphql.web.WebOutput; import org.springframework.http.HttpHeaders; @@ -55,34 +55,34 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** - * Tests for {@link GraphQLTester} parameterized to: + * Tests for {@link GraphQlTester} parameterized to: *
    *
  • Connect to {@link MockWebServer} and return a preset HTTP response. - *
  • Use mock {@link WebGraphQLHandler} to return a preset {@link ExecutionResult}. + *
  • Use mock {@link WebGraphQlHandler} to return a preset {@link ExecutionResult}. *
* *

There is no actual handling via {@link graphql.GraphQL} in either scenario. - * The main focus is to verify {@link GraphQLTester} request preparation and + * The main focus is to verify {@link GraphQlTester} request preparation and * response handling. */ -public class GraphQLTesterTests { +public class GraphQlTesterTests { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); - public static Stream argumentSource() { - return Stream.of(new MockWebServerSetup(), new MockWebGraphQLHandlerSetup()); + public static Stream argumentSource() { + return Stream.of(new MockWebServerSetup(), new MockWebGraphQlHandlerSetup()); } @ParameterizedTest @MethodSource("argumentSource") - void pathAndValueExistsAndEmptyChecks(GraphQLTesterSetup setup) throws Exception { + void pathAndValueExistsAndEmptyChecks(GraphQlTesterSetup setup) throws Exception { String query = "{me {name, friends}}"; setup.response("{\"me\": {\"name\":\"Luke Skywalker\", \"friends\":[]}}"); - GraphQLTester.ResponseSpec spec = setup.graphQLTester().query(query).execute(); + GraphQlTester.ResponseSpec spec = setup.graphQlTester().query(query).execute(); spec.path("me.name").pathExists().valueExists().valueIsNotEmpty(); spec.path("me.friends").valueIsEmpty(); @@ -94,12 +94,12 @@ public class GraphQLTesterTests { @ParameterizedTest @MethodSource("argumentSource") - void matchesJson(GraphQLTesterSetup setup) throws Exception { + void matchesJson(GraphQlTesterSetup setup) throws Exception { String query = "{me {name}}"; setup.response("{\"me\": {\"name\":\"Luke Skywalker\", \"friends\":[]}}"); - GraphQLTester.ResponseSpec spec = setup.graphQLTester().query(query).execute(); + GraphQlTester.ResponseSpec spec = setup.graphQlTester().query(query).execute(); spec.path("").matchesJson("{\"me\": {\"name\":\"Luke Skywalker\",\"friends\":[]}}"); spec.path("me").matchesJson("{\"name\":\"Luke Skywalker\"}"); @@ -115,12 +115,12 @@ public class GraphQLTesterTests { @ParameterizedTest @MethodSource("argumentSource") - void entity(GraphQLTesterSetup setup) throws Exception { + void entity(GraphQlTesterSetup setup) throws Exception { String query = "{me {name}}"; setup.response("{\"me\": {\"name\":\"Luke Skywalker\"}}"); - GraphQLTester.ResponseSpec spec = setup.graphQLTester().query(query).execute(); + GraphQlTester.ResponseSpec spec = setup.graphQlTester().query(query).execute(); MovieCharacter luke = MovieCharacter.create("Luke Skywalker"); MovieCharacter han = MovieCharacter.create("Han Solo"); @@ -147,7 +147,7 @@ public class GraphQLTesterTests { @ParameterizedTest @MethodSource("argumentSource") - void entityList(GraphQLTesterSetup setup) throws Exception { + void entityList(GraphQlTesterSetup setup) throws Exception { String query = "{me {name, friends}}"; setup.response("{" + @@ -158,7 +158,7 @@ public class GraphQLTesterTests { "}" ); - GraphQLTester.ResponseSpec spec = setup.graphQLTester().query(query).execute(); + GraphQlTester.ResponseSpec spec = setup.graphQlTester().query(query).execute(); MovieCharacter han = MovieCharacter.create("Han Solo"); MovieCharacter leia = MovieCharacter.create("Leia Organa"); @@ -185,7 +185,7 @@ public class GraphQLTesterTests { @ParameterizedTest @MethodSource("argumentSource") - void operationNameAndVariables(GraphQLTesterSetup setup) throws Exception { + void operationNameAndVariables(GraphQlTesterSetup setup) throws Exception { String query = "query HeroNameAndFriends($episode: Episode) {" + " hero(episode: $episode) {" + @@ -195,7 +195,7 @@ public class GraphQLTesterTests { setup.response("{\"hero\": {\"name\":\"R2-D2\"}}"); - GraphQLTester.ResponseSpec spec = setup.graphQLTester().query(query) + GraphQlTester.ResponseSpec spec = setup.graphQlTester().query(query) .operationName("HeroNameAndFriends") .variable("episode", "JEDI") .variables(map -> map.put("foo", "bar")) @@ -215,12 +215,12 @@ public class GraphQLTesterTests { @ParameterizedTest @MethodSource("argumentSource") - void errorsCheckedOnExecuteAndVerify(GraphQLTesterSetup setup) throws Exception { + void errorsCheckedOnExecuteAndVerify(GraphQlTesterSetup setup) throws Exception { String query = "{me {name, friends}}"; setup.response(GraphqlErrorBuilder.newError().message("Invalid query").build()); - assertThatThrownBy(() -> setup.graphQLTester().query(query).executeAndVerify()) + assertThatThrownBy(() -> setup.graphQlTester().query(query).executeAndVerify()) .hasMessageContaining("Response has 1 unexpected error(s)."); setup.verifyRequest(input -> assertThat(input.getQuery()).contains(query)); @@ -229,12 +229,12 @@ public class GraphQLTesterTests { @ParameterizedTest @MethodSource("argumentSource") - void errorsCheckedOnTraverse(GraphQLTesterSetup setup) throws Exception { + void errorsCheckedOnTraverse(GraphQlTesterSetup setup) throws Exception { String query = "{me {name, friends}}"; setup.response(GraphqlErrorBuilder.newError().message("Invalid query").build()); - assertThatThrownBy(() -> setup.graphQLTester().query(query).execute().path("me")) + assertThatThrownBy(() -> setup.graphQlTester().query(query).execute().path("me")) .hasMessageContaining("Response has 1 unexpected error(s)."); setup.verifyRequest(input -> assertThat(input.getQuery()).contains(query)); @@ -243,7 +243,7 @@ public class GraphQLTesterTests { @ParameterizedTest @MethodSource("argumentSource") - void errorsPartiallyFiltered(GraphQLTesterSetup setup) throws Exception { + void errorsPartiallyFiltered(GraphQlTesterSetup setup) throws Exception { String query = "{me {name, friends}}"; setup.response( @@ -251,7 +251,7 @@ public class GraphQLTesterTests { GraphqlErrorBuilder.newError().message("some other error").build()); assertThatThrownBy(() -> - setup.graphQLTester().query(query).execute() + setup.graphQlTester().query(query).execute() .errors() .filter(error -> error.getMessage().equals("some error")) .verify()) @@ -263,14 +263,14 @@ public class GraphQLTesterTests { @ParameterizedTest @MethodSource("argumentSource") - void errorsFiltered(GraphQLTesterSetup setup) throws Exception { + void errorsFiltered(GraphQlTesterSetup setup) throws Exception { String query = "{me {name, friends}}"; setup.response( GraphqlErrorBuilder.newError().message("some error").build(), GraphqlErrorBuilder.newError().message("some other error").build()); - setup.graphQLTester().query(query).execute() + setup.graphQlTester().query(query).execute() .errors() .filter(error -> error.getMessage().startsWith("some ")) .verify() @@ -282,7 +282,7 @@ public class GraphQLTesterTests { @ParameterizedTest @MethodSource("argumentSource") - void errorsConsumed(GraphQLTesterSetup setup) throws Exception { + void errorsConsumed(GraphQlTesterSetup setup) throws Exception { String query = "{me {name, friends}}"; setup.response(GraphqlErrorBuilder.newError() @@ -290,7 +290,7 @@ public class GraphQLTesterTests { .location(new SourceLocation(1, 2)) .build()); - setup.graphQLTester().query(query).execute() + setup.graphQlTester().query(query).execute() .errors().satisfy(errors -> { assertThat(errors).hasSize(1); assertThat(errors.get(0).getMessage()).isEqualTo("Invalid query"); @@ -305,9 +305,9 @@ public class GraphQLTesterTests { } - private interface GraphQLTesterSetup { + private interface GraphQlTesterSetup { - GraphQLTester graphQLTester(); + GraphQlTester graphQlTester(); default void response(String data) throws Exception { response(data, Collections.emptyList()); @@ -328,15 +328,15 @@ public class GraphQLTesterTests { } - private static class MockWebServerSetup implements GraphQLTesterSetup { + private static class MockWebServerSetup implements GraphQlTesterSetup { private final MockWebServer server; - private final GraphQLTester graphQLTester; + private final GraphQlTester graphQlTester; MockWebServerSetup() { this.server = new MockWebServer(); - this.graphQLTester = GraphQLTester.create(initWebTestClient(this.server)); + this.graphQlTester = GraphQlTester.create(initWebTestClient(this.server)); } private static WebTestClient initWebTestClient(MockWebServer server) { @@ -345,8 +345,8 @@ public class GraphQLTesterTests { } @Override - public GraphQLTester graphQLTester() { - return this.graphQLTester; + public GraphQlTester graphQlTester() { + return this.graphQlTester; } @Override @@ -393,21 +393,21 @@ public class GraphQLTesterTests { } - private static class MockWebGraphQLHandlerSetup implements GraphQLTesterSetup { + private static class MockWebGraphQlHandlerSetup implements GraphQlTesterSetup { - private final WebGraphQLHandler handler = mock(WebGraphQLHandler.class); + private final WebGraphQlHandler handler = mock(WebGraphQlHandler.class); private final ArgumentCaptor bodyCaptor = ArgumentCaptor.forClass(WebInput.class); - private final GraphQLTester graphQLTester; + private final GraphQlTester graphQlTester; - public MockWebGraphQLHandlerSetup() { - this.graphQLTester = GraphQLTester.create(this.handler); + public MockWebGraphQlHandlerSetup() { + this.graphQlTester = GraphQlTester.create(this.handler); } @Override - public GraphQLTester graphQLTester() { - return this.graphQLTester; + public GraphQlTester graphQlTester() { + return this.graphQlTester; } @Override diff --git a/spring-graphql/src/main/java/org/springframework/graphql/GraphQLService.java b/spring-graphql/src/main/java/org/springframework/graphql/GraphQlService.java similarity index 97% rename from spring-graphql/src/main/java/org/springframework/graphql/GraphQLService.java rename to spring-graphql/src/main/java/org/springframework/graphql/GraphQlService.java index f38e611b..db2b4acc 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/GraphQLService.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/GraphQlService.java @@ -23,7 +23,7 @@ import reactor.core.publisher.Mono; * Strategy to perform GraphQL request execution with input for and output from * the invocation of {@link graphql.GraphQL}. */ -public interface GraphQLService { +public interface GraphQlService { /** * Perform the operation and return the result. diff --git a/spring-graphql/src/main/java/org/springframework/graphql/execution/DefaultGraphQLSourceBuilder.java b/spring-graphql/src/main/java/org/springframework/graphql/execution/DefaultGraphQlSourceBuilder.java similarity index 75% rename from spring-graphql/src/main/java/org/springframework/graphql/execution/DefaultGraphQLSourceBuilder.java rename to spring-graphql/src/main/java/org/springframework/graphql/execution/DefaultGraphQlSourceBuilder.java index 4e079b40..e0dd4046 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/execution/DefaultGraphQLSourceBuilder.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/execution/DefaultGraphQlSourceBuilder.java @@ -37,11 +37,11 @@ import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** - * Default implementation of {@link GraphQLSource.Builder} that initializes a - * {@link GraphQL} instance and wraps it with a {@link GraphQLSource} that + * Default implementation of {@link GraphQlSource.Builder} that initializes a + * {@link GraphQL} instance and wraps it with a {@link GraphQlSource} that * returns it. */ -class DefaultGraphQLSourceBuilder implements GraphQLSource.Builder { +class DefaultGraphQlSourceBuilder implements GraphQlSource.Builder { @Nullable private Resource schemaResource; @@ -54,53 +54,53 @@ class DefaultGraphQLSourceBuilder implements GraphQLSource.Builder { private final List instrumentations = new ArrayList<>(); - private Consumer graphQLConfigurers = builder -> {}; + private Consumer graphQlConfigurers = builder -> {}; - DefaultGraphQLSourceBuilder() { + DefaultGraphQlSourceBuilder() { this.typeVisitors.add(ReactorDataFetcherAdapter.TYPE_VISITOR); } @Override - public GraphQLSource.Builder schemaResource(Resource resource) { + public GraphQlSource.Builder schemaResource(Resource resource) { this.schemaResource = resource; return this; } @Override - public GraphQLSource.Builder runtimeWiring(RuntimeWiring runtimeWiring) { + public GraphQlSource.Builder runtimeWiring(RuntimeWiring runtimeWiring) { Assert.notNull(runtimeWiring, "RuntimeWiring is required"); this.runtimeWiring = runtimeWiring; return this; } @Override - public GraphQLSource.Builder exceptionResolvers(List resolvers) { + public GraphQlSource.Builder exceptionResolvers(List resolvers) { this.exceptionResolvers.addAll(resolvers); return this; } @Override - public GraphQLSource.Builder typeVisitors(List typeVisitors) { + public GraphQlSource.Builder typeVisitors(List typeVisitors) { this.typeVisitors.addAll(typeVisitors); return this; } @Override - public GraphQLSource.Builder instrumentation(List instrumentations) { + public GraphQlSource.Builder instrumentation(List instrumentations) { this.instrumentations.addAll(instrumentations); return this; } @Override - public GraphQLSource.Builder configureGraphQL(Consumer configurer) { - this.graphQLConfigurers = this.graphQLConfigurers.andThen(configurer); + public GraphQlSource.Builder configureGraphQl(Consumer configurer) { + this.graphQlConfigurers = this.graphQlConfigurers.andThen(configurer); return this; } @Override - public GraphQLSource build() { + public GraphQlSource build() { TypeDefinitionRegistry registry = parseSchemaResource(); GraphQLSchema schema = new SchemaGenerator().makeExecutableSchema(registry, this.runtimeWiring); @@ -113,10 +113,10 @@ class DefaultGraphQLSourceBuilder implements GraphQLSource.Builder { if (!this.instrumentations.isEmpty()) { builder = builder.instrumentation(new ChainedInstrumentation(this.instrumentations)); } - this.graphQLConfigurers.accept(builder); - GraphQL graphQL = builder.build(); + this.graphQlConfigurers.accept(builder); + GraphQL graphQl = builder.build(); - return new CachedGraphQLSource(graphQL, schema); + return new CachedGraphQlSource(graphQl, schema); } private TypeDefinitionRegistry parseSchemaResource() { @@ -135,22 +135,22 @@ class DefaultGraphQLSourceBuilder implements GraphQLSource.Builder { /** - * GraphQLSource that returns the built GraphQL instance and its schema. + * GraphQlSource that returns the built GraphQL instance and its schema. */ - private static class CachedGraphQLSource implements GraphQLSource { + private static class CachedGraphQlSource implements GraphQlSource { - private final GraphQL graphQL; + private final GraphQL graphQl; private final GraphQLSchema schema; - CachedGraphQLSource(GraphQL graphQL, GraphQLSchema schema) { - this.graphQL = graphQL; + CachedGraphQlSource(GraphQL graphQl, GraphQLSchema schema) { + this.graphQl = graphQl; this.schema = schema; } @Override - public GraphQL graphQL() { - return this.graphQL; + public GraphQL graphQl() { + return this.graphQl; } @Override diff --git a/spring-graphql/src/main/java/org/springframework/graphql/execution/ExecutionGraphQLService.java b/spring-graphql/src/main/java/org/springframework/graphql/execution/ExecutionGraphQlService.java similarity index 71% rename from spring-graphql/src/main/java/org/springframework/graphql/execution/ExecutionGraphQLService.java rename to spring-graphql/src/main/java/org/springframework/graphql/execution/ExecutionGraphQlService.java index e577b783..bd800690 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/execution/ExecutionGraphQLService.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/execution/ExecutionGraphQlService.java @@ -20,28 +20,28 @@ import graphql.ExecutionResult; import graphql.GraphQL; import reactor.core.publisher.Mono; -import org.springframework.graphql.GraphQLService; +import org.springframework.graphql.GraphQlService; /** - * Implementation of {@link GraphQLService} that performs GraphQL request execution + * Implementation of {@link GraphQlService} that performs GraphQL request execution * through {@link GraphQL#executeAsync(ExecutionInput)}. */ -public class ExecutionGraphQLService implements GraphQLService { +public class ExecutionGraphQlService implements GraphQlService { - private final GraphQLSource graphQLSource; + private final GraphQlSource graphQlSource; - public ExecutionGraphQLService(GraphQLSource graphQLSource) { - this.graphQLSource = graphQLSource; + public ExecutionGraphQlService(GraphQlSource graphQlSource) { + this.graphQlSource = graphQlSource; } @Override public Mono execute(ExecutionInput input) { - GraphQL graphQL = this.graphQLSource.graphQL(); + GraphQL graphQl = this.graphQlSource.graphQl(); return Mono.deferContextual(contextView -> { ReactorDataFetcherAdapter.addReactorContext(input, contextView); - return Mono.fromFuture(graphQL.executeAsync(input)); + return Mono.fromFuture(graphQl.executeAsync(input)); }); } diff --git a/spring-graphql/src/main/java/org/springframework/graphql/execution/GraphQLSource.java b/spring-graphql/src/main/java/org/springframework/graphql/execution/GraphQlSource.java similarity index 88% rename from spring-graphql/src/main/java/org/springframework/graphql/execution/GraphQLSource.java rename to spring-graphql/src/main/java/org/springframework/graphql/execution/GraphQlSource.java index bad271d5..aeee7005 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/execution/GraphQLSource.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/execution/GraphQlSource.java @@ -31,18 +31,18 @@ import org.springframework.core.io.Resource; /** * Strategy to resolve the {@link GraphQL} instance to use. * - *

This contract also includes a {@link GraphQLSource} builder encapsulating + *

This contract also includes a {@link GraphQlSource} builder encapsulating * the initialization of the {@link GraphQL} instance and associated * {@link graphql.schema.GraphQLSchema}. */ -public interface GraphQLSource { +public interface GraphQlSource { /** * Return the {@link GraphQL} to use. This can be a cached instance or a * different one from time to time (e.g. based on a reloaded schema). */ - GraphQL graphQL(); + GraphQL graphQl(); /** * Return the {@link GraphQLSchema} used by the current {@link GraphQL}. @@ -51,16 +51,16 @@ public interface GraphQLSource { /** - * Return a builder for a {@link GraphQLSource} given input for the + * Return a builder for a {@link GraphQlSource} given input for the * initialization of {@link GraphQL} and {@link graphql.schema.GraphQLSchema}. */ static Builder builder() { - return new DefaultGraphQLSourceBuilder(); + return new DefaultGraphQlSourceBuilder(); } /** - * Builder for a {@link GraphQLSource}. + * Builder for a {@link GraphQlSource}. */ interface Builder { @@ -101,12 +101,12 @@ public interface GraphQLSource { * Configure consumers to be given access to the {@link GraphQL.Builder} * used to build {@link GraphQL}. */ - Builder configureGraphQL(Consumer configurer); + Builder configureGraphQl(Consumer configurer); /** - * Build the {@link GraphQLSource}. + * Build the {@link GraphQlSource}. */ - GraphQLSource build(); + GraphQlSource build(); } } diff --git a/spring-graphql/src/main/java/org/springframework/graphql/execution/ReactorDataFetcherAdapter.java b/spring-graphql/src/main/java/org/springframework/graphql/execution/ReactorDataFetcherAdapter.java index 799cf8c1..a397420e 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/execution/ReactorDataFetcherAdapter.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/execution/ReactorDataFetcherAdapter.java @@ -89,8 +89,8 @@ class ReactorDataFetcherAdapter implements DataFetcher { @Nullable private ContextView getReactorContext(DataFetchingEnvironment environment) { - GraphQLContext graphQLContext = environment.getContext(); - return graphQLContext.get(REACTOR_CONTEXT_KEY); + GraphQLContext graphQlContext = environment.getContext(); + return graphQlContext.get(REACTOR_CONTEXT_KEY); } /** @@ -98,8 +98,8 @@ class ReactorDataFetcherAdapter implements DataFetcher { * for later retrieval from the {@link DataFetchingEnvironment}. */ public static void addReactorContext(ExecutionInput executionInput, ContextView reactorContext) { - GraphQLContext graphQLContext = (GraphQLContext) executionInput.getContext(); - graphQLContext.put(REACTOR_CONTEXT_KEY, reactorContext); + GraphQLContext graphQlContext = (GraphQLContext) executionInput.getContext(); + graphQlContext.put(REACTOR_CONTEXT_KEY, reactorContext); } diff --git a/spring-graphql/src/main/java/org/springframework/graphql/package-info.java b/spring-graphql/src/main/java/org/springframework/graphql/package-info.java index 274456d3..cc73a75d 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/package-info.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/package-info.java @@ -1,6 +1,6 @@ /** * Top level abstractions for processing GraphQL requests including - * {@link org.springframework.graphql.GraphQLService} for executing a request and + * {@link org.springframework.graphql.GraphQlService} for executing a request and * {@link org.springframework.graphql.RequestInput} to represent the input for * a request. */ diff --git a/spring-graphql/src/main/java/org/springframework/graphql/web/WebGraphQLHandler.java b/spring-graphql/src/main/java/org/springframework/graphql/web/WebGraphQlHandler.java similarity index 88% rename from spring-graphql/src/main/java/org/springframework/graphql/web/WebGraphQLHandler.java rename to spring-graphql/src/main/java/org/springframework/graphql/web/WebGraphQlHandler.java index c364fec1..808b6bf3 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/web/WebGraphQLHandler.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/web/WebGraphQlHandler.java @@ -19,15 +19,15 @@ import java.util.List; import reactor.core.publisher.Mono; -import org.springframework.graphql.GraphQLService; +import org.springframework.graphql.GraphQlService; /** * Contract to handle a GraphQL over HTTP or WebSocket request that forms the * basis of a {@link WebInterceptor} delegation chain. * - * @see WebInterceptor#createHandler(List, GraphQLService) + * @see WebInterceptor#createHandler(List, GraphQlService) */ -public interface WebGraphQLHandler { +public interface WebGraphQlHandler { /** * Perform request execution for the given input and return the result. diff --git a/spring-graphql/src/main/java/org/springframework/graphql/web/WebInterceptor.java b/spring-graphql/src/main/java/org/springframework/graphql/web/WebInterceptor.java index f2d552cc..de855a81 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/web/WebInterceptor.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/web/WebInterceptor.java @@ -22,7 +22,7 @@ import graphql.ExecutionResult; import reactor.core.publisher.Mono; import org.springframework.beans.factory.ObjectProvider; -import org.springframework.graphql.GraphQLService; +import org.springframework.graphql.GraphQlService; import org.springframework.util.Assert; /** @@ -40,14 +40,14 @@ public interface WebInterceptor { /** * Intercept a request and delegate for further handling and request execution - * via {@link WebGraphQLHandler#handle(WebInput)}. + * via {@link WebGraphQlHandler#handle(WebInput)}. * * @param webInput container with HTTP request information and options to * customize the {@link ExecutionInput}. * @param next the handler to delegate to for request execution * @return a {@link Mono} with the result */ - Mono intercept(WebInput webInput, WebGraphQLHandler next); + Mono intercept(WebInput webInput, WebGraphQlHandler next); /** * Return a composed {@link WebInterceptor} that invokes the current @@ -59,21 +59,21 @@ public interface WebInterceptor { } /** - * Return {@link WebGraphQLHandler} that invokes the current interceptor - * first and then the given {@link GraphQLService} for actual execution of + * Return {@link WebGraphQlHandler} that invokes the current interceptor + * first and then the given {@link GraphQlService} for actual execution of * the GraphQL operation. */ - default WebGraphQLHandler apply(GraphQLService service) { - Assert.notNull(service, "GraphQLService must not be null"); + default WebGraphQlHandler apply(GraphQlService service) { + Assert.notNull(service, "GraphQlService must not be null"); return currentInput -> intercept(currentInput, createHandler(service)); } /** - * Factory method for a {@link WebGraphQLHandler} with a chain of - * interceptors followed by a {@link GraphQLService} at the end. + * Factory method for a {@link WebGraphQlHandler} with a chain of + * interceptors followed by a {@link GraphQlService} at the end. */ - static WebGraphQLHandler createHandler(List interceptors, GraphQLService service) { + static WebGraphQlHandler createHandler(List interceptors, GraphQlService service) { return interceptors.stream() .reduce(WebInterceptor::andThen) .map(interceptor -> interceptor.apply(service)) @@ -81,14 +81,14 @@ public interface WebInterceptor { } /** - * Factory method for a {@link WebGraphQLHandler} that simple invokes the - * given {@link GraphQLService} adapting to its input and output. + * Factory method for a {@link WebGraphQlHandler} that simple invokes the + * given {@link GraphQlService} adapting to its input and output. */ - static WebGraphQLHandler createHandler(GraphQLService graphQLService) { - Assert.notNull(graphQLService, "GraphQLService must not be null"); + static WebGraphQlHandler createHandler(GraphQlService graphQlService) { + Assert.notNull(graphQlService, "GraphQlService must not be null"); return webInput -> { ExecutionInput executionInput = webInput.toExecutionInput(); - return graphQLService.execute(executionInput).map(result -> new WebOutput(webInput, result)); + return graphQlService.execute(executionInput).map(result -> new WebOutput(webInput, result)); }; } diff --git a/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQLHttpHandler.java b/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlHttpHandler.java similarity index 82% rename from spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQLHttpHandler.java rename to spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlHttpHandler.java index 64a6ec4e..cccd8f59 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQLHttpHandler.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlHttpHandler.java @@ -22,7 +22,7 @@ import org.apache.commons.logging.LogFactory; import reactor.core.publisher.Mono; import org.springframework.core.ParameterizedTypeReference; -import org.springframework.graphql.web.WebGraphQLHandler; +import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.web.WebInput; import org.springframework.util.Assert; import org.springframework.web.reactive.function.server.ServerRequest; @@ -31,24 +31,24 @@ import org.springframework.web.reactive.function.server.ServerResponse; /** * WebFlux.fn Handler for GraphQL over HTTP requests. */ -public class GraphQLHttpHandler { +public class GraphQlHttpHandler { - private static final Log logger = LogFactory.getLog(GraphQLHttpHandler.class); + private static final Log logger = LogFactory.getLog(GraphQlHttpHandler.class); private static final ParameterizedTypeReference> MAP_PARAMETERIZED_TYPE_REF = new ParameterizedTypeReference>() {}; - private final WebGraphQLHandler graphQLHandler; + private final WebGraphQlHandler graphQlHandler; /** * Create a new instance. - * @param graphQLHandler common handler for GraphQL over HTTP requests + * @param graphQlHandler common handler for GraphQL over HTTP requests */ - public GraphQLHttpHandler(WebGraphQLHandler graphQLHandler) { - Assert.notNull(graphQLHandler, "WebGraphQLHandler is required"); - this.graphQLHandler = graphQLHandler; + public GraphQlHttpHandler(WebGraphQlHandler graphQlHandler) { + Assert.notNull(graphQlHandler, "WebGraphQlHandler is required"); + this.graphQlHandler = graphQlHandler; } @@ -63,7 +63,7 @@ public class GraphQLHttpHandler { if (logger.isDebugEnabled()) { logger.debug("Executing: " + input); } - return this.graphQLHandler.handle(input); + return this.graphQlHandler.handle(input); }) .flatMap(output -> { Map spec = output.toSpecification(); diff --git a/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQLWebSocketHandler.java b/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlWebSocketHandler.java similarity index 90% rename from spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQLWebSocketHandler.java rename to spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlWebSocketHandler.java index 292be31d..67acfc1d 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQLWebSocketHandler.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlWebSocketHandler.java @@ -39,7 +39,7 @@ import org.springframework.core.codec.Decoder; import org.springframework.core.codec.Encoder; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; -import org.springframework.graphql.web.WebGraphQLHandler; +import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.web.WebInput; import org.springframework.graphql.web.WebOutput; import org.springframework.http.MediaType; @@ -61,9 +61,9 @@ import org.springframework.web.reactive.socket.WebSocketSession; * GraphQL Over WebSocket Protocol * and for use in a Spring WebFlux application. */ -public class GraphQLWebSocketHandler implements WebSocketHandler { +public class GraphQlWebSocketHandler implements WebSocketHandler { - private static final Log logger = LogFactory.getLog(GraphQLWebSocketHandler.class); + private static final Log logger = LogFactory.getLog(GraphQlWebSocketHandler.class); private static final List SUB_PROTOCOL_LIST = Arrays.asList("graphql-transport-ws", "subscriptions-transport-ws"); @@ -72,7 +72,7 @@ public class GraphQLWebSocketHandler implements WebSocketHandler { ResolvableType.forType(new ParameterizedTypeReference>() {}); - private final WebGraphQLHandler graphQLHandler; + private final WebGraphQlHandler graphQlHandler; private final Decoder decoder; @@ -83,16 +83,16 @@ public class GraphQLWebSocketHandler implements WebSocketHandler { /** * Create a new instance. - * @param graphQLHandler common handler for GraphQL over HTTP requests + * @param graphQlHandler common handler for GraphQL over HTTP requests * @param configurer codec configurer for JSON encoding and decoding * @param connectionInitTimeout the time within which the {@code CONNECTION_INIT} * type message must be received. */ - public GraphQLWebSocketHandler( - WebGraphQLHandler graphQLHandler, ServerCodecConfigurer configurer, Duration connectionInitTimeout) { + public GraphQlWebSocketHandler( + WebGraphQlHandler graphQlHandler, ServerCodecConfigurer configurer, Duration connectionInitTimeout) { - Assert.notNull(graphQLHandler, "WebGraphQLHandler is required"); - this.graphQLHandler = graphQLHandler; + Assert.notNull(graphQlHandler, "WebGraphQlHandler is required"); + this.graphQlHandler = graphQlHandler; this.decoder = initDecoder(configurer); this.encoder = initEncoder(configurer); this.initTimeoutDuration = connectionInitTimeout; @@ -129,7 +129,7 @@ public class GraphQLWebSocketHandler implements WebSocketHandler { logger.debug("apollographql/subscriptions-transport-ws is not supported, nor maintained. " + "Please, use https://github.com/enisdenjo/graphql-ws."); } - return session.close(GraphQLStatus.INVALID_MESSAGE_STATUS); + return session.close(GraphQlStatus.INVALID_MESSAGE_STATUS); } // Session state @@ -139,7 +139,7 @@ public class GraphQLWebSocketHandler implements WebSocketHandler { Mono.delay(this.initTimeoutDuration) .then(Mono.defer(() -> connectionInitProcessed.compareAndSet(false, true) ? - session.close(GraphQLStatus.INIT_TIMEOUT_STATUS) : + session.close(GraphQlStatus.INIT_TIMEOUT_STATUS) : Mono.empty())) .subscribe(); @@ -149,22 +149,22 @@ public class GraphQLWebSocketHandler implements WebSocketHandler { String id = (String) map.get("id"); MessageType messageType = MessageType.resolve((String) map.get("type")); if (messageType == null) { - return GraphQLStatus.close(session, GraphQLStatus.INVALID_MESSAGE_STATUS); + return GraphQlStatus.close(session, GraphQlStatus.INVALID_MESSAGE_STATUS); } switch (messageType) { case SUBSCRIBE: if (!connectionInitProcessed.get()) { - return GraphQLStatus.close(session, GraphQLStatus.UNAUTHORIZED_STATUS); + return GraphQlStatus.close(session, GraphQlStatus.UNAUTHORIZED_STATUS); } if (id == null) { - return GraphQLStatus.close(session, GraphQLStatus.INVALID_MESSAGE_STATUS); + return GraphQlStatus.close(session, GraphQlStatus.INVALID_MESSAGE_STATUS); } WebInput input = new WebInput( handshakeInfo.getUri(), handshakeInfo.getHeaders(), getPayload(map), id); if (logger.isDebugEnabled()) { logger.debug("Executing: " + input); } - return this.graphQLHandler.handle(input) + return this.graphQlHandler.handle(input) .flatMapMany(output -> handleWebOutput(session, id, subscriptions, output)) .doOnTerminate(() -> subscriptions.remove(id)); case COMPLETE: @@ -177,11 +177,11 @@ public class GraphQLWebSocketHandler implements WebSocketHandler { return Flux.empty(); case CONNECTION_INIT: if (!connectionInitProcessed.compareAndSet(false, true)) { - return GraphQLStatus.close(session, GraphQLStatus.TOO_MANY_INIT_REQUESTS_STATUS); + return GraphQlStatus.close(session, GraphQlStatus.TOO_MANY_INIT_REQUESTS_STATUS); } return Flux.just(encode(session, null, MessageType.CONNECTION_ACK, null)); default: - return GraphQLStatus.close(session, GraphQLStatus.INVALID_MESSAGE_STATUS); + return GraphQlStatus.close(session, GraphQlStatus.INVALID_MESSAGE_STATUS); } })); } @@ -236,7 +236,7 @@ public class GraphQLWebSocketHandler implements WebSocketHandler { .onErrorResume(ex -> { if (ex instanceof SubscriptionExistsException) { CloseStatus status = new CloseStatus(4409, "Subscriber for " + id + " already exists"); - return GraphQLStatus.close(session, status); + return GraphQlStatus.close(session, status); } ErrorType errorType = ErrorType.DataFetchingException; String message = ex.getMessage(); @@ -306,7 +306,7 @@ public class GraphQLWebSocketHandler implements WebSocketHandler { } - private static class GraphQLStatus { + private static class GraphQlStatus { static final CloseStatus INVALID_MESSAGE_STATUS = new CloseStatus(4400, "Invalid message"); diff --git a/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQLHttpHandler.java b/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlHttpHandler.java similarity index 84% rename from spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQLHttpHandler.java rename to spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlHttpHandler.java index b8f06f8d..69f344d7 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQLHttpHandler.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlHttpHandler.java @@ -25,7 +25,7 @@ import org.apache.commons.logging.LogFactory; import reactor.core.publisher.Mono; import org.springframework.core.ParameterizedTypeReference; -import org.springframework.graphql.web.WebGraphQLHandler; +import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.web.WebInput; import org.springframework.util.Assert; import org.springframework.web.HttpMediaTypeNotSupportedException; @@ -37,24 +37,24 @@ import org.springframework.web.servlet.function.ServerResponse; * GraphQL handler to expose as a WebMvc.fn endpoint via * {@link org.springframework.web.servlet.function.RouterFunctions}. */ -public class GraphQLHttpHandler { +public class GraphQlHttpHandler { - private final static Log logger = LogFactory.getLog(GraphQLHttpHandler.class); + private final static Log logger = LogFactory.getLog(GraphQlHttpHandler.class); private static final ParameterizedTypeReference> MAP_PARAMETERIZED_TYPE_REF = new ParameterizedTypeReference>() {}; - private final WebGraphQLHandler graphQLHandler; + private final WebGraphQlHandler graphQlHandler; /** * Create a new instance. - * @param graphQLHandler common handler for GraphQL over HTTP requests + * @param graphQlHandler common handler for GraphQL over HTTP requests */ - public GraphQLHttpHandler(WebGraphQLHandler graphQLHandler) { - Assert.notNull(graphQLHandler, "WebGraphQLHandler is required"); - this.graphQLHandler = graphQLHandler; + public GraphQlHttpHandler(WebGraphQlHandler graphQlHandler) { + Assert.notNull(graphQlHandler, "WebGraphQlHandler is required"); + this.graphQlHandler = graphQlHandler; } @@ -69,7 +69,7 @@ public class GraphQLHttpHandler { if (logger.isDebugEnabled()) { logger.debug("Executing: " + input); } - Mono responseMono = this.graphQLHandler.handle(input) + Mono responseMono = this.graphQlHandler.handle(input) .map(output -> { if (logger.isDebugEnabled()) { logger.debug("Execution complete"); diff --git a/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQLWebSocketHandler.java b/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlWebSocketHandler.java similarity index 92% rename from spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQLWebSocketHandler.java rename to spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlWebSocketHandler.java index 8601db03..ba704b99 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQLWebSocketHandler.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlWebSocketHandler.java @@ -41,7 +41,7 @@ import reactor.core.publisher.Mono; import reactor.core.scheduler.Scheduler; import reactor.core.scheduler.Schedulers; -import org.springframework.graphql.web.WebGraphQLHandler; +import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.web.WebInput; import org.springframework.graphql.web.WebOutput; import org.springframework.http.HttpHeaders; @@ -63,15 +63,15 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; * GraphQL Over WebSocket Protocol * and for use on a Servlet container with {@code spring-websocket}. */ -public class GraphQLWebSocketHandler extends TextWebSocketHandler implements SubProtocolCapable { +public class GraphQlWebSocketHandler extends TextWebSocketHandler implements SubProtocolCapable { - private static final Log logger = LogFactory.getLog(GraphQLWebSocketHandler.class); + private static final Log logger = LogFactory.getLog(GraphQlWebSocketHandler.class); private static final List SUB_PROTOCOL_LIST = Arrays.asList("graphql-transport-ws", "subscriptions-transport-ws"); - private final WebGraphQLHandler graphQLHandler; + private final WebGraphQlHandler graphQlHandler; private final Duration initTimeoutDuration; @@ -82,17 +82,17 @@ public class GraphQLWebSocketHandler extends TextWebSocketHandler implements Sub /** * Create a new instance. - * @param graphQLHandler common handler for GraphQL over HTTP requests + * @param graphQlHandler common handler for GraphQL over HTTP requests * @param converter for JSON encoding and decoding * @param connectionInitTimeout the time within which the {@code CONNECTION_INIT} * type message must be received. */ - public GraphQLWebSocketHandler( - WebGraphQLHandler graphQLHandler, HttpMessageConverter converter, Duration connectionInitTimeout) { + public GraphQlWebSocketHandler( + WebGraphQlHandler graphQlHandler, HttpMessageConverter converter, Duration connectionInitTimeout) { - Assert.notNull(graphQLHandler, "WebGraphQLHandler is required"); + Assert.notNull(graphQlHandler, "WebGraphQlHandler is required"); Assert.notNull(converter, "HttpMessageConverter for JSON is required"); - this.graphQLHandler = graphQLHandler; + this.graphQlHandler = graphQlHandler; this.initTimeoutDuration = connectionInitTimeout; this.converter = converter; } @@ -111,7 +111,7 @@ public class GraphQLWebSocketHandler extends TextWebSocketHandler implements Sub logger.debug("apollographql/subscriptions-transport-ws is not supported, nor maintained. " + "Please, use https://github.com/enisdenjo/graphql-ws."); } - GraphQLStatus.closeSession(session, GraphQLStatus.INVALID_MESSAGE_STATUS); + GraphQlStatus.closeSession(session, GraphQlStatus.INVALID_MESSAGE_STATUS); return; } @@ -121,7 +121,7 @@ public class GraphQLWebSocketHandler extends TextWebSocketHandler implements Sub Mono.delay(this.initTimeoutDuration) .then(Mono.fromRunnable(() -> { if (sessionState.isConnectionInitNotProcessed()) { - GraphQLStatus.closeSession(session, GraphQLStatus.INIT_TIMEOUT_STATUS); + GraphQlStatus.closeSession(session, GraphQlStatus.INIT_TIMEOUT_STATUS); } })) .subscribe(); @@ -134,18 +134,18 @@ public class GraphQLWebSocketHandler extends TextWebSocketHandler implements Sub String id = (String) map.get("id"); MessageType messageType = MessageType.resolve((String) map.get("type")); if (messageType == null) { - GraphQLStatus.closeSession(session, GraphQLStatus.INVALID_MESSAGE_STATUS); + GraphQlStatus.closeSession(session, GraphQlStatus.INVALID_MESSAGE_STATUS); return; } SessionState sessionState = getSessionInfo(session); switch (messageType) { case SUBSCRIBE: if (sessionState.isConnectionInitNotProcessed()) { - GraphQLStatus.closeSession(session, GraphQLStatus.UNAUTHORIZED_STATUS); + GraphQlStatus.closeSession(session, GraphQlStatus.UNAUTHORIZED_STATUS); return; } if (id == null) { - GraphQLStatus.closeSession(session, GraphQLStatus.INVALID_MESSAGE_STATUS); + GraphQlStatus.closeSession(session, GraphQlStatus.INVALID_MESSAGE_STATUS); return; } URI uri = session.getUri(); @@ -155,7 +155,7 @@ public class GraphQLWebSocketHandler extends TextWebSocketHandler implements Sub if (logger.isDebugEnabled()) { logger.debug("Executing: " + input); } - this.graphQLHandler.handle(input) + this.graphQlHandler.handle(input) .flatMapMany(output -> handleWebOutput(session, input.getId(), output)) .publishOn(sessionState.getScheduler()) // Serial blocking send via single thread .subscribe(new SendMessageSubscriber(id, session, sessionState)); @@ -170,14 +170,14 @@ public class GraphQLWebSocketHandler extends TextWebSocketHandler implements Sub return; case CONNECTION_INIT: if (sessionState.setConnectionInitProcessed()) { - GraphQLStatus.closeSession(session, GraphQLStatus.TOO_MANY_INIT_REQUESTS_STATUS); + GraphQlStatus.closeSession(session, GraphQlStatus.TOO_MANY_INIT_REQUESTS_STATUS); return; } TextMessage outputMessage = encode(null, MessageType.CONNECTION_ACK, null); session.sendMessage(outputMessage); return; default: - GraphQLStatus.closeSession(session, GraphQLStatus.INVALID_MESSAGE_STATUS); + GraphQlStatus.closeSession(session, GraphQlStatus.INVALID_MESSAGE_STATUS); } } @@ -234,7 +234,7 @@ public class GraphQLWebSocketHandler extends TextWebSocketHandler implements Sub .onErrorResume(ex -> { if (ex instanceof SubscriptionExistsException) { CloseStatus status = new CloseStatus(4409, "Subscriber for " + id + " already exists"); - GraphQLStatus.closeSession(session, status); + GraphQlStatus.closeSession(session, status); return Flux.empty(); } ErrorType errorType = ErrorType.DataFetchingException; @@ -326,7 +326,7 @@ public class GraphQLWebSocketHandler extends TextWebSocketHandler implements Sub } - private static class GraphQLStatus { + private static class GraphQlStatus { private static final CloseStatus INVALID_MESSAGE_STATUS = new CloseStatus(4400, "Invalid message"); diff --git a/spring-graphql/src/test/java/org/springframework/graphql/execution/ExceptionResolversExceptionHandlerTests.java b/spring-graphql/src/test/java/org/springframework/graphql/execution/ExceptionResolversExceptionHandlerTests.java index b139744c..535d8e5f 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/execution/ExceptionResolversExceptionHandlerTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/execution/ExceptionResolversExceptionHandlerTests.java @@ -42,7 +42,7 @@ public class ExceptionResolversExceptionHandlerTests { @Test void resolveException() throws Exception { - GraphQL graphQL = graphQL("type Query { greeting: String }", + GraphQL graphQl = graphQl("type Query { greeting: String }", "Query", "greeting", env -> { throw new IllegalArgumentException("Invalid greeting"); }, @@ -53,7 +53,7 @@ public class ExceptionResolversExceptionHandlerTests { .build())); ExecutionInput input = ExecutionInput.newExecutionInput().query("{ greeting }").build(); - ExecutionResult result = graphQL.executeAsync(input).get(); + ExecutionResult result = graphQl.executeAsync(input).get(); Map data = result.getData(); assertThat(data).hasSize(1).containsEntry("greeting", null); @@ -67,13 +67,13 @@ public class ExceptionResolversExceptionHandlerTests { @Test void unresolvedException() throws Exception { - GraphQL graphQL = graphQL("type Query { greeting: String }", + GraphQL graphQl = graphQl("type Query { greeting: String }", "Query", "greeting", env -> { throw new IllegalArgumentException("Invalid greeting"); }); ExecutionInput input = ExecutionInput.newExecutionInput().query("{ greeting }").build(); - ExecutionResult result = graphQL.executeAsync(input).get(); + ExecutionResult result = graphQl.executeAsync(input).get(); Map data = result.getData(); assertThat(data).hasSize(1).containsEntry("greeting", null); @@ -85,7 +85,7 @@ public class ExceptionResolversExceptionHandlerTests { assertThat(error.getErrorType().toString()).isEqualTo("INTERNAL_ERROR"); } - private GraphQL graphQL(String schemaContent, + private GraphQL graphQl(String schemaContent, String typeName, String fieldName, DataFetcher dataFetcher, @Nullable DataFetcherExceptionResolver... resolvers) { @@ -93,12 +93,12 @@ public class ExceptionResolversExceptionHandlerTests { .type(typeName, builder -> builder.dataFetcher(fieldName, dataFetcher)) .build(); - return GraphQLSource.builder() + return GraphQlSource.builder() .schemaResource(new ByteArrayResource(schemaContent.getBytes(StandardCharsets.UTF_8))) .runtimeWiring(wiring) .exceptionResolvers(Arrays.asList(resolvers)) .build() - .graphQL(); + .graphQl(); } } diff --git a/spring-graphql/src/test/java/org/springframework/graphql/execution/ReactorDataFetcherAdapterTests.java b/spring-graphql/src/test/java/org/springframework/graphql/execution/ReactorDataFetcherAdapterTests.java index 28d3cc2f..8c5a3df9 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/execution/ReactorDataFetcherAdapterTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/execution/ReactorDataFetcherAdapterTests.java @@ -42,7 +42,7 @@ public class ReactorDataFetcherAdapterTests { @Test void monoDataFetcher() throws Exception { - GraphQL graphQL = graphQL("type Query { greeting: String }", + GraphQL graphQl = graphQl("type Query { greeting: String }", "Query", "greeting", env -> Mono.deferContextual(context -> { Object name = context.get("name"); @@ -50,14 +50,14 @@ public class ReactorDataFetcherAdapterTests { })); ExecutionInput input = executionInput("{ greeting }", Context.of("name", "007")); - Map data = graphQL.executeAsync(input).get().getData(); + Map data = graphQl.executeAsync(input).get().getData(); assertThat(data).hasSize(1).containsEntry("greeting", "Hello 007"); } @Test void fluxDataFetcher() throws Exception { - GraphQL graphQL = graphQL("type Query { greetings: [String] }", + GraphQL graphQl = graphQl("type Query { greetings: [String] }", "Query", "greetings", env -> Mono.delay(Duration.ofMillis(50)).flatMapMany(aLong -> Flux.deferContextual(context -> { @@ -66,14 +66,14 @@ public class ReactorDataFetcherAdapterTests { }))); ExecutionInput input = executionInput("{ greetings }", Context.of("name", "007")); - Map data = graphQL.executeAsync(input).get().getData(); + Map data = graphQl.executeAsync(input).get().getData(); assertThat((List) data.get("greetings")).containsExactly("Hi 007", "Bonjour 007", "Hola 007"); } @Test void fluxDataFetcherSubscription() throws Exception { - GraphQL graphQL = graphQL( + GraphQL graphQl = graphQl( "type Query { greeting: String } type Subscription { greetings: String }", "Subscription", "greetings", env -> Mono.delay(Duration.ofMillis(50)).flatMapMany(aLong -> @@ -83,7 +83,7 @@ public class ReactorDataFetcherAdapterTests { }))); ExecutionInput input = executionInput("subscription { greetings }", Context.of("name", "007")); - Publisher publisher = graphQL.executeAsync(input).get().getData(); + Publisher publisher = graphQl.executeAsync(input).get().getData(); List actual = Flux.from(publisher) .cast(ExecutionResult.class) @@ -95,15 +95,15 @@ public class ReactorDataFetcherAdapterTests { assertThat(actual).containsExactly("Hi 007", "Bonjour 007", "Hola 007"); } - private GraphQL graphQL(String schemaValue, String typeName, String fieldName, DataFetcher dataFetcher) { + private GraphQL graphQl(String schemaValue, String typeName, String fieldName, DataFetcher dataFetcher) { RuntimeWiring wiring = RuntimeWiring.newRuntimeWiring() .type(typeName, builder -> builder.dataFetcher(fieldName, dataFetcher)) .build(); - return GraphQLSource.builder() + return GraphQlSource.builder() .schemaResource(new ByteArrayResource(schemaValue.getBytes(StandardCharsets.UTF_8))) .runtimeWiring(wiring) .build() - .graphQL(); + .graphQl(); } private ExecutionInput executionInput(String query, Context reactorContext) { diff --git a/spring-graphql/src/test/java/org/springframework/graphql/web/ConsumeOneAndNeverCompleteInterceptor.java b/spring-graphql/src/test/java/org/springframework/graphql/web/ConsumeOneAndNeverCompleteInterceptor.java index cdc50545..2ab3a6f1 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/web/ConsumeOneAndNeverCompleteInterceptor.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/web/ConsumeOneAndNeverCompleteInterceptor.java @@ -24,7 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ConsumeOneAndNeverCompleteInterceptor implements WebInterceptor { @Override - public Mono intercept(WebInput webInput, WebGraphQLHandler next) { + public Mono intercept(WebInput webInput, WebGraphQlHandler next) { return next.handle(webInput).map(output -> output.transform(builder -> { Publisher publisher = output.getData(); diff --git a/spring-graphql/src/test/java/org/springframework/graphql/web/GraphQLDataFetchers.java b/spring-graphql/src/test/java/org/springframework/graphql/web/GraphQlDataFetchers.java similarity index 96% rename from spring-graphql/src/test/java/org/springframework/graphql/web/GraphQLDataFetchers.java rename to spring-graphql/src/test/java/org/springframework/graphql/web/GraphQlDataFetchers.java index df0acf99..47e1576e 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/web/GraphQLDataFetchers.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/web/GraphQlDataFetchers.java @@ -6,7 +6,7 @@ import java.util.List; import graphql.schema.DataFetcher; import reactor.core.publisher.Flux; -public class GraphQLDataFetchers { +public class GraphQlDataFetchers { private static List books = Arrays.asList( new Book("book-1", "GraphQL for beginners", 100, "John GraphQL"), diff --git a/spring-graphql/src/test/java/org/springframework/graphql/web/WebInterceptorTests.java b/spring-graphql/src/test/java/org/springframework/graphql/web/WebInterceptorTests.java index bdd8e60d..4666eeb3 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/web/WebInterceptorTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/web/WebInterceptorTests.java @@ -22,7 +22,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.fasterxml.jackson.databind.ObjectMapper; import graphql.ExecutionInput; import graphql.ExecutionResult; import graphql.ExecutionResultImpl; @@ -30,7 +29,7 @@ import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; -import org.springframework.graphql.GraphQLService; +import org.springframework.graphql.GraphQlService; import org.springframework.http.HttpHeaders; import static org.assertj.core.api.Assertions.assertThat; @@ -46,7 +45,7 @@ public class WebInterceptorTests { List interceptors = Arrays.asList( new TestWebInterceptor(sb, 1), new TestWebInterceptor(sb, 2), new TestWebInterceptor(sb, 3)); - TestGraphQLService service = new TestGraphQLService(); + TestGraphQlService service = new TestGraphQlService(); WebInput input = new WebInput( URI.create("/"), new HttpHeaders(), Collections.singletonMap("query", "any"), "1"); @@ -59,7 +58,7 @@ public class WebInterceptorTests { } - private static class TestGraphQLService implements GraphQLService { + private static class TestGraphQlService implements GraphQlService { private ExecutionInput savedInput; @@ -87,7 +86,7 @@ public class WebInterceptorTests { } @Override - public Mono intercept(WebInput webInput, WebGraphQLHandler next) { + public Mono intercept(WebInput webInput, WebGraphQlHandler next) { this.output.append(":pre").append(this.index); diff --git a/spring-graphql/src/test/java/org/springframework/graphql/web/webflux/GraphQLWebSocketHandlerTests.java b/spring-graphql/src/test/java/org/springframework/graphql/web/webflux/GraphQlWebSocketHandlerTests.java similarity index 93% rename from spring-graphql/src/test/java/org/springframework/graphql/web/webflux/GraphQLWebSocketHandlerTests.java rename to spring-graphql/src/test/java/org/springframework/graphql/web/webflux/GraphQlWebSocketHandlerTests.java index db766e3c..917102ad 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/web/webflux/GraphQLWebSocketHandlerTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/web/webflux/GraphQlWebSocketHandlerTests.java @@ -36,11 +36,11 @@ import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; import org.springframework.core.io.buffer.DefaultDataBufferFactory; -import org.springframework.graphql.execution.ExecutionGraphQLService; -import org.springframework.graphql.execution.GraphQLSource; +import org.springframework.graphql.execution.ExecutionGraphQlService; +import org.springframework.graphql.execution.GraphQlSource; import org.springframework.graphql.web.ConsumeOneAndNeverCompleteInterceptor; -import org.springframework.graphql.web.GraphQLDataFetchers; -import org.springframework.graphql.web.WebGraphQLHandler; +import org.springframework.graphql.web.GraphQlDataFetchers; +import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.web.WebInterceptor; import org.springframework.http.HttpHeaders; import org.springframework.http.codec.ServerCodecConfigurer; @@ -57,9 +57,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.InstanceOfAssertFactories.map; /** - * Unit tests for {@link GraphQLWebSocketHandler}. + * Unit tests for {@link GraphQlWebSocketHandler}. */ -public class GraphQLWebSocketHandlerTests { +public class GraphQlWebSocketHandlerTests { private static final Jackson2JsonDecoder decoder = new Jackson2JsonDecoder(); @@ -267,29 +267,29 @@ public class GraphQLWebSocketHandlerTests { .verifyTimeout(Duration.ofMillis(500)); } - private GraphQLWebSocketHandler initWebSocketHandler() throws Exception { + private GraphQlWebSocketHandler initWebSocketHandler() throws Exception { return initWebSocketHandler(Collections.emptyList(), Duration.ofSeconds(60)); } - private GraphQLWebSocketHandler initWebSocketHandler( + private GraphQlWebSocketHandler initWebSocketHandler( @Nullable List interceptors, @Nullable Duration initTimeoutDuration) throws Exception { - WebGraphQLHandler graphQLHandler = WebInterceptor.createHandler( + WebGraphQlHandler graphQlHandler = WebInterceptor.createHandler( (interceptors != null ? interceptors : Collections.emptyList()), - new ExecutionGraphQLService(graphQLSource())); + new ExecutionGraphQlService(graphQlSource())); - return new GraphQLWebSocketHandler(graphQLHandler, + return new GraphQlWebSocketHandler(graphQlHandler, ServerCodecConfigurer.create(), (initTimeoutDuration != null ? initTimeoutDuration : Duration.ofSeconds(60))); } - private static GraphQLSource graphQLSource() { + private static GraphQlSource graphQlSource() { RuntimeWiring.Builder builder = RuntimeWiring.newRuntimeWiring(); - builder.type(newTypeWiring("Query").dataFetcher("bookById", GraphQLDataFetchers.getBookByIdDataFetcher())); - builder.type(newTypeWiring("Subscription").dataFetcher("bookSearch", GraphQLDataFetchers.getBooksOnSale())); + builder.type(newTypeWiring("Query").dataFetcher("bookById", GraphQlDataFetchers.getBookByIdDataFetcher())); + builder.type(newTypeWiring("Subscription").dataFetcher("bookSearch", GraphQlDataFetchers.getBooksOnSale())); RuntimeWiring runtimeWiring = builder.build(); - return GraphQLSource.builder() + return GraphQlSource.builder() .schemaResource(new ClassPathResource("books/schema.graphqls")) .runtimeWiring(runtimeWiring) .build(); @@ -304,7 +304,7 @@ public class GraphQLWebSocketHandlerTests { private Map decode(WebSocketMessage message) { return (Map) decoder.decode( DataBufferUtils.retain(message.getPayload()), - GraphQLWebSocketHandler.MAP_RESOLVABLE_TYPE, null, Collections.emptyMap()); + GraphQlWebSocketHandler.MAP_RESOLVABLE_TYPE, null, Collections.emptyMap()); } private void assertMessageType(WebSocketMessage message, String messageType) { diff --git a/spring-graphql/src/test/java/org/springframework/graphql/web/webmvc/GraphQLWebSocketHandlerTests.java b/spring-graphql/src/test/java/org/springframework/graphql/web/webmvc/GraphQlWebSocketHandlerTests.java similarity index 92% rename from spring-graphql/src/test/java/org/springframework/graphql/web/webmvc/GraphQLWebSocketHandlerTests.java rename to spring-graphql/src/test/java/org/springframework/graphql/web/webmvc/GraphQlWebSocketHandlerTests.java index 76f881e6..c29e558c 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/web/webmvc/GraphQLWebSocketHandlerTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/web/webmvc/GraphQlWebSocketHandlerTests.java @@ -31,11 +31,11 @@ import org.junit.jupiter.api.Test; import reactor.test.StepVerifier; import org.springframework.core.io.ClassPathResource; -import org.springframework.graphql.execution.ExecutionGraphQLService; -import org.springframework.graphql.execution.GraphQLSource; +import org.springframework.graphql.execution.ExecutionGraphQlService; +import org.springframework.graphql.execution.GraphQlSource; import org.springframework.graphql.web.ConsumeOneAndNeverCompleteInterceptor; -import org.springframework.graphql.web.GraphQLDataFetchers; -import org.springframework.graphql.web.WebGraphQLHandler; +import org.springframework.graphql.web.GraphQlDataFetchers; +import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.web.WebInterceptor; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpInputMessage; @@ -52,9 +52,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.InstanceOfAssertFactories.map; /** - * Unit tests for {@link GraphQLWebSocketHandler}. + * Unit tests for {@link GraphQlWebSocketHandler}. */ -public class GraphQLWebSocketHandlerTests { +public class GraphQlWebSocketHandlerTests { private static final String SUBSCRIPTION_ID = "123"; @@ -76,7 +76,7 @@ public class GraphQLWebSocketHandlerTests { private final TestWebSocketSession session = new TestWebSocketSession(); - private final GraphQLWebSocketHandler handler = + private final GraphQlWebSocketHandler handler = initWebSocketHandler(Collections.emptyList(), Duration.ofSeconds(60)); @@ -192,7 +192,7 @@ public class GraphQLWebSocketHandlerTests { @Test void connectionInitTimeout() { - GraphQLWebSocketHandler handler = initWebSocketHandler(Collections.emptyList(), Duration.ofMillis(50)); + GraphQlWebSocketHandler handler = initWebSocketHandler(Collections.emptyList(), Duration.ofMillis(50)); handler.afterConnectionEstablished(session); StepVerifier.create(session.closeStatus()) @@ -202,7 +202,7 @@ public class GraphQLWebSocketHandlerTests { @Test void subscriptionExists() throws Exception { - GraphQLWebSocketHandler handler = initWebSocketHandler( + GraphQlWebSocketHandler handler = initWebSocketHandler( Collections.singletonList(new ConsumeOneAndNeverCompleteInterceptor()), null); handler.afterConnectionEstablished(session); @@ -225,7 +225,7 @@ public class GraphQLWebSocketHandlerTests { @Test void clientCompletion() throws Exception { - GraphQLWebSocketHandler handler = initWebSocketHandler( + GraphQlWebSocketHandler handler = initWebSocketHandler( Collections.singletonList(new ConsumeOneAndNeverCompleteInterceptor()), null); handler.afterConnectionEstablished(session); @@ -254,15 +254,15 @@ public class GraphQLWebSocketHandlerTests { } - private GraphQLWebSocketHandler initWebSocketHandler( + private GraphQlWebSocketHandler initWebSocketHandler( @Nullable List interceptors, @Nullable Duration initTimeoutDuration) { try { - WebGraphQLHandler graphQLHandler = WebInterceptor.createHandler( + WebGraphQlHandler graphQlHandler = WebInterceptor.createHandler( (interceptors != null ? interceptors : Collections.emptyList()), - new ExecutionGraphQLService(graphQLSource())); + new ExecutionGraphQlService(graphQlSource())); - return new GraphQLWebSocketHandler(graphQLHandler, converter, + return new GraphQlWebSocketHandler(graphQlHandler, converter, (initTimeoutDuration != null ? initTimeoutDuration : Duration.ofSeconds(60))); } catch (Exception ex) { @@ -270,13 +270,13 @@ public class GraphQLWebSocketHandlerTests { } } - private static GraphQLSource graphQLSource() { + private static GraphQlSource graphQlSource() { RuntimeWiring.Builder builder = RuntimeWiring.newRuntimeWiring(); - builder.type(newTypeWiring("Query").dataFetcher("bookById", GraphQLDataFetchers.getBookByIdDataFetcher())); - builder.type(newTypeWiring("Subscription").dataFetcher("bookSearch", GraphQLDataFetchers.getBooksOnSale())); + builder.type(newTypeWiring("Query").dataFetcher("bookById", GraphQlDataFetchers.getBookByIdDataFetcher())); + builder.type(newTypeWiring("Subscription").dataFetcher("bookSearch", GraphQlDataFetchers.getBooksOnSale())); RuntimeWiring runtimeWiring = builder.build(); - return GraphQLSource.builder() + return GraphQlSource.builder() .schemaResource(new ClassPathResource("books/schema.graphqls")) .runtimeWiring(runtimeWiring) .build();