Commit Graph

31788 Commits

Author SHA1 Message Date
Stéphane Nicoll
bad4e18b4d Add support for building a request directly from MockMvcTester
Closes gh-32913'
2024-05-28 15:33:21 +02:00
Sam Brannen
defb6b7a62 Polish documentation and implementation of SpEL's Indexer 2024-05-28 15:29:54 +02:00
Stéphane Nicoll
8d2bc3bdba Add support for fluent preparation of the request in MockMvcTester
See gh-32913
2024-05-28 15:29:14 +02:00
Stéphane Nicoll
a3e7fd47c6 Allow MockHttpServletRequestBuilder to support AssertJ
This commit moves the features of MockHttpServletRequestBuilder in
an abstract class so that another class can offer the same feature
whilst providing AssertJ support. This wasn't possible previously as
the builder's return type would lose the concrete builder types.

This change benefits MockMultipartHttpServletRequestBuilder that can
use the same mechanism to offer additional settings.

This change also makes it so that a builder instance can be created
using only the HttpMethod. Previously, the URI had to be provided as
well and that makes it impossible to specify it using the builder.

See gh-32913
2024-05-28 15:29:14 +02:00
Arjen Poutsma
726ac9110c Do not read Map in FormHttpMessageConverter
This commit ensures that the FormHttpMessageConverter no longer supports
 reading Maps (just MultiValueMaps). Plain maps are often used to
 represent JSON.

See gh-32826
2024-05-28 15:25:08 +02:00
Stéphane Nicoll
fc54cf4430 Harmonize use of uri in MockMvc
Closes gh-32915
2024-05-28 11:17:40 +02:00
Sam Brannen
54c07eddcc Merge branch '6.1.x' 2024-05-28 10:26:56 +02:00
Sam Brannen
e9de426eb5 Support compilation of map indexing with primitive in SpEL
Prior to this commit, the Spring Expression Language (SpEL) failed to
compile an expression that indexed into a Map using a primitive literal
(boolean, int, long, float, or double).

This commit adds support for compilation of such expressions by
ensuring that primitive literals are boxed into their corresponding
wrapper types in the compiled bytecode.

Closes gh-32903
2024-05-28 10:19:15 +02:00
Stéphane Nicoll
2d1e58b928 Polish 2024-05-28 09:31:44 +02:00
Stéphane Nicoll
f6504c5f91 Deprecate use of raw String for HttpMethod in MockMvc
Closes gh-32914
2024-05-28 09:24:08 +02:00
Sam Brannen
8871d67298 Merge branch '6.1.x' 2024-05-27 17:13:01 +02:00
Sam Brannen
cda577d1aa Support compilation of array and list indexing with Integer in SpEL
Prior to this commit, the Spring Expression Language (SpEL) failed to
compile an expression that indexed into any array or list using an
Integer.

This commit adds support for compilation of such expressions by
ensuring that an Integer is unboxed into an int in the compiled
bytecode.

See gh-32694
Closes gh-32908
2024-05-27 17:06:48 +02:00
Marcus Hert Da Coregio
57fae7a59e Add update-antora-ui-spring.yml workflow 2024-05-27 16:56:13 +02:00
Sam Brannen
b3cc603401 Avoid usage of deprecated AssertJ feature 2024-05-27 16:51:39 +02:00
Sam Brannen
870d15c0b6 Merge branch '6.1.x' 2024-05-27 16:44:19 +02:00
Sam Brannen
8feb842df5 Upgrade to AssertJ 3.26.0
See https://github.com/assertj/assertj/issues/3322
2024-05-27 16:43:22 +02:00
Brian Clozel
3b53165574 Expose WebSocketMessageBrokerStats contracts
Prior to this commit, the `WebSocketMessageBrokerStats` would be in
charge of periodically logging WebSocket stats. This class would also
publicly expose each stats type with dedicated methods, as `String`.
This would not allow observation libraries to easily extract information
and turn them into metrics.

This commit introduces new methods exposing the `Stats` types directly
and deprecates the former `String` variants. This will allow
observability libraries like Micrometer to expose this as metrics:

```
MeterRegistry meterRegistry = ...;

Gauge.builder("spring.stomp.frames", stats.getStompSubProtocolStats(),
      StompSubProtocolHandler.Stats::getTotalConnect)
  .tag("type", "CONNECT")
  .description("number of CONNECT frames processed")
  .register(meterRegistry);
```

Closes gh-31604
2024-05-27 16:06:32 +02:00
Brian Clozel
e856e7e590 Add checkstyle rule for "@since" javadoc convention 2024-05-27 09:28:23 +02:00
Stéphane Nicoll
e2c5887cea Allow JSON content assertions to be nested
Previously, AbstractJsonContentAssert worked on a raw String, which
made standard AssertJ nested calls, such as satisfies, to return an
assert on the raw string, rather than one with JSON support.

This commit rework AbstractJsonContentAssert so that it no longer
extend from AbstractStringAssert. This makes the list of methods more
focused on JSON assertions, and allow standard operations to provide
the right assert object.

Closes gh-32894
2024-05-27 09:25:12 +02:00
Sam Brannen
489d18a169 Merge branch '6.1.x' 2024-05-24 15:42:39 +02:00
Sam Brannen
ea2931f24a Use Develocity Gradle plugin API to avoid deprecation warning
Prior to this commit, the Gradle build issued the following warning.

- The deprecated "gradleEnterprise.buildScan.value" API has been
  replaced by "develocity.buildScan.value"
2024-05-24 15:41:58 +02:00
Sam Brannen
7e3a4a12f8 Use consistent version strings for 6.2 2024-05-24 15:19:30 +02:00
Sam Brannen
b82b83c8f0 Disable warnings for deprecated for removal in Eclipse 2024-05-24 14:30:56 +02:00
Sam Brannen
5d39598025 Disable warnings for unclosed @⁠AutoCloseable in Eclipse 2024-05-24 14:15:25 +02:00
Sam Brannen
159c2cd7c6 Remove obsolete code 2024-05-24 14:14:43 +02:00
Sam Brannen
dac18a3ff1 Clean up warnings in Gradle build 2024-05-24 13:39:56 +02:00
Sam Brannen
77f7da01e4 Polishing 2024-05-24 13:39:56 +02:00
Sam Brannen
e999f4e47d Sync changes to MockHttpServletRequest 2024-05-24 13:39:55 +02:00
Sam Brannen
e3c268ef18 Fix formatting 2024-05-24 13:39:55 +02:00
Juergen Hoeller
49caa02584 Merge branch '6.1.x' 2024-05-24 13:06:21 +02:00
Juergen Hoeller
26d1c38d84 Polishing 2024-05-24 13:05:49 +02:00
Juergen Hoeller
dae4366325 Merge branch '6.1.x' 2024-05-24 11:55:53 +02:00
Juergen Hoeller
345daaabbc Detect original generic method for CGLIB bridge method
Closes gh-32888
2024-05-24 11:49:10 +02:00
Arjen Poutsma
903493e9a9 Various MultiValueMap improvements
This commit makes several improvements to MultiValueMap:
- asSingleValueMap offers a single-value view (as opposed to the
  existing toSingleValueMap, which offers a copy)
- fromSingleValue is a static method that adapts a Map<?,?> to the
  MultiValueMap interface
- fromMultiValue is a static method that adapts a Map<?,List<?>> to the
  MultiValueMap interface

Closes gh-32832
2024-05-24 11:44:55 +02:00
Stéphane Nicoll
97647ef5f6 Flag tests using deprecated json method deprecated
See gh-32791
2024-05-24 11:03:33 +02:00
Juergen Hoeller
0110c5ac82 Merge branch '6.1.x' 2024-05-23 17:08:22 +02:00
Juergen Hoeller
6c08d93992 Polishing 2024-05-23 17:07:55 +02:00
Juergen Hoeller
6d7cd9c7dc Defensive handling of incompatible advice methods
This covers AspectJ transaction and caching aspects when encountered by Spring AOP.

Closes gh-32882
See gh-32793
2024-05-23 17:07:51 +02:00
Juergen Hoeller
35278d09ac Polishing 2024-05-23 16:34:24 +02:00
Stéphane Nicoll
975e2f4218 Revert "Avoid deprecation warnings for WebJarsResourceResolver"
This reverts commit 61db499ae2.
2024-05-23 16:21:42 +02:00
Stéphane Nicoll
0ac7e41beb Provide an implementation of JsonComparator
See gh-32791
2024-05-23 16:17:02 +02:00
Sébastien Deleuze
f62275d674 Merge branch '6.1.x' 2024-05-23 16:05:54 +02:00
Attacktive
73eb6f0660 Complete a Kotlin code snippet in the refdoc
Closes gh-32877
2024-05-23 16:03:34 +02:00
Brian Clozel
51f6e78e25 Fall back on */* during content negotiation for errors
Prior to this commit, gh-31936 enabled content negotiation for
`@ExceptionHandler` annotated methods in Spring MVC and WebFlux.
In the case of WebFlux, HTTP clients sending invalid media types in the
"Accept" request header would fail with a `NotAcceptableStatusException`
This exception would be handled with an HTTP 406 response status,
instead of processing the original exception.

This commit ensures that invalid media types are ignored during the
exception handling phase and that we fall back to "*/*".

Fixes gh-32878
2024-05-23 13:57:02 +02:00
Stéphane Nicoll
94348d9d41 Revert "Merge pull request #32876 from quaff"
This reverts commit 3b2a4da023, reversing
changes made to 181b68088a.

See gh-32876
2024-05-23 13:13:02 +02:00
Phillip Webb
d8dcd3af0b Introduce JSON comparison abstraction for tests
This commit introduces a JsonComparator abstraction, with an
implementation using JSONAssert. Previously, JSONAssert was the only
choice.

Test APIs have been adapted to allow the new abstraction while relying
on JSONAssert still for high-level methods.

Closes gh-32791

Co-authored-by: Stéphane Nicoll <stephane.nicoll@broadcom.com>
2024-05-23 12:32:39 +02:00
Arjen Poutsma
80faa94afc Support Map in FormHttpMessageConverter
This commit changes the FormHttpMessageConverter from a
HttpMessageConverter<MultiValueMap<String, ?>> to a
HttpMessageConverter<Map<String, ?>>, so that normal, single-value maps
can also be used as form representation, both for reading and writing.

Closes gh-32826
2024-05-23 10:33:49 +02:00
Arjen Poutsma
67d2b2566e Revert "WIP"
This reverts commit c09b0f57631905a7b9cca32be5516853e4263ac0.
2024-05-23 10:33:49 +02:00
Arjen Poutsma
14861024d5 WIP 2024-05-23 10:33:49 +02:00
Stéphane Nicoll
fa275f908e Polish 2024-05-23 08:49:03 +02:00