Clean up warnings in spring-webflux module
This commit is contained in:
		
							parent
							
								
									ee379f8fc9
								
							
						
					
					
						commit
						d46c307f55
					
				| 
						 | 
				
			
			@ -630,6 +630,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
 | 
			
		|||
 | 
			
		||||
	private static class PreFlightAmbiguousMatchHandler {
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public void handle() {
 | 
			
		||||
			throw new UnsupportedOperationException("Not implemented");
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -438,6 +438,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
 | 
			
		|||
			return result;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public HttpHeaders handle() {
 | 
			
		||||
			return this.headers;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,6 @@ import reactor.core.publisher.Mono;
 | 
			
		|||
import org.springframework.core.MethodParameter;
 | 
			
		||||
import org.springframework.core.ReactiveAdapterRegistry;
 | 
			
		||||
import org.springframework.http.codec.HttpMessageReader;
 | 
			
		||||
import org.springframework.validation.Validator;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.reactive.BindingContext;
 | 
			
		||||
import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,11 +21,8 @@ import java.util.List;
 | 
			
		|||
import reactor.core.publisher.Mono;
 | 
			
		||||
 | 
			
		||||
import org.springframework.core.MethodParameter;
 | 
			
		||||
import org.springframework.core.ReactiveAdapter;
 | 
			
		||||
import org.springframework.core.ReactiveAdapterRegistry;
 | 
			
		||||
import org.springframework.core.ResolvableType;
 | 
			
		||||
import org.springframework.core.annotation.AnnotationUtils;
 | 
			
		||||
import org.springframework.http.HttpEntity;
 | 
			
		||||
import org.springframework.http.codec.HttpMessageWriter;
 | 
			
		||||
import org.springframework.web.bind.annotation.ResponseBody;
 | 
			
		||||
import org.springframework.web.reactive.HandlerResult;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,6 @@ import java.util.Locale;
 | 
			
		|||
 | 
			
		||||
import reactor.core.publisher.Mono;
 | 
			
		||||
 | 
			
		||||
import org.springframework.web.reactive.result.view.AbstractUrlBasedView;
 | 
			
		||||
import org.springframework.web.reactive.result.view.UrlBasedViewResolver;
 | 
			
		||||
import org.springframework.web.reactive.result.view.View;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,6 @@ package org.springframework.web.reactive;
 | 
			
		|||
import java.nio.charset.StandardCharsets;
 | 
			
		||||
import java.time.Duration;
 | 
			
		||||
 | 
			
		||||
import org.junit.Assume;
 | 
			
		||||
import org.junit.Before;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
import org.reactivestreams.Publisher;
 | 
			
		||||
| 
						 | 
				
			
			@ -29,23 +28,20 @@ import reactor.test.StepVerifier;
 | 
			
		|||
 | 
			
		||||
import org.springframework.core.io.buffer.DataBuffer;
 | 
			
		||||
import org.springframework.core.io.buffer.DataBufferFactory;
 | 
			
		||||
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
 | 
			
		||||
import org.springframework.http.server.reactive.AbstractHttpHandlerIntegrationTests;
 | 
			
		||||
import org.springframework.http.server.reactive.HttpHandler;
 | 
			
		||||
import org.springframework.http.server.reactive.ServerHttpRequest;
 | 
			
		||||
import org.springframework.http.server.reactive.ServerHttpResponse;
 | 
			
		||||
import org.springframework.http.server.reactive.bootstrap.RxNettyHttpServer;
 | 
			
		||||
import org.springframework.web.reactive.function.BodyExtractors;
 | 
			
		||||
import org.springframework.web.reactive.function.client.ExchangeFunction;
 | 
			
		||||
import org.springframework.web.reactive.function.client.ExchangeFunctions;
 | 
			
		||||
import org.springframework.web.reactive.function.client.WebClient;
 | 
			
		||||
import org.springframework.web.util.DefaultUriBuilderFactory;
 | 
			
		||||
import org.springframework.web.util.UriBuilderFactory;
 | 
			
		||||
 | 
			
		||||
import static org.junit.Assert.assertTrue;
 | 
			
		||||
import static org.junit.Assume.assumeFalse;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author Sebastien Deleuze
 | 
			
		||||
 * @since 5.0
 | 
			
		||||
 */
 | 
			
		||||
public class FlushingIntegrationTests extends AbstractHttpHandlerIntegrationTests {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +51,7 @@ public class FlushingIntegrationTests extends AbstractHttpHandlerIntegrationTest
 | 
			
		|||
	@Before
 | 
			
		||||
	public void setup() throws Exception {
 | 
			
		||||
		// TODO: fix failing RxNetty tests
 | 
			
		||||
		Assume.assumeFalse(this.server instanceof RxNettyHttpServer);
 | 
			
		||||
		assumeFalse(this.server instanceof RxNettyHttpServer);
 | 
			
		||||
 | 
			
		||||
		super.setup();
 | 
			
		||||
		this.webClient = WebClient.create("http://localhost:" + this.port);
 | 
			
		||||
| 
						 | 
				
			
			@ -118,7 +114,7 @@ public class FlushingIntegrationTests extends AbstractHttpHandlerIntegrationTest
 | 
			
		|||
			String path = request.getURI().getPath();
 | 
			
		||||
			if (path.endsWith("write-and-flush")) {
 | 
			
		||||
				Flux<Publisher<DataBuffer>> responseBody = Flux
 | 
			
		||||
						.intervalMillis(50)
 | 
			
		||||
						.interval(Duration.ofMillis(50))
 | 
			
		||||
						.map(l -> toDataBuffer("data" + l, response.bufferFactory()))
 | 
			
		||||
						.take(2)
 | 
			
		||||
						.map(Flux::just);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -258,6 +258,7 @@ public class BodyInsertersTests {
 | 
			
		|||
	interface SafeToSerialize {}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@SuppressWarnings("unused")
 | 
			
		||||
	private static class User {
 | 
			
		||||
 | 
			
		||||
		@JsonView(SafeToSerialize.class)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -171,10 +171,6 @@ public class DispatcherHandlerIntegrationTests extends AbstractHttpHandlerIntegr
 | 
			
		|||
					fromPublisher(Flux.just(person1, person2), Person.class));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public Mono<ServerResponse> view() {
 | 
			
		||||
			return ServerResponse.ok().render("foo", "bar");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private static class Person {
 | 
			
		||||
| 
						 | 
				
			
			@ -193,6 +189,7 @@ public class DispatcherHandlerIntegrationTests extends AbstractHttpHandlerIntegr
 | 
			
		|||
			return this.name;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public void setName(String name) {
 | 
			
		||||
			this.name = name;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -205,8 +202,7 @@ public class DispatcherHandlerIntegrationTests extends AbstractHttpHandlerIntegr
 | 
			
		|||
			if (o == null || getClass() != o.getClass()) {
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			Person
 | 
			
		||||
					person = (Person) o;
 | 
			
		||||
			Person person = (Person) o;
 | 
			
		||||
			return !(this.name != null ? !this.name.equals(person.name) : person.name != null);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -105,6 +105,7 @@ public class MockServerRequest implements ServerRequest {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	@SuppressWarnings("unchecked")
 | 
			
		||||
	public <S> S body(BodyExtractor<S, ? super ServerHttpRequest> extractor, Map<String, Object> hints) {
 | 
			
		||||
		return (S) this.body;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -124,6 +124,7 @@ public class PublisherHandlerFunctionIntegrationTests extends AbstractRouterFunc
 | 
			
		|||
			return name;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public void setName(String name) {
 | 
			
		||||
			this.name = name;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -140,11 +140,11 @@ public class SseHandlerFunctionIntegrationTests extends AbstractRouterFunctionIn
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@SuppressWarnings("unused")
 | 
			
		||||
	private static class Person {
 | 
			
		||||
 | 
			
		||||
		private String name;
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public Person() {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,7 @@
 | 
			
		|||
package org.springframework.web.reactive.resource;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.time.Duration;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
| 
						 | 
				
			
			@ -45,7 +46,7 @@ public class PathResourceResolverTests {
 | 
			
		|||
		Resource location = new ClassPathResource("test/", PathResourceResolver.class);
 | 
			
		||||
		String path = "bar.css";
 | 
			
		||||
		List<Resource> locations = singletonList(location);
 | 
			
		||||
		Resource actual = this.resolver.resolveResource(null, path, locations, null).blockMillis(5000);
 | 
			
		||||
		Resource actual = this.resolver.resolveResource(null, path, locations, null).block(Duration.ofMillis(5000));
 | 
			
		||||
		assertEquals(location.createRelative(path), actual);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -54,7 +55,7 @@ public class PathResourceResolverTests {
 | 
			
		|||
		Resource location = new ClassPathResource("/");
 | 
			
		||||
		String path = "org/springframework/web/reactive/resource/test/bar.css";
 | 
			
		||||
		List<Resource> locations = singletonList(location);
 | 
			
		||||
		Resource actual = this.resolver.resolveResource(null, path, locations, null).blockMillis(5000);
 | 
			
		||||
		Resource actual = this.resolver.resolveResource(null, path, locations, null).block(Duration.ofMillis(5000));
 | 
			
		||||
		assertNotNull(actual);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -79,7 +80,7 @@ public class PathResourceResolverTests {
 | 
			
		|||
 | 
			
		||||
	private void testCheckResource(Resource location, String requestPath) throws IOException {
 | 
			
		||||
		List<Resource> locations = singletonList(location);
 | 
			
		||||
		Resource actual = this.resolver.resolveResource(null, requestPath, locations, null).blockMillis(5000);
 | 
			
		||||
		Resource actual = this.resolver.resolveResource(null, requestPath, locations, null).block(Duration.ofMillis(5000));
 | 
			
		||||
		if (!location.createRelative(requestPath).exists() && !requestPath.contains(":")) {
 | 
			
		||||
			fail(requestPath + " doesn't actually exist as a relative path");
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +96,7 @@ public class PathResourceResolverTests {
 | 
			
		|||
 | 
			
		||||
		Resource location = new ClassPathResource("test/main.css", PathResourceResolver.class);
 | 
			
		||||
		String actual = this.resolver.resolveUrlPath("../testalternatepath/bar.css",
 | 
			
		||||
				singletonList(location), null).blockMillis(5000);
 | 
			
		||||
				singletonList(location), null).block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		assertEquals("../testalternatepath/bar.css", actual);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -105,7 +106,7 @@ public class PathResourceResolverTests {
 | 
			
		|||
		String locationUrl= new UrlResource(getClass().getResource("./test/")).getURL().toExternalForm();
 | 
			
		||||
		Resource location = new UrlResource(locationUrl.replace("/springframework","/../org/springframework"));
 | 
			
		||||
		List<Resource> locations = singletonList(location);
 | 
			
		||||
		assertNotNull(this.resolver.resolveResource(null, "main.css", locations, null).blockMillis(5000));
 | 
			
		||||
		assertNotNull(this.resolver.resolveResource(null, "main.css", locations, null).block(Duration.ofMillis(5000)));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test // SPR-12747
 | 
			
		||||
| 
						 | 
				
			
			@ -118,7 +119,7 @@ public class PathResourceResolverTests {
 | 
			
		|||
	public void resolvePathRootResource() throws Exception {
 | 
			
		||||
		Resource webjarsLocation = new ClassPathResource("/META-INF/resources/webjars/", PathResourceResolver.class);
 | 
			
		||||
		String path = this.resolver.resolveUrlPathInternal(
 | 
			
		||||
				"", singletonList(webjarsLocation), null).blockMillis(5000);
 | 
			
		||||
				"", singletonList(webjarsLocation), null).block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		assertNull(path);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,7 @@
 | 
			
		|||
 */
 | 
			
		||||
package org.springframework.web.reactive.resource;
 | 
			
		||||
 | 
			
		||||
import java.time.Duration;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
| 
						 | 
				
			
			@ -78,7 +79,7 @@ public class VersionResourceResolverTests {
 | 
			
		|||
		this.resolver.setStrategyMap(Collections.singletonMap("/**", this.versionStrategy));
 | 
			
		||||
		Resource actual = this.resolver
 | 
			
		||||
				.resolveResourceInternal(null, file, this.locations, this.chain)
 | 
			
		||||
				.blockMillis(5000);
 | 
			
		||||
				.block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		assertEquals(expected, actual);
 | 
			
		||||
		verify(this.chain, times(1)).resolveResource(null, file, this.locations);
 | 
			
		||||
| 
						 | 
				
			
			@ -93,7 +94,7 @@ public class VersionResourceResolverTests {
 | 
			
		|||
		this.resolver.setStrategyMap(Collections.emptyMap());
 | 
			
		||||
		Resource actual = this.resolver
 | 
			
		||||
				.resolveResourceInternal(null, file, this.locations, this.chain)
 | 
			
		||||
				.blockMillis(5000);
 | 
			
		||||
				.block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		assertNull(actual);
 | 
			
		||||
		verify(this.chain, times(1)).resolveResource(null, file, this.locations);
 | 
			
		||||
| 
						 | 
				
			
			@ -108,7 +109,7 @@ public class VersionResourceResolverTests {
 | 
			
		|||
		this.resolver.setStrategyMap(Collections.singletonMap("/**", this.versionStrategy));
 | 
			
		||||
		Resource actual = this.resolver
 | 
			
		||||
				.resolveResourceInternal(null, file, this.locations, this.chain)
 | 
			
		||||
				.blockMillis(5000);
 | 
			
		||||
				.block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		assertNull(actual);
 | 
			
		||||
		verify(this.chain, times(1)).resolveResource(null, file, this.locations);
 | 
			
		||||
| 
						 | 
				
			
			@ -128,7 +129,7 @@ public class VersionResourceResolverTests {
 | 
			
		|||
		this.resolver.setStrategyMap(Collections.singletonMap("/**", this.versionStrategy));
 | 
			
		||||
		Resource actual = this.resolver
 | 
			
		||||
				.resolveResourceInternal(null, versionFile, this.locations, this.chain)
 | 
			
		||||
				.blockMillis(5000);
 | 
			
		||||
				.block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		assertNull(actual);
 | 
			
		||||
		verify(this.versionStrategy, times(1)).removeVersion(versionFile, version);
 | 
			
		||||
| 
						 | 
				
			
			@ -149,7 +150,7 @@ public class VersionResourceResolverTests {
 | 
			
		|||
		this.resolver.setStrategyMap(Collections.singletonMap("/**", this.versionStrategy));
 | 
			
		||||
		Resource actual = this.resolver
 | 
			
		||||
				.resolveResourceInternal(null, versionFile, this.locations, this.chain)
 | 
			
		||||
				.blockMillis(5000);
 | 
			
		||||
				.block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		assertNull(actual);
 | 
			
		||||
		verify(this.versionStrategy, times(1)).getResourceVersion(expected);
 | 
			
		||||
| 
						 | 
				
			
			@ -171,7 +172,7 @@ public class VersionResourceResolverTests {
 | 
			
		|||
		this.resolver.setStrategyMap(Collections.singletonMap("/**", this.versionStrategy));
 | 
			
		||||
		Resource actual = this.resolver
 | 
			
		||||
				.resolveResourceInternal(exchange, versionFile, this.locations, this.chain)
 | 
			
		||||
				.blockMillis(5000);
 | 
			
		||||
				.block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		assertEquals(expected.getFilename(), actual.getFilename());
 | 
			
		||||
		verify(this.versionStrategy, times(1)).getResourceVersion(expected);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -104,7 +104,7 @@ public class HandlerMethodMappingTests {
 | 
			
		|||
		this.mapping.registerMapping(key1, this.handler, this.method1);
 | 
			
		||||
		this.mapping.registerMapping(key2, this.handler, this.method2);
 | 
			
		||||
 | 
			
		||||
		List directUrlMatches = this.mapping.getMappingRegistry().getMappingsByUrl(key1);
 | 
			
		||||
		List<String> directUrlMatches = this.mapping.getMappingRegistry().getMappingsByUrl(key1);
 | 
			
		||||
 | 
			
		||||
		assertNotNull(directUrlMatches);
 | 
			
		||||
		assertEquals(1, directUrlMatches.size());
 | 
			
		||||
| 
						 | 
				
			
			@ -120,7 +120,7 @@ public class HandlerMethodMappingTests {
 | 
			
		|||
		this.mapping.registerMapping(key1, handler1, this.method1);
 | 
			
		||||
		this.mapping.registerMapping(key2, handler2, this.method1);
 | 
			
		||||
 | 
			
		||||
		List directUrlMatches = this.mapping.getMappingRegistry().getMappingsByUrl(key1);
 | 
			
		||||
		List<String> directUrlMatches = this.mapping.getMappingRegistry().getMappingsByUrl(key1);
 | 
			
		||||
 | 
			
		||||
		assertNotNull(directUrlMatches);
 | 
			
		||||
		assertEquals(1, directUrlMatches.size());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,8 @@
 | 
			
		|||
 | 
			
		||||
package org.springframework.web.reactive.result.method.annotation;
 | 
			
		||||
 | 
			
		||||
import java.time.Duration;
 | 
			
		||||
 | 
			
		||||
import org.junit.Before;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
import reactor.core.publisher.Mono;
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +109,7 @@ public class ErrorsArgumentResolverTests {
 | 
			
		|||
	@Test(expected = IllegalArgumentException.class)
 | 
			
		||||
	public void resolveErrorsAfterMonoModelAttribute() throws Exception {
 | 
			
		||||
		MethodParameter parameter = this.testMethod.arg(BindingResult.class);
 | 
			
		||||
		this.resolver.resolveArgument(parameter, this.bindingContext, this.exchange).blockMillis(5000);
 | 
			
		||||
		this.resolver.resolveArgument(parameter, this.bindingContext, this.exchange).block(Duration.ofMillis(5000));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -119,12 +121,13 @@ public class ErrorsArgumentResolverTests {
 | 
			
		|||
		MethodParameter parameter = this.testMethod.arg(Errors.class);
 | 
			
		||||
 | 
			
		||||
		Object actual = this.resolver.resolveArgument(parameter, this.bindingContext, this.exchange)
 | 
			
		||||
				.blockMillis(5000);
 | 
			
		||||
				.block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		assertSame(this.bindingResult, actual);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@SuppressWarnings("unused")
 | 
			
		||||
	private static class Foo {
 | 
			
		||||
 | 
			
		||||
		private String name;
 | 
			
		||||
| 
						 | 
				
			
			@ -145,7 +148,6 @@ public class ErrorsArgumentResolverTests {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@SuppressWarnings("unused")
 | 
			
		||||
	void handle(
 | 
			
		||||
			@ModelAttribute Foo foo,
 | 
			
		||||
			Errors errors,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,11 +102,11 @@ public class JsonStreamingIntegrationTests extends AbstractHttpHandlerIntegratio
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@SuppressWarnings("unused")
 | 
			
		||||
	private static class Person {
 | 
			
		||||
 | 
			
		||||
		private String name;
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public Person() {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,8 +45,6 @@ import org.springframework.http.MediaType;
 | 
			
		|||
import org.springframework.http.codec.DecoderHttpMessageReader;
 | 
			
		||||
import org.springframework.http.codec.HttpMessageReader;
 | 
			
		||||
import org.springframework.http.codec.json.Jackson2JsonDecoder;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse;
 | 
			
		||||
import org.springframework.validation.Errors;
 | 
			
		||||
import org.springframework.validation.Validator;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
| 
						 | 
				
			
			@ -57,7 +55,6 @@ import org.springframework.web.method.ResolvableMethod;
 | 
			
		|||
import org.springframework.web.server.ServerWebExchange;
 | 
			
		||||
import org.springframework.web.server.ServerWebInputException;
 | 
			
		||||
import org.springframework.web.server.UnsupportedMediaTypeStatusException;
 | 
			
		||||
import org.springframework.web.server.adapter.DefaultServerWebExchange;
 | 
			
		||||
 | 
			
		||||
import static org.junit.Assert.assertArrayEquals;
 | 
			
		||||
import static org.junit.Assert.assertEquals;
 | 
			
		||||
| 
						 | 
				
			
			@ -222,7 +219,7 @@ public class MessageReaderArgumentResolverTests {
 | 
			
		|||
		map.put("bar", "b1");
 | 
			
		||||
		ResolvableType type = forClassWithGenerics(Map.class, String.class, String.class);
 | 
			
		||||
		MethodParameter param = this.testMethod.arg(type);
 | 
			
		||||
		Map actual = resolveValue(param, body);
 | 
			
		||||
		Map<String, String> actual = resolveValue(param, body);
 | 
			
		||||
 | 
			
		||||
		assertEquals(map, actual);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -335,13 +332,13 @@ public class MessageReaderArgumentResolverTests {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
	@XmlRootElement
 | 
			
		||||
	@SuppressWarnings("unused")
 | 
			
		||||
	private static class TestBean {
 | 
			
		||||
 | 
			
		||||
		private String foo;
 | 
			
		||||
 | 
			
		||||
		private String bar;
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public TestBean() {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -426,7 +423,7 @@ public class MessageReaderArgumentResolverTests {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@SuppressWarnings({"serial"})
 | 
			
		||||
	@SuppressWarnings({"serial", "unused"})
 | 
			
		||||
	private static class SimpleBean implements Identifiable {
 | 
			
		||||
 | 
			
		||||
		private Long id;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -255,6 +255,7 @@ public class MessageWriterResultHandlerTests {
 | 
			
		|||
			return id;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public String getName() {
 | 
			
		||||
			return name;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -245,7 +245,6 @@ public class ModelAttributeMethodArgumentResolverTests {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
	@SuppressWarnings("unchecked")
 | 
			
		||||
	public void validationErrorToSingle() throws Exception {
 | 
			
		||||
 | 
			
		||||
		MethodParameter parameter = this.testMethod
 | 
			
		||||
| 
						 | 
				
			
			@ -256,7 +255,7 @@ public class ModelAttributeMethodArgumentResolverTests {
 | 
			
		|||
					Object value = resolvedArgumentMono.block(Duration.ofSeconds(5));
 | 
			
		||||
					assertNotNull(value);
 | 
			
		||||
					assertTrue(value instanceof Single);
 | 
			
		||||
					return Mono.from(RxReactiveStreams.toPublisher((Single) value));
 | 
			
		||||
					return Mono.from(RxReactiveStreams.toPublisher((Single<?>) value));
 | 
			
		||||
				});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -303,6 +302,7 @@ public class ModelAttributeMethodArgumentResolverTests {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@SuppressWarnings("unused")
 | 
			
		||||
	private static class Foo {
 | 
			
		||||
 | 
			
		||||
		private String name;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,6 +17,7 @@
 | 
			
		|||
package org.springframework.web.reactive.result.method.annotation;
 | 
			
		||||
 | 
			
		||||
import java.lang.reflect.Method;
 | 
			
		||||
import java.time.Duration;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
| 
						 | 
				
			
			@ -73,7 +74,7 @@ public class ModelInitializerTests {
 | 
			
		|||
		WebBindingInitializer bindingInitializer = new ConfigurableWebBindingInitializer();
 | 
			
		||||
		BindingContext bindingContext = new InitBinderBindingContext(bindingInitializer, binderMethods);
 | 
			
		||||
 | 
			
		||||
		this.modelInitializer.initModel(bindingContext, attributeMethods, this.exchange).blockMillis(5000);
 | 
			
		||||
		this.modelInitializer.initModel(bindingContext, attributeMethods, this.exchange).block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		WebExchangeDataBinder binder = bindingContext.createDataBinder(this.exchange, "name");
 | 
			
		||||
		assertEquals(Collections.singletonList(validator), binder.getValidators());
 | 
			
		||||
| 
						 | 
				
			
			@ -85,7 +86,7 @@ public class ModelInitializerTests {
 | 
			
		|||
		assertEquals("Bean", ((TestBean) value).getName());
 | 
			
		||||
 | 
			
		||||
		value = model.get("monoBean");
 | 
			
		||||
		assertEquals("Mono Bean", ((Mono<TestBean>) value).blockMillis(5000).getName());
 | 
			
		||||
		assertEquals("Mono Bean", ((Mono<TestBean>) value).block(Duration.ofMillis(5000)).getName());
 | 
			
		||||
 | 
			
		||||
		value = model.get("singleBean");
 | 
			
		||||
		assertEquals("Single Bean", ((Single<TestBean>) value).toBlocking().value().getName());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -158,7 +158,7 @@ public class PathVariableMethodArgumentResolverTests {
 | 
			
		|||
		StepVerifier.create(mono)
 | 
			
		||||
				.consumeNextWith(value -> {
 | 
			
		||||
					assertTrue(value instanceof Optional);
 | 
			
		||||
					assertFalse(((Optional) value).isPresent());
 | 
			
		||||
					assertFalse(((Optional<?>) value).isPresent());
 | 
			
		||||
				})
 | 
			
		||||
				.expectComplete()
 | 
			
		||||
				.verify();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -129,7 +129,7 @@ public class RequestAttributeMethodArgumentResolverTests {
 | 
			
		|||
 | 
			
		||||
		assertNotNull(mono.block());
 | 
			
		||||
		assertEquals(Optional.class, mono.block().getClass());
 | 
			
		||||
		assertFalse(((Optional) mono.block()).isPresent());
 | 
			
		||||
		assertFalse(((Optional<?>) mono.block()).isPresent());
 | 
			
		||||
 | 
			
		||||
		ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
 | 
			
		||||
		initializer.setConversionService(new DefaultFormattingConversionService());
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +141,7 @@ public class RequestAttributeMethodArgumentResolverTests {
 | 
			
		|||
 | 
			
		||||
		assertNotNull(mono.block());
 | 
			
		||||
		assertEquals(Optional.class, mono.block().getClass());
 | 
			
		||||
		Optional optional = (Optional) mono.block();
 | 
			
		||||
		Optional<?> optional = (Optional<?>) mono.block();
 | 
			
		||||
		assertTrue(optional.isPresent());
 | 
			
		||||
		assertSame(foo, optional.get());
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,9 +32,7 @@ import org.springframework.core.MethodParameter;
 | 
			
		|||
import org.springframework.core.ReactiveAdapterRegistry;
 | 
			
		||||
import org.springframework.core.annotation.SynthesizingMethodParameter;
 | 
			
		||||
import org.springframework.format.support.DefaultFormattingConversionService;
 | 
			
		||||
import org.springframework.http.server.reactive.ServerHttpRequest;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerWebExchange;
 | 
			
		||||
import org.springframework.util.ReflectionUtils;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestHeader;
 | 
			
		||||
| 
						 | 
				
			
			@ -42,7 +40,6 @@ import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
 | 
			
		|||
import org.springframework.web.reactive.BindingContext;
 | 
			
		||||
import org.springframework.web.server.ServerWebExchange;
 | 
			
		||||
import org.springframework.web.server.ServerWebInputException;
 | 
			
		||||
import org.springframework.web.server.adapter.DefaultServerWebExchange;
 | 
			
		||||
 | 
			
		||||
import static org.junit.Assert.*;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -237,7 +234,6 @@ public class RequestHeaderMethodArgumentResolverTests {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@SuppressWarnings("unused")
 | 
			
		||||
	public void params(
 | 
			
		||||
			@RequestHeader(name = "name", defaultValue = "bar") String param1,
 | 
			
		||||
			@RequestHeader("name") String[] param2,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -121,6 +121,7 @@ public class RequestMappingDataBindingIntegrationTests extends AbstractRequestMa
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@SuppressWarnings("unused")
 | 
			
		||||
	private static class Foo {
 | 
			
		||||
 | 
			
		||||
		private final Long id;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,13 +16,14 @@
 | 
			
		|||
 | 
			
		||||
package org.springframework.web.reactive.result.method.annotation;
 | 
			
		||||
 | 
			
		||||
import java.time.Duration;
 | 
			
		||||
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
import org.reactivestreams.Publisher;
 | 
			
		||||
import reactor.core.publisher.Flux;
 | 
			
		||||
 | 
			
		||||
import org.springframework.context.ApplicationContext;
 | 
			
		||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 | 
			
		||||
import org.springframework.context.annotation.ComponentScan;
 | 
			
		||||
import org.springframework.context.annotation.Configuration;
 | 
			
		||||
import org.springframework.http.HttpHeaders;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
| 
						 | 
				
			
			@ -41,13 +42,14 @@ import static org.junit.Assert.*;
 | 
			
		|||
 *
 | 
			
		||||
 * @author Rossen Stoyanchev
 | 
			
		||||
 * @author Stephane Maldini
 | 
			
		||||
 * @since 5.0
 | 
			
		||||
 */
 | 
			
		||||
public class RequestMappingIntegrationTests extends AbstractRequestMappingIntegrationTests {
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected ApplicationContext initApplicationContext() {
 | 
			
		||||
		AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext();
 | 
			
		||||
		wac.register(WebConfig.class);
 | 
			
		||||
		wac.register(WebConfig.class, TestRestController.class);
 | 
			
		||||
		wac.refresh();
 | 
			
		||||
		return wac;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -80,14 +82,11 @@ public class RequestMappingIntegrationTests extends AbstractRequestMappingIntegr
 | 
			
		|||
 | 
			
		||||
	@Configuration
 | 
			
		||||
	@EnableWebFlux
 | 
			
		||||
	@ComponentScan(resourcePattern = "**/RequestMappingIntegrationTests$*.class")
 | 
			
		||||
	@SuppressWarnings({"unused", "WeakerAccess"})
 | 
			
		||||
	static class WebConfig {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@RestController
 | 
			
		||||
	@SuppressWarnings("unused")
 | 
			
		||||
	private static class TestRestController {
 | 
			
		||||
 | 
			
		||||
		@GetMapping("/param")
 | 
			
		||||
| 
						 | 
				
			
			@ -97,7 +96,7 @@ public class RequestMappingIntegrationTests extends AbstractRequestMappingIntegr
 | 
			
		|||
 | 
			
		||||
		@GetMapping("/long-stream-result")
 | 
			
		||||
		public Publisher<Long> longStreamResponseBody() {
 | 
			
		||||
			return Flux.intervalMillis(100).take(5);
 | 
			
		||||
			return Flux.interval(Duration.ofMillis(100)).take(5);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		@GetMapping("/object-stream-result")
 | 
			
		||||
| 
						 | 
				
			
			@ -111,17 +110,16 @@ public class RequestMappingIntegrationTests extends AbstractRequestMappingIntegr
 | 
			
		|||
 | 
			
		||||
		private String name;
 | 
			
		||||
 | 
			
		||||
		public Foo() {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public Foo(String name) {
 | 
			
		||||
			this.name = name;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public String getName() {
 | 
			
		||||
			return name;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public void setName(String name) {
 | 
			
		||||
			this.name = name;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -601,12 +601,11 @@ public class RequestMappingMessageConversionIntegrationTests extends AbstractReq
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
	@XmlRootElement
 | 
			
		||||
	@SuppressWarnings("WeakerAccess")
 | 
			
		||||
	@SuppressWarnings("unused")
 | 
			
		||||
	private static class Person {
 | 
			
		||||
 | 
			
		||||
		private String name;
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public Person() {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,18 +16,16 @@
 | 
			
		|||
 | 
			
		||||
package org.springframework.web.reactive.result.method.annotation;
 | 
			
		||||
 | 
			
		||||
import java.net.URISyntaxException;
 | 
			
		||||
import java.time.Duration;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import org.junit.Before;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
import reactor.core.publisher.Mono;
 | 
			
		||||
 | 
			
		||||
import org.springframework.core.MethodParameter;
 | 
			
		||||
import org.springframework.core.ReactiveAdapterRegistry;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
 | 
			
		||||
import org.springframework.util.MultiValueMap;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestParam;
 | 
			
		||||
| 
						 | 
				
			
			@ -48,17 +46,11 @@ import static org.springframework.web.method.MvcAnnotationPredicates.requestPara
 | 
			
		|||
 */
 | 
			
		||||
public class RequestParamMapMethodArgumentResolverTests {
 | 
			
		||||
 | 
			
		||||
	private RequestParamMapMethodArgumentResolver resolver;
 | 
			
		||||
	private RequestParamMapMethodArgumentResolver resolver = new RequestParamMapMethodArgumentResolver(new ReactiveAdapterRegistry());
 | 
			
		||||
 | 
			
		||||
	private ResolvableMethod testMethod = ResolvableMethod.on(getClass()).named("handle").build();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@Before
 | 
			
		||||
	public void setup() throws Exception {
 | 
			
		||||
		this.resolver = new RequestParamMapMethodArgumentResolver(new ReactiveAdapterRegistry());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
	public void supportsParameter() {
 | 
			
		||||
		MethodParameter param = this.testMethod.annot(requestParam().name("")).arg(Map.class);
 | 
			
		||||
| 
						 | 
				
			
			@ -114,11 +106,10 @@ public class RequestParamMapMethodArgumentResolverTests {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
	private Object resolve(MethodParameter parameter, ServerWebExchange exchange) {
 | 
			
		||||
		return this.resolver.resolveArgument(parameter, null, exchange).blockMillis(0);
 | 
			
		||||
		return this.resolver.resolveArgument(parameter, null, exchange).block(Duration.ofMillis(0));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@SuppressWarnings("unused")
 | 
			
		||||
	public void handle(
 | 
			
		||||
			@RequestParam Map<?, ?> param1,
 | 
			
		||||
			@RequestParam MultiValueMap<?, ?> param2,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -132,7 +132,7 @@ public class SessionAttributeMethodArgumentResolverTests {
 | 
			
		|||
		Mono<Object> mono = this.resolver.resolveArgument(param, new BindingContext(), this.exchange);
 | 
			
		||||
		assertNotNull(mono.block());
 | 
			
		||||
		assertEquals(Optional.class, mono.block().getClass());
 | 
			
		||||
		assertFalse(((Optional) mono.block()).isPresent());
 | 
			
		||||
		assertFalse(((Optional<?>) mono.block()).isPresent());
 | 
			
		||||
 | 
			
		||||
		ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
 | 
			
		||||
		initializer.setConversionService(new DefaultFormattingConversionService());
 | 
			
		||||
| 
						 | 
				
			
			@ -144,7 +144,7 @@ public class SessionAttributeMethodArgumentResolverTests {
 | 
			
		|||
 | 
			
		||||
		assertNotNull(mono.block());
 | 
			
		||||
		assertEquals(Optional.class, mono.block().getClass());
 | 
			
		||||
		Optional optional = (Optional) mono.block();
 | 
			
		||||
		Optional<?> optional = (Optional<?>) mono.block();
 | 
			
		||||
		assertTrue(optional.isPresent());
 | 
			
		||||
		assertSame(foo, optional.get());
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -192,11 +192,11 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@SuppressWarnings("unused")
 | 
			
		||||
	private static class Person {
 | 
			
		||||
 | 
			
		||||
		private String name;
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public Person() {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -355,6 +355,7 @@ public class ViewResolutionResultHandlerTests {
 | 
			
		|||
			this.mediaTypes = Arrays.asList(mediaTypes);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public String getName() {
 | 
			
		||||
			return this.name;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -387,6 +388,7 @@ public class ViewResolutionResultHandlerTests {
 | 
			
		|||
			this.name = name;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		@SuppressWarnings("unused")
 | 
			
		||||
		public String getName() {
 | 
			
		||||
			return this.name;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -440,7 +442,7 @@ public class ViewResolutionResultHandlerTests {
 | 
			
		|||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Map map() {
 | 
			
		||||
		Map<?,?> map() {
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,7 @@ package org.springframework.web.reactive.result.view.freemarker;
 | 
			
		|||
 | 
			
		||||
import java.nio.ByteBuffer;
 | 
			
		||||
import java.nio.charset.StandardCharsets;
 | 
			
		||||
import java.time.Duration;
 | 
			
		||||
import java.util.Locale;
 | 
			
		||||
 | 
			
		||||
import freemarker.template.Configuration;
 | 
			
		||||
| 
						 | 
				
			
			@ -106,7 +107,7 @@ public class FreeMarkerViewTests {
 | 
			
		|||
 | 
			
		||||
		ModelMap model = new ExtendedModelMap();
 | 
			
		||||
		model.addAttribute("hello", "hi FreeMarker");
 | 
			
		||||
		view.render(model, null, this.exchange).blockMillis(5000);
 | 
			
		||||
		view.render(model, null, this.exchange).block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		StepVerifier.create(this.exchange.getResponse().getBody())
 | 
			
		||||
				.consumeNextWith(buf -> assertEquals("<html><body>hi FreeMarker</body></html>", asString(buf)))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,14 +19,12 @@ package org.springframework.web.reactive.result.view.script;
 | 
			
		|||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import org.junit.Before;
 | 
			
		||||
import org.junit.Ignore;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
 | 
			
		||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 | 
			
		||||
import org.springframework.context.annotation.Bean;
 | 
			
		||||
import org.springframework.context.annotation.Configuration;
 | 
			
		||||
import org.springframework.context.support.StaticApplicationContext;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse;
 | 
			
		||||
| 
						 | 
				
			
			@ -42,13 +40,6 @@ import static org.junit.Assert.assertEquals;
 | 
			
		|||
@Ignore("JRuby not compatible with JDK 9 yet")
 | 
			
		||||
public class JRubyScriptTemplateTests {
 | 
			
		||||
 | 
			
		||||
	private StaticApplicationContext context;
 | 
			
		||||
 | 
			
		||||
	@Before
 | 
			
		||||
	public void setup() {
 | 
			
		||||
		this.context = new StaticApplicationContext();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
	public void renderTemplate() throws Exception {
 | 
			
		||||
		Map<String, Object> model = new HashMap<>();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2002-2015 the original author or authors.
 | 
			
		||||
 * Copyright 2002-2017 the original author or authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -19,13 +19,11 @@ package org.springframework.web.reactive.result.view.script;
 | 
			
		|||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import org.junit.Before;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
 | 
			
		||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 | 
			
		||||
import org.springframework.context.annotation.Bean;
 | 
			
		||||
import org.springframework.context.annotation.Configuration;
 | 
			
		||||
import org.springframework.context.support.StaticApplicationContext;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse;
 | 
			
		||||
| 
						 | 
				
			
			@ -40,14 +38,6 @@ import static org.junit.Assert.assertEquals;
 | 
			
		|||
 */
 | 
			
		||||
public class JythonScriptTemplateTests {
 | 
			
		||||
 | 
			
		||||
	private StaticApplicationContext context;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@Before
 | 
			
		||||
	public void setup() {
 | 
			
		||||
		this.context = new StaticApplicationContext();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
	public void renderTemplate() throws Exception {
 | 
			
		||||
		Map<String, Object> model = new HashMap<>();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2002-2015 the original author or authors.
 | 
			
		||||
 * Copyright 2002-2017 the original author or authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -20,14 +20,12 @@ import java.util.HashMap;
 | 
			
		|||
import java.util.Locale;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import org.junit.Before;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
 | 
			
		||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 | 
			
		||||
import org.springframework.context.annotation.Bean;
 | 
			
		||||
import org.springframework.context.annotation.Configuration;
 | 
			
		||||
import org.springframework.context.support.ResourceBundleMessageSource;
 | 
			
		||||
import org.springframework.context.support.StaticApplicationContext;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse;
 | 
			
		||||
| 
						 | 
				
			
			@ -42,13 +40,6 @@ import static org.junit.Assert.assertEquals;
 | 
			
		|||
 */
 | 
			
		||||
public class KotlinScriptTemplateTests {
 | 
			
		||||
 | 
			
		||||
	private StaticApplicationContext context;
 | 
			
		||||
 | 
			
		||||
	@Before
 | 
			
		||||
	public void setup() {
 | 
			
		||||
		this.context = new StaticApplicationContext();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
	public void renderTemplateWithFrenchLocale() throws Exception {
 | 
			
		||||
		Map<String, Object> model = new HashMap<>();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2002-2015 the original author or authors.
 | 
			
		||||
 * Copyright 2002-2017 the original author or authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -19,13 +19,11 @@ package org.springframework.web.reactive.result.view.script;
 | 
			
		|||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import org.junit.Before;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
 | 
			
		||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 | 
			
		||||
import org.springframework.context.annotation.Bean;
 | 
			
		||||
import org.springframework.context.annotation.Configuration;
 | 
			
		||||
import org.springframework.context.support.StaticApplicationContext;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
 | 
			
		||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse;
 | 
			
		||||
| 
						 | 
				
			
			@ -34,19 +32,12 @@ import org.springframework.mock.http.server.reactive.test.MockServerWebExchange;
 | 
			
		|||
import static org.junit.Assert.assertEquals;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Unit tests for pure Javascript templates running on Nashorn engine.
 | 
			
		||||
 * Unit tests for pure JavaScript templates running on Nashorn engine.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Sebastien Deleuze
 | 
			
		||||
 */
 | 
			
		||||
public class NashornScriptTemplateTests {
 | 
			
		||||
 | 
			
		||||
	private StaticApplicationContext context;
 | 
			
		||||
 | 
			
		||||
	@Before
 | 
			
		||||
	public void setup() {
 | 
			
		||||
		this.context = new StaticApplicationContext();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
	public void renderTemplate() throws Exception {
 | 
			
		||||
		Map<String, Object> model = new HashMap<>();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2002-2015 the original author or authors.
 | 
			
		||||
 * Copyright 2002-2017 the original author or authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ public class ScriptTemplateViewResolverTests {
 | 
			
		|||
		ScriptTemplateViewResolver resolver = new ScriptTemplateViewResolver();
 | 
			
		||||
		Assert.assertEquals(ScriptTemplateView.class, resolver.requiredViewClass());
 | 
			
		||||
		DirectFieldAccessor viewAccessor = new DirectFieldAccessor(resolver);
 | 
			
		||||
		Class viewClass = (Class) viewAccessor.getPropertyValue("viewClass");
 | 
			
		||||
		Class<?> viewClass = (Class<?>) viewAccessor.getPropertyValue("viewClass");
 | 
			
		||||
		Assert.assertEquals(ScriptTemplateView.class, viewClass);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2002-2016 the original author or authors.
 | 
			
		||||
 * Copyright 2002-2017 the original author or authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -13,8 +13,10 @@
 | 
			
		|||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package org.springframework.web.reactive.socket;
 | 
			
		||||
 | 
			
		||||
import java.time.Duration;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.concurrent.atomic.AtomicReference;
 | 
			
		||||
| 
						 | 
				
			
			@ -40,7 +42,6 @@ import static org.junit.Assert.assertThat;
 | 
			
		|||
 * Integration tests with server-side {@link WebSocketHandler}s.
 | 
			
		||||
 * @author Rossen Stoyanchev
 | 
			
		||||
 */
 | 
			
		||||
@SuppressWarnings({"unused", "WeakerAccess"})
 | 
			
		||||
public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -62,9 +63,9 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests
 | 
			
		|||
						.thenMany(session.receive().take(count).map(WebSocketMessage::getPayloadAsText))
 | 
			
		||||
						.subscribeWith(output)
 | 
			
		||||
						.then())
 | 
			
		||||
				.blockMillis(5000);
 | 
			
		||||
				.block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		assertEquals(input.collectList().blockMillis(5000), output.collectList().blockMillis(5000));
 | 
			
		||||
		assertEquals(input.collectList().block(Duration.ofMillis(5000)), output.collectList().block(Duration.ofMillis(5000)));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
| 
						 | 
				
			
			@ -91,13 +92,13 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests
 | 
			
		|||
								.then();
 | 
			
		||||
					}
 | 
			
		||||
				})
 | 
			
		||||
				.blockMillis(5000);
 | 
			
		||||
				.block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		HandshakeInfo info = infoRef.get();
 | 
			
		||||
		assertThat(info.getHeaders().getFirst("Upgrade"), Matchers.equalToIgnoringCase("websocket"));
 | 
			
		||||
		assertEquals(protocol, info.getHeaders().getFirst("Sec-WebSocket-Protocol"));
 | 
			
		||||
		assertEquals("Wrong protocol accepted", protocol, info.getSubProtocol().orElse("none"));
 | 
			
		||||
		assertEquals("Wrong protocol detected on the server side", protocol, output.blockMillis(5000));
 | 
			
		||||
		assertEquals("Wrong protocol detected on the server side", protocol, output.block(Duration.ofMillis(5000)));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
| 
						 | 
				
			
			@ -111,9 +112,9 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests
 | 
			
		|||
						.map(WebSocketMessage::getPayloadAsText)
 | 
			
		||||
						.subscribeWith(output)
 | 
			
		||||
						.then())
 | 
			
		||||
				.blockMillis(5000);
 | 
			
		||||
				.block(Duration.ofMillis(5000));
 | 
			
		||||
 | 
			
		||||
		assertEquals("my-header:my-value", output.blockMillis(5000));
 | 
			
		||||
		assertEquals("my-header:my-value", output.block(Duration.ofMillis(5000)));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -174,7 +175,7 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests
 | 
			
		|||
	// https://github.com/ReactiveX/RxNetty/issues/560
 | 
			
		||||
 | 
			
		||||
	private static Mono<Void> doSend(WebSocketSession session, Publisher<WebSocketMessage> output) {
 | 
			
		||||
		return session.send(Mono.delayMillis(100).thenMany(output));
 | 
			
		||||
		return session.send(Mono.delay(Duration.ofMillis(100)).thenMany(output));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue