Commit Graph

868 Commits

Author SHA1 Message Date
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
Johnny Lim
21e163e5da Fix typo 2019-05-20 16:41:05 +02:00
Rossen Stoyanchev
97c2de915a Add RouteMatcher
Closes gh-22642
2019-05-14 21:44:39 -04:00
stsypanov
9ca8681f79 Iteration over a map using EntrySet 2019-05-13 15:38:13 +02:00
Sam Brannen
0cff7eb32c Fix Javadoc links 2019-05-10 17:40:03 +02:00
Stephane Nicoll
f188aab5f2 Merge branch '5.1.x' 2019-05-10 10:49:59 +02:00
chenqimiao
e3137f11df Fix typo in package-info.java
Closes gh-22941
2019-05-10 10:49:13 +02:00
Rossen Stoyanchev
06c3a058f4 Use most recent RSocket RC for M2 release 2019-05-08 20:34:22 -04:00
Phillip Webb
798b51f4a3 Migrate to BDD Mockito
Migrate all tests to consistently use BDD Mockito. Also add
checksyle rule to enforce going forwards.
2019-05-08 13:46:13 -07:00
Phillip Webb
816bbee8de Remove '.*' imports from tests
Organize test imports to expand all '.*' static imports into
fully qualified imports.

This update will allow us to use additional checkstyle rules in
the future, and will also help if we migrate fully to AssertJ.
2019-05-08 09:55:09 -07:00
Phil Webb
d7320de871 Migrate away from ExpectedException (#22922)
* Add limited checkstyles to test code

Add a limited set of checkstyle rules to the test codebase to improve
code consistency.

* Fix checksyle violations in test code

* Organize imports to fix checkstyle for test code

* Migrate to assertThatExceptionOfType

Migrate aware from ExpectedException rules to AssertJ exception
assertions. Also include a checkstyle rules to ensure that the
the ExpectedException is not accidentally used in the future.

See gh-22894
2019-05-08 16:25:52 +02:00
Juergen Hoeller
cdf51c3d51 Nullability refinements and related polishing 2019-05-08 00:27:56 +02:00
Juergen Hoeller
8eb9782ca2 Polishing 2019-05-07 12:43:36 +02:00
Juergen Hoeller
85cecb66e5 Consistent parameter retrieval across InvocableHandlerMethod variants
See gh-22900
2019-05-07 01:33:07 +02:00
Juergen Hoeller
f56c70d2f0 Merge branch '5.1.x' 2019-05-07 01:23:16 +02:00
Juergen Hoeller
c841b62bb0 Consistent parameter retrieval across InvocableHandlerMethod variants
See gh-22900
2019-05-07 01:20:05 +02:00
Juergen Hoeller
30a1f6fed5 Consistent exception naming across InvocableHandlerMethod variants
See gh-22900
2019-05-07 01:00:45 +02:00
Juergen Hoeller
4b06d8e511 Merge branch '5.1.x' 2019-05-07 00:59:56 +02:00
Juergen Hoeller
3f85a7db1b Consistent exception naming across InvocableHandlerMethod variants
See gh-22900
2019-05-07 00:48:27 +02:00