Commit Graph

1369 Commits

Author SHA1 Message Date
Juergen Hoeller 3881a4aded Polishing 2018-07-25 14:16:02 +02:00
Juergen Hoeller 1603c4ab2f Programmatic ObjectProvider retrieval through BeanFactory API
Introduces getBeanProvider(Class) and getBeanProvider(ResolvableType), also narrowing getBean(String, Class) and isTypeMatch(String, Class) to a non-null Class argument and enriching NoUniqueBeanDefinitionException with a full ResolvableType. In addition, ObjectProvider supports iterable/stream access for collection-style resolution of multiple matching beans now, and collection injection falls back to an empty collection in a single-constructor case with non-null arguments.

Issue: SPR-17075
Issue: SPR-11419
Issue: SPR-15338
2018-07-24 00:42:03 +02:00
Rossen Stoyanchev c57e1afd2b ResulatMatcher.matchAll
Issue: SPR-16417
2018-07-20 23:02:47 -04:00
Rossen Stoyanchev 91122ec0f5 Add Consumer methods to WebTestClient assertion classes
Issue: SPR-16574
2018-07-20 22:28:40 -04:00
Rossen Stoyanchev 20de5003ff Hamcrest methods in WebTestClient
Issue: SPR-16729
2018-07-20 17:40:38 -04:00
Rossen Stoyanchev 0c62d6b5da Polish
Leaving out hamcrest for now, to address more broadly.

Issue: SPR-16741
2018-07-20 17:40:38 -04:00
Eric Deandrea 2734f01067 Provide XML assertions in WebTestClient
Adds XML-based assertions in
org.springframework.test.web.reactive.server.WebTestClient.BodyContentSpec
for asserting against the XML body as well as xPath,
similar to those assertions offered when using
MockMvcResultMatchers.xpath().

Issue: SPR-16741
2018-07-20 17:38:04 -04:00
Juergen Hoeller 9a43d2ec20 Revised log levels: less WARN and INFO, fine-tuned DEBUG vs TRACE
Issue: SPR-16946
2018-07-20 15:05:16 +02:00
Juergen Hoeller b3d6283d7d CookieAssertionTests expects language tag compliance by default
Issue: SPR-16700
2018-07-17 18:18:54 +02:00
Rossen Stoyanchev 75e45103b5 Polish DefaultUriBuilderFactory 2018-07-16 21:21:34 -04:00
Rossen Stoyanchev fd90b73748 Correlated WebFlux server log messages
Issue: SPR-16966
2018-07-05 08:27:13 -04:00
Sam Brannen 160002cf8b Polishing 2018-07-04 14:33:39 +02:00
Sam Brannen 755add3087 Verify that TestContextBootstrapper resolution ignores duplicates
This commit introduces a test to verify that multiple declarations of
@BootstrapWith that register the same TestContextBootstrapper type
(i.e., duplicates) do not result in an error.

Issue: SPR-17006
2018-07-04 13:58:49 +02:00
Juergen Hoeller d22d408261 Propagate read-only status through Session.setDefaultReadOnly(true)
Issue: SPR-16956
2018-07-03 22:22:19 +02:00
Juergen Hoeller 4ff1e3e74b Consistent abstract declaration for utility classes (plus polishing)
Issue: SPR-16968
2018-07-01 02:31:20 +02:00
Rossen Stoyanchev d74e09a925 Polish MockClientHttpRequest 2018-06-29 17:37:45 -04:00
Rossen Stoyanchev 7f555785dd Add getBodyAsString() to MockClientHttpRequest
Issue: SPR-16988
2018-06-29 17:34:23 -04:00
Juergen Hoeller e22466e9d5 Polishing 2018-06-29 19:44:15 +02:00
Juergen Hoeller b0ece0e967 Remove hard configuration validation from SpringClassRule/MethodRule
Issue: SPR-16967
2018-06-28 14:15:16 +02:00
Phillip Webb a89e716cc7 Use tabs rather than spaces in tests
Update tests to ensure that tabs are used instead of spaces. Also
consistently apply a new line at the end of each file.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 81451aa800 Organize imports
Reorganize imports to ensure consistent ordering. This commit also
expands any `.*` static imports in favor of using fully-qualified
method references.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 5cedd0d5d4 Consistently use tabs rather than spaces
Update code that has accidentally used spaces instead of tabs.
Also remove all trailing whitespace.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 0b53c1096a Always use 'this.' when accessing fields
Ensure that `this.` is used consistently when accessing class
fields.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb eeebd51f57 Use consistent class design
Update all classes so that inner classes are always last. Also
ensure that utility classes are always final and have a private
constructor and make exceptions final whenever possible.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 0ad0f341bd Don't use single letter catch variables
Update existing catch blocks to ensure that `ex` is always used
in preference to `e` or `t` as the variable name.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 04a8c285df Fix annotation styling issues
Update all annotations so that each is on its own line and
consistently use the short form (i.e. don't use `value=`) when
possible.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb e9d1b39aff Apply consistent copyright header
Add copyright header to `package-info.java` files and fix a few
malformed headers on existing java files.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb c3a17dfd47 Ensure all files end with a newline
Update all files to ensure that they always end with a new line.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb e0480f75ac Fix javadoc checkstyle issues
Fix checkstyle violations for javadoc.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Sam Brannen 802763d26f Reintroduce suppression of deprecation warning 2018-06-15 00:43:21 +03:00
Sam Brannen 8027e1f109 Remove obsolete suppression of deprecation warning 2018-06-14 22:48:34 +03:00
Sam Brannen 4ae4788e93 Delete unused import 2018-06-14 22:46:10 +03:00
Juergen Hoeller 3fc8ec498c MockHttpServletRequest returns a single InputStream or Reader
Issue: SPR-16505
Issue: SPR-16499
2018-06-13 22:03:16 +02:00
Rossen Stoyanchev a31204938a Getter for DispatcherSerlvet in MockMvc
Issue: SPR-16924
2018-06-11 12:42:55 -04:00
Rossen Stoyanchev 124d4c833c Support for Servlet request params with HTTP DELETE
This commit adds FormContentFilter, which is the same as the
HttpPutFormContentFilter but also supports DELETE.

The HttpPutFormContentFilter is now deprecated.

Issue: SPR-16874
2018-06-04 15:48:47 -04:00
Juergen Hoeller 8593fec22c Avoid ConstantConditions warnings suppression (plus related polishing)
Issue: SPR-15756
2018-05-29 21:47:10 +02:00
Rossen Stoyanchev 2acf91a438 Polish 2018-05-26 09:24:23 -04:00
Rossen Stoyanchev 2a993bf9ff Respect async request timeout of -1 in MockMvc
When falling back on the timeout associated with the async request,
a value of -1 must be treated as: never time out.

Issue: SPR-16869
2018-05-24 12:33:19 -04:00
Sebastien Deleuze 265960f09c Add StatusResultMatchers.isEqualTo Kotlin extension
Issue: SPR-16429
2018-05-15 15:37:47 +02:00
Rossen Stoyanchev 15182b29a4 Add MockWebSession for use with MockServerWebExchange
Issue: SPR-16772
2018-05-11 10:53:28 -04:00
Rossen Stoyanchev 4da43de7e1 Remove individual detection of forwarded headers
This commit removes all places where forwarded headers are checked
implicitly, on an ad-hoc basis.

ForwardedHeaderFilter is expected to be used instead providing
centralized control over using or discarding such headers.

Issue: SPR-16668
2018-05-11 09:31:39 -04:00
Rossen Stoyanchev d3f3b41f52 MockHttpServletResponse writer sets committed flag
Issue: SPR-16683
2018-05-10 16:22:54 -04:00
Rossen Stoyanchev eef592d901 Add builder to MockServerWebExchange
Issue: SPR-16772
2018-05-10 15:16:13 -04:00
Sam Brannen 7444a62f98 Test Spring-managed JUnit Jupiter extension 2018-05-09 13:34:30 +02:00
Arjen Poutsma 22edab852d Provide simple way to create ServerRequest
This commit introduces support for creating a new `ServerRequest` from
an existing instance. This is especially useful when filtering requests
in a HandlerFilterFunction.

Issue: SPR-16707
2018-05-02 10:54:00 +02:00
Juergen Hoeller a683472daa Support for non-standard HTTP status in reactive ClientHttpResponse
Issue: SPR-16748
2018-04-27 18:25:11 +02:00
Rossen Stoyanchev 9bc4e70e93 Better assertion message in MockPart
Issue: SPR-16767
2018-04-25 09:59:06 -04:00
Sam Brannen ae3fd49ebb Introduce non-transactional test for TestNG support 2018-04-23 16:18:02 +02:00
sdeleuze 568a0b5b79 Make ResponseSpec.expectBody Kotlin extension usable
Prior to this commit, due to KT-5464 type inference issue there was not
proper way to provide body expectations with WebTestClient. This commit
provides a workaround by updating the existing Kotlin extension to
return a Kotlin compatible API.

Issue: SPR-15692
2018-04-17 15:00:04 +02:00
Sam Brannen c6ed41ec47 Suppress warning in SpringFailOnTimeoutTests 2018-04-14 15:02:57 +02:00
Sam Brannen 8317f12a9b Move SpringFailOnTimeoutTests to 'statements' package 2018-04-12 11:14:08 +02:00
Sam Brannen 4f3a7dd9b4 Expand scope of SpringFailOnTimeoutTests
Issue: SPR-16716
2018-04-12 10:56:40 +02:00
Igor Suhorukov 3c34a1cb8c Throw exception from user code in SpringFailOnTimeout even if a timeout occurs
Issue: SPR-16717
2018-04-12 10:37:13 +02:00
Sam Brannen 2523c3ab77 Clean up deprecation warning in spring-test 2018-04-11 12:03:55 +02:00
Arjen Poutsma 7e2726f400 Add remoteAddress() to ServerRequest
Issue: SPR-16681
2018-04-10 11:13:45 +02:00
Rossen Stoyanchev 313308208e TestDispatcherServlet unwraps to find mock request
Issue: SPR-16695
2018-04-06 11:02:46 -04:00
Sam Brannen 56774baa2a Use Gradle 4.6's built-in support for the JUnit Platform
Gradle 4.6 provides built-in support for the JUnit Platform within the
standard `test` task.

This commit configures a custom `testJUnitJupiter` test task for
executing JUnit Jupiter tests directly on the JUnit Platform instead of
indirectly on JUnit 4 via @RunWith(JUnitPlatform.class).

This switch provides for better integration with Gradle's test reporting
and paves the way for a possible transition to the JUnit Platform in the
future.

Issue: SPR-16672
2018-04-04 15:43:44 +02:00
Sam Brannen 71cacff8c2 Upgrade to JUnit Jupiter 5.1
Issue: SPR-16408
2018-04-04 12:29:26 +02:00
Juergen Hoeller 912c270f2b Polishing 2018-03-31 17:49:21 +02:00
Sam Brannen e5096be660 Polishing 2018-03-30 12:23:28 +02:00
Sam Brannen f79562f8d1 Introduce tests for generics & @Nested test classes 2018-03-30 12:12:21 +02:00
Juergen Hoeller d553ddc5b3 Nullability refinements (based on IntelliJ IDEA 2018.1 introspection)
Issue: SPR-15756
2018-03-29 23:50:17 +02:00
igor-suhorukov c1ff97e2a8 Short-circuit logic should be used in boolean contexts 2018-03-29 23:33:22 +02:00
Sam Brannen 9244090ba0 Support DI of individual constructor args in @Nested tests
Prior to this commit it was impossible to have an individual
constructor argument in a @Nested (i.e., inner) test class injected via
@Autowired, @Qualifier, or @Value.

This is due to a bug in javac on JDK versions prior to 9, whereby
annotation lookups performed directly via the
java.lang.reflect.Parameter API fail for inner class constructors.

Specifically, the parameter annotations array in the compiled byte code
for the user's test class excludes an entry for the implicit enclosing
instance parameter for an inner class constructor.

This commit introduces a workaround in ParameterAutowireUtils for this
off-by-one error by transparently looking up annotations on the
preceding Parameter object (i.e., index - 1). In addition, this commit
relies on the change recently introduced in MethodParameter in order to
compensate for the same JDK bug (see SPR-16652).

Issue: SPR-16653
2018-03-29 17:47:45 +02:00
Rossen Stoyanchev f9e6ea5482 MvcResult returns asyncResult after asyncDispatch
Issue: SPR-16648
2018-03-28 22:15:16 -04:00
igor-suhorukov 4aae6a6dda Use Map.forEach instead of manual Map.Entry iteration wherever possible SPR-16646 2018-03-28 01:09:03 +02:00
Sam Brannen 75f70b269e Introduce @Nested tests with constructor injection
This commit introduces @Nested tests to verify support for constructor
injection when using the SpringExtension.

One of the tests is disabled on Java 8 due to a bug in javac that was
first fixed in JDK 9.

See https://github.com/junit-team/junit5/issues/1345 for details.
2018-03-27 16:45:26 +02:00
Juergen Hoeller f00afe3247 Use (Concurrent)Map.computeIfAbsent for lazy nested collection creation 2018-03-23 17:36:23 +01:00
Arjen Poutsma c56317928f Add formData() and multipartData() to ServerRequest
Issue: SPR-16551
2018-03-23 10:00:30 +01:00
Juergen Hoeller c1405ef140 Polishing 2018-03-21 16:12:42 +01:00
Arjen Poutsma b31d55dfce Deprecated ClientRequest.method in favor of ClientRequest.create
The former method clashed with the ClientRequest.method() getter.
2018-03-16 17:27:29 +01:00
Rossen Stoyanchev 72bbb2619d Commit actions are (properly) deferred
Issue: SPR-16597
2018-03-15 23:17:57 -04:00
Rossen Stoyanchev 541ee13934 Add bufferContent option to MockRestServiceServer
Issue: SPR-14694
2018-03-15 22:13:44 -04:00
Rossen Stoyanchev f7e75a5b82 Polish MockRestServiceServer client tests 2018-03-15 22:13:43 -04:00
Sam Brannen 5f4d5f17f7 Polishing 2018-03-13 16:48:52 +01:00
Sam Brannen 2c2ce55f47 Support target type in JsonPath assertions for MockMvc results
This commit picks up where SPR-14498 left off by adding support for an
explicit target type when using JsonPath to perform an assertion against
the response content using a Hamcrest Matcher.

Specifically, there is a new overloaded value(Matcher<T>, Class<T>)
method in JsonPathResultMatchers for use with Hamcrest matchers where
the target type (i.e., Class<T>) can be specified.

Issue: SPR-16587
2018-03-13 15:55:39 +01:00
Bronwyn Perry-Huston d64f2eb038 Add JSON matcher to assert on request body
Support asserting JSON regardless of order and formatting.
Based on same JsonExpectationHelper used in ContentResultMatchers.

Issue: SPR-13919
2018-03-13 12:27:05 +01:00
Sam Brannen 1fa1f2b58a Delete unused import 2018-03-10 16:56:33 +01:00
Rossen Stoyanchev 3653a37e27 Polish tests 2018-03-09 21:16:18 -05:00
Sam Brannen 107f8bb5fd Polishing 2018-03-09 18:19:30 +01:00
Sam Brannen 00fea23e6b Introduce test for WebTestClient with RegEx-based JsonPath 2018-03-09 14:51:37 +01:00
Juergen Hoeller 139dc1d373 Polishing (collapsed if checks, consistent downcasts, refined javadoc) 2018-03-08 18:11:57 +01:00
igor-suhorukov 0f7485b01d Polish: reorder the modifiers to comply with the Java Language Specification. 2018-03-08 17:57:47 +01:00
Sam Brannen b14301bfba Allow TestContextManager to be compiled in Eclipse again 2018-03-07 17:44:24 +01:00
Sam Brannen 2454b31b30 Polish MockRestRequestMatchers[Tests] 2018-03-07 14:20:57 +01:00
Sam Brannen f932796201 Polishing 2018-03-07 13:22:36 +01:00
Sam Brannen fef0c7b151 Throw AssertionError instead of IAE in MockRestRequestMatchers 2018-03-07 13:22:21 +01:00
Yannik Hampe 4094879daf Make MockRestRequestMatchers independent of JUnit (#1720)
MockRestRequestMatchers was using org.junit.Assert.assertNotNull
and thus could not be used in projects that use e.g. TestNG instead
of JUnit 4.
2018-03-07 13:07:32 +01:00
Juergen Hoeller a0cc80063d Concurrency and exception message refinements for test transactions 2018-03-05 13:00:35 +01:00
igor-suhorukov ed936cbd89 Polish: Overriding methods should do more than simply call the same method in the super class 2018-03-02 00:06:27 +01:00
Juergen Hoeller bfddbbe731 Polishing 2018-03-01 01:39:06 +01:00
igor-suhorukov 8080f56db8 Polish: "@Override" should be used on overriding and implementing methods 2018-03-01 00:15:18 +01:00
Rossen Stoyanchev e12fcca1e3 Fix failing test 2018-02-26 20:35:17 -05:00
Juergen Hoeller 9e55422334 Polishing 2018-02-25 15:38:32 +01:00
Juergen Hoeller 01d9475bcc Turn registered controller classes into controller instances on the fly
Issue: SPR-16520
2018-02-25 14:29:44 +01:00
igor-suhorukov c782075a13 Polish: Array designators "[]" should be on the type, not the variable 2018-02-25 13:14:20 +01:00
Juergen Hoeller 3531c104b0 Prefer Collections.addAll call with array over Set.addAll(Arrays.asList) 2018-02-25 00:21:39 +01:00
Juergen Hoeller a5cbf5fe24 Consistent use of Collection.toArray with zero-sized array argument
Includes consistent use of ClassUtils.toClassArray (as non-null variant)

Issue: SPR-16523
2018-02-22 11:29:46 +01:00
Rossen Stoyanchev bb8cddda23 Assert instances (vs classes) in MockMvc/WebTestClient
Issue: SPR-16520
2018-02-21 14:01:53 -05:00
Juergen Hoeller 0de36d2883 Consistent HttpMethod identity comparisons 2018-02-18 22:01:22 +01:00
Juergen Hoeller d7cab23e6d Consistent use of StringUtils.toStringArray
(cherry picked from commit 6d11b40)
2018-02-16 20:49:17 +01:00
Juergen Hoeller 8d3264f680 Prefer List.sort(Comparator) over Collections.sort(List, Comparator) 2018-02-16 10:23:18 +01:00
igor-suhorukov 2be4985b8f Polish: anonymous inner classes containing only one method should become lambdas,
use getOrDefault instead of ternary operator
2018-02-16 09:38:19 +01:00
Juergen Hoeller 3b810f3544 Consistent Class array vs vararg declarations (and related polishing) 2018-02-14 14:44:00 +01:00
igor-suhorukov 45e520ed86 Polish: remove unused private fields, remove empty operator 2018-02-13 23:00:18 +01:00
igor-suhorukov 0ee505b73e Polish: assertion arguments should be passed in the correct order,
use assertNull instead of assertEquals(null, value),
declare delta as double value in assertEquals
2018-02-10 17:17:28 +01:00
Juergen Hoeller 39201adca4 Consistent handling of InterruptedException
Issue: SPR-16479
2018-02-10 13:03:33 +01:00
igor-suhorukov 9a6fbf59c5 Polish: follow name convention - make immutable fields final 2018-02-10 12:09:19 +01:00
Stephane Nicoll 991eb4858e Update copyright header 2018-02-09 10:16:58 +01:00
igor-suhorukov e381514b07 Collection.isEmpty() should be used to test for emptiness
Closes gh-1670
2018-02-09 10:11:44 +01:00
Rossen Stoyanchev 1653a32a04 Stabilize Flux.interval emissions in integration tests
After this commit the use of interval in tests is combined with
take(n).onBackpressureBuffer(n) to ensure emissions don't fail if the
fixed rate is exceeded (e.g. on slow CI server).

Tests that verify N number of items followed by verifyOnComplete()
should set the number of emissions to N.

Tests that verify N number of items followed by thenCancel() should
set the number of buffered to an arbitrary number greater than N.
2018-02-06 11:01:19 -05:00
Rossen Stoyanchev f20eacdb9b Polish 2018-02-02 15:06:59 -05:00
Rob Winch 0cd427bdd3 MockHttpServletRequestBuilder decodes pathInfo
Previously MockHttpServletRequestBuilder calculated the pathInfo from the
provided URL without decoding the value. This meant that the pathInfo
incorrectly included URL encoded values.

Now MockHttpServletRequestBuilder properly decodes the pathInfo.

Fixes: SPR-16453
2018-02-02 15:00:47 -05:00
Juergen Hoeller b3e21ec737 MockHttpServletRequest leniently handles invalid Accept-Language header
Issue: SPR-16454
2018-02-02 11:34:22 +01:00
Rossen Stoyanchev 6d909b013e Do not commit response on access to content
MockHttpServletResponse no longer calls flushBuffer on calls to
getContentAsByteArray and getContentAsString. The flushing doesn't
actually do anything useful but does commit the response leading to
unexpected side effects.

Issue: SPR-16430
2018-01-30 16:19:08 -05:00
Sam Brannen b612f53e27 Rename doesExist() to exists() for header assertions 2018-01-26 17:24:54 +01:00
Juergen Hoeller c6b0d85a7c Consistent available() support in DelegatingServletInputStream
Issue: SPR-16416
2018-01-25 19:06:20 +01:00
Ketan Padegaonkar a0c9fdba12 Fix `DelegatingServletInputStream#available`
Ensure that the method returns the correct number of bytes that can be
read without blocking

Issue: #SPR-16416
2018-01-25 18:02:59 +01:00
Sam Brannen 165ca12e6d Add doesExist() to HeaderAssertions for WebTestClient 2018-01-25 15:50:19 +01:00
Sam Brannen 431494096a Polishing 2018-01-25 15:49:06 +01:00
Rossen Stoyanchev 49f1aa78eb Polish 2018-01-24 17:37:49 -05:00
Neonailol 81ca1f7c2b Add doesExist assertion method to HeaderResultMatchers 2018-01-24 17:28:46 -05:00
Juergen Hoeller 61579ffe7b Polishing 2018-01-22 21:34:44 +01:00
Juergen Hoeller 9d0e62ef68 Javadoc format and related polishing 2018-01-22 11:43:21 +01:00
Juergen Hoeller 40127bd9ad Polishing 2018-01-19 12:30:10 +01:00
Rossen Stoyanchev 0c289283ff Separate from expectations from response creation
This commit separates the creation of a response so that it is executed
after the synchronized block inside which requests need to be matched
and validated (for order and count).

This allows a ResponseCreator to be slow or block if it has to.

Issue: SPR-16319
2018-01-17 13:01:40 -05:00
Rossen Stoyanchev 7ab4d0ca08 Polish MockRestServiceServer code 2018-01-17 13:01:40 -05:00
Juergen Hoeller 214576673a Proper NoClassDefFoundError check against BeanUtils.instantiateClass
Issue: SPR-16369
2018-01-17 18:29:05 +01:00
Sam Brannen c88f11f958 Avoid deprecation warnings on JDK 9 in spring-test 2018-01-13 16:45:04 +01:00
Juergen Hoeller a15975d94d Log non-loadable TestExecutionListener classes at debug level only
Issue: SPR-16369
2018-01-12 16:47:46 +01:00
Juergen Hoeller 8f6d3feaa0 Tests for non-required MultipartFile parameters
Issue: SPR-16329
2018-01-11 10:22:59 +01:00
Juergen Hoeller 4a57e26d76 Polishing 2018-01-07 23:33:35 +01:00
Rossen Stoyanchev 0f1f95e090 Add hasJsonPath/doesNotHaveJsonPath assertion options
Issue: SPR-16339
2018-01-03 20:27:09 -05:00
Brian Clozel 6e587d5c57 Add new WebTestClient header assertions
This commit adds new header assertions for `WebTestClient`.

`doesNotExist` tests that a given header is not present:

    .expectHeader().doesNotExist("Cache-Control");

`contentTypeCompatibleWith` tests for MediaType compatibility:

    .expectHeader().contentTypeCompatibleWith("text/*");

Issue: SPR-16285
2017-12-21 20:34:24 +01:00
Rossen Stoyanchev a8cf275aed MockServerHttpRequest builder supports query params
Issue: SPR-16280
2017-12-19 15:38:12 -05:00
Rossen Stoyanchev 6df1a7874a MockHttpServletResponse uses correct language header
Issue: SPR-16311
2017-12-19 13:56:16 -05:00
sdeleuze 9f1d8517ba Polish Kotlin source code style 2017-11-21 15:59:23 +01:00
Juergen Hoeller 7697b398d5 Polishing 2017-11-14 17:11:16 +01:00
Rossen Stoyanchev 87375fe6f8 ServerHttpRequest exposes SSL certificates
Issue: SPR-15964
2017-11-10 16:43:12 -05:00
Rossen Stoyanchev cb34b0b963 Polish 2017-11-09 17:16:31 -05:00
anton_bondarenko b487db294b Fix NullPointer when setting cookies in RequestUriSpec 2017-11-09 16:59:44 -05:00
Rossen Stoyanchev 263da1535b WebTestClient can be configured with connector
Issue: SPR-16168
2017-11-07 13:01:12 -05:00
Rossen Stoyanchev 14f02d7192 Update reference with examples of multipart requests
Issue: SPR-16118
2017-11-06 16:33:58 -05:00
Juergen Hoeller 4ec60f08ad PrintingResultHandler defensively accesses session.getAttributeNames()
Issue: SPR-16164
2017-11-06 21:19:44 +01:00
Juergen Hoeller e5c1deea63 Polishing 2017-11-05 16:23:30 +01:00
Juergen Hoeller 80a0cf71f4 MockHttpServletResponse.getDateHeader returns -1 for non-existent header
Includes consistent getDateHeader results in both MockHttpServletResponse variants (spring-test and spring-web)

Issue: SPR-16160
2017-11-05 16:12:21 +01:00
Juergen Hoeller 0edf4d6509 MockHttpServletRequest.getRequestURL aligns with getServerName/Port
Issue: SPR-16138
2017-11-05 16:11:21 +01:00
Rossen Stoyanchev 579328bd7a MockClientHttpRequest|Response support cookie headers
Issue: SPR-16124
2017-10-31 12:08:18 -04:00
Juergen Hoeller 295e3b6a99 MockRestServiceServer test for follow-up request after failure
Issue: SPR-16132
2017-10-30 16:40:20 +01:00
Eric Pabst 43d88e4a25 Move requests.add(request) into finally block.
This avoids "IllegalStateException: Expectations already declared" when
a MockRestServiceServer is used after one request throws an exception.

Issues: SPR-16132
2017-10-30 08:53:13 -06:00
Juergen Hoeller 70ed45020b Add StatusAssertions.isForbidden
Includes aligned quoting for header assertion messages.
Also aligns HeaderAssertionTests class name.

Issue: SPR-16129
2017-10-29 09:51:25 +01:00
Sebastien Deleuze b9a0e6bbf2 Update documentation about WebTestClient Kotlin issue
Issue: SPR-16057
2017-10-27 13:52:51 +02:00
Rossen Stoyanchev a982123ed5 Decouple ExchangeResult from WiretapRequest/Response
This commit decouples ExchangeResult from knowledge about
WiretapClientHttpRequest/Response both of which are now private to
WiretapConnector.

ExchangeResult takes ClientHttpRequest/Response instead along with
promises for the serialized request and response content in the form
of MonoProcessor<byte[]>.

This sets up the possibility for an ExchangeResult to be created
outside and independent of WebTestClient, should we decide to make its
constructor public.

Issue: SPR-16101
2017-10-25 17:41:46 -04:00
Rossen Stoyanchev cd634633d8 MockMvc re-uses response instance on async dispatch
MockMvc now properly detects the presence of an AsyncContext and
re-uses the response instance used to start it.

This commit also includes a minor fix in
ResponseBodyEmitterReturnValueHandler to ensure it does not disable
ETag related content buffering for reactive return values that do not
result in streaming (e.g. single value or collections).

Issue: SPR-16067
2017-10-17 16:57:35 -04:00
Rossen Stoyanchev 94c4a7f941 Shortcut factory method in MockServerWebExchange
MockServerWebExchange now has a second factory method that accepts a
MockServerHttpRequest.BaseBuilder.

Issue: SPR-16079
2017-10-17 12:23:12 -04:00
Arjen Poutsma 24ca8ccf5a WebTestClient.mutate() should not impact future .mutate() invocations
Issue: SPR-16059
2017-10-13 16:54:30 +02:00
Sam Brannen ef0e4dc56a Delete unused import 2017-10-12 17:31:10 +02:00
Rossen Stoyanchev d04d4bfb4d Better "no content" support and polish in WebTestClient
The WebTestClient now takes advantage of the support for decoding
response to Void.class in WebClient so that applications can use
expectBody(Void.class) to the same effect as using
response.bodyToMono(Void.class) as documneted on WebClient#exchange.

The top-level, no-arg returnResult method (added very recently) has been
retracted, since the use of returnResult at that level, i.e. without
consuming the response content, should be used mainly for streaming.
It shouldn't be used for "no content" scenarios.

Documentation and Javadoc have been udpated accordingly.
2017-10-04 15:05:25 -04:00
Rossen Stoyanchev decb6329db DefaultWebTestClient internal refactoring
Use the ClientResponse methods bodyToMono and bodyToFlux rather than
passing in a BodyExtractor so that WebTestclient now also benefits from
the recently improved handling of Void.class.
2017-10-04 15:05:25 -04:00
Rossen Stoyanchev 48c41049b1 Correct package for MockServerWebExchange
Discovered late, but not too late. MockServerWebExchange is now in the
proper package matching to the location of ServerWebExchange.
2017-09-29 17:03:23 -04:00
Rossen Stoyanchev 223e27d53d Package private request and response implementations
Concrete server and client, reactive request and response
implementations should not have to be accessed outside their package.
They could be seen as private to their HttpHandler adapters and
ClientHttpConnector's respectively.

The one exception, WebSocket upgrades in spring-webflux, is an internal
framework use case, accommodated via downcast + accessors in the
abstract base classes.
2017-09-29 13:04:03 -04:00
Brian Clozel 126ac849e5 Fix behavior of ClientResponse#bodyTo** with Void
Prior to this commit, asking for a `Void` type using any of the
`ClientResponse#bodyTo*` methods would immediately return an empty
`Publisher` without consuming the response body.

Not doing so can lead to HTTP connection pool inconsistencies and/or
memory leaks, since:

* a connection that still has a response body being written to it cannot
be properly recycled in the connection pool
* incoming `DataBuffer` might not be released

This commit detects when `Void` types are asked as body types and in
those cases does the following:

1. Subscribe to the response body `Publisher` to allow the connection to
be returned to the connection pool
2. `cancel()` the body `Publisher` if the response body is not empty; in
that case, we choose to close the connection vs. consume the whole
response body

Those changes imply that `ClientHttpResponse` and other related
contracts don't need a `close()` method anymore.

Issue: SPR-16018
2017-09-28 00:58:38 +02:00
Rossen Stoyanchev 6ee1af27c6 WebFlux supports HTTP HEAD
Issue: SPR-15994
2017-09-27 15:25:29 -04:00
Sam Brannen 2b91d668df Polish Javadoc for @DisabledIf 2017-09-27 16:25:30 +02:00
Juergen Hoeller efce7902c4 Polishing 2017-09-27 01:34:11 +02:00
Sam Brannen 96bbd18e98 Delete unused import 2017-09-26 16:19:49 +02:00
Arjen Poutsma 1a3cc3df94 Moved fromServerRequest to ServerRequest itself
This commit moves WebFluxUriComponentsBuilder.fromServerRequest to the
ServerRequest interface itself.

Consequently, the WebFluxUriComponentsBuilder is removes itself, as it
contained no other methods.

Issue: SPR-15953
2017-09-25 11:29:07 +02:00
Sebastien Deleuze 0d8031d9b4 Remove remaining Kotlin compilation warning 2017-09-24 23:11:36 +02:00
Rossen Stoyanchev d742fc198a Add consumeWith to FluxExchangeResult
Issue: SPR-15959
2017-09-22 21:04:02 -04:00
Juergen Hoeller 7ae59d0c2a Nullability refinements on private and static methods
Based on IntelliJ IDEA 2017.3 introspection results.

Issue: SPR-15756
2017-09-22 18:22:14 +02:00
Juergen Hoeller 15c82afc1c Consistent conversion of Optional array/list arrangements
Issue: SPR-15918
Issue: SPR-15919
Issue: SPR-15676
2017-09-20 18:28:49 +02:00
Juergen Hoeller ea01c4113a Revisit MockPart constructors
Issue: SPR-15854
2017-09-20 10:55:06 +02:00
Arjen Poutsma 2fb3eeba6f Introduce ServerRequest.methodName()
This commit introduces a methodName() method to the ServerRequest,
returning the String name of the method. This method is useful for
non-standard HTTP methods.
2017-09-15 14:14:39 +02:00
Sebastien Deleuze 1bc93e3d0f Revisit nullability annotations
This commit introduces the following changes.

1) It adds a new Spring @NonNull annotation which allows to apply
@NonNullApi semantic on a specific element, like @Nullable does.
Combined with @Nullable, it allows partial null-safety support when
package granularity is too broad.

2) @Nullable and @NonNull can apply to ElementType.TYPE_USE in order
to be used on generic type arguments (SPR-15942).

3) Annotations does not apply to ElementType.TYPE_PARAMETER anymore
since it is not supported yet (applicability for such use case is
controversial and need to be discussed).

4) @NonNullApi does not apply to ElementType.FIELD anymore since in a
lot of use cases (private, protected) it is not part for the public API
+ its usage should remain opt-in. A dedicated @NonNullFields annotation
has been added in order to set fields default to non-nullable.

5) Updated Javadoc and reference documentation.

Issue: SPR-15756
2017-09-15 13:26:41 +02:00
Juergen Hoeller fd0132c7e6 Polishing 2017-09-08 16:56:22 +02:00
Sam Brannen dcdb0b416f Rename SPRING_CLASS_RULE fields to springClassRule 2017-09-06 17:38:22 +02:00
Brian Clozel 16f3f8d28f Add close() method on HTTP client response
Before this commit, there was no way to signal the HTTP client that we
were done consuming the response. Without that, the underlying client
library cannot know when it is safe to release the associated resources
(e.g. the HTTP connection).

This commit adds new `close()` methods on both `ClientHttpResponse`
and `ClientResponse`. This methods is non-blocking and its behavior
depends on the library, its configuration, HTTP version, etc.

At the `WebClient` level, `close()` is called automatically if we
consume the response body through the `ResponseSpec` or the
`ClientResponse` itself.

Note that it is *required* to call `close()` manually otherwise; not
doing so might create resource leaks or connection issues.

Issue: SPR-15920
2017-09-06 17:29:18 +02:00
Sam Brannen ba6b617bd5 Demo: @Autowired rules not supported with Spring's JUnit rules
This commit introduces a test that demonstrates that custom JUnit 4
rules can be @Autowired into a test instance but that they will not be
applied by JUnit since JUnit only ever sees such fields as null and
therefore ignores them.

Issue: SPR-15927
2017-09-06 17:29:04 +02:00
Sam Brannen 0702898836 Clean up warnings in Gradle build output 2017-09-04 16:26:51 +02:00
Sam Brannen 9da3927235 Polishing 2017-08-22 22:23:44 +01:00
Juergen Hoeller fac1f236c3 Upgrade to Servlet API 4.0 for MVC and merge EhCache 3 tests into spring-context-support
Includes general streamlining of dependency declarations with reduced version variables, direct use of EclipseLink 2.7 and its implicit JPA 2.2 dependency in spring-orm, mixed use of Hibernate 5.2.10 and 5.1.10 for integration tests, as well as an upgrade to Jetty 9.4.7 RC0 and a downgrade to Groovy 2.4.12 (since Groovy 2.5 won't be final in time for Spring Framework 5.0).

Issue: SPR-15879
Issue: SPR-15880
2017-08-21 01:34:11 +02:00
Sebastien Deleuze 73cf07e9a4 Fix overridden methods nullability
Issue: SPR-15869
2017-08-17 15:02:59 +02:00
Rossen Stoyanchev 9c3bd8ce85 Separate forwarded~ and redirectedUrlTemplate methods
This commit restores and existing redirectedUrl and forwardedUrl
methods (simple String comparison) and creates separate
redirectedUrlTemplate and forwardedUrlTemplate methods that expand
and also encode before comparing.

Issue: SPR-15834
2017-08-15 15:25:39 +02:00
Rossen Stoyanchev ea2864c73e Polish 2017-08-15 15:08:23 +02:00
Drummond Dawson 809189be1a URI variables with MockRestRequestMatchers requestToUriTemplate
Issue: SPR-15819
2017-08-15 14:55:56 +02:00
Sam Brannen c4f7ff04dc Polish JavaDoc for the SpringExtension 2017-08-03 23:26:38 +03:00
Sam Brannen da8d50f91f Revise SpringExtension based on recent changes in JUnit Jupiter
This commit revises the implementation of the SpringExtension to use
the getRequired*() methods in the ExtensionContext which are now built
into JUnit Jupiter thanks to inspiration from the initial "convenience"
methods implemented here.
2017-08-03 23:19:57 +03:00
Rossen Stoyanchev 6855a85c41 Move RequestPath to parent server package 2017-07-28 12:26:34 +02:00
Sam Brannen 4630e62c20 Fix formatting 2017-07-28 12:25:05 +02:00
Sam Brannen 859da2f074 Clean up warnings in spring-test 2017-07-28 12:24:53 +02:00
Arjen Poutsma eb435f5947 Add ParameterizedTypeReference method variants to ServerRequest/ServerResponse
This commit changes adds overloaded `ParameterizedTypeReference `
variants to body-related methods in `ServerRequest` and
`ServerResponse`.
It also adds a single PTR variant to ClientRequest, which was missing
before.

Issue: SPR-15817
2017-07-27 13:38:35 +02:00
Rossen Stoyanchev 45e714ec13 Add test case for SPR-15719 2017-07-25 12:29:44 +02:00
Rossen Stoyanchev d20e5fcc59 Polish 2017-07-25 12:29:44 +02:00
Juergen Hoeller 46eba3dbfa Nullability fine-tuning around declaration inconsistencies
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 22:22:20 +02:00
Sebastien Deleuze fb4ddb0746 Make getters and setters null-safety consistent
This commit ensure that null-safety is consistent between
getters and setters in order to be able to provide beans
with properties with a common type when type safety is
taken in account like with Kotlin.

It also add a few missing property level @Nullable
annotations.

Issue: SPR-15792
2017-07-19 09:07:56 +02:00
Sebastien Deleuze ff85726fa9 Fix warnings in Kotlin tests 2017-07-19 08:12:48 +02:00
Rossen Stoyanchev f5c54f90b3 Add shortcut to mutate + apply to WebTestClient
Issue: SPR-15770
2017-07-14 16:24:15 +02:00
Juergen Hoeller 50493a0f5f Missing abstract declaration on ReflectionTestUtils
Issue: SPR-15757
2017-07-13 13:19:52 +02:00
Arjen Poutsma e11bb17aa6 Change ServerRequest.attribute(String) to return Object
This commit changes `ServerRequest.attribute(String)`` to return
`Optional<Object>` instead of `Optional<T>`, where `T` was infered
from a type parameter.
2017-07-11 15:41:33 +02:00
Rossen Stoyanchev 1d5bd8ef35 Polish 2017-07-11 12:01:44 +02:00
Rossen Stoyanchev eb84547894 Fix MockMvc + HttpPutFormContentFilter issue
Issue: SPR-15753
2017-07-11 11:43:48 +02:00
Rossen Stoyanchev 9f7d57f933 Encapsulate choice of URI encoding within RequestPath
Currently the URI path is always treated as UTF-8 so we can eliminate
the encoding parameter from RequestPath#parse.
2017-07-11 06:05:36 +02:00
Juergen Hoeller dd43b6aabe ReflectionTestUtils does not require spring-aop on the classpath
Issue: SPR-15757
2017-07-10 20:43:34 +02:00
Rossen Stoyanchev 7d747f9645 Deprecate AsyncRestTemplate methods in MockRestServiceServer 2017-07-07 19:20:36 +02:00
Juergen Hoeller 00f4c36d7a Nullability fine-tuning (RequestContext, LocaleResolver)
Includes page-level JSTL time zone support for JSP tags.

Issue: SPR-15720
Issue: SPR-15746
2017-07-07 18:46:19 +02:00
Sam Brannen 4a3ca17d3f Fix imports 2017-07-07 17:23:43 +02:00
Arjen Poutsma 5f2d2b21d9 Avoid required uri when using WebTestClient w/ base url
This commit makes the `uri` step of the WebTestClient optional, so that
users who have specified a base URL during WebClient config do not need
to provide an empty one (i.e. `url("")`).

Issue: SPR-15695
2017-07-07 17:07:15 +02:00
Sam Brannen 1c07369406 Verify interoperability w/ JUnit Jupiter's @ParameterizedTest in TCF
This commit introduces integration tests which verify that the
SpringExtension can be used in conjunction with JUnit Jupiter's
@ParameterizedTest support.
2017-07-07 16:52:37 +02:00
Sam Brannen 2b03507894 Polishing wording regarding JUnit Platform and JUnit Jupiter 2017-07-07 16:52:37 +02:00
Sam Brannen ad5f85f8d3 Clean up deprecation warnings in spring-test 2017-07-07 15:41:02 +02:00
Rossen Stoyanchev aad4916cac WiretapConnector removes exchanges
Issue: SPR-15744
2017-07-06 23:01:01 +02:00
Arjen Poutsma 74b4c02881 Add ClientRequest attributes
This commit introduces client-side request attributes, similar to those
found on the server-side. The attributes can be used, for instance, for
passing on request-specific information to a globally registered
ExchangeFilterFunction.

The client request builder, as well as WebClient.RequestHeadersSpec and
WebTestClient.RequestHeaderSpec, add methods for adding a single
attribute, as well as manipulating the entire attributes map.

The client request itself adds a accessor for the (immutable) attributes
map.

This commit also introduces a new variant of the basic authentication
filter in ExchangeFilterFunctions. This variant takes the username and
password from well-known attributes.

Issue: SPR-15691
2017-07-05 14:52:38 +02:00
Sam Brannen 75a71accea Upgrade to JUnit Jupiter 5.0 M5
Issue: SPR-15728
2017-07-04 22:21:13 +02:00
Arjen Poutsma f8589d9eca Return MultiValueMap from ServerRequest.queryParams instead of List
This commit changes ServerRequest.queryParams from returning a
List<String> given a String name, to returning a
MultiValueMap<String, String>, which gives more flexibility.
2017-07-03 16:23:33 +02:00
Arjen Poutsma 2ccbc55ffd Use PathContainer in web.reactive.function.server
This commit uses the newly introduced `PathContainer` and `RequestPath`
support in the functional web framework. It exposes the path container
as property in `ServerRequest`, and uses that in the path-based
`RequestPredicates`.
2017-07-03 13:36:30 +02:00
Sam Brannen f790337880 Clean up warnings in spring-test 2017-07-02 21:28:39 +02:00
Arjen Poutsma 930f0f1760 Add ServerRequest.cookies()
This commit introduces a cookies() method on ServerRequest, returning a
MultiValueMap<String, HttpCookie>.

Issue: SPR-15715
2017-06-30 16:31:37 +02:00
Juergen Hoeller cc74a2891a @Nullable all the way: null-safety at field level
This commits extends nullability declarations to the field level, formalizing the interaction between methods and their underlying fields and therefore avoiding any nullability mismatch.

Issue: SPR-15720
2017-06-30 01:54:16 +02:00
Rossen Stoyanchev 7de6cfa1df Refactor WebSession#getAttribute options
Issue: SPR-15718
2017-06-29 15:23:36 -04:00
Rossen Stoyanchev 9253facf02 Refactor ServerWebExchange#getAttribute options
Issue: SPR-15718
2017-06-29 14:55:30 -04:00
Rossen Stoyanchev 667437e300 Polish 2017-06-27 18:48:45 -04:00
Sebastien Deleuze d728d597f2 Add missing license headers in Kotlin files 2017-06-27 14:39:26 +02:00
Rossen Stoyanchev 5b8f7f503f Deprecate adapter classes for async interceptors 2017-06-26 15:34:51 -04:00
Rossen Stoyanchev 043c0eff4f Same session after mutate for WebTestClient mock server
Issue: SPR-15674
2017-06-23 19:19:14 -04:00
Rossen Stoyanchev 12850c5fc4 Fix test failure by using the new cloneBuilder method
The cloneBuilder helps to avoid the issue in the comment of the ticket.
Rather than creating the WebClient to then obtain a fresh builder which
causes connector instantiation, we now use the cloneBuilder

Issue: SPR-15674
2017-06-23 16:22:10 -04:00
Rossen Stoyanchev 8fc3b3bc37 Add WebTestClientConfigurer
Issue: SPR-15674
2017-06-23 14:45:46 -04:00
Rossen Stoyanchev 4db0ce12e1 Add MockServerConfigurer to WebTestClient
Issue: SPR-15674
2017-06-23 10:46:59 -04:00
Rossen Stoyanchev c37c59f578 Consumer methods for WebHttpHandlerBuilder
Replace the more limited List-based methods to add filtes and exception
handlers with Consumer<List<?>> variants.
2017-06-23 07:12:10 -04:00
Sebastien Deleuze 5c1d8c7c59 Leverage ZonedDateTime in HttpHeaders
This commit introduces 2 new public methods in HttpHeaders in order
to leverage Java 8 ZonedDateTime in addition to the existing long
(with GMT time zone implied) variants:
 - ZonedDateTime getFirstZonedDateTime(String headerName)
 - void setZonedDateTime(String headerName, ZonedDateTime date)

This commit also leverages Java 8 thread-safe DateTimeFormatter for
HttpHeader implementation instead of SimpleDateFormat. As a consequence
of the usage of DateTimeFormatter.RFC_1123_DATE_TIME, HTTP date header
serialization could change slightly for single digit days from for
example "Thu, 01 Jan 1970 00:00:00 GMT" to
"Thu, 1 Jan 1970 00:00:00 GMT".

Issue: SPR-15661
2017-06-23 00:15:51 +02:00
Arjen Poutsma a95cf07317 Add WebTestClient.mutate()
This commit introduces a WebTestClient.mutate() method,
returning a WebTestClient.Builder.

Issue: SPR-15657
2017-06-20 17:11:52 +02:00
Arjen Poutsma 4a0597d612 Replace WebClient.filter with Builder.filter
This commit replaces the WebClient.filter method with
WebClient.Builder.filter. The reason for this change is that filters
added via WebClient.filter would be applied in the opposite order of
their declaration, due to the compositional nature of the method,
combined with the immutable nature of the WebClient.
WebClient.Builder.filter does keep the order of the filters, as
registered.

Furthermore, this commit introduces a WebClient.mutate() method,
returning a WebClient.Builder. This method allow to add/remove filters
and other defaults from a given WebClient.

Issue: SPR-15657

Add WebClient.Builder.addFilter

Add Consumer-based headers and cookies methods to builders.

Add WebClient.mutate
2017-06-20 14:25:52 +02:00
Juergen Hoeller efb735aa99 SimpleRequestExpectationManager properly handles sequential requests with different count
Issue: SPR-15672
2017-06-16 13:32:43 +02:00
Sebastien Deleuze 04d5a2951c Remove KClass based Kotlin extensions
Issue: SPR-15660
2017-06-13 18:43:59 +02:00
diguage 1ef5f61ab2 Refactor iterator of Map with Java8's Map.forEach
See gh-1459
2017-06-13 16:06:20 +02:00
Sebastien Deleuze e0e6736bc5 Introduce LocaleContextResolver in WebFlux
This commit introduces LocaleContextResolver interface, which is used
at ServerWebExchange level to resolve Locale, TimeZone and other i18n
related informations.

It follows Spring MVC locale resolution patterns with a few differences:
 - Only LocaleContextResolver is supported since LocaleResolver is less
   flexible
 - Support is implemented in the org.springframework.web.server.i18n
   package of spring-web module rather than in spring-webflux in order
   to be able to leverage it at ServerWebExchange level

2 implementations are provided:
 - FixedLocaleContextResolver
 - AcceptHeaderLocaleContextResolver

It can be configured with both functional or annotation-based APIs.

Issue: SPR-15036
2017-06-13 15:10:18 +02:00
Stephane Nicoll 58242f2249 Polish 2017-06-13 10:13:14 +02:00
Stephane Nicoll fc64b8040f Polish "Replace relevant code with lambda"
Closes gh-1454
2017-06-13 09:42:20 +02:00
diguage 4b1478d830 Replace relevant code with lambda
See gh-1454
2017-06-13 08:55:38 +02:00
Juergen Hoeller 47ec966757 TargetSource.getTarget() is nullable again (for compatibility with MethodInvocation.getThis)
Issue: SPR-15651
2017-06-12 22:54:18 +02:00
Juergen Hoeller 3ae84d6dd8 Consistent support for Charset/StandardCharsets in UriUtils etc
Issue: SPR-15613
2017-06-12 15:51:45 +02:00
Sebastien Deleuze 3373a3f7ef Add Kotlin extensions for WebTestClient API
Issue: SPR-15622
2017-06-12 10:42:56 +02:00
diguage c1d44d9a34 Use the diamond syntax
Closes gh-1450
2017-06-12 09:19:06 +02:00
Rossen Stoyanchev 38a12ed4ba Expose RequestPath in ServerHttpRequest
The new structured getPath() method replaces the existing
getContextPath() + getPathWithinApplication().

Issue: SPR-15648
2017-06-11 21:59:24 -04:00
Arjen Poutsma 5e954dcba0 Use ParameterizedTypeReference in public-facing WebFlux APIs
This commit changes the use of `ResolvableType` to
`ParameterizedTypeReference` in all public-facing WebFlux APIs. This
change removes the necessity for providing the parameterized type
information twice: once for creating the `ResolvableType`, and once for
specifying a `BodyExtractor`.

Issue: SPR-15636
2017-06-09 13:29:15 +02:00
Juergen Hoeller fd53d2a51a Consistent use of @Nullable in spring-test
This commit also removes nullability from two common spots: ResolvableType.getType() and TargetSource.getTarget(), both of which are never effectively null with any regular implementation. For such scenarios, a non-null empty type/target is the cleaner contract.

Issue: SPR-15540
2017-06-08 22:52:59 +02:00
Juergen Hoeller f813712f5b Consistent use of @Nullable across the codebase (even for internals)
Beyond just formally declaring the current behavior, this revision actually enforces non-null behavior in selected signatures now, not tolerating null values anymore when not explicitly documented. It also changes some utility methods with historic null-in/null-out tolerance towards enforced non-null return values, making them a proper citizen in non-null assignments.

Some issues are left as to-do: in particular a thorough revision of spring-test, and a few tests with unclear failures (ignored as "TODO: NULLABLE") to be sorted out in a follow-up commit.

Issue: SPR-15540
2017-06-07 14:19:15 +02:00
Arjen Poutsma 8504084553 Add package-info.java to mock.web.reactive.function.server 2017-06-01 12:37:42 +02:00
Sebastien Deleuze 1f28825f9d Add more @Nullable parameters based on null usage
Issue: SPR-15540
2017-05-31 21:42:23 +02:00
Sebastien Deleuze b47d713e14 Add missing @Nullable annotations on parameters
Issue: SPR-15540
2017-05-31 16:56:08 +02:00
Rossen Stoyanchev abcc4ac979 Fix composability issue in ExchangeMutatorWebFilter
This commit replaces the UnaryOperatory<ServerWebExchange> inputs with
Function<ServerWebExchange, ServerWebExchange> instead. Unfortunately
the composability methods inherited from Function don't work in terms
of generics for composing multiple UnaryOperator's.

Issue: SPR-15599
2017-05-31 09:30:04 -04:00