Skip to content

Commit 33b4878

Browse files
committed
Start building against Spring GraphQL 1.3.0-M1 snapshots
See gh-39495
1 parent 84b9ebe commit 33b4878

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/security/GraphQlWebMvcSecurityAutoConfigurationTests.java

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2023 the original author or authors.
2+
* Copyright 2020-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,14 +46,12 @@
4646
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
4747
import org.springframework.security.web.DefaultSecurityFilterChain;
4848
import org.springframework.test.web.servlet.MockMvc;
49-
import org.springframework.test.web.servlet.MvcResult;
5049
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
5150

5251
import static org.assertj.core.api.Assertions.assertThat;
5352
import static org.springframework.security.config.Customizer.withDefaults;
5453
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user;
5554
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity;
56-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.asyncDispatch;
5755
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
5856
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
5957
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
@@ -84,8 +82,7 @@ void contributesSecurityComponents() {
8482
void anonymousUserShouldBeUnauthorized() {
8583
testWith((mockMvc) -> {
8684
String query = "{ bookById(id: \\\"book-1\\\"){ id name pageCount author }}";
87-
MvcResult result = mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}")).andReturn();
88-
mockMvc.perform(asyncDispatch(result))
85+
mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}"))
8986
.andExpect(status().isOk())
9087
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
9188
.andExpect(jsonPath("data.bookById.name").doesNotExist())
@@ -97,10 +94,7 @@ void anonymousUserShouldBeUnauthorized() {
9794
void authenticatedUserShouldGetData() {
9895
testWith((mockMvc) -> {
9996
String query = "{ bookById(id: \\\"book-1\\\"){ id name pageCount author }}";
100-
MvcResult result = mockMvc
101-
.perform(post("/graphql").content("{\"query\": \"" + query + "\"}").with(user("rob")))
102-
.andReturn();
103-
mockMvc.perform(asyncDispatch(result))
97+
mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}").with(user("rob")))
10498
.andExpect(status().isOk())
10599
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
106100
.andExpect(jsonPath("data.bookById.name").value("GraphQL for beginners"))

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfigurationTests.java

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,7 +43,6 @@
4343
import org.springframework.http.HttpHeaders;
4444
import org.springframework.http.MediaType;
4545
import org.springframework.test.web.servlet.MockMvc;
46-
import org.springframework.test.web.servlet.MvcResult;
4746
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
4847
import org.springframework.web.servlet.HandlerMapping;
4948
import org.springframework.web.servlet.function.RouterFunction;
@@ -52,7 +51,6 @@
5251
import org.springframework.web.socket.server.support.WebSocketHandlerMapping;
5352

5453
import static org.assertj.core.api.Assertions.assertThat;
55-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.asyncDispatch;
5654
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
5755
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
5856
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
@@ -88,8 +86,7 @@ void shouldContributeDefaultBeans() {
8886
void simpleQueryShouldWork() {
8987
testWith((mockMvc) -> {
9088
String query = "{ bookById(id: \\\"book-1\\\"){ id name pageCount author } }";
91-
MvcResult result = mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}")).andReturn();
92-
mockMvc.perform(asyncDispatch(result))
89+
mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}"))
9390
.andExpect(status().isOk())
9491
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_GRAPHQL_RESPONSE))
9592
.andExpect(jsonPath("data.bookById.name").value("GraphQL for beginners"));
@@ -120,8 +117,7 @@ void shouldRejectQueryWithInvalidJson() {
120117
void shouldConfigureWebInterceptors() {
121118
testWith((mockMvc) -> {
122119
String query = "{ bookById(id: \\\"book-1\\\"){ id name pageCount author } }";
123-
MvcResult result = mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}")).andReturn();
124-
mockMvc.perform(asyncDispatch(result))
120+
mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}"))
125121
.andExpect(status().isOk())
126122
.andExpect(header().string("X-Custom-Header", "42"));
127123
});
@@ -152,12 +148,10 @@ void shouldSupportCors() {
152148
testWith((mockMvc) -> {
153149
String query = "{" + " bookById(id: \\\"book-1\\\"){ " + " id" + " name" + " pageCount"
154150
+ " author" + " }" + "}";
155-
MvcResult result = mockMvc
151+
mockMvc
156152
.perform(post("/graphql").header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST")
157153
.header(HttpHeaders.ORIGIN, "https://example.com")
158154
.content("{\"query\": \"" + query + "\"}"))
159-
.andReturn();
160-
mockMvc.perform(asyncDispatch(result))
161155
.andExpect(status().isOk())
162156
.andExpect(header().stringValues(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "https://example.com"))
163157
.andExpect(header().stringValues(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"));

spring-boot-project/spring-boot-dependencies/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ bom {
14661466
]
14671467
}
14681468
}
1469-
library("Spring GraphQL", "1.2.4") {
1469+
library("Spring GraphQL", "1.3.0-SNAPSHOT") {
14701470
considerSnapshots()
14711471
group("org.springframework.graphql") {
14721472
modules = [

0 commit comments

Comments
 (0)