Commit Graph

1186 Commits

Author SHA1 Message Date
Brian Clozel b6d2a2980d Update for Reactor API changes 2020-08-05 13:31:39 +02:00
Brian Clozel 9aae5ed3fa Update Reactor Netty modules
Since reactor/reactor-netty#739, the `reactor-netty` module is now split
into two: `reactor-netty-core` and `reactor-netty-http`.

This commit updates the Spring Framework build accordingly.
2020-08-01 11:49:15 +02:00
Sébastien Deleuze 5c456db3cc Upgrade to Kotlin 1.4 RC
- The compiler is configured to retain compatibility with Kotlin 1.3.
- Explicit API mode is not yet enabled but could be in the future.
- Some exceptions thrown by Kotlin have changed to NullPointerException,
  see https://youtrack.jetbrains.com/issue/KT-22275 for more details.

Closes gh-24171
2020-07-30 10:18:33 +02:00
XenoAmess ab859fcc96 Refine use of substring operations
Closes gh-25445
2020-07-22 17:26:42 +02:00
XenoAmess edfc6c0293 Refine use of substring operations
Closes gh-25445
2020-07-22 16:28:58 +02:00
Rossen Stoyanchev 9fe1feea9a Provide access to underlying RSocketClient
The recently introduced support for RSocketClient in commit
7c98251142 did not expose the underlying
client in order to avoid a hard dependency on RSocket 1.1 for the time
being. However such access appears to be necessary, e.g. for Spring
Integration, where the connection needs to be established (warmed up)
ahead of actual requests.

See gh-25332
2020-07-22 14:57:33 +03:00
Rossen Stoyanchev f9ba58eab9 Match subscriptions to remove by id
Commit 524ca1a676 unintentionally changed
how subscriptions to be removed are matched. This commit restores that.

See gh-25298
2020-07-22 13:22:29 +03:00
XenoAmess e71f702bb9
Use `static private` instead of `private static` for method declarations
Closes gh-25452
2020-07-21 18:26:28 +02:00
Rossen Stoyanchev b451379c2f Update eviction queue before size
See gh-25298
2020-07-16 17:28:32 +03:00
Rossen Stoyanchev 44f1f94f97 Polishing contribution
Renaming, trimming of method parameters, minor refactoring of helper
methods, comments, etc. Completely functionally neutral.

See gh-25298
2020-07-16 17:28:32 +03:00
Tomas Drabek 524ca1a676 DefaultSubscriptionRegistry: Reduced thread contention
* DestinationCache is now synchronized on multiple 'destination' locks
 (previously a single shared lock)
* DestinationCache keeps destinations without any subscriptions
 (previously such destinations were recomputed over and over)
* SessionSubscriptionRegistry is now a
 'sessionId -> subscriptionId -> (destination,selector)' map
 for faster lookups
 (previously 'sessionId -> destination -> set of (subscriptionId,selector)')

closes gh-24395
2020-07-16 17:28:32 +03:00
Rossen Stoyanchev 7c98251142 Support for making requests via RSocketClient
Closes gh-25332
2020-07-14 12:07:59 +03:00
Rossen Stoyanchev 5e1b6e3386 Merge branch '5.2.x' 2020-07-01 08:07:56 +01:00
Rossen Stoyanchev b2a4d1c5b1 Avoid re-creating connect Mono<RSocket>
Closes gh-25330
2020-07-01 08:02:03 +01:00
Rossen Stoyanchev b16f6fa456 Shared static instance of DefaultDataBufferFactory 2020-06-24 16:12:56 +01:00
Sam Brannen b33d2fe683 Clean up warnings in Gradle build, polishing, etc. 2020-06-24 15:02:24 +02:00
Rossen Stoyanchev 22bf62def1 Replace remaining use of deprecated Processors in tests
See gh-25085
2020-06-23 20:29:35 +01:00
Rossen Stoyanchev 734f4a4706 Replace of ReplayProcessor in RSocket tests
See gh-25085
2020-06-23 14:25:16 +01:00
Rossen Stoyanchev 7cf1ccc415 Use MonoProcessor instead of FluxIdentityProcessor
We just need to signal completion when close() is called. MonoProcessor
should suffice and we can avoid a hard dependency on Reactor 3.4.

See gh-25085
2020-06-22 05:46:25 +01:00
Sam Brannen ab0e651547 Polish SerializationTestUtils, clean up warnings, etc. 2020-06-20 18:17:03 +02:00
Brian Clozel 7391f9b392 Fix Reactor Core DirectProcessor deprecation
As of reactor/reactor-core#2188, `DirectProcessor` variants are
deprecated. This commit replaces them with the new
`FluxIdentityProcessor` variant.

See gh-25085
2020-06-19 22:13:15 +02:00
Sébastien Deleuze 6b355df903 Revert "Upgrade to Kotlin 1.4 M2"
This reverts commit 2a74eff10f.

Some regressions require to wait at least Kotlin 1.4 M3.
2020-06-18 14:06:39 +02:00
Сергей Цыпанов 7949937655 Remove redundant assignment of default values to volatile fields 2020-06-17 10:50:51 +02:00
Sébastien Deleuze 2a74eff10f Upgrade to Kotlin 1.4 M2
- The compiler is configured to retain compatibility with Kotlin 1.3.
- Explicit API mode is not yet enabled but could be in the future.
- A workaround for Gradle build is required for now, see
  https://youtrack.jetbrains.com/issue/KT-39610 for more details.
- Some exceptions thrown by Kotlin have changed to NullPointerException,
  see https://youtrack.jetbrains.com/issue/KT-22275 for more details.

Closes gh-24171
2020-06-16 15:21:57 +02:00
Rossen Stoyanchev 1d0fe1223d Fix checkstyle violation 2020-06-09 11:47:05 +01:00
Rossen Stoyanchev b48ddef4c6 Upgrade to RSocket 1.0.1 2020-06-09 08:59:55 +01:00
Rossen Stoyanchev 6d6269f1ee Switch to Reactor 2020.0.0 snapshots
A switch to RSocket 1.0.1 snapshots is also required to pick up a
for froward compatibility with Reactor Netty 1.0.

See gh-25085
2020-05-29 15:14:01 +01:00
Juergen Hoeller 9999414b3b Merge branch '5.2.x' 2020-05-18 14:24:33 +02:00
Juergen Hoeller c35b21b49f Consistent not-null assertions for configured interceptors
Closes gh-25088
2020-05-18 14:23:05 +02:00
Rossen Stoyanchev b1224835be Add metadataPush support to RSocketRequester
Closes gh-24322
2020-05-14 15:42:43 +01:00
Rossen Stoyanchev ef27bc4b82 Upgrade to RSocket 1.0.0
Closes gh-25053
2020-05-12 12:00:06 +01:00
Rossen Stoyanchev 71d384f1f8 Upgrade to RSocket 1.0.0
Closes gh-25053
2020-05-12 11:46:13 +01:00
Rossen Stoyanchev 7f59381c7d Add support for RxJava 3
Closes gh-24170
2020-05-11 08:48:48 +01:00
Rossen Stoyanchev 2002a1689a Adapt test to changes in RSocket Java
See gh-24934
2020-04-25 07:11:34 +01:00
Sam Brannen 5eba1ae73c Avoid deprecation warning in DefaultRSocketRequesterBuilderTests 2020-04-22 19:19:34 +02:00
Rossen Stoyanchev 1904e9b7e7 Disable failing test temporarily 2020-04-20 10:16:40 +01:00
Rossen Stoyanchev ed8c61a852 Upgrade to RSocket 1.0 RC7 snapshots 2020-04-20 09:42:28 +01:00
Sébastien Deleuze 3c354a9b18 Avoid using Mockito argument matcher in Mockk test 2020-04-07 16:38:09 +02:00
陈其苗 13970ae528 Use autoboxing instead of explicit wrapping in tests
Closes gh-24801
2020-04-01 14:34:20 +02:00
Rossen Stoyanchev 95ef9c25c2 Reduce byte[] allocations in StompEncoder
Closes gh-24694
2020-03-31 12:56:10 +01:00
Sam Brannen e26764d249 Remove duplicate words in documentation and polish Javadoc 2020-03-31 12:17:58 +02:00
Sam Brannen 9e30620ac2 Polish contribution
See gh-24805
2020-03-30 13:47:00 +02:00
Сергей Цыпанов e63d1cf12d Improve usage of ByteArrayOutputStream/ByteArrayInputStream
Closes gh-24805
2020-03-30 13:22:21 +02:00
Qimiao Chen 7c831d2ef4
Replace anonymous inner classes with lambdas in tests
Closes gh-24808
2020-03-30 12:02:23 +02:00
Rossen Stoyanchev 3175f0771e Remove dumpString from DataBufferTestUtils
See gh-24786
2020-03-26 21:42:12 +00:00
Sam Brannen 6222efc54b Polish contribution
See gh-24785
2020-03-26 16:52:24 +01:00
Сергей Цыпанов 65aa2d03f0 Simplify conversion of ByteArrayOutputStream to String
Closes gh-24785
2020-03-26 16:52:14 +01:00
Qimiao Chen 09b36380cd
Fix typos in source files
Closes gh-24746
2020-03-20 20:06:52 +01:00
Rossen Stoyanchev 7efb62091d MessagingRSocket correctly handles unconsumed input
Closes gh-24741
2020-03-20 10:03:56 +00:00
Rossen Stoyanchev 5b27df772a Suppress deprecation warning
See gh-24725
2020-03-19 07:21:21 +00:00
Sam Brannen a8feb792da Fix broken Javadoc links 2020-03-16 16:30:27 +01:00
Rossen Stoyanchev 4aedf2ea13 MetadataEncoder expands vars correctly
Closes gh-24656
2020-03-12 11:35:08 +00:00
ZhangT c5fb7b9fb7
Simplify some redundant code
Closes gh-24586

Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2020-02-26 12:29:09 +01:00
Hyunjin Choi ede2a1d4b2 Remove unnecessary semicolon in some enum classes 2020-02-24 14:56:12 +01:00
Rossen Stoyanchev 28a95e89f3 Upgrade to Dysprosium SR5 snapshots
See gh-24355
2020-02-11 12:52:04 +00:00
Rossen Stoyanchev 3c0c0c0597 Fix issue with new line handling in StompDecoder
Closes gh-23713
2020-01-16 14:54:10 +00:00
Sam Brannen 94f8ef08e2 Move common TestPrincipal to spring-core test fixtures
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen 4260c34b47 Rename test fixture package in spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen 5718bf424b Use Gradle test fixture support for spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen 1b4fd1cba1 Polishing 2019-12-22 16:00:45 +01:00
Sébastien Deleuze 0f41536820 Fix RSocketRequester Coroutines extensions
After gh-24073, some Coroutines extensions should be applied on
RetrieveSpec instead of RequestSpec.

Closes gh-24166
2019-12-09 11:50:06 +01:00
Sam Brannen 55ae3c5e87 Polishing 2019-12-07 12:59:03 +01:00
Brian Clozel d4209392d2 Allow ExchangeStrategies customizations in WebClient
Prior to this commit, developers could configure their WebClient to use
their custom `ExchangeStrategies`, by providing it in the
`WebClient.Builder` chain.
Once created, an `ExchangeStrategies` instance is not mutable, which
makes it hard for further customizations by other components. In the
case of the reported issue, other components would override the default
configuration for the codecs maxInMemorySize.

This commit makes the `ExchangeStrategies` mutable and uses that fact to
further customize them with a new `WebClient.Builder#exchangeStrategies`
`Consumer` variant. This commit is also deprecating those mutating
variants in favor of a new `WebClient.Builder#exchangeStrategies` that
takes a `ExchangeStrategies#Builder` directly and avoids mutation issues
altogether.

Closes gh-23961
2019-12-02 14:12:59 +00:00
Brian Clozel 1560bbd81e Revert "Allow ExchangeStrategies customizations in WebClient"
This reverts commit b3020bc484.
2019-12-02 10:39:53 +01:00
Juergen Hoeller 567c7695dd Polishing 2019-12-01 00:20:00 +01:00
Brian Clozel b3020bc484 Allow ExchangeStrategies customizations in WebClient
Prior to this commit, developers could configure their WebClient to use
their custom `ExchangeStrategies`, by providing it in the
`WebClient.Builder` chain.
Once created, an `ExchangeStrategies` instance is not mutable, which
makes it hard for further customizations by other components. In the
case of the reported issue, other components would override the default
configuration for the codecs maxInMemorySize.

This commit makes the `ExchangeStrategies` mutable and uses that fact to
further customize them with a new `WebClient.Builder#exchangeStrategies`
`Consumer` variant. This commit is also deprecating those mutating
variants in favor of a new `WebClient.Builder#exchangeStrategies` that
takes a `ExchangeStrategies#Builder` directly and avoids mutation issues
altogether.

Closes gh-23961
2019-11-29 22:26:52 +01:00
Rossen Stoyanchev 25f3465f1f Polishing contribution
See gh-24087
2019-11-29 15:53:37 +00:00
Parviz ROzikov e858b21c60 #24022 - added protobuf MessageConverter 2019-11-29 14:20:05 +00:00
Rossen Stoyanchev 26d800cc93 Fix empty payload handling in RSocketRequester
Closes gh-24088
2019-11-27 07:35:45 +00:00
Rossen Stoyanchev 30d68f2de7 Reject user names with "%2F" in STOMP
Closes gh-23836
2019-11-26 16:21:48 +00:00
Rossen Stoyanchev 6ed1b5835b Separate step for retrieve in RSocketRequester
Closes gh-24073
2019-11-25 11:47:41 +00:00
Sébastien Deleuze 712eac2915 Refine Coroutines annotated controller support
This commit refines Coroutines annotated controller support
by considering Kotlin Unit as Java void and using the right
ReactiveAdapter to support all use cases, including suspending
functions that return Flow (usual when using APIs like WebClient).

It also fixes RSocket fire and forget handling and adds related tests
for that use case.

Closes gh-24057
Closes gh-23866
2019-11-22 14:13:17 +01:00
Rossen Stoyanchev 996f7290cf Allow async metadata in RSocketRequester
This commit allows single-value async producers for the values of
metadata entries in both the SETUP and for requests. The same is also
enabled for data in the SETUP frame.

Close gh-23640
2019-11-20 19:41:16 +00:00
Rossen Stoyanchev f08cf0e864 Add RSocketFrameTypeMessageCondition constants
See gh-23999
2019-11-19 16:03:56 +00:00
Rossen Stoyanchev 842b424acd Use method signature to refine RSocket @MessageMapping
Before this change an @MessageMapping could be matched to any RSocket
interaction type, which is arguably too flexible, makes it difficult to
reason what would happen in case of a significant mismatch of
cardinality, e.g. request for Fire-And-Forget (1-to-0) mapped to a
method that returns Flux, and could result in payloads being ignored,
or not seen unintentionally.

This commit checks @ConnectMapping method on startup and rejects them
if they return any values (sync or async). It also refines each
@MessageMapping to match only the RSocket interaction type it fits
based on the input and output cardinality of the handler method.
Subsequently if a request is not matched, we'll do a second search to
identify partial matches (by route only) and raise a helpful error that
explains which interaction type is actually supported.

The reference docs has been updated to explain the options.

Closes gh-23999
2019-11-18 17:27:41 +00:00
Rossen Stoyanchev 32f82c0ed0 Polishing 2019-11-08 17:47:59 +00:00
Ilja 08f1cb454a Allow sending headers with the disconnect frame 2019-11-08 17:41:39 +00:00
Rossen Stoyanchev b2b02ad7a1 Polishing 2019-11-08 15:03:53 +00:00
Ilya Lukyanovich 801cca8cf8 Preserve ErrorMessage#getOriginalMessage()
See gh-23417
2019-11-08 15:03:53 +00:00
Rossen Stoyanchev 0e1a237139 Polishing 2019-11-08 09:17:25 +00:00
Johnny Lim 91f5f42d13 Add tests for PrincipalMethodArgumentResolver 2019-11-08 08:48:56 +00:00
Rossen Stoyanchev 005d2018d4 Refine changes for PR
Closes gh-23882
2019-10-31 14:14:44 +00:00
Dekel Pilli 64f2beb9bf Fixing NPE in AbstractNamedValueMethodArgumentResolver
See gh-23882
2019-10-31 14:13:44 +00:00
Sam Brannen 9f00eb68e9 Clean up warnings 2019-10-30 19:14:58 +01:00
Christoph Dreis 3c17178b16 Fix Mockito deprecations 2019-10-30 18:30:05 +01:00
Juergen Hoeller 19ff7d84ab Polishing 2019-10-30 14:31:46 +01:00
Sebastien Deleuze 9f242fac66 Add RSocketRequester retrieveAndAwaitOrNull extension
Closes gh-23874
2019-10-27 20:11:08 +01:00
Rossen Stoyanchev 739d2881fa Polishing 2019-10-23 14:55:55 +01:00
KateVasovski f77d23de94 @MessgeMapping support for Optional<Principal> 2019-10-23 14:51:07 +01:00
Juergen Hoeller 2861fc65bd Polishing 2019-09-27 10:17:56 +02:00
Sebastien Deleuze 091c512f0d Upgrade to Coroutines 1.3.2
Closes gh-23663
2019-09-25 21:51:04 +02:00
Sebastien Deleuze c10dcec9ed Polishing 2019-09-25 21:48:47 +02:00
Sebastien Deleuze a4b278a269 Polishing 2019-09-25 17:02:05 +02:00
Sebastien Deleuze 5866693ece Add MetadataExtractorRegistry.metadataToExtract Kotlin extensions
Closes gh-23705
2019-09-25 17:02:05 +02:00
Rossen Stoyanchev e2baf7277b Use metadata slice
Take a slice of the metadata if not using composite metadata to allow
reading it multiple times. For composite metadata this is not an isuse
as it is ensured by the underlying RSocket Java API.
2019-09-23 13:32:28 +01:00
Brian Clozel 809009e6c4 Rename RSocketStrategies.Builder.metadataExtractors
This commit renames the `metadataExtractors` method to something that is
closer to the actual intent: addming new metadata extractors against the
registry given as a parameter of the `Consumer`.

The method is renamed to `metadataExtractorRegistry`.
2019-09-19 14:54:36 +02:00
Sebastien Deleuze 90b5e6ab48 Polishing
See gh-23649
2019-09-18 19:29:15 +02:00
Sebastien Deleuze 5adc3d6666 Fix RSocketRequester API for requests without payload
This commit makes it possible to send requests without
requiring to call data(Mono.empty()). It introduces a
dedicated MetadataSpec interface and merge ResponseSpec
into RequestSpec for more flexibility.

Closes gh-23649
2019-09-18 16:00:16 +02:00
Brian Clozel 848804a227 Allow registration of RSocket metadata extractors
Prior to this commit, customizing the extraction of RSocket metadata
from frames would require developers to override the default
`MetadataExtractor` while configuring `RSocketStrategies`.
This touches on many infrastructure parts, whereas the goal is just to
configure an extra metadata entry extractor using already configured
codecs.

This commit adds a way to register metadata entry extractors on the
`RSocketStrategies` builder with a `Consumer`-based API.

Closes gh-23645
2019-09-16 19:01:14 +02:00
Phillip Webb deba2ed1b3 Add blank line between java and javax imports
See gh-23539
2019-09-04 22:05:46 -07:00
Sebastien Deleuze d587a660fc Fix a warning in Kotlin tests 2019-09-03 23:48:39 +02:00
Sebastien Deleuze 9b33b0ad58 Rename CoroutinesUtils#invokeHandlerMethod to invokeSuspendingFunction 2019-09-03 23:41:53 +02:00
Brian Clozel d4089747b8 Use dependency management in Framework build
Prior to this commit, the Spring Framework build would partially use the
dependency management plugin to import and enforce BOMs.

This commit applies the dependency management plugin to all Java
projects and regroups all version management declaration in the root
`build.gradle` file (versions and exclusions).

Some versions are overridden in specific modules for
backwards-compatibility reasons or extended support.

This commit also adds the Gradle versions plugin that checks for
dependency upgrades in artifact repositories and produces a report; you
can use the following:

    ./gradlew dependencyUpdates
2019-09-02 18:01:09 +02:00
Sebastien Deleuze c13941821a Treat Kotlin warnings as errors
Closes gh-23566
2019-09-02 16:49:31 +02:00
Sebastien Deleuze ca02cc1194 Migrate to AssertJ in Kotlin tests
Closes gh-23475
2019-09-02 15:59:26 +02:00
Rossen Stoyanchev 58e9266e99 Add Consumer methods to RSocketRequester
Closes gh-23513
2019-09-02 13:31:28 +01:00
Rossen Stoyanchev b144c72937 Support ByteBuf as a metadata value
This allows encoding of metadata values externally via some
existing API for encoding RSocket metadata, rather than relying on
registered Encoders.

Also remove explicit checks for DataBuffer since those are supported
through the DataBufferEncoder (registered by default).

See gh-23513
2019-09-02 13:31:28 +01:00
Rossen Stoyanchev 71f3498a26 Switch to using RoutingMetadata API
Closes gh-23137
2019-09-02 13:31:28 +01:00
Rossen Stoyanchev 29a58ab045 Remove RSocket metadata MimeType constants
For public use, these constants aren't ideally exposed through an SPI
like MetadataExtractor, and there isn't any other obvious place either.
In practice the only public API where these can be passed in is
RSocketRequester and RSocketMessageHandler both of which already
default to composite metadata anyway, leaving only the routing MimeType
to be used potentially but much less likely.
Due to existence of similar constants in the RSocket itself, i.e.
WellKnownMimeType, we can get by internally too without declaring
MimeType constants from a central place.
2019-08-27 13:04:58 +03:00
Rossen Stoyanchev 45d0405624 Upgrade to RSocket 1.0 RC3 snapshots and...
take advantage of the symmetrical SocketAcceptor methods now available
on RSocketFactory for both client and server side.
2019-08-27 13:04:58 +03:00
Sam Brannen ad6231ad29 Add missing @Override annotations 2019-08-23 13:50:58 +02:00
Brian Clozel e45a3f4738 Rename non-Framework project modules
Prior to this commit, the Spring Framework build would mix proper
framework modules (spring-* modules published to maven central) and
internal modules such as:
* "spring-framework-bom" (which publishes the Framework BOM with all
modules)
* "spring-core-coroutines" which is an internal modules for Kotlin
compilation only

This commit renames these modules so that they don't start with
"spring-*"; we're also moving the "kotlin-coroutines" module under
"spring-core", since it's merged in the resulting JAR.

See gh-23282
2019-08-21 14:32:25 +02:00
Brian Clozel e9523161f0 Revert "Revert "Refactor Gradle tasks in Spring Framework build""
This reverts commit fb0d618751.
2019-08-20 20:26:43 +02:00
Stephane Nicoll fb0d618751 Revert "Refactor Gradle tasks in Spring Framework build"
This reverts commit 1539ba8991.
2019-08-20 20:07:11 +02:00
Brian Clozel 1539ba8991 Refactor Gradle tasks in Spring Framework build
This commit reorganizes tasks and scripts in the build to only apply
them where they're needed. We're considering here 3 "types" of projects
in our build:
* the root project, handling documentation, publishing, etc
* framework modules (a project that's published as a spring artifact)
* internal modules, such as the BOM, our coroutines support and our
integration-tests

With this change, we're strealining the project configuration for all
spring modules and only applying plugins when needed (typically our
kotlin support).

See gh-23282
2019-08-20 18:17:02 +02:00
Sebastien Deleuze 4d10249b70 Update to Coroutine 1.3.0-RC2
This updates brings full interoperability between Reactor and
Coroutines contexts.

Closes gh-22986
2019-08-19 10:03:01 +02:00
Sam Brannen bbe33832cf Clean up warnings in Javadoc 2019-08-17 13:21:28 +02:00
Sam Brannen 979508a7f3 Remove JUnit 4 dependency from all modules except spring-test
This commit removes the JUnit 4 dependency from all modules except
spring-test which provides explicit JUnit 4 support.

This commit also includes the following.

- migration from JUnit 4 assertions to JUnit Jupiter assertions in all
  Kotlin tests
- migration from JUnit 4 assumptions in Spring's TestGroup support to
  JUnit Jupiter assumptions, based on org.opentest4j.TestAbortedException
- introduction of a new TestGroups utility class than can be used from
  existing JUnit 4 tests in the spring-test module in order to perform
  assumptions using JUnit 4's Assume class

See gh-23451
2019-08-17 11:37:21 +02:00
Sam Brannen 3f3e41923f Migrate rest of test suite from JUnit 4 to JUnit Jupiter
This commit migrates the rest of Spring's test suite to JUnit Jupiter,
except spring-test which will be migrated in a separate commit.

See gh-23451
2019-08-17 11:36:58 +02:00
Phillip Webb 62a3e41473 Deprecate mutable methods of MethodParameter
Deprecate all mutation methods in `MethodParameter` in favor of factory
methods that return a new instance. Existing code that previously relied
on mutation has been updated to use the replacement methods.

Closes gh-23385
2019-08-01 08:05:14 +01:00
Juergen Hoeller dea9ad6cb2 Merge branch '5.1.x' 2019-07-31 23:53:32 +02:00
Juergen Hoeller ea4f7d365f Deprecate logger field in HandlerMethodArgumentResolverComposite 2019-07-31 23:48:21 +02:00
Juergen Hoeller e6f86c5c75 Nullability refinements and related polishing 2019-07-31 13:45:48 +02:00
Juergen Hoeller 8ef557df2f Merge branch '5.1.x' 2019-07-30 17:34:29 +02:00
Rossen Stoyanchev 5e15bbfbf1 Change order of argument for createPayload
Expecting data first and metadata second aligns better with the single
arg variant that accepts data. This is also consistent with the
RSocket API in the create methods of ByteBufPayload and DefaultPayload.
2019-07-30 16:16:30 +01:00
Rossen Stoyanchev a1a8781279 PayloadUtils improvements and tests 2019-07-30 16:16:30 +01:00
Juergen Hoeller c4622dbebc Polishing 2019-07-30 16:59:01 +02:00
Rossen Stoyanchev d972911d51 Merge branch '5.1.x' 2019-07-30 11:02:33 +01:00
Rossen Stoyanchev 1d92755cc7 Remove custom handling of byte[] in DefaultStompSession
Closes gh-23358
2019-07-30 10:52:51 +01:00
Rossen Stoyanchev 2c878e9331 Support for setupPayload in RSocketRequester
Closes gh-23368
2019-07-29 22:09:06 +01:00
Rossen Stoyanchev 55946bf319 Factor out MetadataEncoder from RSocketRequester
To be re-used also for creating metadata for the setup payload.

See: gh-23368
2019-07-29 22:09:06 +01:00
Rossen Stoyanchev c76370d7d8 Polish 2019-07-29 22:09:02 +01:00
Rossen Stoyanchev dc0c730ee8 DefaultMetadataExtractor refactoring 2019-07-29 22:08:26 +01:00
Rossen Stoyanchev 2aa3363ba2 ClientRSocketFactoryConfigurer refactoring 2019-07-29 22:08:07 +01:00
Rossen Stoyanchev 8574f977a2 Mutate RSocketStrategies in RSocketMessageHandler
Use rsocketStrategies field with mutate() to ensure consistency
with internal state.

Remove transparent initialization of decoders in MetadataExtractor
and expect them to be set to avoid unintended side effects.
2019-07-26 16:12:02 +01:00
Rossen Stoyanchev fab0a5d504 MetadataExtractor refactoring
Remove RSocketStrategies argument from the contract to avoid having to
pass them every time especially by application components, like an
implementation of a Spring Security matcher.

Decouple DefaultMetadataExtractor from RSocketStrategies in favor of
a decoders property and an internal DataBufferFactory, which does not
need to be the shared one as we're only wrapping ByteBufs.
2019-07-26 16:12:02 +01:00
Rossen Stoyanchev be4facef1b Relax check on default data MimeType
If there is more than one non-basic codec (e.g. CBOR and JSON)
RSocketRequester.Builder takes the mime type of the first one rather
than giving up. It is a valid scenario (JSON for server responding to
browser, and CBOR for client talking to server) and it is the default
situation in Boot, and after all the point here is to pick some default
as best as we can with the worst possible outcome being a server
refusing the connection if it doesn't support the mime type. Beyond
that applications can set the dataMimeType on the builder explicitly.

To match that change this commit also ensures RSocketMessageHandler
rejects proactively data mime types it does not support at the point
of accepting a connection.
2019-07-24 18:44:04 +01:00
Rossen Stoyanchev 88016d47d0 Fix issues in RSocketMessageHandler initialization
This commit ensures getRSocketStrategies() now reflects the state of
corresponding RSocketMessageHandler properties even if those change
after a call to setRSocketStrategies.

RSocketMessageHandler has default Encoder/Decoder initializations
consistent with the recent changes to RSocketStrategies.
2019-07-24 17:39:31 +01:00
Rossen Stoyanchev e19e36ae4c Simplify RSocket client responder config
Now that responder RSocketStrategies also exposes responder strategies,
AnnotationClientResponderConfigurer is reduced and no longer needs to
be public. This commit folds it into RSocketMessageHandler as a nested
class and exposes it as a ClientRSocketFactoryConfigurer through a
static method that accepts the handlers to use.

Effectively a shortcut for creating RSocketMessageHandler, giving it
RSocketStrategies, calling afterPropertiesSet, and then the instance
createResponder.

See gh-23314
2019-07-24 11:17:56 +01:00
Rossen Stoyanchev c456950bc3 Add create shortcut to RSocketStrategies
Now that RSocketStrategies has default settings it makes sense to have
a create() shortcut vs builder().build().

This commit also updates tests to take advantage of improvements in this
and the previous two commits.

See gh-23314
2019-07-24 11:16:27 +01:00
Rossen Stoyanchev 91b040d0bf Add responder strategies to RSocketStrategies
RouteMatcher and MetadataExtractor can now be configured on and
accessed through RSocketStrategies. This simplifies configuration for
client and server responders.

See gh-23314
2019-07-24 11:16:27 +01:00
Rossen Stoyanchev a780cad12e Updates to RSocket[Strategies|Requester] defaults
1. RSocketStrategies hooks in the basic codecs from spring-core by
default. Now that we have support for composite metadata, it makes
sense to have multiple codecs available.

2. RSocketStrategies is pre-configured with NettyDataBufferFactory.

3. DefaultRSocketRequesterBuilder configures RSocket with a frame
decoder that matches the DataBufferFactory choice, i.e. ensuring
consistency of zero copy vs default (copy) choice.

4. DefaultRSocketRequesterBuilder now tries to find a single non-basic
decoder to select a default data MimeType (e.g. CBOR), or otherwise
fall back on the first default decoder (e.g. String).

See gh-23314
2019-07-24 11:16:27 +01:00
Rossen Stoyanchev 56c2987273 RSocketRequester support for route vars
Closes gh-23310
2019-07-22 14:02:22 +01:00
Sebastien Deleuze c006a83584 Upgrade to Coroutines 1.3.0-RC
This commit upgrades Coroutines support to kotlinx.coroutines
1.3.0-RC, leverages the new Coroutines BOM and refine Coroutines
detection to avoid false positives.

Only Coroutines to Mono context interoperability is supported
for now.

CLoses gh-23326
2019-07-21 11:27:43 +02:00
Juergen Hoeller cdeb1fef5f Merge branch '5.1.x' 2019-07-20 18:23:00 +02:00
Juergen Hoeller 92890232df Upgrade to OpenPDF 1.2.21, Rome 1.12.1, XStream 1.4.11.1
Includes updated javadoc links for 5.1.x branch.
2019-07-20 18:20:03 +02:00
Sebastien Deleuze 095fd5bcb3 Use Kotlin BOM
Close gh-23316
2019-07-19 10:43:54 +02:00
Rossen Stoyanchev d2a7d9fa88 Introduce RSocketClientFactoryConfigurer
The new interface supersedes ClientResponderFactory and is more general,
for any RSocketFactory customization.

DefaultClientResponderFactory implements the new interface and is
renamed to AnnotationClientResponderConfigurer.

See gh-23170
2019-07-18 10:21:51 +01:00
Rossen Stoyanchev 1e9ccdd8b8 Pass RSocketStrategies to MetadataExtractor
Simplify the creation of MetadataExtractor by not requiring
RSocketStrategies up front. The strategies are already configured in higher
level places like RSocketMessageHandler that invoke the MetadataExtractor.
The strategies are now passed in as an argument to the extract method.
2019-07-18 10:21:51 +01:00
Rossen Stoyanchev d33e4878a0 Move MetadataExtractor to the rsocket package
The move up the hierarchy reflects the fact that MetadataExtractor
is more generally useful and not tied to annotations.
2019-07-18 10:18:28 +01:00
Juergen Hoeller 94e3210ae7 Fix nullability warnings and javadoc-triggered package cycles 2019-07-17 22:34:07 +02:00
Brian Clozel e7ecb83449 Add client responder configuration
Prior to this commit, the `RSocketRequester.Builder` would allow to
configure directly annotated handlers for processing server requests.
This lead to a package tangle where the `o.s.messaging.rsocket` would
use classes from `o.s.messaging.rsocket.annotation.support` package.

This commit introduces the `ClientResponderFactory` interface for
configuring a responder on the client RSocket factory. Its goal is
to be compatible with future changes with a functional variant for
RSocket handlers.

Closes gh-23170
2019-07-17 12:09:09 +02:00
Sam Brannen 60a7092977 Fix dataMimeType and metadataMimeType mixup in precondition check
Closes gh-23292
2019-07-16 11:13:21 +02:00
Rossen Stoyanchev 68c99dafcf Rename {client|server}Acceptor to Responder
See gh-23170
2019-07-13 10:23:46 +01:00
Сергей Цыпанов 1728bf17fc Avoid unnecessary boxing where primitives can be used
Closes gh-23267
2019-07-10 16:51:18 +02:00
Sam Brannen 43447a8ee9 Polishing 2019-07-09 12:33:55 +02:00
Sebastien Deleuze ca75c2843a Upgrade to Coroutines 1.3.0-M2 2019-07-09 11:36:26 +02:00
Rossen Stoyanchev 47d60b34f8 Fix checkstyle violation 2019-07-08 21:35:00 +01:00
Rossen Stoyanchev 7b1a6eb50a Add getters to RSocketMessageHandler 2019-07-08 19:39:54 +01:00
Rossen Stoyanchev 2f77541f9c Update @MessageMapping Javadoc 2019-07-08 18:02:45 +01:00
Rossen Stoyanchev c199cb9054 @ConnectMapping for RSocket handling
The new annotation helps to differentiate the handling of connection
level frames (SETUP and METADATA_PUSH) from the 4 stream requests.

Closes gh-23177
2019-07-08 17:04:23 +01:00
Brian Clozel 507d128e1d Fix RSocket API warning 2019-07-08 14:47:41 +02:00
Sebastien Deleuze 08a5196c3a Use elementClass and elementTypeRef consistently 2019-07-08 12:08:40 +02:00
Sebastien Deleuze 88d7fede36 Avoid shadowed RSocketRequester extensions
This commit renames RSocketRequester.RequestSpec data extension to
dataWithType to avoid shadowing issues and adds Publisher<T> and Flow<T>
variants to provide automatic reified type parameter resolution for
those types. It also makes RSocketRequester consistent with the
changes introduced via 2b4d6ce354 in WebFlux.
2019-07-08 12:08:26 +02:00
slawluc 4bced4682a Make RSocketRequester extensions reified
Extension functions need to use reified types to create
ParameterizedTypeReference.

Closes gh-23185
2019-07-08 10:49:44 +02:00
Sam Brannen 0fbc9bf461 Fix broken Javadoc links 2019-07-07 19:50:34 +02:00
Juergen Hoeller a5cb8799fa Merge branch '5.1.x' 2019-07-05 18:22:02 +02:00
Juergen Hoeller 16deb3c50f Defensively register ReactiveReturnValueHandler for messaging methods
Closes gh-23207
2019-07-05 17:08:08 +02:00
Rossen Stoyanchev 3d913b8134 Merge branch '5.1.x' 2019-07-03 17:25:12 +01:00
Rossen Stoyanchev 4e6e47b726 Earlier detection of token authentication
Use a callback to detect token authentication (via inteceptor) thus
avoiding a potential race between that detection after the message is
sent on the inbound channel (via Executor) and the processing of the
CONNECTED frame returned from the broker on the outbound channel.

Closes gh-23160
2019-07-03 15:24:27 +01:00
Rossen Stoyanchev 511a430906 Polish 2019-06-28 23:13:31 +01:00
Rossen Stoyanchev 5bf070a857 More flexible RSocket metadata support
The responding side now relies on a new MetadataExtractor which decodes
metadata entries of interest, and adds them to an output map whose
values are then added as Message headers, and are hence accessible to
controller methods.

Decoded metadata entry values can be added to the output map one for
one, or translated to any number of values (e.g. JSON properties),
as long as one of the resulting pairs has a key called "route".

On the requesting side, now any metadata can be sent, and a String
route for example is not required to be provided explicitly. Instead
an application could create any metadata (e.g. JSON properties) as long
as the server can work out the route from it.

The commit contains further refinements on the requesting side so that
any mime type can be used, not only composite or routing metadata, e.g.
a route in an "text/plain" entry.

Closes gh-23157
2019-06-28 22:00:44 +01:00
Brian Clozel dd15ff79d7 Register annotated handlers in RSocketRequester
Prior to this commit, there would be no easy way to register client
RSocket handlers against an `RSocketRequester` instance. The only
solution was to gather all handlers and wrap them in a
`RSocketMessageHandler` and configure it as an acceptor on the client
RSocket.

This commit adds a convenience method on the `RSocketRequester` builder
to tkae care of this part of the infrastructure.

Closes gh-23170
2019-06-24 15:11:18 +02:00
Sebastien Deleuze eaecf0c006 Improve RSocketRequester.ResponseSpec Kotlin extensions
This commit adds retrieveMono and retrieveFlux reified variants, and
turns dataFlow(flow: Flow) extension into a general purpose reified
data(producer: Any) one.

Closes gh-23164
2019-06-21 15:26:12 +02:00
Rossen Stoyanchev 003247dc40 Equalize copy of ChannelSendOperator
See gh-23175
2019-06-21 14:16:44 +01:00
Rossen Stoyanchev 7f1d5d790e Polish 2019-06-21 06:51:59 +01:00
Rossen Stoyanchev c6a2c89408 Package refactoring in rsocket support
Create annotation.support sub-package and move handler code there. This
prepares for a future, functional handler (responder) variant and is
consistent with the package structure under simp.
2019-06-21 06:49:59 +01:00
Rossen Stoyanchev 772087fe18 Refactor RSocket handler selection
1. Consolidate config options for handler detection in the base class
AbstractMethodMessageHandler with sub-classes like RSocketMessageHandler
now only setting the handler predicate by default (e.g. @Controller).

2. Remove autoDetection flag in favor of just having the mutually
exclusive handler Predicate<Object> vs manually registered List<Object>.
Or if both are desired for some reason, then manually register first,
and set the predicate second.
2019-06-20 12:16:08 +01:00
Rossen Stoyanchev 7d68a65dc0 Replace deprecated methods in RSocket tests 2019-06-20 12:16:08 +01:00
Rossen Stoyanchev d6b5c20058 Generalize RSocketRequester data methods
Replace the Publisher argument in RequestSpec's
data(Publisher, Class<T>) and
data(Publisher, ParameterizedTypeReference<T>) methods with Object thus
allowing any reactive type known to the ReactiveAdapterRegistry to be
passed in directly rather than adapted to Publisher first.
2019-06-20 12:16:08 +01:00
Rossen Stoyanchev 22fd521e0a Remove MessageHandlerAcceptor sub-class
This commit removes the MessageHandlerAcceptor sub-class of
RSocketMessageHandler, and rather than implementing directly the
contracts for RSocket client and server acceptors, RSocketMessageHandler
now exposes clientAcceptor() and serverAcceptor() methods that return
the required adapter instances.

This provides better separation between the RSocketMessageHandler and
the RSocket adapter code, and also avoids implementing generic
interfaces like the BiFunction required for the client acceptor.
2019-06-19 22:19:19 +01:00
Rossen Stoyanchev 73c2eb1b77 Fix minor Assert-related issues 2019-06-18 21:31:44 +01:00
Rossen Stoyanchev 14e2c6803e Support for RSocket composite metadata
Closes gh-22798
2019-06-12 17:11:30 -04:00
Juergen Hoeller 0a77477d32 Merge branch '5.1.x' 2019-06-12 18:16:30 +02:00
Juergen Hoeller fc46abf0b7 Polishing 2019-06-12 18:04:06 +02:00
Juergen Hoeller 707c720441 Polishing 2019-06-12 00:05:37 +02:00
Juergen Hoeller 9f92b42d69 Upgrade to Tomcat 9.0.21, Undertow 2.0.21, RxJava 2.2.9, Checkstyle 8.21, Mockito 2.28.2, Hibernate ORM 5.4.3
Centralizes rsocketVersion declaration in build.gradle; also includes upgrade to Reactor Dysprosium M2 proper.
2019-06-11 18:26:13 +02:00
Sebastien Deleuze 098ac0bbb8 Annotate Object#equals parameter with @Nullable
Closes gh-23093
2019-06-06 14:18:30 +02:00
Rossen Stoyanchev eacc531cf7 Add dataMimeType to RSocketRequestBuilder
Closes gh-23012
2019-05-29 17:08:46 -04:00
Rossen Stoyanchev 64f3dbbee8 Polish in rsocket package 2019-05-29 17:08:46 -04:00
Сергей Цыпанов 7ef8cc9faf Tiny improvements regarding ArrayList creation
Closes gh-23047
2019-05-28 16:08:58 +02:00
Sam Brannen 141ef9082f Clean up Mockito usage
This commit migrates to the MockitoJUnitRunner where sensible, which
will later allow for an easier migration to Mockito's extension for
JUnit Jupiter.

In addition, this commit deletes unnecessary stubbing for various mocks
and polishes test fixture setup in various test classes.
2019-05-28 13:59:43 +02:00
Christoph Dreis 4e4145ac27 Avoid unnecessary call to get message type
Closes gh-23040
2019-05-28 07:21:08 +02:00
Phillip Webb 9d74da006c Migrate JUnit 4 assertions to AssertJ
Migrate all existing JUnit 4 `assert...` based assertions to AssertJ
and add a checkstyle rule to ensure they don't return.

See gh-23022
2019-05-23 15:52:49 -07:00
Phillip Webb 95a9d46a87 Migrate Hamcrest assertions to AssertJ
Migrate all existing `assertThat(..., Matcher)` assertions to AssertJ
and add checkstyle rules to ensure they don't return.

See gh-23022
2019-05-23 15:49:59 -07:00
Rossen Stoyanchev 2294625cf0 Exposes STOMP frame stats
Closes gh-23015
2019-05-23 18:32:11 -04:00
Rossen Stoyanchev e09c5fd9e5 Use TaskExecutor instead of ThreadPoolTaskExecutor
Closes gh-22943
2019-05-23 14:26:51 -04:00
Rossen Stoyanchev 0b2fcbfe8a Use TaskScheduler instead of ThreadPoolTaskScheduler
Closes gh-22943
2019-05-23 14:01:05 -04:00
Rossen Stoyanchev 438d3710d3 Detect MimeType via ConnectionSetupPayload
Closes gh-23012
2019-05-21 14:07:59 -04:00
Phillip Webb 02850f357f Migrate exception checking tests to use AssertJ
Migrate tests that use `@Test(expectedException=...)` or
`try...fail...catch` to use AssertJ's `assertThatException`
instead.
2019-05-20 10:47:53 -07:00