From 2b3c70af590a40f2fec34215dd54deb330d74911 Mon Sep 17 00:00:00 2001 From: Andreas Berger Date: Sun, 2 Feb 2020 18:02:11 +0100 Subject: [PATCH] create .editorconfig file and apply codestyle --- .editorconfig | 285 ++++++++++++++++++ graphql-spqr-spring-boot-annotations/pom.xml | 3 +- .../annotations/WithResolverBuilder.java | 2 + .../pom.xml | 3 +- .../autoconfigure/MvcAutoConfiguration.java | 4 +- .../WebSocketAutoConfiguration.java | 2 +- .../spring/modules/reactive/FluxAdapter.java | 2 +- .../spqr/spring/web/GraphQLController.java | 14 +- .../spqr/spring/web/GraphQLExecutor.java | 2 +- .../web/apollo/ApolloProtocolHandler.java | 2 +- .../apollo/PerConnectionApolloHandler.java | 3 +- .../src/main/resources/playground.html | 3 +- ...lobalConfig_SpqrAutoConfigurationTest.java | 8 +- .../test/ResolverBuilder_TestConfig.java | 2 +- .../ResolverBuilder_TestReactiveConfig.java | 6 +- .../spring/web/GraphQLControllerTest.java | 44 +-- graphql-spqr-spring-boot-starter/pom.xml | 3 +- pom.xml | 3 +- 18 files changed, 341 insertions(+), 50 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..253b6b5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,285 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = false +max_line_length = 120 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = false +ij_smart_tabs = false +ij_wrap_on_typing = false + +[*.java] +ij_smart_tabs = true +ij_java_align_consecutive_assignments = false +ij_java_align_consecutive_variable_declarations = false +ij_java_align_group_field_declarations = false +ij_java_align_multiline_annotation_parameters = false +ij_java_align_multiline_array_initializer_expression = false +ij_java_align_multiline_assignment = false +ij_java_align_multiline_binary_operation = false +ij_java_align_multiline_chained_methods = false +ij_java_align_multiline_extends_list = false +ij_java_align_multiline_for = true +ij_java_align_multiline_method_parentheses = false +ij_java_align_multiline_parameters = true +ij_java_align_multiline_parameters_in_calls = false +ij_java_align_multiline_parenthesized_expression = false +ij_java_align_multiline_resources = true +ij_java_align_multiline_ternary_operation = false +ij_java_align_multiline_text_blocks = false +ij_java_align_multiline_throws_list = false +ij_java_align_subsequent_simple_methods = false +ij_java_align_throws_keyword = false +ij_java_annotation_parameter_wrap = off +ij_java_array_initializer_new_line_after_left_brace = false +ij_java_array_initializer_right_brace_on_new_line = false +ij_java_array_initializer_wrap = off +ij_java_assert_statement_colon_on_next_line = false +ij_java_assert_statement_wrap = off +ij_java_assignment_wrap = off +ij_java_binary_operation_sign_on_next_line = false +ij_java_binary_operation_wrap = off +ij_java_blank_lines_after_anonymous_class_header = 0 +ij_java_blank_lines_after_class_header = 0 +ij_java_blank_lines_after_imports = 1 +ij_java_blank_lines_after_package = 1 +ij_java_blank_lines_around_class = 1 +ij_java_blank_lines_around_field = 0 +ij_java_blank_lines_around_field_in_interface = 0 +ij_java_blank_lines_around_initializer = 1 +ij_java_blank_lines_around_method = 1 +ij_java_blank_lines_around_method_in_interface = 1 +ij_java_blank_lines_before_class_end = 0 +ij_java_blank_lines_before_imports = 1 +ij_java_blank_lines_before_method_body = 0 +ij_java_blank_lines_before_package = 0 +ij_java_block_brace_style = next_line_if_wrapped +ij_java_block_comment_at_first_column = true +ij_java_call_parameters_new_line_after_left_paren = false +ij_java_call_parameters_right_paren_on_new_line = false +ij_java_call_parameters_wrap = off +ij_java_case_statement_on_separate_line = true +ij_java_catch_on_new_line = false +ij_java_class_annotation_wrap = split_into_lines +ij_java_class_brace_style = end_of_line +ij_java_class_count_to_use_import_on_demand = 99 +ij_java_class_names_in_javadoc = 1 +ij_java_do_not_indent_top_level_class_members = false +ij_java_do_not_wrap_after_single_annotation = false +ij_java_do_while_brace_force = never +ij_java_doc_add_blank_line_after_description = true +ij_java_doc_add_blank_line_after_param_comments = false +ij_java_doc_add_blank_line_after_return = false +ij_java_doc_add_p_tag_on_empty_lines = true +ij_java_doc_align_exception_comments = true +ij_java_doc_align_param_comments = false +ij_java_doc_do_not_wrap_if_one_line = false +ij_java_doc_enable_formatting = true +ij_java_doc_enable_leading_asterisks = true +ij_java_doc_indent_on_continuation = false +ij_java_doc_keep_empty_lines = true +ij_java_doc_keep_empty_parameter_tag = true +ij_java_doc_keep_empty_return_tag = true +ij_java_doc_keep_empty_throws_tag = true +ij_java_doc_keep_invalid_tags = true +ij_java_doc_param_description_on_new_line = false +ij_java_doc_preserve_line_breaks = false +ij_java_doc_use_throws_not_exception_tag = true +ij_java_else_on_new_line = false +ij_java_entity_dd_suffix = EJB +ij_java_entity_eb_suffix = Bean +ij_java_entity_hi_suffix = Home +ij_java_entity_lhi_prefix = Local +ij_java_entity_lhi_suffix = Home +ij_java_entity_li_prefix = Local +ij_java_entity_pk_class = java.lang.String +ij_java_entity_vo_suffix = VO +ij_java_enum_constants_wrap = off +ij_java_extends_keyword_wrap = off +ij_java_extends_list_wrap = off +ij_java_field_annotation_wrap = split_into_lines +ij_java_finally_on_new_line = false +ij_java_for_brace_force = never +ij_java_for_statement_new_line_after_left_paren = false +ij_java_for_statement_right_paren_on_new_line = false +ij_java_for_statement_wrap = off +ij_java_generate_final_locals = false +ij_java_generate_final_parameters = false +ij_java_if_brace_force = never +ij_java_imports_layout = *, |, javax.**, java.**, |, $* +ij_java_indent_case_from_switch = true +ij_java_insert_inner_class_imports = false +ij_java_insert_override_annotation = true +ij_java_keep_blank_lines_before_right_brace = 2 +ij_java_keep_blank_lines_between_package_declaration_and_header = 2 +ij_java_keep_blank_lines_in_code = 2 +ij_java_keep_blank_lines_in_declarations = 2 +ij_java_keep_control_statement_in_one_line = true +ij_java_keep_first_column_comment = true +ij_java_keep_indents_on_empty_lines = false +ij_java_keep_line_breaks = true +ij_java_keep_multiple_expressions_in_one_line = false +ij_java_keep_simple_blocks_in_one_line = false +ij_java_keep_simple_classes_in_one_line = false +ij_java_keep_simple_lambdas_in_one_line = false +ij_java_keep_simple_methods_in_one_line = false +ij_java_label_indent_absolute = false +ij_java_label_indent_size = 0 +ij_java_lambda_brace_style = end_of_line +ij_java_layout_static_imports_separately = true +ij_java_line_comment_add_space = false +ij_java_line_comment_at_first_column = true +ij_java_message_dd_suffix = EJB +ij_java_message_eb_suffix = Bean +ij_java_method_annotation_wrap = split_into_lines +ij_java_method_brace_style = end_of_line +ij_java_method_call_chain_wrap = off +ij_java_method_parameters_new_line_after_left_paren = false +ij_java_method_parameters_right_paren_on_new_line = false +ij_java_method_parameters_wrap = off +ij_java_modifier_list_wrap = false +ij_java_names_count_to_use_import_on_demand = 99 +ij_java_packages_to_use_import_on_demand = java.awt.*, javax.swing.* +ij_java_parameter_annotation_wrap = off +ij_java_parentheses_expression_new_line_after_left_paren = false +ij_java_parentheses_expression_right_paren_on_new_line = false +ij_java_place_assignment_sign_on_next_line = false +ij_java_prefer_longer_names = true +ij_java_prefer_parameters_wrap = false +ij_java_repeat_synchronized = true +ij_java_replace_instanceof_and_cast = false +ij_java_replace_null_check = true +ij_java_replace_sum_lambda_with_method_ref = true +ij_java_resource_list_new_line_after_left_paren = false +ij_java_resource_list_right_paren_on_new_line = false +ij_java_resource_list_wrap = off +ij_java_session_dd_suffix = EJB +ij_java_session_eb_suffix = Bean +ij_java_session_hi_suffix = Home +ij_java_session_lhi_prefix = Local +ij_java_session_lhi_suffix = Home +ij_java_session_li_prefix = Local +ij_java_session_si_suffix = Service +ij_java_space_after_closing_angle_bracket_in_type_argument = false +ij_java_space_after_colon = true +ij_java_space_after_comma = true +ij_java_space_after_comma_in_type_arguments = true +ij_java_space_after_for_semicolon = true +ij_java_space_after_quest = true +ij_java_space_after_type_cast = true +ij_java_space_before_annotation_array_initializer_left_brace = false +ij_java_space_before_annotation_parameter_list = false +ij_java_space_before_array_initializer_left_brace = true +ij_java_space_before_catch_keyword = true +ij_java_space_before_catch_left_brace = true +ij_java_space_before_catch_parentheses = true +ij_java_space_before_class_left_brace = true +ij_java_space_before_colon = true +ij_java_space_before_colon_in_foreach = true +ij_java_space_before_comma = false +ij_java_space_before_do_left_brace = true +ij_java_space_before_else_keyword = true +ij_java_space_before_else_left_brace = true +ij_java_space_before_finally_keyword = true +ij_java_space_before_finally_left_brace = true +ij_java_space_before_for_left_brace = true +ij_java_space_before_for_parentheses = true +ij_java_space_before_for_semicolon = false +ij_java_space_before_if_left_brace = true +ij_java_space_before_if_parentheses = true +ij_java_space_before_method_call_parentheses = false +ij_java_space_before_method_left_brace = true +ij_java_space_before_method_parentheses = false +ij_java_space_before_opening_angle_bracket_in_type_parameter = false +ij_java_space_before_quest = true +ij_java_space_before_switch_left_brace = true +ij_java_space_before_switch_parentheses = true +ij_java_space_before_synchronized_left_brace = true +ij_java_space_before_synchronized_parentheses = true +ij_java_space_before_try_left_brace = true +ij_java_space_before_try_parentheses = true +ij_java_space_before_type_parameter_list = false +ij_java_space_before_while_keyword = true +ij_java_space_before_while_left_brace = true +ij_java_space_before_while_parentheses = true +ij_java_space_inside_one_line_enum_braces = false +ij_java_space_within_empty_array_initializer_braces = false +ij_java_space_within_empty_method_call_parentheses = false +ij_java_space_within_empty_method_parentheses = false +ij_java_spaces_around_additive_operators = true +ij_java_spaces_around_assignment_operators = true +ij_java_spaces_around_bitwise_operators = true +ij_java_spaces_around_equality_operators = true +ij_java_spaces_around_lambda_arrow = true +ij_java_spaces_around_logical_operators = true +ij_java_spaces_around_method_ref_dbl_colon = false +ij_java_spaces_around_multiplicative_operators = true +ij_java_spaces_around_relational_operators = true +ij_java_spaces_around_shift_operators = true +ij_java_spaces_around_type_bounds_in_type_parameters = true +ij_java_spaces_around_unary_operator = false +ij_java_spaces_within_angle_brackets = false +ij_java_spaces_within_annotation_parentheses = false +ij_java_spaces_within_array_initializer_braces = false +ij_java_spaces_within_braces = false +ij_java_spaces_within_brackets = false +ij_java_spaces_within_cast_parentheses = false +ij_java_spaces_within_catch_parentheses = false +ij_java_spaces_within_for_parentheses = false +ij_java_spaces_within_if_parentheses = false +ij_java_spaces_within_method_call_parentheses = false +ij_java_spaces_within_method_parentheses = false +ij_java_spaces_within_parentheses = false +ij_java_spaces_within_switch_parentheses = false +ij_java_spaces_within_synchronized_parentheses = false +ij_java_spaces_within_try_parentheses = false +ij_java_spaces_within_while_parentheses = false +ij_java_special_else_if_treatment = true +ij_java_subclass_name_suffix = Impl +ij_java_ternary_operation_signs_on_next_line = false +ij_java_ternary_operation_wrap = off +ij_java_test_name_suffix = Test +ij_java_throws_keyword_wrap = off +ij_java_throws_list_wrap = off +ij_java_use_external_annotations = false +ij_java_use_fq_class_names = false +ij_java_use_relative_indents = false +ij_java_use_single_class_imports = true +ij_java_variable_annotation_wrap = off +ij_java_visibility = public +ij_java_while_brace_force = never +ij_java_while_on_new_line = false +ij_java_wrap_comments = false +ij_java_wrap_first_method_in_call_chain = false +ij_java_wrap_long_lines = false + +[{*.jhm, *.xjb, *.rng, *.wsdl, *.wsdd, *.fxml, *.bpmn, *.pom, *.xslt, *.jrxml, *.ant, *.xul, *.xsl, *.xsd, *.tld, *.jnlp, *.wadl, *.xml}] +ij_xml_block_comment_at_first_column = true +ij_xml_keep_indents_on_empty_lines = false +ij_xml_line_comment_at_first_column = true + +[{.eslintrc, .babelrc, .stylelintrc, jest.config, bowerrc, *.jsb3, *.jsb2, *.graphqlconfig, *.json}] +indent_size = 2 +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = true +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false + +[{spring.schemas, spring.handlers, *.properties}] +ij_properties_align_group_field_declarations = false + +[*.yml] +indent_size = 2 diff --git a/graphql-spqr-spring-boot-annotations/pom.xml b/graphql-spqr-spring-boot-annotations/pom.xml index b3118f2..2b59edc 100644 --- a/graphql-spqr-spring-boot-annotations/pom.xml +++ b/graphql-spqr-spring-boot-annotations/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 diff --git a/graphql-spqr-spring-boot-annotations/src/main/java/io/leangen/graphql/spqr/spring/annotations/WithResolverBuilder.java b/graphql-spqr-spring-boot-annotations/src/main/java/io/leangen/graphql/spqr/spring/annotations/WithResolverBuilder.java index c34b407..a6622b5 100644 --- a/graphql-spqr-spring-boot-annotations/src/main/java/io/leangen/graphql/spqr/spring/annotations/WithResolverBuilder.java +++ b/graphql-spqr-spring-boot-annotations/src/main/java/io/leangen/graphql/spqr/spring/annotations/WithResolverBuilder.java @@ -15,6 +15,8 @@ @Repeatable(WithResolverBuilders.class) public @interface WithResolverBuilder { Class value(); + String qualifierValue() default ""; + Class qualifierType() default Qualifier.class; } diff --git a/graphql-spqr-spring-boot-autoconfigure/pom.xml b/graphql-spqr-spring-boot-autoconfigure/pom.xml index ea909c9..e0140bd 100644 --- a/graphql-spqr-spring-boot-autoconfigure/pom.xml +++ b/graphql-spqr-spring-boot-autoconfigure/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 diff --git a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/autoconfigure/MvcAutoConfiguration.java b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/autoconfigure/MvcAutoConfiguration.java index 433db4a..9215f34 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/autoconfigure/MvcAutoConfiguration.java +++ b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/autoconfigure/MvcAutoConfiguration.java @@ -3,10 +3,10 @@ import graphql.GraphQL; import graphql.schema.GraphQLSchema; import io.leangen.graphql.spqr.spring.web.GraphQLController; -import io.leangen.graphql.spqr.spring.web.servlet.GraphQLServletExecutor; import io.leangen.graphql.spqr.spring.web.GuiController; -import io.leangen.graphql.spqr.spring.web.servlet.DefaultGraphQLExecutor; import io.leangen.graphql.spqr.spring.web.servlet.DefaultGraphQLController; +import io.leangen.graphql.spqr.spring.web.servlet.DefaultGraphQLExecutor; +import io.leangen.graphql.spqr.spring.web.servlet.GraphQLServletExecutor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; diff --git a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/autoconfigure/WebSocketAutoConfiguration.java b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/autoconfigure/WebSocketAutoConfiguration.java index 232a84a..cbf726c 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/autoconfigure/WebSocketAutoConfiguration.java +++ b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/autoconfigure/WebSocketAutoConfiguration.java @@ -2,9 +2,9 @@ import graphql.GraphQL; import graphql.schema.GraphQLSchema; -import io.leangen.graphql.spqr.spring.web.servlet.websocket.GraphQLWebSocketExecutor; import io.leangen.graphql.spqr.spring.web.apollo.PerConnectionApolloHandler; import io.leangen.graphql.spqr.spring.web.servlet.websocket.DefaultGraphQLExecutor; +import io.leangen.graphql.spqr.spring.web.servlet.websocket.GraphQLWebSocketExecutor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; diff --git a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/modules/reactive/FluxAdapter.java b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/modules/reactive/FluxAdapter.java index d5de26d..581c841 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/modules/reactive/FluxAdapter.java +++ b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/modules/reactive/FluxAdapter.java @@ -17,7 +17,7 @@ public Flux convertInput(CompletableFuture> substitute, AnnotatedType @Override protected Object convertOutputForNonSubscription(Publisher original, AnnotatedType type, ResolutionEnvironment resolutionEnvironment) { - return ((Flux)original).collectList().toFuture(); + return ((Flux) original).collectList().toFuture(); } @Override diff --git a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/GraphQLController.java b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/GraphQLController.java index e1b97af..86db267 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/GraphQLController.java +++ b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/GraphQLController.java @@ -33,8 +33,8 @@ public GraphQLController(GraphQL graphQL, GraphQLExecutor executor) { ) @ResponseBody public Object executeJsonPost(@RequestBody GraphQLRequest requestBody, - GraphQLRequest requestParams, - R request) { + GraphQLRequest requestParams, + R request) { String query = requestParams.getQuery() == null ? requestBody.getQuery() : requestParams.getQuery(); String operationName = requestParams.getOperationName() == null ? requestBody.getOperationName() : requestParams.getOperationName(); Map variables = requestParams.getVariables().isEmpty() ? requestBody.getVariables() : requestParams.getVariables(); @@ -49,8 +49,8 @@ public Object executeJsonPost(@RequestBody GraphQLRequest requestBody, ) @ResponseBody public Object executeGraphQLPost(@RequestBody String queryBody, - GraphQLRequest graphQLRequest, - R request) { + GraphQLRequest graphQLRequest, + R request) { String query = graphQLRequest.getQuery() == null ? queryBody : graphQLRequest.getQuery(); return executor.execute(graphQL, new GraphQLRequest(query, graphQLRequest.getOperationName(), graphQLRequest.getVariables()), request); } @@ -63,8 +63,8 @@ public Object executeGraphQLPost(@RequestBody String queryBody, ) @ResponseBody public Object executeFormPost(@RequestParam Map queryParams, - GraphQLRequest graphQLRequest, - R request) { + GraphQLRequest graphQLRequest, + R request) { String queryParam = queryParams.get("query"); String operationNameParam = queryParams.get("operationName"); @@ -77,7 +77,7 @@ public Object executeFormPost(@RequestParam Map queryParams, @GetMapping( value = "${graphql.spqr.http.endpoint:/graphql}", produces = MediaType.APPLICATION_JSON_VALUE, - headers = { "Connection!=Upgrade", "Connection!=keep-alive, Upgrade" } + headers = {"Connection!=Upgrade", "Connection!=keep-alive, Upgrade"} ) @ResponseBody public Object executeGet(GraphQLRequest graphQLRequest, R request) { diff --git a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/GraphQLExecutor.java b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/GraphQLExecutor.java index 9e5dfce..58998e4 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/GraphQLExecutor.java +++ b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/GraphQLExecutor.java @@ -13,7 +13,7 @@ public interface GraphQLExecutor { Object execute(GraphQL graphQL, GraphQLRequest graphQLRequest, R request); default ExecutionInput buildInput(GraphQLRequest graphQLRequest, R request, ContextFactory contextFactory, - DataLoaderRegistryFactory loaderFactory) { + DataLoaderRegistryFactory loaderFactory) { ExecutionInput.Builder inputBuilder = ExecutionInput.newExecutionInput() .query(graphQLRequest.getQuery()) .operationName(graphQLRequest.getOperationName()) diff --git a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/apollo/ApolloProtocolHandler.java b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/apollo/ApolloProtocolHandler.java index f91b799..62c661d 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/apollo/ApolloProtocolHandler.java +++ b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/apollo/ApolloProtocolHandler.java @@ -2,8 +2,8 @@ import graphql.ExecutionResult; import graphql.GraphQL; -import io.leangen.graphql.spqr.spring.web.servlet.websocket.GraphQLWebSocketExecutor; import io.leangen.graphql.spqr.spring.web.dto.GraphQLRequest; +import io.leangen.graphql.spqr.spring.web.servlet.websocket.GraphQLWebSocketExecutor; import org.reactivestreams.Publisher; import org.reactivestreams.Subscriber; import org.reactivestreams.Subscription; diff --git a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/apollo/PerConnectionApolloHandler.java b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/apollo/PerConnectionApolloHandler.java index b1b36ca..ec658af 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/apollo/PerConnectionApolloHandler.java +++ b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/apollo/PerConnectionApolloHandler.java @@ -56,8 +56,7 @@ public void handleTransportError(WebSocketSession session, Throwable exception) public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception { try { getHandler(session).afterConnectionClosed(session, closeStatus); - } - finally { + } finally { this.handlers.remove(session); } } diff --git a/graphql-spqr-spring-boot-autoconfigure/src/main/resources/playground.html b/graphql-spqr-spring-boot-autoconfigure/src/main/resources/playground.html index cc5c2e2..a38c9b9 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/main/resources/playground.html +++ b/graphql-spqr-spring-boot-autoconfigure/src/main/resources/playground.html @@ -3,7 +3,8 @@ - + ${pageTitle} diff --git a/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/autoconfigure/GlobalConfig_SpqrAutoConfigurationTest.java b/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/autoconfigure/GlobalConfig_SpqrAutoConfigurationTest.java index e8d3af9..0f36ca7 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/autoconfigure/GlobalConfig_SpqrAutoConfigurationTest.java +++ b/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/autoconfigure/GlobalConfig_SpqrAutoConfigurationTest.java @@ -176,7 +176,7 @@ public void valueMapperFactory_schemaGeneratorConfigTest() { assertNotNull(valueMapperFactory); - GlobalEnvironment mockEnv = new GlobalEnvironment(null,null, null, null, null, null, null, null); + GlobalEnvironment mockEnv = new GlobalEnvironment(null, null, null, null, null, null, null, null); ValueMapper valueMapper = valueMapperFactory.getValueMapper(Collections.emptyMap(), mockEnv); @@ -368,11 +368,11 @@ public void moduleExtensionProvider_schemaGeneratorConfigTest() { } @SuppressWarnings("unchecked") - private T getPrivateFieldValueFromObject(Object object, String fieldName){ + private T getPrivateFieldValueFromObject(Object object, String fieldName) { try { Field f = object.getClass().getDeclaredField(fieldName); f.setAccessible(true); - return (T) f.get(object); + return (T) f.get(object); } catch (NoSuchFieldException | IllegalAccessException e) { throw new RuntimeException("Error getting private field value", e); } @@ -385,7 +385,7 @@ static class TypeMapper_TestConfig { @GraphQLApi private class AnnotatedOperationSourceBean { @GraphQLQuery(name = "greetingFromAnnotatedSource_wiredAsComponent") - public String getGreeting(){ + public String getGreeting() { return "Hello world !"; } } diff --git a/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/test/ResolverBuilder_TestConfig.java b/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/test/ResolverBuilder_TestConfig.java index 977957e..a7229e5 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/test/ResolverBuilder_TestConfig.java +++ b/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/test/ResolverBuilder_TestConfig.java @@ -180,7 +180,7 @@ public static class SpringPageComponent { static List projects = IntStream.range(0, 20) .boxed() - .map(i -> new Project("Project"+i)) + .map(i -> new Project("Project" + i)) .collect(Collectors.toList()); diff --git a/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/test/ResolverBuilder_TestReactiveConfig.java b/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/test/ResolverBuilder_TestReactiveConfig.java index b8bc72b..66d992e 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/test/ResolverBuilder_TestReactiveConfig.java +++ b/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/test/ResolverBuilder_TestReactiveConfig.java @@ -14,13 +14,13 @@ public class ResolverBuilder_TestReactiveConfig { @GraphQLApi public static class AnnotatedOperationSourceReactiveBean { @GraphQLQuery(name = "greetingFromAnnotatedSourceReactive_mono") - public Mono getGreetingMono(){ + public Mono getGreetingMono() { return Mono.just("Hello world !"); } @GraphQLQuery(name = "greetingFromAnnotatedSourceReactive_flux") - public Flux getGreetingFlux(){ - return Flux.fromArray(new String[]{"First Hello world !","Second Hello world !"}); + public Flux getGreetingFlux() { + return Flux.fromArray(new String[] {"First Hello world !", "Second Hello world !"}); } } } diff --git a/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/web/GraphQLControllerTest.java b/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/web/GraphQLControllerTest.java index 3c26c17..6b39b07 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/web/GraphQLControllerTest.java +++ b/graphql-spqr-spring-boot-autoconfigure/src/test/java/io/leangen/graphql/spqr/spring/web/GraphQLControllerTest.java @@ -41,9 +41,9 @@ public class GraphQLControllerTest { @Test public void defaultControllerTest_POST_applicationGraphql_noQueryParams() throws Exception { mockMvc.perform( - post("/"+apiContext) - .contentType("application/graphql") - .content("{greetingFromBeanSource_wiredAsComponent_byAnnotation}")) + post("/" + apiContext) + .contentType("application/graphql") + .content("{greetingFromBeanSource_wiredAsComponent_byAnnotation}")) .andExpect(status().isOk()) .andExpect(content().string(containsString("Hello world"))); } @@ -51,7 +51,7 @@ public void defaultControllerTest_POST_applicationGraphql_noQueryParams() throws @Test public void defaultControllerTest_POST_applicationJson_noQueryParams() throws Exception { mockMvc.perform( - post("/"+apiContext) + post("/" + apiContext) .contentType(MediaType.APPLICATION_JSON) .content("{\"query\":\"{greetingFromBeanSource_wiredAsComponent_byAnnotation}\",\"variables\":null,\"operationName\":null}")) .andExpect(status().isOk()) @@ -61,9 +61,9 @@ public void defaultControllerTest_POST_applicationJson_noQueryParams() throws Ex @Test public void defaultControllerTest_POST_formUrlEncoded_noQueryParams() throws Exception { mockMvc.perform( - post("/"+apiContext) + post("/" + apiContext) .contentType(MediaType.APPLICATION_FORM_URLENCODED_VALUE) - .content("query="+ URLEncoder.encode("{greetingFromBeanSource_wiredAsComponent_byAnnotation}", StandardCharsets.UTF_8.toString()))) + .content("query=" + URLEncoder.encode("{greetingFromBeanSource_wiredAsComponent_byAnnotation}", StandardCharsets.UTF_8.toString()))) .andExpect(status().isOk()) .andExpect(content().string(containsString("Hello world"))); } @@ -71,8 +71,8 @@ public void defaultControllerTest_POST_formUrlEncoded_noQueryParams() throws Exc @Test public void defaultControllerTest_GET() throws Exception { mockMvc.perform( - get("/"+apiContext) - .param("query","{greetingFromBeanSource_wiredAsComponent_byAnnotation}")) + get("/" + apiContext) + .param("query", "{greetingFromBeanSource_wiredAsComponent_byAnnotation}")) .andExpect(status().isOk()) .andExpect(content().string(containsString("Hello world"))); } @@ -80,7 +80,7 @@ public void defaultControllerTest_GET() throws Exception { @Test public void defaultControllerTest_POST_applicationGraphql_INVALID() throws Exception { mockMvc.perform( - post("/"+apiContext) + post("/" + apiContext) .contentType("application/graphql") .content("{INVALID_QUERY}")) .andExpect(status().isOk()) @@ -90,8 +90,8 @@ public void defaultControllerTest_POST_applicationGraphql_INVALID() throws Excep @Test public void defaultControllerTest_POST_applicationGraphql_overridingQueryParams() throws Exception { mockMvc.perform( - post("/"+apiContext) - .param("query","{greetingFromBeanSource_wiredAsComponent_byAnnotation}") + post("/" + apiContext) + .param("query", "{greetingFromBeanSource_wiredAsComponent_byAnnotation}") .contentType("application/graphql") .content("{INVALID_QUERY}")) .andExpect(status().isOk()) @@ -101,7 +101,7 @@ public void defaultControllerTest_POST_applicationGraphql_overridingQueryParams( @Test public void defaultControllerTest_POST_applicationJson_INVALID() throws Exception { mockMvc.perform( - post("/"+apiContext) + post("/" + apiContext) .contentType(MediaType.APPLICATION_JSON) .content("{\"query\":\"{INVALID_QUERY}\",\"variables\":null,\"operationName\":null}")) .andExpect(status().isOk()) @@ -111,8 +111,8 @@ public void defaultControllerTest_POST_applicationJson_INVALID() throws Exceptio @Test public void defaultControllerTest_POST_applicationJson_overridingQueryParams() throws Exception { mockMvc.perform( - post("/"+apiContext) - .param("query","{greetingFromBeanSource_wiredAsComponent_byAnnotation}") + post("/" + apiContext) + .param("query", "{greetingFromBeanSource_wiredAsComponent_byAnnotation}") .contentType(MediaType.APPLICATION_JSON) .content("{\"query\":\"{INVALID_QUERY}\",\"variables\":null,\"operationName\":null}")) .andExpect(status().isOk()) @@ -122,9 +122,9 @@ public void defaultControllerTest_POST_applicationJson_overridingQueryParams() t @Test public void defaultControllerTest_POST_formUrlEncoded_INVALID() throws Exception { mockMvc.perform( - post("/"+apiContext) + post("/" + apiContext) .contentType(MediaType.APPLICATION_FORM_URLENCODED_VALUE) - .content("query="+ URLEncoder.encode("{INVALID_QUERY}", StandardCharsets.UTF_8.toString()))) + .content("query=" + URLEncoder.encode("{INVALID_QUERY}", StandardCharsets.UTF_8.toString()))) .andExpect(status().isOk()) .andExpect(content().string(containsString("FieldUndefined: Field 'INVALID_QUERY'"))); } @@ -132,10 +132,10 @@ public void defaultControllerTest_POST_formUrlEncoded_INVALID() throws Exception @Test public void defaultControllerTest_POST_formUrlEncoded_overridingQueryParams() throws Exception { mockMvc.perform( - post("/"+apiContext) - .param("query","{greetingFromBeanSource_wiredAsComponent_byAnnotation}") + post("/" + apiContext) + .param("query", "{greetingFromBeanSource_wiredAsComponent_byAnnotation}") .contentType(MediaType.APPLICATION_FORM_URLENCODED_VALUE) - .content("query="+ URLEncoder.encode("{INVALID_QUERY}", StandardCharsets.UTF_8.toString()))) + .content("query=" + URLEncoder.encode("{INVALID_QUERY}", StandardCharsets.UTF_8.toString()))) .andExpect(status().isOk()) .andExpect(content().string(containsString("Hello world"))); } @@ -143,7 +143,7 @@ public void defaultControllerTest_POST_formUrlEncoded_overridingQueryParams() th @Test public void defaultControllerTest_POST_spring_page() throws Exception { - String withPage ="{\n" + + String withPage = "{\n" + " springPageComponent_users(first:3,after:\"2id\") {\n" + " pageInfo {\n" + " startCursor\n" + @@ -173,8 +173,8 @@ public void defaultControllerTest_POST_spring_page() throws Exception { "}\n"; mockMvc.perform( - get("/"+apiContext) - .param("query",withPage)) + get("/" + apiContext) + .param("query", withPage)) .andExpect(status().isOk()) .andExpect(content().string(equalToCompressingWhiteSpace("{" + "\"data\":{\"springPageComponent_users\":{\"pageInfo\":{\"startCursor\":\"1\",\"endCursor\":\"3\",\"hasNextPage\":true}," + diff --git a/graphql-spqr-spring-boot-starter/pom.xml b/graphql-spqr-spring-boot-starter/pom.xml index 2980e06..6563077 100644 --- a/graphql-spqr-spring-boot-starter/pom.xml +++ b/graphql-spqr-spring-boot-starter/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 diff --git a/pom.xml b/pom.xml index fd1546f..b9bfa55 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 io.leangen.graphql