Commit Graph

9931 Commits

Author SHA1 Message Date
Artem Bilan
2da7ae016d Add NPE test for ExprEvalSqlParameterSourceFactory
Related to https://github.com/spring-projects/spring-integration/issues/3113

Also clean up code style in the `ExpressionEvaluatingSqlParameterSourceFactory`
2019-11-21 12:11:30 -05:00
Gary Russell
9fb2e570c9 GH-3113: Fix NPE in EESqlParameterSourceFactory
Resolves https://github.com/spring-projects/spring-integration/issues/3113
2019-11-21 09:13:14 -05:00
Gary Russell
ffa199876d Fix Sonar issue from previous commit 2019-11-21 09:07:21 -05:00
Gary Russell
f80ecf17fa Fix TcpConnectionFactory FactoryBean
- bean factory and application context were not injected
- `afterPropertiesSet()` was not called

**cherry-pick to all supported branches**
2019-11-20 14:57:59 -05:00
Artem Bilan
0ec9859c0f Refactor some tests into JUnit 5
* Improve their interaction with Reactor Test
2019-11-19 15:28:55 -05:00
Artem Bilan
25e945908c Fix RSocket module according changes in SF
Related to https://github.com/spring-projects/spring-framework/issues/23999

* Since Spring Integration inbound endpoints are generic in their method
signature we can't rely on a new `EMPTY_CONDITION` because it turns on
configuration merge into just `FrameType.REQUEST_FNF` &
`FrameType.REQUEST_RESPONSE`.
So, use `FrameType.REQUEST_FNF`, `FrameType.REQUEST_RESPONSE`,
`FrameType.REQUEST_STREAM` & `FrameType.REQUEST_CHANNEL` explicitly to
cover all the valid request-response models for SI endpoints
* Rework `RSocketOutboundGatewayIntegrationTests` according new logic.
Plus refactor to earlier subscription into `FluxMessageChannel` to
avoid potential race conditions
2019-11-19 12:12:46 -05:00
Artem Bilan
0f5bd4a40a INT-3494: Resolve dir for writing as a Resource (#3109)
* INT-3494: Resolve dir for writing as a Resource

JIRA: https://jira.spring.io/browse/INT-3494

The expression for local directory can be resolved into a `Resource`
or resource location.
* Fix `ExpressionUtils.expressionToFile()` to support `Resource` and
also use `ResourceUtils.getFile(path)` when expression result is a string
* Modify tests to ensure that resource is resolved properly
* Upgrade affected tests to JUnit 5
* Mention an new functionality in docs

* * Improve Java doc for `ExpressionUtils.expressionToFile()`
* Finish the sentence in the `file.adoc`
2019-11-14 16:27:59 -05:00
Artem Bilan
069d8730e0 Fix NPE in RSocketInboundGateway.decodePayload() 2019-11-14 10:02:56 -05:00
Artem Bilan
72f7c72392 GH-3107: Add errorOnTimeout for TcpInboundGateway
Fixes https://github.com/spring-projects/spring-integration/issues/3107

The `MessagingGatewaySupport` has an `errorOnTimeout` option to throw
a `MessageTimeoutException` when downstream reply doesn't come back in
time for configured reply timeout

* Expose an `errorOnTimeout` option as a `TcpInboundGateway` ctor
property
* Add new factory methods into a `Tcp` factory for Java DSL
* Ensure a property works as expected in the `IpIntegrationTests`
* Document a new option

* Add a setter for MessagingGatewaySupport.errorOnTimeout option
* Expose an `errorOnTimeout` option on the DSL's `MessagingGatewaySpec`
making all the out-of-the-box inbound gateways possible to react to the
`MessageTimeoutException` when no reply during reply timeout
* Propagate properly `errorOnTimeout` in the `JmsInboundGateway`
* Modify docs respectively

* Improve docs about `errorOnTimeout`
2019-11-14 09:07:46 -05:00
Artem Bilan
0bbdd3a5f7 Upgrade to Gradle 6.0; AMQP and Data SNAPSHOTs 2019-11-13 11:24:28 -05:00
Artem Bilan
783a07cf06 Fix HTTP tests accoridng SF changes
Related to https://github.com/spring-projects/spring-framework/pull/1956
2019-11-13 10:34:33 -05:00
Artem Bilan
d9e09b93fc Test that Kotlin synthetic classes work in SpEL
Related to https://github.com/spring-projects/spring-framework/issues/23812

* Modify `FunctionsTests.kt` test to be sure that fall back to SpEL
invocation in case of Kotlin lambda works as expected.
This is like an additional test to the fix in Spring Framework
2019-11-13 10:09:08 -05:00
Artem Bilan
feae9d8dcd Remove duplicate WebFlux endpoints summary
There is a WebFlux endpoints row in the `endpoint-summary.adoc`
table in its proper place by alphabet order, therefor one just after an
HTTP is wrong
2019-11-12 15:34:07 -05:00
Artem Bilan
a6fb891a81 Fix MMIH to check for Advised in getTargetClass()
* Currently `MessagingMethodInvokerHelper.getTargetClass()` logs a
debug message when it can't cast a `targetObject` into an `Advised`.
Such a message is misleading and really unnecessary noise in the target
applications
* Fix the logic of the method to check `targetObject instanceof Advised`
before trying to extract interfaces from proxy.
This way we don't need to catch any exceptions at all.
If something will fail, it should be bubbled upstream for possible fixes
* Convert `MethodInvokingMessageProcessorTests` to JUnit 5 and restore
a couple tests
2019-11-10 10:44:17 -05:00
Gary Russell
bb2ecd8a50 Upgrade AssertJ, Hamcrest, Gradle 2019-11-08 16:25:08 -05:00
lsgeme
1820c05c26 GH-3105: Fix (S)FTP streaming single filter logic
Fixes https://github.com/spring-projects/spring-integration/issues/3105

The loop in the `AbstractRemoteFileStreamingMessageSource` doesn't check
the next polled file for filtering.

* Add `continue;` when we filter the current file and poll the next one.
So, we go over into the `while()` beginning
* Clean up the code style and cover more code path in test
2019-11-08 11:44:42 -05:00
Spring Buildmaster
ddccb5a887 [artifactory-release] Next development version 2019-11-04 21:39:46 +00:00
Spring Buildmaster
7d46c8d601 [artifactory-release] Release version 5.2.1.RELEASE 2019-11-04 21:39:42 +00:00
Gary Russell
be887814f8 Upgrade Spring Security, Micrometer 2019-11-04 15:06:42 -05:00
Gary Russell
1287aa5644 Upgrade dependencies 2019-11-04 12:12:50 -05:00
Artem Bilan
3e68228ae3 More docs for new RSocket features 2019-11-01 16:53:23 -04:00
Artem Bilan
dd1d65bb23 Refinement for ResolvableType JSON header
Fix a logic in the `JsonToObjectTransformer.obtainResolvableTypeFromHeadersIfAny`
when we have both `JsonHeaders.RESOLVABLE_TYPE` and `JsonHeaders.TYPE_ID`
and `JsonHeaders.RESOLVABLE_TYPE` header is valid `ResolvableType`, so
`JsonHeaders.TYPE_ID` doesn't override its value to return
2019-11-01 15:54:12 -04:00
Artem Bilan
ad97f818cf GH-3096: Skip RESOLVABLE_TYPE header in mapping (#3098)
* GH-3096: Skip RESOLVABLE_TYPE header in mapping

Fixes https://github.com/spring-projects/spring-integration/issues/3096

When we sent an AMQP message we should not map a
`JsonHeaders.RESOLVABLE_TYPE` header which is a `ResolvableType` and
isn not compatible after converting to string

Also improve `JsonToObjectTransformer` to ignore a
`JsonHeaders.RESOLVABLE_TYPE` when it is type of String

* * Fix `obtainResolvableTypeFromHeadersIfAny()` logic
2019-11-01 15:28:06 -04:00
Artem Bilan
845a39653e Revert testReactiveStreamsConsumerPollableChannel
https://build.spring.io/browse/INT-MASTER-1776/

Looks like there is a race condition between subscribers
2019-11-01 15:03:06 -04:00
Artem Bilan
36c9f72a9d Use EmitterProcessor for Channels adaptation (#3100)
* Use `EmitterProcessor` for Channels adaptation

Related https://github.com/spring-cloud/spring-cloud-stream/issues/1835

To honor a back-pressure after `MessageChannel` adaptation it is better
to use an `EmitterProcessor.create(1)` instead of `Flux.create()`.
This way whenever an emitter buffer is full, we block upstream producer
and don't allow it to produce more messages

**Cherry-pick to 5.1.x**

* * Wrap every new subscription into a `Flux.defer()`
* Fix `ReactiveStreamsConsumerTests` to use a new `Subscription` after
each `stop()/start()` on the `ReactiveStreamsConsumer`

* * Remove unused imports
2019-11-01 14:49:29 -04:00
Sergei Egorov
69401c263c Back-pressure tests for SubscribableChPubAdapter
* Add back-pressure tests for SubscribableChannelPublisherAdapter
2019-11-01 12:13:11 -04:00
Gary Russell
e2ba60f021 TCP Test - increase wait time for close 2019-11-01 10:22:58 -04:00
Artem Bilan
04ff879f7e Improve RSocket support
Related to: https://github.com/spring-projects/spring-boot/issues/18812

* Extract `ServerRSocketMessageHandler` into a `public` class to allow
to configure it as top-level bean and bind it into an existing server
* Change `ServerRSocketConnector` to accept the mentioned external bean
and don't create an internal RSocket server with an assumption that it
is create externally
* Add `IntegrationRSocketMessageHandler.requestMappingCompatible`
option to allow to configure `ServerRSocketMessageHandler` for both
Spring Integration RSocket channel adapters and regular `@MessageMapping`.
This is useful for Spring Boot auto-configuration

These changes give a hook to auto-configure Spring Integration RSocket
channel adapters in Spring Boot
2019-11-01 09:26:09 -04:00
Gary Russell
0ceea8414f GH-3089: Fix import 2019-10-31 17:02:21 -04:00
Gary Russell
841a91d2cb GH-3089: Fix since in gateway spec 2019-10-31 16:47:58 -04:00
Artem Bilan
6468ecc530 GH-3089: Add AmqpInGateway.replyHeadersMappedLast (#3091)
* GH-3089: Add AmqpInGateway.replyHeadersMappedLast

Fixes https://github.com/spring-projects/spring-integration/issues/3089

In some use-case we would like to control when headers from SI message
should be populated into an AMQP message.
One of the use-case is like a `SimpleMessageConverter` and its `plain/text`
for the String reply, meanwhile we know that this content is an
`application/json`.
So, with a new `replyHeadersMappedLast` we can override the mentioned
`content-type` header, populated by the `MessageConverter` with an
actual value from the message headers populated in the flow upstream

* Introduce an `AmqpInboundGateway.replyHeadersMappedLast`; expose it
on the DSL and XML level
* Use newly introduced `MappingUtils.mapReplyMessage()`
* Optimize `DefaultAmqpHeaderMapper` to not parse JSON headers at all
when `JsonHeaders.TYPE_ID` is already present (e.g. `MessageConverter`
result)
* Also skip `JsonHeaders` when we `populateUserDefinedHeader()`

**Cherry-pick to 5.1.x**

* * Fix language and package typos
* Add missed `@param` in JavaDoc of the `AmqpBaseInboundGatewaySpec.batchingStrategy()`
* Extract a `RabbitTemplate` `MessageConverter` to use for reply messages
conversion - pursue a backward compatibility
2019-10-31 16:25:40 -04:00
Artem Bilan
977997e3bf GH-3090: Add logout() to FtpSession.close()` (#3094)
* GH-3090: Add `logout() to `FtpSession.close()`

Fixes https://github.com/spring-projects/spring-integration/issues/3090

Without `logout()` the FTP session is not closed at all,
but just the connection is closed.
Some FTP servers close those sessions eventually anyway, but some just
leak with resources.

**Cherry-pick to 5.1.x & 4.3.x**

* * Migrate `SessionFactoryTests` to JUnit 5
2019-10-30 15:41:42 -04:00
Joaquin Santana
7aea76c6c4 GH-3026: Fix chmod support for DSL
Fixes https://github.com/spring-projects/spring-integration/issues/3026

**Cherry-pick to `5.1.x`**

* Populate proper `FileTransferringMessageHandler` impl from DSL spec
implementations.
This way we are able to use a provided `chmod` from Java DSL
* Added `FileTransferringMessageHandlerSpec` ctor TODO
* Update SftpTests
* Code cleanup; `@Ignore` `SftpTests.testSftpOutboundFlowWithChmod()`
since it doesn't work properly on Windows
2019-10-29 15:20:08 -04:00
Artem Bilan
66c3eff2ba Fix new Sonar smells 2019-10-29 08:11:31 -04:00
Artem Bilan
ca56a0eb80 Extract BaseIntegrationFlowDefinition (#3087)
* Extract `BaseIntegrationFlowDefinition`

Kotlin inline reified functions cannot override as syntax sugar generic
Java methods.

* Extract a `BaseIntegrationFlowDefinition` with strong typed methods,
plus those which doesn't have a syntax sugar variants
* Leave in the `IntegrationFlowDefinition` only those generic methods
which are just a syntax sugar without any types requirements

This way we can write Kotlin inline reified functions as an extension
 with the same names to make a Kotlin DSL much cleaner

* * Override methods in the IntegrationFlowDefinition for bytecode compatibility
* Extract `protected` getters and setters for `BaseIntegrationFlowDefinition`
properties to allow a proper extension
* Use those getters and setters in the code

* * Add // NOSONAR for overridden methods
2019-10-28 10:11:15 -04:00
Artem Bilan
1a2907eeb3 Upgrade dependencies; fix deprecations 2019-10-25 15:25:14 -04:00
Artem Bilan
ab06c21bbc Give access to AmqpOutboundEndpoint.RabbitTemplate
Related to https://github.com/spring-cloud/spring-cloud-stream/pull/1824

There are some use-cases when we would like to further customize a
`RabbitTemplate` encapsulated in the `AmqpOutboundEndpoint`.
For this purpose there is just enough to make its getter as `public`.
Also make a `AmqpHeaderMapper` available same way via `public` getter
2019-10-23 14:21:26 -04:00
Artem Bilan
a2e0dda4d8 Show Rsocket requestChannel in RSocketDslTests 2019-10-23 13:29:20 -04:00
Artem Bilan
375f3c1317 Ensure that dynamic routes are included into graph (#3085)
* Ensure that dynamic routes are included into graph

Modify an `IntegrationGraphServerTests` to be sure that dynamic routes
are included into the graph (with links) after sending a message to the
router and rebuilding a graph

* * Fix test for the actual numbers to expect
2019-10-21 15:19:17 -04:00
Gary Russell
612ae341ae TCP: Fix race in test
- since the deserializer is no longer volatile, we can't change it in the test
- move the "old behavior" test for the raw deserializer to a new test
2019-10-18 09:00:51 -04:00
Emmanuel Roux
c420c414d3 GH-3076: NioFileLocker: add file existence check
Fixes spring-projects/spring-integration#3076

* Return `null` instead of throwing an exception

* Fix license header

* Add missing `@since`

* Avoid over-engineered test logic

* Fix code style

* Test non-existent file does not get created

* Fix: remove unused import
2019-10-17 14:52:46 -04:00
Artem Bilan
1e50707370 Fix new Sonar smells 2019-10-17 10:09:55 -04:00
Artem Bilan
33667884a7 GH-3079: Use getMostSpecificMethod for SpEL calls (#3082)
* GH-3079: Use getMostSpecificMethod for SpEL calls

Fixes https://github.com/spring-projects/spring-integration/issues/3079

It turns out that we need to use a *most specific* method for the target
to be called reflectively from the SpEL

NOTE: We drop a *Method not found* error in case of wrong method source
since now we find a right source via `ClassUtils.getMostSpecificMethod()`

**Cherry-pick to 5.1.x**

* * `@Ignore` `MethodInvokingMessageProcessorTests.testProcessMessageMethodNotFound()`
instead of removal
2019-10-16 15:57:33 -04:00
Gary Russell
87af95ee7a GH-3083: Support @Header with dotted literals
Fixes https://github.com/spring-projects/spring-integration/issues/3083

`@Header("foo.bar")` means extract property `bar` from header `foo`.

Support `@Header("'foo.bar'")`, meaning get the value of header `foo.bar`.

**cherry-pick to 5.1.x, 4.3.x**
2019-10-16 11:13:19 -04:00
Artem Bilan
911cdc86b5 Refinement for gateway Mono processing (#3075)
* Refinement for gateway Mono processing

* Introduce a `MessagingGatewaySupport.MonoReplyChannel` instead of
`FutureReplyChannel` for better on demand handling and reusing a
`Mono` returned from the target handler
* Refactor `GatewayProxyFactoryBean` to identify a target return type
(including generics for `Function`) during initialization
* Handle a `Mono` return type via
`MessagingGatewaySupport.sendAndReceiveMessageReactive()`
* Some `@Nullable` in the `GatewayProxyFactoryBean` and `ExpressionUtils`
* Add `MonoFunction` test-case into the `FunctionsTests.kt`

* * Deprecate `GatewayProxyFactoryBean.setServiceInterface()` in favor of
ctor initialization
* Fix `GatewayProxyFactoryBean.setServiceInterface()` usage in tests
2019-10-14 15:31:04 -04:00
Gary Russell
7733da651f GH-3072: Allow JDBC inbound query changes
Resolves https://github.com/spring-projects/spring-integration/issues/3072

* Assert for selectQuery setter
2019-10-04 15:39:22 -04:00
Artem Bilan
2a8615539f Deprecate IntFlows.from(service, methodName)
The method reference together with a `IntegrationFlows.frm(Supplier<?>)`
do the trick to avoid a method name resolution and also gives us a code
navigation in the IDE
2019-10-02 10:58:03 -04:00
Spring Buildmaster
07b44aec18 [artifactory-release] Next development version 2019-10-01 17:15:56 +00:00
Spring Buildmaster
c9d68c5c55 [artifactory-release] Release version 5.2.0.RELEASE 2019-10-01 17:15:52 +00:00
Artem Bilan
d3d82db374 Upgrade to Spring AMQP 2.2 GA; prepare for release 2019-10-01 12:53:57 -04:00