Commit Graph

19930 Commits

Author SHA1 Message Date
Juergen Hoeller
0900808820 Method-level @SuppressWarnings("unchecked") for generic varargs 2016-07-04 23:20:41 +02:00
Sam Brannen
873fc53a2f Introduce support for JUnit 5 in the TestContext framework
This commit introduces initial support for JUnit Jupiter (i.e., the new
programming and extension models in JUnit 5) in the Spring TestContext
Framework.

Specifically, this commit introduces the following.

- SpringExtension: an implementation of multiple extension APIs from
  JUnit Jupiter that provides full support for the existing feature set
  of the Spring TestContext Framework. This support is enabled via
  @ExtendWith(SpringExtension.class).

- @SpringJUnitConfig: a composed annotation that combines
  @ExtendWith(SpringExtension.class) from JUnit Jupiter with
  @ContextConfiguration from the Spring TestContext Framework.

- @SpringJUnitWebConfig: a composed annotation that combines
  @ExtendWith(SpringExtension.class) from JUnit Jupiter with
  @ContextConfiguration and @WebAppConfiguration from the Spring
  TestContext Framework.

Issue: SPR-13575
2016-07-04 22:40:58 +02:00
Sam Brannen
54e3ea8d37 Enable Java 8 source and target compatibility in Gradle build
Issue: SPR-13188
2016-07-04 16:28:26 +02:00
Sebastien Deleuze
8690464a9b Remove @Ignore on streamResult() test
This test was fixed by previous commit that allows to
JSON encode correctly streams with more than 2 elements.
2016-07-04 15:51:44 +02:00
Sebastien Deleuze
7ed03d01c6 Fix JacksonJsonEncoder for streams with more than 2 elements 2016-07-04 15:45:32 +02:00
Sam Brannen
3aefa136fd Upgrade build to Gradle 2.14
Issue: SPR-14362
2016-07-04 15:24:38 +02:00
Sam Brannen
3be0ea9128 Suppress deprecation warning in spring-test 2016-07-04 15:20:52 +02:00
Sam Brannen
fb1eb00b4a Update @since tag in Eclipse template to 5.0 2016-07-04 15:15:19 +02:00
Sebastien Deleuze
c1518c3fde Avoid exception while setting the status code of a committed response
Before this commit, it was not possible to set the status code of an
HTTP response without throwing an exception if it was already
committed. The consequence was a lot of errors in the logs for long
lived HTTP exchanges like Server-Sent Events for example.

After this commit, ServerHttpResponse#setStatusCode() returns
true if the operation succeeded and false if the status code has not
been set because the response has already been committed.

In term of implementation, that makes status code managed
consistently with headers and cookies:
AbstractServerHttpResponse#setStatusCode() stores the status
code that will be effectively set later in the response lifecycle by
the HTTP server via AbstractServerHttpResponse#writeStatusCode()
when the response will be committed.
2016-07-04 13:16:19 +02:00
Stephane Nicoll
19622e3b2d Upgrade copyright 2016-07-04 12:42:54 +02:00
Spring Buildmaster
b6a1680df5 Next Development Version 2016-07-04 09:33:06 +00:00
Sebastien Deleuze
b7b6704c7e Support rx.Completable 2016-07-04 11:05:49 +02:00
Sebastien Deleuze
a1d4fe6938 Upgrade dependencies 2016-07-04 10:17:54 +02:00
Sebastien Deleuze
f254680f29 Remove unused imports 2016-07-04 10:06:02 +02:00
Sebastien Deleuze
0f01729b27 Allow to configure Tomcat baseDir
This commit also set Tomcat baseDir to java.io.tmpdir for
integration tests in order to avoid creation of temporary directories
in the project root.
2016-07-04 09:52:39 +02:00
Sebastien Deleuze
b7b0313c21 Speed up RequestMappingIntegrationTests
Reactor Core + Spring Reactive now handle correctly
shorter interval for the stream result test.
2016-07-04 08:45:47 +02:00
Rossen Stoyanchev
8c76581442 Provide rich type information to ConversionService
When using the ConversionService to check and bridge to and from
reactive types we now generallly provide the full type information
available from method signatures. However that full type information
is not always necessary such as when we perform additional checks on
the generics of the reactive type (e.g. Mono<ResponseEntity>).

This allows us to switch to use DefaultFormattingConversionService
instead of GenericConversionService while also ensuring that the
CollectionToObjectConverter doesn't think it can convert List<?> to
any reactive type.

The ObjectToObjectConverter can also interfere because it is smart
enough to find the "from(Publisher<?>)" method on Flux and Mono.
To make up for that on the response side we now check if a type
is assignable to Publisher first in which case it is a simple cast.

In turn that means we don't need a PublisherToFluxConverter which can
be problematic in its own right because it can convert from Mono to
Flux which technically doesn't lose data but switches stream semantics.

Issue: #124, #128
2016-07-03 21:55:32 -04:00
Rossen Stoyanchev
fb2e796048 HandlerResult now requires MethodParameter as input
HandlerAdapter's should always be able to provide a MethodParameter
which in turn ensures that HandlerResultHandler's have full type
information from method declarations.

This commit also introduces ResolvableMethod for use in tests to make
it easy to obtain MethodParameter return types.

Issue: #128
2016-07-03 21:54:20 -04:00
Juergen Hoeller
080dcad218 Add missing package-info file for new test.context.web.socket package
Issue: SPR-14420
2016-07-02 15:46:21 +02:00
Juergen Hoeller
a6e4b64c23 PropertySourcesPropertyResolver provides logKeyFound template method
Issue: SPR-14370
2016-07-02 15:43:40 +02:00
Juergen Hoeller
f6334fc62b Aligned default Map capacity 2016-07-02 15:17:34 +02:00
Juergen Hoeller
c6752e6023 Explicit note on self references
Issue: SPR-14402
2016-07-02 14:58:54 +02:00
Juergen Hoeller
b204437cef Polishing 2016-07-02 14:48:15 +02:00
Juergen Hoeller
e5122d084a Avoid wrapping in plain RuntimeException in favor of IllegalStateException 2016-07-02 13:03:33 +02:00
Juergen Hoeller
e7a53e37fb Avoid stateful MethodParameter nesting level changes in MVC processing 2016-07-02 13:02:22 +02:00
Juergen Hoeller
e5de7d5455 @MessageExceptionHandler matches cause as well (analogous to @ExceptionHandler)
Issue: SPR-14424
2016-07-02 12:56:37 +02:00
Juergen Hoeller
cfc560c4c4 Leniently accept custom DeferredResult etc subclasses for null values
Issue: SPR-14423
2016-07-02 12:55:30 +02:00
Rossen Stoyanchev
dffd6d674a Shorten returnValueType name in HandlerResult 2016-07-01 18:00:31 -04:00
Rossen Stoyanchev
df64262db6 Complete reactive conversion support refactoring
This commit ensures stream semantics (Flux vs Mono) are adhered to also
on the target side.
2016-07-01 17:42:36 -04:00
Rossen Stoyanchev
71f4dff011 Polish validation in RequestBodyArgumentResolver 2016-07-01 17:42:36 -04:00
Rossen Stoyanchev
a68ff94fbc Polish "decodeOne" related changes 2016-07-01 17:42:36 -04:00
Sebastien Deleuze
917a2fb9d0 Add Decoder#decodeOne()
This commit adds a Decoder#decodeOne() method in order
to handle correctly the streaming versus one value
deserialization based on the type provided by the user.

For example, if a List parameter is provided in a controller
method, Jackson will be called once, while if the user provides
a Flux or an Observable parameter, Jackson will be called for
each element.
2016-07-01 17:42:36 -04:00
Sebastien Deleuze
12d7b78169 Refactor reactive type conversion support
This commit replaces Reactive Streams converters for RxJava1 and
CompletableFuture with Reactor specific ones. The results in conversion
that preserves stream semantics, i.e. Mono vs Flux.

For example this is allowed:
Flux -> Observable
Mono -> Single
Mono -> CompletableFuture

This is not allowed:
Flux -> Single
Mono -> Observable
Flux -> CompletableFuture

As a result it is now possible to check through the ConversionService
if a target type to convert to is a stream of many or of one which is
useful for decoding purposes.

The commit also adds PublisherToFluxConverter to allow conversion from
raw Publisher to Flux. The reverse is not necessary since Flux is a
Publisher and it's a no-op conversion.
2016-07-01 17:41:37 -04:00
Juergen Hoeller
498d896ef0 Upgrade to WebJars Locator 0.32 2016-07-01 15:16:19 +02:00
Stephane Nicoll
037746da44 Polish
Closes gh-1097
2016-07-01 14:26:48 +02:00
Juergen Hoeller
d7184d1ad8 Latest dependency updates (HttpAsyncClient 4.1.2, HtmlUnit 2.22, Selenium 2.53.1, JOpt Simple 5.0.2) 2016-07-01 14:12:46 +02:00
Juergen Hoeller
1c73664c40 Defensively access deprecated AbstractHttpClient class from Apache HttpComponents
Issue: SPR-14422
2016-07-01 14:11:26 +02:00
Sam Brannen
8389e3fc35 Suppress warnings in Gradle build 2016-07-01 13:08:39 +02:00
Juergen Hoeller
a530a1c7f2 Upgrade to Hibernate ORM 5.2.1
Issue: SPR-14327
2016-07-01 12:57:24 +02:00
Stephane Nicoll
716273df47 Polish
Closes gh-967
2016-07-01 11:15:32 +02:00
Stephane Nicoll
49d78b4835 Merge pull request #1089 from nkjackzhang:patch-2
* pr/1089:
  Polish
  Fix typo in asciidoc
2016-07-01 11:00:08 +02:00
Stephane Nicoll
cac58738c9 Polish
Closes gh-1089
2016-07-01 10:58:15 +02:00
nkjackzhang
66fd86be33 Fix typo in asciidoc
See gh-1089
2016-07-01 10:47:06 +02:00
Stephane Nicoll
d9993243b6 Polish
Closes gh-1096
2016-07-01 10:43:54 +02:00
Stephane Nicoll
d35709dfbc Merge pull request #1095 from nkjackzhang:patch-4
* pr/1095:
  Polish contribution
  Fix typo in javadoc
2016-07-01 10:41:07 +02:00
Stephane Nicoll
2b822d5053 Polish contribution
Closes gh-1095
2016-07-01 10:40:54 +02:00
nkjackzhang
60123b6ca3 Fix typo in javadoc
See gh-1095
2016-07-01 10:40:15 +02:00
Juergen Hoeller
5c6f57ba78 Upgrade to EhCache 3.1 and Jetty 9.3.10 2016-06-30 22:25:18 +02:00
Rossen Stoyanchev
952395192f Collapse core.codec and core.codec.support into one 2016-06-30 16:12:36 -04:00
Rossen Stoyanchev
2f2546c8a4 Simplify initialization of WebSession Mono
The DefaultWebSessionManager now uses Mono.defer to protect the call
to getSession from parsing session cookies immediately. This allows
pre-initializing the Mono<WebSession> upfront vs using a lock.
2016-06-30 16:00:49 -04:00