Commit Graph

9552 Commits

Author SHA1 Message Date
Artem Bilan
4f34d922c1 INT-4573: Fix logic in the OperationInvokingMH
JIRA: https://jira.spring.io/browse/INT-4573

* Fix check order for headers first in the `resolveObjectName()` and
`resolveOperationName()`.
Then fallback to defaults configured on the `OperationInvokingMessageHandler`
* Remove also a deprecated API in the `OperationInvokingMessageHandler`
* Remove requirements for `object-name` and `operation-name` XML
attributes since those options can be provided in the request message
headers
* Fix `OperationInvokingChannelAdapterParserTests` for proper headers
resolution
* Mention `JmxHeaders.OBJECT_NAME` and `JmxHeaders.OPERATION_NAME`
headers in the `jmx.adoc`
2019-02-25 17:28:31 -05:00
Gary Russell
0ce6d1cef8 Restore Sonar to 2.7
This reverts commit 10637db614.
2019-02-25 17:06:50 -05:00
Gary Russell
10637db614 Revert Sonar to 2.6.2 2019-02-25 16:17:28 -05:00
Artem Bilan
aa075439fc INT-4559: JDBC Gateway: return List for maxRows>1
JIRA: https://jira.spring.io/browse/INT-4559

* Return a single item from result only if
`maxRows == null || maxRows == 1`
* Remove deprecated `max-rows-per-poll` from the
`JdbcOutboundGateway.java` and its XSD and parsers
2019-02-22 17:14:01 -05:00
Artem Bilan
1d54f9663a GH-2760: use assertThatExceptionOfType in tests
Fixes https://github.com/spring-projects/spring-integration/issues/2760

* The `assertThatExceptionOfType()` is more convenient,
than `assertThatThrownBy`, so, replace all the usages accordingly
* Fix JavaDoc typo in the `AbstractScriptExecutingMessageProcessor`
* Fix Sonar smells for `throws Exception` in `AbstractScriptExecutingMessageProcessor`
hierarchy and some code polishing for them
2019-02-22 13:54:36 -05:00
Artem Bilan
82ecd5a75d GH-2749: Deprecate ChannelInterceptorAware (#2751)
* GH-2749: Deprecate ChannelInterceptorAware

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

The `org.springframework.messaging.support.InterceptableChannel` provides
exact functionality as `ChannelInterceptorAware`

* Make `ChannelInterceptorAware extends InterceptableChannel`
* Suppress deprecation warning whenever we need to keep backward
compatibility
* Fix all other places to deal with `InterceptableChannel` already

* GH-2749: Deprecate ChannelInterceptorAware

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

The `org.springframework.messaging.support.InterceptableChannel` provides
exact functionality as `ChannelInterceptorAware`

* Make `ChannelInterceptorAware extends InterceptableChannel`
* Suppress deprecation warning whenever we need to keep backward
compatibility
* Fix all other places to deal with `InterceptableChannel` already

* * Fix `channel.adoc` for the current version
2019-02-22 10:22:58 -05:00
Gary Russell
d6ac866871 GH-2759: Fix CorrelationData.future
* GH-2759: Fix CorrelationData.future

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

The outbound endpoints wrap user correlation data in a wrapper.
If the user data is a `CorrelationData`, we must delegate methods
involving the `Future<?>` and `returnedMessage` to the user data.

**cherry-pick to 5.1 and switch AMQP to snapshots**

* Polishing - remove redundant override.

* Add debug log with null correlation data
2019-02-22 10:20:51 -05:00
Artem Bilan
221393e02f MessageHandlingException consistency
* Use `IntegrationUtils.wrapInHandlingExceptionIfNecessary()` whenever
it is possible to avoid double wrapping into the `MessageHandlingException`
* Some code polishing for affected classes `@Nullable`, streams, diamonds etc.
2019-02-22 09:43:59 -05:00
Artem Bilan
9c84eceec2 Optimize updateCopyrights, checkTestConfigs tasks
* The Gradle `checkTestConfigs` task deals only with resources,
so narrowing its `outputs` to the `build/resources`
* The Gradle `updateCopyrights`  tasks deals only with compiled classes,
so narrowing its `outputs` to the `build/classes`
2019-02-21 19:04:32 -05:00
Artem Bilan
7e3b56939e Fix XSDs for actual core schema version 2019-02-21 12:43:21 -05:00
Artem Bilan
622d42c71a Migrate tests to AssertJ
Mostly thanks to IDEA's plugin: https://plugins.jetbrains.com/plugin/10345-assertions2assertj
There is still a lot of work to do when complex and composite matchers are used.

* Add `awaitility` dependency and deprecate `EventuallyMatcher` in favor
of `awaitility`
* Remove Hamcrest from dependencies and disable JUnit & Hamcrest
static imports to encourage to use only AssertJ
* Migrate JUnit assumptions in rules to AssertJ's assumptions
* Deprecate some custom matchers in favor of existing in Hamcrest
after upgrading the last to version `2.1`
* Replace `ExpectedException` rules with `assertThatThrownBy()`
* Mention `MessagePredicate` in the `testing.adoc`
2019-02-21 10:20:45 -05:00
mamachanko
b62c2a8fb3 Update docs for message routers so that they compile 2019-02-21 10:08:54 -05:00
Gary Russell
f15a4c49eb EnableIntegrationTests: increase receive timers
https://build.spring.io/browse/INT-MASTERSPRING40-623/
2019-02-20 10:49:24 -05:00
Gary Russell
c6965b226d Fix typo in MQTT doc 2019-02-20 09:20:11 -05:00
Artem Bilan
baf1b971c8 GH-2752: RequestMapping: react only for our event
Fixes https://github.com/spring-projects/spring-integration/issues/2752

The logic in the `IntegrationRequestMappingHandlerMapping` fully depends
on the application context it has been registered with, therefore any
arbitrary `ContextRefreshedEvent` doesn't fit our requirements.
More over it may cause a problem with missed mappings when parent-child
configuration is used.

**Chery-pick to 5.1.x, 5.0.x & 4.3.x**
2019-02-19 16:08:27 -05:00
Artem Bilan
9e238f5d69 Upgrades and doc fixes
* Upgrade to Gradle 5.2.1, SonarQube 2.7, asciidoctor 1.5.10,
Apache Sshd 2.2.0, AsertJ 3.12.0, Curator Framework 4.1.0, room Tool 1.12.0,
Checkstyle 8.17
* remove Eclipse Link support in JPA tests since it is not compatible
with Java 11
* Move 5.1 changes to the `changes-5.0-5.1.adoc`; start new "What's New"
2019-02-15 15:54:18 -05:00
Gary Russell
520ebbbd2c Move master to 5.2 2019-02-15 12:01:24 -05:00
Spring Buildmaster
7dda106b80 [artifactory-release] Next development version 2019-02-14 21:01:27 +00:00
Spring Buildmaster
dab5e0b6dc [artifactory-release] Release version 5.1.3.RELEASE 2019-02-14 21:01:23 +00:00
Artem Bilan
0d37566452 GH-2744: ScatterGather: reinstate request headers
Fixes https://github.com/spring-projects/spring-integration/issues/2744

When we get scattering results, there is no reason to keep internal
headers any more.
* Fix `ScatterGatherHandler` to modify scattering result messages to
reinstate headers from original request message.
This way we are able to re-throw an exception from the gatherer to
the caller.

* Fix typos and language in Docs
2019-02-14 15:19:57 -05:00
Artem Bilan
d38db25fb7 Fix updateCopyrights Gradle task
* Do not modify files which already has an actual year in the Copyright
* Make it to be performed really before any compilation, there change
to `compileKotlin.dependsOn updateCopyrights`
2019-02-14 13:42:48 -05:00
Artem Bilan
fe5d0affde Optimize checkTestConfigs task for UP_TO_DATE
We really don't need to parse `inputs.files` for wrong XSD configuration.
This is already a responsibility of the task.
There is just enough to track changes in the XML configs and if they
happened only after that treat the task as out of date and parse configs
for wrong XSD configuration
2019-02-14 10:39:50 -05:00
Artem Bilan
1fad620b8f Upgrade Spring Data & security; fix docs path 2019-02-13 16:23:06 -05:00
Artem Bilan
9879c7450c Upgrade dependencies, including Kotlin 2019-02-13 14:34:56 -05:00
Artem Bilan
daf00154c6 Add updateCopyrights Gradle task
To avoid extra manual task to check all the files for actual Copyright
header an `updateCopyrights` is introduced to be performed before
`processResources` and check modified classes via `Git status` command
by the `grgit` plugin.
The `updateCopyrights` task is enabled only locally: when it's not on
Travis or Bamboo - no reason to infer code base when it is not going
to be committed.
2019-02-13 13:45:57 -05:00
Gary Russell
53272fd1f7 Remove unused import 2019-02-12 15:29:15 -05:00
Artem Bilan
e8aa8618df GH-2735: Add errorChannel to ScatterGatherHandler
Fixes spring-projects/spring-integration#2735

* Fix typos in Scatter-Gather JavaDocs
* Add Scatter-Gather error handling documentation

Doc polishing
2019-02-11 15:08:01 -05:00
Artem Bilan
5c46efe067 Fix Sonar smells for websocket module
* Introduce `JavaUtils` for chaining properties setting
* Fix method complexity in the `ServerWebSocketContainer` using newly
introduced `JavaUtils`
* Make `JavaUtils` as `final`
2019-02-11 14:17:49 -05:00
Artem Bilan
5eba369be0 Fix new Sonar smells in MessagingGatewaySupport 2019-02-09 19:46:54 -05:00
Artem Bilan
4c88ddd429 GH-2731: Fix nested gateway error propagation
Fixes https://github.com/spring-projects/spring-integration/issues/2731

When we have a nested gateway configuration, we are losing the context
of the current request message in case of errors and the downstream
`MessagingException` is just re-thrown as is, without the proper
`failedMessage` and its processed `errorChannel` header.

* Check for exception type and for the `errorChannel` header in the
current `requestMessage` before re-throwing as a new
`MessageHandlingException` in the `MessagingGatewaySupport.sendAndReceive()`
* Extract `.gateway()` tests into the separate `GatewayDslTests` class
2019-02-08 14:47:23 -05:00
Gary Russell
37563a140c Polish Contribution Guidelines 2019-02-08 14:46:35 -05:00
Artem Bilan
04875b72b4 GH-2727: Ensure JDBC queries are logged (#2730)
* GH-2727: Ensure JDBC queries are logged

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

The `JdbcTemplate` logs a message for the sql to execute when it is
supplied by the `QueryProvider`.

* Refactor `JdbcPollingChannelAdapter` to use new introduced internal
`PreparedStatementCreatorWithMaxRows` with the `QueryProvider`
* Refactor `JdbcMessageHandler` to instantiate a `generatedKeysStatementCreator`
based on the `PreparedStatementCreatorFactory`
* Verify in the `JdbcOutboundGatewayParserTests` that both fixes logs
sql queries properly

* * Implement all the delegate interfaces for the `PreparedStatementCreatorWithMaxRows`
2019-02-08 14:27:03 -05:00
Artem Bilan
71fd60fda6 Add default expressions for ExpEvalReqHAdvice (#2738)
* Add default expressions for ExpEvalReqHAdvice

https://stackoverflow.com/questions/54546728/how-to-handle-ftpoutboundadapter-connection-exception-in-spring-integration-flow

When channels are configured for the `ExpressionEvaluatingRequestHandlerAdvice`,
but no expressions, the logic is not performed.
In other words: we can evaluate expressions, when no channels,
but we  don't send messages to channels when no expressions.

* Provide default expressions to be evaluated to `payload`, when only
channels are provided.

* * Remove asserts for expression setters
2019-02-06 16:21:03 -05:00
Artem Bilan
e2d177e900 Fix "One sentence per line" in docs 2019-02-06 11:21:33 -05:00
Gary Russell
d56e29b28d GH-2733: Polishing
- fix `equals()` implementation issues.
2019-02-06 09:00:22 -05:00
Gary Russell
f6c8a652eb GH-2733: Fix Meter Memory Leak
Fixes https://github.com/spring-projects/spring-integration/issues/2733

`AbstractMessageChannel` exception meters caused a memory leak because they
are stored in a `Set` for destruction purposes but did not implement
`hashCode` and `equals`.

Add `hashCode()` and `equals()` to all meter facades, delegating to the
underlying Micrometer objects.
2019-02-05 09:48:47 -05:00
Gary Russell
6391e4bebf Tcp Doc Polishing
Also remove some `this.` method calls.
2019-02-04 14:51:33 -05:00
Gary Russell
f82c7164f7 GH-2728: AMQP Manual acks and conversion errors
Resolves https://github.com/spring-projects/spring-integration/issues/2728

Provide access to the channel and delivery tag in the `ErrorMessage` when
using `AcknowledgeMode.MANUAL`.
2019-02-01 12:57:10 -05:00
Gary Russell
65b889925a Revert INT-4386: Support Instant in schedule expr.
This reverts commit f901c4e167.
2019-01-31 16:23:59 -05:00
Artem Bilan
f901c4e167 INT-4386: Support Instant in schedule expressions
JIRA: https://jira.spring.io/browse/INT-4386

* Expose `java.time` in the `IntegrationEvaluationContextFactoryBean`
ot simply a `T()` SpEL operator
* Add `Instant` result evaluation to the `delayExpression`
2019-01-31 16:13:27 -05:00
Artem Bilan
020ea76d59 Make IOS.setTaskScheduler() as public (#2725)
* Make IOS.setTaskScheduler() as public

* Make `IntegrationObjectSupport.setTaskScheduler()` as `public` and
remove all the overrides for visibility
* Fix Sonar smells for all the affected classes

* * Fix `throws Exception` for affected classes to avoid compilation errors

* * Fix "merely rethrow" smell
* Revert `throws Exception` for `AbstractEndpoint.destroy()`

* * Catch a couple exceptions from `destroy()`
2019-01-30 13:59:37 -05:00
Jay Bryant
7980afef9b INT-4339: Remove Docbook & rely on Asciidoctor
JIRA: https://jira.spring.io/browse/INT-4339
2019-01-29 21:47:18 -05:00
Artem Bilan
a283ad60fb GH-2723: Handle unsupported XML properties
Fixes spring-projects/spring-integration#2723

Not all XML components support all the configuration properties.
For example Saxon HE doesn't support `XMLConstants.ACCESS_EXTERNAL_DTD`
and end up with an exception like:
`IllegalArgumentException: Unknown configuration property http://javax.xml.XMLConstants/property/accessExternalDTD`

* Change `XsltPayloadTransformer` to re-use `TransformerFactoryUtils`
from spring-ws as a centralized source of `TransformerFactory`
configuration.
* Wrap `XMLConstants.ACCESS_EXTERNAL_STYLESHEET` to the `try..catch`
and log INFO about not supported property

**Cherry-pick to 5.0.x & 4.3.x**
2019-01-29 12:27:05 -05:00
Artem Bilan
4c6ffec6fe * Fix some typos in Docs, old DSL callbacks
https://stackoverflow.com/questions/54413401/file-inbound-adapter-example-provided-in-sample-not-working/54413480
2019-01-29 10:42:58 -05:00
Artem Bilan
5295a76b42 Fix mail lock race condition & Sonar smells (#2721)
* Fix mail lock race condition & Sonar smells

https://build.spring.io/browse/INT-MASTERSPRING40-599/

* The `folderReadLock` might not be re-locked when `openFolder()`
throws an exception
* Fix all the Sonar smells for mail module
* Optimize all the dynamic `Assert` messages to `Supplier`
* Refactor `MailReceiverFactoryBean` to be based on the `AbstractFactoryBean`

* * Fix new reported Sonar smells

* * Log error during cancel idle state in the `ImapMailReceiver`
* Remove commented code in the `MailTransportUtils`
2019-01-28 13:07:26 -05:00
Artem Bilan
a609bd9398 Some file module Sonar fixes (#2718)
* Some file module Sonar fixes

* * Fixes after testing

* * Some further Sonar fixes for file module

* * Further Sonar fixes for file module

* * More Sonar fixes for file module

* * Fix `RemoteFileTemplate` issues

* * Fix new sonar smells after previous one

* * Review feedback
2019-01-25 14:37:57 -05:00
Artem Bilan
db239f8ba0 Fix NPE Sonar report in the NotificationPublishMH 2019-01-24 13:04:44 -05:00
Artem Bilan
9ab6779dc2 Fix new Sonar smell and some other in JMX module (#2716)
* Fix new Sonar smell and some other in JMX module

* * Fix issues after testing
2019-01-24 11:55:46 -05:00
Gary Russell
bac3565dfd GH-2714: Fix PollSkipAdvice
Fixes https://github.com/spring-projects/spring-integration/issues/2714

Return null instead of false when poll skipped.
2019-01-24 10:46:04 -05:00
Gary Russell
fff968e5ad Add Duration overloads to Pollers factory
- test adds coverage to all time-based factory methods
2019-01-23 17:39:12 -05:00