Browse Source

Promoted BindingContext to web.reactive root (since HandlerResult requires it there)

Issue: SPR-14542
pull/1233/head
Juergen Hoeller 9 years ago
parent
commit
f0be79e0a1
  1. 18
      spring-web-reactive/src/main/java/org/springframework/web/reactive/BindingContext.java
  2. 1
      spring-web-reactive/src/main/java/org/springframework/web/reactive/HandlerResult.java
  3. 5
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/HandlerMethodArgumentResolver.java
  4. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java
  5. 4
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncHandlerMethodArgumentResolver.java
  6. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncInvocableHandlerMethod.java
  7. 5
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java
  8. 4
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueArgumentResolver.java
  9. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueSyncArgumentResolver.java
  10. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactory.java
  11. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolver.java
  12. 4
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolver.java
  13. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContext.java
  14. 4
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelArgumentResolver.java
  15. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolver.java
  16. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolver.java
  17. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PrincipalArgumentResolver.java
  18. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolver.java
  19. 2
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMapMethodArgumentResolver.java
  20. 2
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java
  21. 2
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java
  22. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolver.java
  23. 9
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/WebSessionArgumentResolver.java
  24. 2
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java
  25. 2
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java
  26. 17
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java
  27. 12
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactoryTests.java
  28. 6
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java
  29. 7
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsArgumentResolverTests.java
  30. 11
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ExpressionValueMethodArgumentResolverTests.java
  31. 11
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolverTests.java
  32. 9
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContextTests.java
  33. 27
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageReaderArgumentResolverTests.java
  34. 29
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolverTests.java
  35. 9
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolverTests.java
  36. 6
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java
  37. 13
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java
  38. 11
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolverTests.java
  39. 7
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java
  40. 8
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java
  41. 2
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolverTests.java
  42. 2
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java
  43. 15
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java

18
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/BindingContext.java → spring-web-reactive/src/main/java/org/springframework/web/reactive/BindingContext.java

@ -13,7 +13,8 @@ @@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method;
package org.springframework.web.reactive;
import org.springframework.ui.Model;
import org.springframework.validation.support.BindingAwareConcurrentModel;
@ -22,7 +23,6 @@ import org.springframework.web.bind.WebExchangeDataBinder; @@ -22,7 +23,6 @@ import org.springframework.web.bind.WebExchangeDataBinder;
import org.springframework.web.bind.support.WebBindingInitializer;
import org.springframework.web.server.ServerWebExchange;
/**
* A context for binding requests to method arguments that provides access to
* the default model, data binding, validation, and type conversion.
@ -45,14 +45,6 @@ public class BindingContext { @@ -45,14 +45,6 @@ public class BindingContext {
this.initializer = initializer;
}
private static WebExchangeDataBinder initTypeConverter(WebBindingInitializer initializer) {
WebExchangeDataBinder binder = new WebExchangeDataBinder(null);
if (initializer != null) {
initializer.initBinder(binder);
}
return binder;
}
/**
* Return the default model.
@ -65,7 +57,6 @@ public class BindingContext { @@ -65,7 +57,6 @@ public class BindingContext {
/**
* Create a {@link WebExchangeDataBinder} for applying data binding, type
* conversion, and validation on the given "target" object.
*
* @param exchange the current exchange
* @param target the object to create a data binder for
* @param name the name of the target object
@ -82,7 +73,6 @@ public class BindingContext { @@ -82,7 +73,6 @@ public class BindingContext {
/**
* Create a {@link WebExchangeDataBinder} without a "target" object, i.e.
* for applying type conversion to simple types.
*
* @param exchange the current exchange
* @param name the name of the target object
* @return a Mono for the created {@link WebDataBinder} instance
@ -101,9 +91,7 @@ public class BindingContext { @@ -101,9 +91,7 @@ public class BindingContext {
/**
* Initialize the data binder instance for the given exchange.
*/
protected WebExchangeDataBinder initDataBinder(WebExchangeDataBinder binder,
ServerWebExchange exchange) {
protected WebExchangeDataBinder initDataBinder(WebExchangeDataBinder binder, ServerWebExchange exchange) {
return binder;
}

1
spring-web-reactive/src/main/java/org/springframework/web/reactive/HandlerResult.java

@ -25,7 +25,6 @@ import org.springframework.core.MethodParameter; @@ -25,7 +25,6 @@ import org.springframework.core.MethodParameter;
import org.springframework.core.ResolvableType;
import org.springframework.ui.Model;
import org.springframework.util.Assert;
import org.springframework.web.reactive.result.method.BindingContext;
/**
* Represent the result of the invocation of a handler or a handler method.

5
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/HandlerMethodArgumentResolver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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,9 +19,9 @@ package org.springframework.web.reactive.result.method; @@ -19,9 +19,9 @@ package org.springframework.web.reactive.result.method;
import reactor.core.publisher.Mono;
import org.springframework.core.MethodParameter;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.server.ServerWebExchange;
/**
* Strategy interface for resolving method parameters into argument values in
* the context of a given request.
@ -31,7 +31,6 @@ import org.springframework.web.server.ServerWebExchange; @@ -31,7 +31,6 @@ import org.springframework.web.server.ServerWebExchange;
*/
public interface HandlerMethodArgumentResolver {
boolean supportsParameter(MethodParameter parameter);
/**

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java

@ -36,11 +36,12 @@ import org.springframework.util.ClassUtils; @@ -36,11 +36,12 @@ import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.HandlerResult;
import org.springframework.web.server.ServerWebExchange;
/**
* A sub-class of {@link HandlerMethod} that can resolve method arguments from
* A subclass of {@link HandlerMethod} that can resolve method arguments from
* a {@link ServerWebExchange} and use that to invoke the underlying method.
*
* @author Rossen Stoyanchev

4
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncHandlerMethodArgumentResolver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@ -21,9 +21,9 @@ import java.util.Optional; @@ -21,9 +21,9 @@ import java.util.Optional;
import reactor.core.publisher.Mono;
import org.springframework.core.MethodParameter;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.server.ServerWebExchange;
/**
* An extension of {@link HandlerMethodArgumentResolver} for implementations
* that are synchronous in nature and do not block to resolve values.

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncInvocableHandlerMethod.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method;
import java.lang.reflect.Method;
@ -21,6 +22,7 @@ import java.util.List; @@ -21,6 +22,7 @@ import java.util.List;
import org.springframework.util.Assert;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.HandlerResult;
import org.springframework.web.server.ServerWebExchange;
@ -35,7 +37,6 @@ import org.springframework.web.server.ServerWebExchange; @@ -35,7 +37,6 @@ import org.springframework.web.server.ServerWebExchange;
*/
public class SyncInvocableHandlerMethod extends InvocableHandlerMethod {
public SyncInvocableHandlerMethod(HandlerMethod handlerMethod) {
super(handlerMethod);
}

5
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import java.lang.annotation.Annotation;
@ -38,12 +39,12 @@ import org.springframework.http.server.reactive.ServerHttpResponse; @@ -38,12 +39,12 @@ import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.util.Assert;
import org.springframework.validation.Validator;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.WebExchangeBindException;
import org.springframework.web.bind.WebExchangeDataBinder;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.ServerWebInputException;
import org.springframework.web.server.UnsupportedMediaTypeStatusException;
import org.springframework.web.bind.WebExchangeBindException;
/**
* Abstract base class for argument resolvers that resolve method arguments

4
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueArgumentResolver.java

@ -30,7 +30,7 @@ import org.springframework.core.MethodParameter; @@ -30,7 +30,7 @@ import org.springframework.core.MethodParameter;
import org.springframework.ui.Model;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.ValueConstants;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver;
import org.springframework.web.server.ServerErrorException;
import org.springframework.web.server.ServerWebExchange;
@ -40,6 +40,7 @@ import org.springframework.web.server.ServerWebInputException; @@ -40,6 +40,7 @@ import org.springframework.web.server.ServerWebInputException;
* Abstract base class for resolving method arguments from a named value.
* Request parameters, request headers, and path variables are examples of named
* values. Each may have a name, a required flag, and a default value.
*
* <p>Subclasses define how to do the following:
* <ul>
* <li>Obtain named value information for a method parameter
@ -47,6 +48,7 @@ import org.springframework.web.server.ServerWebInputException; @@ -47,6 +48,7 @@ import org.springframework.web.server.ServerWebInputException;
* <li>Handle missing argument values when argument values are required
* <li>Optionally handle a resolved value
* </ul>
*
* <p>A default value string can contain ${...} placeholders and Spring Expression
* Language #{...} expressions. For this to work a
* {@link ConfigurableBeanFactory} must be supplied to the class constructor.

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueSyncArgumentResolver.java

@ -22,7 +22,7 @@ import reactor.core.publisher.Mono; @@ -22,7 +22,7 @@ import reactor.core.publisher.Mono;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.core.MethodParameter;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver;
import org.springframework.web.server.ServerWebExchange;
@ -38,7 +38,6 @@ import org.springframework.web.server.ServerWebExchange; @@ -38,7 +38,6 @@ import org.springframework.web.server.ServerWebExchange;
public abstract class AbstractNamedValueSyncArgumentResolver extends AbstractNamedValueArgumentResolver
implements SyncHandlerMethodArgumentResolver {
public AbstractNamedValueSyncArgumentResolver(ConfigurableBeanFactory beanFactory) {
super(beanFactory);
}

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactory.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import java.lang.reflect.Method;
@ -33,8 +34,8 @@ import org.springframework.util.StringUtils; @@ -33,8 +34,8 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.support.WebBindingInitializer;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.HandlerResult;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver;
import org.springframework.web.reactive.result.method.InvocableHandlerMethod;
import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver;

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolver.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import reactor.core.publisher.Mono;
@ -27,7 +28,7 @@ import org.springframework.util.StringUtils; @@ -27,7 +28,7 @@ import org.springframework.util.StringUtils;
import org.springframework.validation.BindingResult;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver;
import org.springframework.web.server.ServerWebExchange;

4
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolver.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import java.util.List;
@ -28,7 +29,7 @@ import org.springframework.http.RequestEntity; @@ -28,7 +29,7 @@ import org.springframework.http.RequestEntity;
import org.springframework.http.codec.HttpMessageReader;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.validation.Validator;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver;
import org.springframework.web.server.ServerWebExchange;
@ -43,7 +44,6 @@ import org.springframework.web.server.ServerWebExchange; @@ -43,7 +44,6 @@ import org.springframework.web.server.ServerWebExchange;
public class HttpEntityArgumentResolver extends AbstractMessageReaderArgumentResolver
implements HandlerMethodArgumentResolver {
/**
* Constructor with {@link HttpMessageReader}'s and a {@link Validator}.
* @param readers readers for de-serializing the request body with

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContext.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import java.util.Arrays;
@ -24,8 +25,8 @@ import org.springframework.web.bind.WebExchangeDataBinder; @@ -24,8 +25,8 @@ import org.springframework.web.bind.WebExchangeDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.support.WebBindingInitializer;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.HandlerResult;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.result.method.SyncInvocableHandlerMethod;
import org.springframework.web.server.ServerWebExchange;

4
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelArgumentResolver.java

@ -13,13 +13,14 @@ @@ -13,13 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import java.util.Optional;
import org.springframework.core.MethodParameter;
import org.springframework.ui.Model;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver;
import org.springframework.web.server.ServerWebExchange;
@ -31,7 +32,6 @@ import org.springframework.web.server.ServerWebExchange; @@ -31,7 +32,6 @@ import org.springframework.web.server.ServerWebExchange;
*/
public class ModelArgumentResolver implements SyncHandlerMethodArgumentResolver {
@Override
public boolean supportsParameter(MethodParameter parameter) {
return Model.class.isAssignableFrom(parameter.getParameterType());

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolver.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import java.lang.annotation.Annotation;
@ -37,7 +38,7 @@ import org.springframework.validation.annotation.Validated; @@ -37,7 +38,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.WebExchangeBindException;
import org.springframework.web.bind.WebExchangeDataBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver;
import org.springframework.web.server.ServerWebExchange;

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolver.java

@ -23,8 +23,8 @@ import java.util.Optional; @@ -23,8 +23,8 @@ import java.util.Optional;
import org.springframework.core.MethodParameter;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.HandlerMapping;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver;
import org.springframework.web.server.ServerWebExchange;
@ -40,7 +40,6 @@ import org.springframework.web.server.ServerWebExchange; @@ -40,7 +40,6 @@ import org.springframework.web.server.ServerWebExchange;
*/
public class PathVariableMapMethodArgumentResolver implements SyncHandlerMethodArgumentResolver {
@Override
public boolean supportsParameter(MethodParameter parameter) {
PathVariable ann = parameter.getParameterAnnotation(PathVariable.class);

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PrincipalArgumentResolver.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import java.security.Principal;
@ -20,7 +21,7 @@ import java.security.Principal; @@ -20,7 +21,7 @@ import java.security.Principal;
import reactor.core.publisher.Mono;
import org.springframework.core.MethodParameter;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver;
import org.springframework.web.server.ServerWebExchange;

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolver.java

@ -25,7 +25,7 @@ import org.springframework.core.ReactiveAdapterRegistry; @@ -25,7 +25,7 @@ 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.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.ServerWebInputException;
@ -47,7 +47,6 @@ import org.springframework.web.server.ServerWebInputException; @@ -47,7 +47,6 @@ import org.springframework.web.server.ServerWebInputException;
public class RequestBodyArgumentResolver extends AbstractMessageReaderArgumentResolver
implements HandlerMethodArgumentResolver {
/**
* Constructor with {@link HttpMessageReader}'s and a {@link Validator}.
* @param readers readers for de-serializing the request body with

2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMapMethodArgumentResolver.java

@ -23,7 +23,7 @@ import org.springframework.core.MethodParameter; @@ -23,7 +23,7 @@ import org.springframework.core.MethodParameter;
import org.springframework.http.HttpHeaders;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver;
import org.springframework.web.server.ServerWebExchange;

2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java

@ -47,9 +47,9 @@ import org.springframework.web.bind.annotation.RequestMapping; @@ -47,9 +47,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.support.WebBindingInitializer;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.method.annotation.ExceptionHandlerMethodResolver;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.HandlerAdapter;
import org.springframework.web.reactive.HandlerResult;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver;
import org.springframework.web.reactive.result.method.InvocableHandlerMethod;
import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver;

2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java

@ -23,7 +23,7 @@ import org.springframework.core.MethodParameter; @@ -23,7 +23,7 @@ import org.springframework.core.MethodParameter;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver;
import org.springframework.web.server.ServerWebExchange;

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolver.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import java.util.Optional;
@ -21,7 +22,7 @@ import org.springframework.core.MethodParameter; @@ -21,7 +22,7 @@ import org.springframework.core.MethodParameter;
import org.springframework.http.HttpMethod;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver;
import org.springframework.web.server.ServerWebExchange;

9
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/WebSessionArgumentResolver.java

@ -13,19 +13,14 @@ @@ -13,19 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import java.util.Optional;
package org.springframework.web.reactive.result.method.annotation;
import reactor.core.publisher.Mono;
import org.springframework.core.MethodParameter;
import org.springframework.http.HttpMethod;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver;
import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebSession;

2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java

@ -42,11 +42,11 @@ import org.springframework.util.StringUtils; @@ -42,11 +42,11 @@ import org.springframework.util.StringUtils;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebExchangeDataBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.HandlerResult;
import org.springframework.web.reactive.HandlerResultHandler;
import org.springframework.web.reactive.accept.RequestedContentTypeResolver;
import org.springframework.web.reactive.result.AbstractHandlerResultHandler;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.server.NotAcceptableStatusException;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.util.HttpRequestPathHelper;

2
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java

@ -27,6 +27,7 @@ import reactor.test.StepVerifier; @@ -27,6 +27,7 @@ import reactor.test.StepVerifier;
import org.springframework.http.HttpMethod;
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.HandlerResult;
import org.springframework.web.reactive.result.ResolvableMethod;
import org.springframework.web.server.ServerWebExchange;
@ -36,6 +37,7 @@ import org.springframework.web.server.session.MockWebSessionManager; @@ -36,6 +37,7 @@ import org.springframework.web.server.session.MockWebSessionManager;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.*;
/**

17
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java

@ -47,10 +47,11 @@ import org.springframework.web.bind.annotation.RequestBody; @@ -47,10 +47,11 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.HandlerMapping;
import org.springframework.web.reactive.HandlerResult;
import org.springframework.web.reactive.result.ResolvableMethod;
import org.springframework.web.reactive.result.method.RequestMappingInfo.BuilderConfiguration;
import org.springframework.web.reactive.result.method.RequestMappingInfo.*;
import org.springframework.web.server.MethodNotAllowedException;
import org.springframework.web.server.NotAcceptableStatusException;
import org.springframework.web.server.ServerWebExchange;
@ -61,16 +62,10 @@ import org.springframework.web.server.session.MockWebSessionManager; @@ -61,16 +62,10 @@ import org.springframework.web.server.session.MockWebSessionManager;
import org.springframework.web.server.session.WebSessionManager;
import org.springframework.web.util.HttpRequestPathHelper;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.HEAD;
import static org.springframework.web.bind.annotation.RequestMethod.OPTIONS;
import static org.springframework.web.reactive.result.method.RequestMappingInfo.paths;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.springframework.web.bind.annotation.RequestMethod.*;
import static org.springframework.web.reactive.result.method.RequestMappingInfo.*;
/**
* Unit tests for {@link RequestMappingInfoHandlerMapping}.

12
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactoryTests.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import java.util.Collections;
@ -36,17 +37,16 @@ import org.springframework.web.bind.annotation.InitBinder; @@ -36,17 +37,16 @@ import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.config.WebReactiveConfigurationSupport;
import org.springframework.web.reactive.result.ResolvableMethod;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.adapter.DefaultServerWebExchange;
import org.springframework.web.server.session.DefaultWebSessionManager;
import org.springframework.web.server.session.WebSessionManager;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
/**
* Unit tests for {@link BindingContextFactory}.
@ -77,7 +77,6 @@ public class BindingContextFactoryTests { @@ -77,7 +77,6 @@ public class BindingContextFactoryTests {
@SuppressWarnings("unchecked")
@Test
public void basic() throws Exception {
Validator validator = mock(Validator.class);
TestController controller = new TestController(validator);
@ -117,12 +116,10 @@ public class BindingContextFactoryTests { @@ -117,12 +116,10 @@ public class BindingContextFactoryTests {
private Validator[] validators;
public TestController(Validator... validators) {
this.validators = validators;
}
@InitBinder
public void initDataBinder(WebDataBinder dataBinder) {
if (!ObjectUtils.isEmpty(this.validators)) {
@ -161,6 +158,7 @@ public class BindingContextFactoryTests { @@ -161,6 +158,7 @@ public class BindingContextFactoryTests {
public void handle() {}
}
private static class TestBean {
private final String name;

6
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java

@ -32,16 +32,14 @@ import org.springframework.http.server.reactive.ServerHttpRequest; @@ -32,16 +32,14 @@ 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.web.bind.annotation.CookieValue;
import org.springframework.web.reactive.result.method.BindingContext;
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 org.springframework.web.server.session.MockWebSessionManager;
import org.springframework.web.server.session.WebSessionManager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
/**
* Test fixture with {@link CookieValueMethodArgumentResolver}.

7
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsArgumentResolverTests.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import org.junit.Before;
@ -30,8 +31,8 @@ import org.springframework.validation.BindingResult; @@ -30,8 +31,8 @@ import org.springframework.validation.BindingResult;
import org.springframework.validation.Errors;
import org.springframework.web.bind.WebExchangeDataBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.ResolvableMethod;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.adapter.DefaultServerWebExchange;
import org.springframework.web.server.session.MockWebSessionManager;
@ -40,11 +41,11 @@ import org.springframework.web.server.session.WebSessionManager; @@ -40,11 +41,11 @@ import org.springframework.web.server.session.WebSessionManager;
import static junit.framework.TestCase.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.springframework.core.ResolvableType.forClass;
import static org.springframework.core.ResolvableType.forClassWithGenerics;
import static org.springframework.core.ResolvableType.*;
/**
* Unit tests for {@link ErrorsMethodArgumentResolver}.
*
* @author Rossen Stoyanchev
*/
public class ErrorsArgumentResolverTests {

11
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ExpressionValueMethodArgumentResolverTests.java

@ -29,15 +29,13 @@ import org.springframework.http.HttpMethod; @@ -29,15 +29,13 @@ import org.springframework.http.HttpMethod;
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.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.adapter.DefaultServerWebExchange;
import org.springframework.web.server.session.MockWebSessionManager;
import org.springframework.web.server.session.WebSessionManager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
/**
* Unit tests for {@link ExpressionValueMethodArgumentResolver}.
@ -96,8 +94,7 @@ public class ExpressionValueMethodArgumentResolverTests { @@ -96,8 +94,7 @@ public class ExpressionValueMethodArgumentResolverTests {
@SuppressWarnings("unused")
public void params(@Value("#{systemProperties.systemProperty}") int param1,
String notSupported) {
public void params(@Value("#{systemProperties.systemProperty}") int param1, String notSupported) {
}
}
}

11
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolverTests.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import java.nio.ByteBuffer;
@ -46,19 +47,15 @@ import org.springframework.http.codec.DecoderHttpMessageReader; @@ -46,19 +47,15 @@ import org.springframework.http.codec.DecoderHttpMessageReader;
import org.springframework.http.codec.HttpMessageReader;
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.ResolvableMethod;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.ServerWebInputException;
import org.springframework.web.server.adapter.DefaultServerWebExchange;
import org.springframework.web.server.session.MockWebSessionManager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.springframework.core.ResolvableType.forClassWithGenerics;
import static org.junit.Assert.*;
import static org.springframework.core.ResolvableType.*;
/**
* Unit tests for {@link HttpEntityArgumentResolver}.When adding a test also

9
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContextTests.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import java.lang.reflect.Method;
@ -31,18 +32,14 @@ import org.springframework.web.bind.WebDataBinder; @@ -31,18 +32,14 @@ import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver;
import org.springframework.web.reactive.result.method.SyncInvocableHandlerMethod;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.adapter.DefaultServerWebExchange;
import org.springframework.web.server.session.DefaultWebSessionManager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.*;
/**
* Unit tests for {@link InitBinderBindingContext}.

27
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageReaderArgumentResolverTests.java

@ -52,23 +52,20 @@ import org.springframework.validation.Validator; @@ -52,23 +52,20 @@ import org.springframework.validation.Validator;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.ResolvableMethod;
import org.springframework.web.reactive.result.method.BindingContext;
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 org.springframework.web.server.session.MockWebSessionManager;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.springframework.core.ResolvableType.forClass;
import static org.springframework.core.ResolvableType.forClassWithGenerics;
import static org.junit.Assert.*;
import static org.springframework.core.ResolvableType.*;
/**
* Unit tests for {@link AbstractMessageReaderArgumentResolver}.
*
* @author Rossen Stoyanchev
*/
public class MessageReaderArgumentResolverTests {
@ -266,7 +263,8 @@ public class MessageReaderArgumentResolverTests { @@ -266,7 +263,8 @@ public class MessageReaderArgumentResolverTests {
assertArrayEquals(new TestBean[] {new TestBean("f1", "b1"), new TestBean("f2", "b2")}, value);
}
@Test @SuppressWarnings("unchecked")
@Test
@SuppressWarnings("unchecked")
public void validateMonoTestBean() throws Exception {
String body = "{\"bar\":\"b1\"}";
ResolvableType type = forClassWithGenerics(Mono.class, TestBean.class);
@ -276,7 +274,8 @@ public class MessageReaderArgumentResolverTests { @@ -276,7 +274,8 @@ public class MessageReaderArgumentResolverTests {
StepVerifier.create(mono).expectNextCount(0).expectError(ServerWebInputException.class).verify();
}
@Test @SuppressWarnings("unchecked")
@Test
@SuppressWarnings("unchecked")
public void validateFluxTestBean() throws Exception {
String body = "[{\"bar\":\"b1\",\"foo\":\"f1\"},{\"bar\":\"b2\"}]";
ResolvableType type = forClassWithGenerics(Flux.class, TestBean.class);
@ -289,7 +288,7 @@ public class MessageReaderArgumentResolverTests { @@ -289,7 +288,7 @@ public class MessageReaderArgumentResolverTests {
.verify();
}
@Test // SPR-9964
@Test // SPR-9964
public void parameterizedMethodArgument() throws Exception {
Method method = AbstractParameterizedController.class.getMethod("handleDto", Identifiable.class);
HandlerMethod handlerMethod = new HandlerMethod(new ConcreteParameterizedController(), method);
@ -337,7 +336,8 @@ public class MessageReaderArgumentResolverTests { @@ -337,7 +336,8 @@ public class MessageReaderArgumentResolverTests {
List<TestBean> list,
Mono<List<TestBean>> monoList,
Set<TestBean> set,
TestBean[] array) {}
TestBean[] array) {
}
@XmlRootElement
@ -395,6 +395,7 @@ public class MessageReaderArgumentResolverTests { @@ -395,6 +395,7 @@ public class MessageReaderArgumentResolverTests {
}
}
private static class TestBeanValidator implements Validator {
@Override
@ -411,15 +412,18 @@ public class MessageReaderArgumentResolverTests { @@ -411,15 +412,18 @@ public class MessageReaderArgumentResolverTests {
}
}
private static abstract class AbstractParameterizedController<DTO extends Identifiable> {
@SuppressWarnings("unused")
public void handleDto(DTO dto) {}
}
private static class ConcreteParameterizedController extends AbstractParameterizedController<SimpleBean> {
}
private interface Identifiable extends Serializable {
Long getId();
@ -427,6 +431,7 @@ public class MessageReaderArgumentResolverTests { @@ -427,6 +431,7 @@ public class MessageReaderArgumentResolverTests {
void setId(Long id);
}
@SuppressWarnings({"serial"})
private static class SimpleBean implements Identifiable {

29
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolverTests.java

@ -39,8 +39,8 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; @@ -39,8 +39,8 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.bind.WebExchangeBindException;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.ResolvableMethod;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.adapter.DefaultServerWebExchange;
@ -51,9 +51,8 @@ import static org.junit.Assert.assertEquals; @@ -51,9 +51,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.springframework.core.ResolvableType.forClass;
import static org.springframework.core.ResolvableType.forClassWithGenerics;
import static org.springframework.util.Assert.isTrue;
import static org.springframework.core.ResolvableType.*;
import static org.springframework.util.Assert.*;
/**
@ -296,6 +295,18 @@ public class ModelAttributeMethodArgumentResolverTests { @@ -296,6 +295,18 @@ public class ModelAttributeMethodArgumentResolverTests {
}
@SuppressWarnings("unused")
void handle(
@ModelAttribute @Validated Foo foo,
@ModelAttribute @Validated Mono<Foo> mono,
@ModelAttribute @Validated Single<Foo> single,
Foo fooNotAnnotated,
String stringNotAnnotated,
Mono<Foo> monoNotAnnotated,
Mono<String> monoStringNotAnnotated) {
}
private static class Foo {
private String name;
@ -326,14 +337,4 @@ public class ModelAttributeMethodArgumentResolverTests { @@ -326,14 +337,4 @@ public class ModelAttributeMethodArgumentResolverTests {
}
}
@SuppressWarnings("unused")
void handle(
@ModelAttribute @Validated Foo foo,
@ModelAttribute @Validated Mono<Foo> mono,
@ModelAttribute @Validated Single<Foo> single,
Foo fooNotAnnotated,
String stringNotAnnotated,
Mono<Foo> monoNotAnnotated,
Mono<String> monoStringNotAnnotated) {}
}

9
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolverTests.java

@ -31,16 +31,14 @@ import org.springframework.http.server.reactive.ServerHttpRequest; @@ -31,16 +31,14 @@ 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.web.bind.annotation.PathVariable;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.HandlerMapping;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.adapter.DefaultServerWebExchange;
import org.springframework.web.server.session.MockWebSessionManager;
import org.springframework.web.server.session.WebSessionManager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
/**
* Unit tests for {@link PathVariableMapMethodArgumentResolver}.
@ -72,6 +70,7 @@ public class PathVariableMapMethodArgumentResolverTests { @@ -72,6 +70,7 @@ public class PathVariableMapMethodArgumentResolverTests {
this.paramMapNoAnnot = new MethodParameter(method, 2);
}
@Test
public void supportsParameter() {
assertTrue(resolver.supportsParameter(paramMap));
@ -108,4 +107,4 @@ public class PathVariableMapMethodArgumentResolverTests { @@ -108,4 +107,4 @@ public class PathVariableMapMethodArgumentResolverTests {
Map<String, String> mapWithoutAnnotat) {
}
}
}

6
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java

@ -36,17 +36,15 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse @@ -36,17 +36,15 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.HandlerMapping;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.server.ServerErrorException;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.adapter.DefaultServerWebExchange;
import org.springframework.web.server.session.MockWebSessionManager;
import org.springframework.web.server.session.WebSessionManager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
/**
* Unit tests for {@link PathVariableMethodArgumentResolver}.

13
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.method.annotation;
import java.lang.reflect.Method;
@ -36,23 +37,18 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse @@ -36,23 +37,18 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.reactive.result.method.BindingContext;
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 org.springframework.web.server.session.MockWebSessionManager;
import org.springframework.web.server.session.WebSessionManager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
/**
* Unit tests for {@link RequestAttributeMethodArgumentResolver}.
*
* @author Rossen Stoyanchev
*/
public class RequestAttributeMethodArgumentResolverTests {
@ -163,6 +159,7 @@ public class RequestAttributeMethodArgumentResolverTests { @@ -163,6 +159,7 @@ public class RequestAttributeMethodArgumentResolverTests {
String notSupported) {
}
private static class Foo {
}

11
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolverTests.java

@ -41,20 +41,15 @@ import org.springframework.http.codec.HttpMessageReader; @@ -41,20 +41,15 @@ import org.springframework.http.codec.HttpMessageReader;
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.ResolvableMethod;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.ServerWebInputException;
import org.springframework.web.server.adapter.DefaultServerWebExchange;
import org.springframework.web.server.session.MockWebSessionManager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.springframework.core.ResolvableType.forClass;
import static org.springframework.core.ResolvableType.forClassWithGenerics;
import static org.junit.Assert.*;
import static org.springframework.core.ResolvableType.*;
/**
* Unit tests for {@link RequestBodyArgumentResolver}. When adding a test also

7
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java

@ -39,17 +39,14 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse @@ -39,17 +39,14 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.reactive.result.method.BindingContext;
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 org.springframework.web.server.session.MockWebSessionManager;
import org.springframework.web.server.session.WebSessionManager;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
/**
* Unit tests for {@link RequestHeaderMethodArgumentResolver}.

8
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java

@ -38,18 +38,14 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse @@ -38,18 +38,14 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.reactive.result.method.BindingContext;
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 org.springframework.web.server.session.MockWebSessionManager;
import org.springframework.web.server.session.WebSessionManager;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
/**
* Unit tests for {@link RequestParamMethodArgumentResolver}.

2
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolverTests.java

@ -26,8 +26,8 @@ import org.springframework.http.server.reactive.ServerHttpRequest; @@ -26,8 +26,8 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.ResolvableMethod;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebSession;
import org.springframework.web.server.adapter.DefaultServerWebExchange;

2
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java

@ -37,7 +37,7 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse @@ -37,7 +37,7 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.SessionAttribute;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.ServerWebInputException;
import org.springframework.web.server.WebSession;

15
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java

@ -50,24 +50,23 @@ import org.springframework.ui.ConcurrentModel; @@ -50,24 +50,23 @@ import org.springframework.ui.ConcurrentModel;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.HandlerResult;
import org.springframework.web.reactive.accept.HeaderContentTypeResolver;
import org.springframework.web.reactive.accept.RequestedContentTypeResolver;
import org.springframework.web.reactive.result.ResolvableMethod;
import org.springframework.web.reactive.result.method.BindingContext;
import org.springframework.web.server.NotAcceptableStatusException;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.adapter.DefaultServerWebExchange;
import org.springframework.web.server.session.DefaultWebSessionManager;
import org.springframework.web.server.session.WebSessionManager;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.springframework.core.ResolvableType.forClass;
import static org.springframework.core.ResolvableType.forClassWithGenerics;
import static org.springframework.core.io.buffer.support.DataBufferTestUtils.dumpString;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static java.nio.charset.StandardCharsets.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import static org.springframework.core.ResolvableType.*;
import static org.springframework.core.io.buffer.support.DataBufferTestUtils.*;
import static org.springframework.http.MediaType.*;
/**
* Unit tests for {@link ViewResolutionResultHandler}.

Loading…
Cancel
Save