Start building against Spring GraphQL 1.2.5 snapshots
See gh-39482
This commit is contained in:
		
							parent
							
								
									4b37228cfa
								
							
						
					
					
						commit
						dada1378bd
					
				| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2020-2023 the original author or authors.
 | 
					 * Copyright 2020-2024 the original author or authors.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 * you may not use this file except in compliance with the License.
 | 
					 * you may not use this file except in compliance with the License.
 | 
				
			||||||
| 
						 | 
					@ -46,14 +46,12 @@ import org.springframework.security.core.userdetails.UserDetails;
 | 
				
			||||||
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
 | 
					import org.springframework.security.provisioning.InMemoryUserDetailsManager;
 | 
				
			||||||
import org.springframework.security.web.DefaultSecurityFilterChain;
 | 
					import org.springframework.security.web.DefaultSecurityFilterChain;
 | 
				
			||||||
import org.springframework.test.web.servlet.MockMvc;
 | 
					import org.springframework.test.web.servlet.MockMvc;
 | 
				
			||||||
import org.springframework.test.web.servlet.MvcResult;
 | 
					 | 
				
			||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
 | 
					import org.springframework.test.web.servlet.setup.MockMvcBuilders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static org.assertj.core.api.Assertions.assertThat;
 | 
					import static org.assertj.core.api.Assertions.assertThat;
 | 
				
			||||||
import static org.springframework.security.config.Customizer.withDefaults;
 | 
					import static org.springframework.security.config.Customizer.withDefaults;
 | 
				
			||||||
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user;
 | 
					import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user;
 | 
				
			||||||
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity;
 | 
					import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity;
 | 
				
			||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.asyncDispatch;
 | 
					 | 
				
			||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
 | 
					import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
 | 
				
			||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
 | 
					import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
 | 
				
			||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
 | 
					import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
 | 
				
			||||||
| 
						 | 
					@ -84,8 +82,7 @@ class GraphQlWebMvcSecurityAutoConfigurationTests {
 | 
				
			||||||
	void anonymousUserShouldBeUnauthorized() {
 | 
						void anonymousUserShouldBeUnauthorized() {
 | 
				
			||||||
		testWith((mockMvc) -> {
 | 
							testWith((mockMvc) -> {
 | 
				
			||||||
			String query = "{ bookById(id: \\\"book-1\\\"){ id name pageCount author }}";
 | 
								String query = "{ bookById(id: \\\"book-1\\\"){ id name pageCount author }}";
 | 
				
			||||||
			MvcResult result = mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}")).andReturn();
 | 
								mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}"))
 | 
				
			||||||
			mockMvc.perform(asyncDispatch(result))
 | 
					 | 
				
			||||||
				.andExpect(status().isOk())
 | 
									.andExpect(status().isOk())
 | 
				
			||||||
				.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
 | 
									.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
 | 
				
			||||||
				.andExpect(jsonPath("data.bookById.name").doesNotExist())
 | 
									.andExpect(jsonPath("data.bookById.name").doesNotExist())
 | 
				
			||||||
| 
						 | 
					@ -97,10 +94,7 @@ class GraphQlWebMvcSecurityAutoConfigurationTests {
 | 
				
			||||||
	void authenticatedUserShouldGetData() {
 | 
						void authenticatedUserShouldGetData() {
 | 
				
			||||||
		testWith((mockMvc) -> {
 | 
							testWith((mockMvc) -> {
 | 
				
			||||||
			String query = "{  bookById(id: \\\"book-1\\\"){ id name pageCount author }}";
 | 
								String query = "{  bookById(id: \\\"book-1\\\"){ id name pageCount author }}";
 | 
				
			||||||
			MvcResult result = mockMvc
 | 
								mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}").with(user("rob")))
 | 
				
			||||||
				.perform(post("/graphql").content("{\"query\": \"" + query + "\"}").with(user("rob")))
 | 
					 | 
				
			||||||
				.andReturn();
 | 
					 | 
				
			||||||
			mockMvc.perform(asyncDispatch(result))
 | 
					 | 
				
			||||||
				.andExpect(status().isOk())
 | 
									.andExpect(status().isOk())
 | 
				
			||||||
				.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
 | 
									.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
 | 
				
			||||||
				.andExpect(jsonPath("data.bookById.name").value("GraphQL for beginners"))
 | 
									.andExpect(jsonPath("data.bookById.name").value("GraphQL for beginners"))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2012-2023 the original author or authors.
 | 
					 * Copyright 2012-2024 the original author or authors.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 * you may not use this file except in compliance with the License.
 | 
					 * you may not use this file except in compliance with the License.
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,6 @@ import org.springframework.graphql.server.webmvc.GraphQlWebSocketHandler;
 | 
				
			||||||
import org.springframework.http.HttpHeaders;
 | 
					import org.springframework.http.HttpHeaders;
 | 
				
			||||||
import org.springframework.http.MediaType;
 | 
					import org.springframework.http.MediaType;
 | 
				
			||||||
import org.springframework.test.web.servlet.MockMvc;
 | 
					import org.springframework.test.web.servlet.MockMvc;
 | 
				
			||||||
import org.springframework.test.web.servlet.MvcResult;
 | 
					 | 
				
			||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
 | 
					import org.springframework.test.web.servlet.setup.MockMvcBuilders;
 | 
				
			||||||
import org.springframework.web.servlet.HandlerMapping;
 | 
					import org.springframework.web.servlet.HandlerMapping;
 | 
				
			||||||
import org.springframework.web.servlet.function.RouterFunction;
 | 
					import org.springframework.web.servlet.function.RouterFunction;
 | 
				
			||||||
| 
						 | 
					@ -52,7 +51,6 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
 | 
				
			||||||
import org.springframework.web.socket.server.support.WebSocketHandlerMapping;
 | 
					import org.springframework.web.socket.server.support.WebSocketHandlerMapping;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static org.assertj.core.api.Assertions.assertThat;
 | 
					import static org.assertj.core.api.Assertions.assertThat;
 | 
				
			||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.asyncDispatch;
 | 
					 | 
				
			||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
 | 
					import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
 | 
				
			||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
 | 
					import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
 | 
				
			||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
 | 
					import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
 | 
				
			||||||
| 
						 | 
					@ -88,8 +86,7 @@ class GraphQlWebMvcAutoConfigurationTests {
 | 
				
			||||||
	void simpleQueryShouldWork() {
 | 
						void simpleQueryShouldWork() {
 | 
				
			||||||
		testWith((mockMvc) -> {
 | 
							testWith((mockMvc) -> {
 | 
				
			||||||
			String query = "{ bookById(id: \\\"book-1\\\"){ id name pageCount author } }";
 | 
								String query = "{ bookById(id: \\\"book-1\\\"){ id name pageCount author } }";
 | 
				
			||||||
			MvcResult result = mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}")).andReturn();
 | 
								mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}"))
 | 
				
			||||||
			mockMvc.perform(asyncDispatch(result))
 | 
					 | 
				
			||||||
				.andExpect(status().isOk())
 | 
									.andExpect(status().isOk())
 | 
				
			||||||
				.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_GRAPHQL_RESPONSE))
 | 
									.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_GRAPHQL_RESPONSE))
 | 
				
			||||||
				.andExpect(jsonPath("data.bookById.name").value("GraphQL for beginners"));
 | 
									.andExpect(jsonPath("data.bookById.name").value("GraphQL for beginners"));
 | 
				
			||||||
| 
						 | 
					@ -120,8 +117,7 @@ class GraphQlWebMvcAutoConfigurationTests {
 | 
				
			||||||
	void shouldConfigureWebInterceptors() {
 | 
						void shouldConfigureWebInterceptors() {
 | 
				
			||||||
		testWith((mockMvc) -> {
 | 
							testWith((mockMvc) -> {
 | 
				
			||||||
			String query = "{ bookById(id: \\\"book-1\\\"){ id name pageCount author } }";
 | 
								String query = "{ bookById(id: \\\"book-1\\\"){ id name pageCount author } }";
 | 
				
			||||||
			MvcResult result = mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}")).andReturn();
 | 
								mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}"))
 | 
				
			||||||
			mockMvc.perform(asyncDispatch(result))
 | 
					 | 
				
			||||||
				.andExpect(status().isOk())
 | 
									.andExpect(status().isOk())
 | 
				
			||||||
				.andExpect(header().string("X-Custom-Header", "42"));
 | 
									.andExpect(header().string("X-Custom-Header", "42"));
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
| 
						 | 
					@ -152,12 +148,10 @@ class GraphQlWebMvcAutoConfigurationTests {
 | 
				
			||||||
		testWith((mockMvc) -> {
 | 
							testWith((mockMvc) -> {
 | 
				
			||||||
			String query = "{" + "  bookById(id: \\\"book-1\\\"){ " + "    id" + "    name" + "    pageCount"
 | 
								String query = "{" + "  bookById(id: \\\"book-1\\\"){ " + "    id" + "    name" + "    pageCount"
 | 
				
			||||||
					+ "    author" + "  }" + "}";
 | 
										+ "    author" + "  }" + "}";
 | 
				
			||||||
			MvcResult result = mockMvc
 | 
								mockMvc
 | 
				
			||||||
				.perform(post("/graphql").header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST")
 | 
									.perform(post("/graphql").header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST")
 | 
				
			||||||
					.header(HttpHeaders.ORIGIN, "https://example.com")
 | 
										.header(HttpHeaders.ORIGIN, "https://example.com")
 | 
				
			||||||
					.content("{\"query\": \"" + query + "\"}"))
 | 
										.content("{\"query\": \"" + query + "\"}"))
 | 
				
			||||||
				.andReturn();
 | 
					 | 
				
			||||||
			mockMvc.perform(asyncDispatch(result))
 | 
					 | 
				
			||||||
				.andExpect(status().isOk())
 | 
									.andExpect(status().isOk())
 | 
				
			||||||
				.andExpect(header().stringValues(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "https://example.com"))
 | 
									.andExpect(header().stringValues(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "https://example.com"))
 | 
				
			||||||
				.andExpect(header().stringValues(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"));
 | 
									.andExpect(header().stringValues(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1537,7 +1537,7 @@ bom {
 | 
				
			||||||
			]
 | 
								]
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	library("Spring GraphQL", "1.2.4") {
 | 
						library("Spring GraphQL", "1.2.5-SNAPSHOT") {
 | 
				
			||||||
		considerSnapshots()
 | 
							considerSnapshots()
 | 
				
			||||||
		group("org.springframework.graphql") {
 | 
							group("org.springframework.graphql") {
 | 
				
			||||||
			modules = [
 | 
								modules = [
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue