Commit Graph

9623 Commits

Author SHA1 Message Date
Gary Russell
b30f404173 INT-4230: Fix (S)FTP Preserve Timestamp on MGET
JIRA: https://jira.spring.io/browse/INT-4230

The `get()` method only preserves the timestamp when an LS operation is done within it.
For MGET ops, we don't perform another LS, so the timestamp was not updated.

Add code to the recursive and non-recursive MGET methods to preserve the timestamp if so configured.
2017-02-21 12:46:28 -05:00
Gary Russell
7558b847fb Update to Java Mail 1.5.6
Align with Boot.
2017-02-18 09:15:52 -05:00
Artem Bilan
30de1ff95f IdempotentReceiverIntegrationTests: use unique key 2017-02-16 15:21:03 -05:00
Artem Bilan
cedbc53f88 IdempotentReceiver: BridgeFrom/To test-cases 2017-02-16 15:18:55 -05:00
Artem Bilan
dda2fea60e INT-2655: (un)marshal Only via WebServiceTemplate
JIRA: https://jira.spring.io/browse/INT-2655

There might be some use-cases when end-user expect more control over sending/receiving messages via `WebServiceTemplate`.
It would be better to delegate (un)marshalling logic to the `WebServiceTemplate.marshalSendAndReceive()` directly.

Fix Checkstyle violations

Polishing
2017-02-16 14:40:43 -05:00
Artem Bilan
b0094b32b7 INT-4089 Add Source support for WS header mapping
JIRA: https://jira.spring.io/browse/INT-4089

Right now `DefaultSoapHeaderMapper` can map only `String` user-defined headers and only to the `SAOP:Header` attributes.

* Add functionality to map `Source` user-defined headers as sub-elements of the `SAOP:Header`

Polishing
2017-02-15 15:07:32 -05:00
Artem Bilan
1a892ab1c9 INT-3561: WS: add web-service-template attr
JIRA: https://jira.spring.io/browse/INT-3561

To allow any possible custom properties on the `WebServiceTemplate` it would be better just to have an injection for the rather than try to pursue exposing for all `WebServiceTemplate` setters
2017-02-15 13:46:12 -05:00
Gary Russell
f043d6ca0b INT-4228 Fix Hidden Channel Bean Definition Error
JIRA: https://jira.spring.io/browse/INT-4228

Previously, if a bean definition for a channel exists, but has configuration issues,
the `AbstractMethodAnnotationPostProcessor` still went ahead and created a `DirectChannel`.
Only with TRACE logging was the root cause apparent.

This was because all `BeanException` s cause that behavior.

Now, only `NoSuchBeanDefinitionException` will cause auto-creation of channels.

Tested with mocks and a real Boot app, which now correctly reports

```
15:28:41.582 [main] DEBUG o.s.b.d.LoggingFailureAnalysisReporter - Application failed to start due to an exception
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'rabbitConnectionFactory' available
```
2017-02-14 16:30:20 -05:00
Damiano Albani
6bc6c18de5 Fix incorrect package name for logging of SFTP 2017-02-14 11:44:45 -05:00
Damiano Albani
b2e857ced8 [doc] Fix incorrect package name of PropertiesPersistingMetadataStore 2017-02-14 11:33:28 -05:00
Artem Bilan
10372826b7 Add Log4jLevelAdjuster to PollerAdviceTests
https://build.spring.io/browse/INT-FATS5IC-85
2017-02-13 13:00:00 -05:00
Artem Bilan
8276bf8eae MMIH: Use Original Method for InvocableHandMethod
The `MessagingMethodInvokerHelper` extracts `targetClass` to process methods and avoid extra methods when class is Proxy

The `InvocableHandlerMethod` is based on the reflection method invocation and we should use runtime methods on the proxy to invoke.
We don't see such a problem in SpEL because it is parsed from the plain String to the real code later

Polishing

Add an Advice to the test.
2017-02-07 12:53:40 -05:00
Artem Bilan
5987f2e3b9 Fix SocketSupportTests for SSL handshake exception
https://build.spring.io/browse/INT-FATS5IC-79/

Since there is no guaranty which exception message will be built by the SSL handshake error, we can't rely on only one expectation.

Also fix Checkstyle vulnerabilities in the IP module for ImportOrder rule
2017-02-07 10:11:24 -05:00
Artem Bilan
c71240575c CONTRIBUTING: Discuss PR rebase, push --force
Contribution: Change `merge` to `push --force`

Polishing
2017-02-06 12:37:00 -05:00
Artem Bilan
9839b5fcaa INT-4218: MessagingMethodInvokerHelp Improvements
JIRA: https://jira.spring.io/browse/INT-4218

* Add `InvocableHandlerMethod` invocation threshold logic to give up eventually in favor of permanent expression evaluation
* Add `ParametersWrapper.toString()` for better logging messages
* Log `InvocableHandlerMethod` invocation failure message in favor of SpEL only once when `failedAttempts` is exceeded already
* Switch to `spelOnly` mode after that
* Refactor `MessagingMethodInvokerHelper.processInternal()` to separate SpEL or Ivocable logic via their own invocation methods
* Move `MessagingMethodInvokerHelper.HandlerMethod` static fields to the `MessagingMethodInvokerHelper` level since it doesn't matter from this class perspective but can be reused in other places from top level of the `MessagingMethodInvokerHelper` class
* Catch `IllegalArgumentException` with the `java.lang.ClassCastException@...` message.
See http://stackoverflow.com/questions/16042591/reflections-illegalargumentexception-causes for more info

Address PR comments

* Make `handlerMethod.failedAttempts` conditional expression as `>=` to avoid race conditions in multi-threaded environment
* Analyze StackTrace for the class of the `IllegalStateExpception` avoid SpEL fall back in case of user exception, not reflection invocation
* Fix race condition in the `TcpNioConnectionTests`, when atomic value is set after `latch.countDown()`
2017-02-06 11:43:29 -05:00
Shiliang Li
802061985c INT-4208: Support AsycRest in HTTP Module
https://jira.spring.io/browse/INT-4208
https://jira.spring.io/browse/INT-4076

Add `AsyncRestTemplate` support in `HttpRequestExecutingMessageHandler` and corresponding config/dsl support

* Polishing Docs
2017-02-03 10:16:01 -05:00
Artem Bilan
e06c0e2927 Add convenient IntegrationFlowDefinition.bridge()
To avoid confusing `.bridge(null)` in the end of flow for replying to the gateway on top introduce simple `.bridge()` with just delegation to the `.bridge(null)` with the same result as before
2017-02-02 18:18:10 -05:00
Gary Russell
d8cbcd1310 INT-3923: Fix MQTT Reconnect Logic
JIRA: https://jira.spring.io/browse/INT-3923

Fixes: #2046

Previously, when connection is lost, the inbound adapter attempted to reconnect on
a schedule with a fixed delay.

If a connection was again lost, while the schedule is still running, we can end up
with another scheduled task running.

This is benign aside from the DEBUG log noise because the scheduled task tests the
connection before reconnecting.

However, if the `recoveryInterval` is short, it could consume CPU.

Change the reconnect to be a one-time scheduled task and reschedule if it fails to
reconnect.

Synchronize all access to the `connected` field.

Add a test case with a short recovery interval, before this fix, we see many logs
`Attempting reconnect`.
2017-02-02 13:45:44 -05:00
Gary Russell
218daa94e8 INT-4222: Don't Propagate a null ConversionService
JIRA: https://jira.spring.io/browse/INT-4222

See INT-4214; the `DefaultMessageHandlerMethodFactory` requires a conversion service
and sets up a default.

Some SI components propagated a `null` conversion service which overwrote the default
causing runtime exceptions.

    Caused by: java.lang.IllegalArgumentException: ConversionService must not be null
	at org.springframework.util.Assert.notNull(Assert.java:163) ~[spring-core-5.0.0.BUILD-SNAPSHOT.jar:5.0.0.BUILD-SNAPSHOT]
2017-02-01 12:45:01 -05:00
Artem Bilan
9616cc72a1 INT-4220: Leaders: warn event publishing errors
JIRA: https://jira.spring.io/browse/INT-4220

Currently when an error is thrown from the event publishing the role granting is broken and we just go to the role revoking.

* Since it's just an event publishing it shouldn't effect the original leader election.
* `try...catch` event publishing in the `LeaderInitiator` and `logger.warn` an `Exception`
* Make `leader/Context` as `@FunctionalInterface` for simple Lambda use-case like `NULL_CONTEXT` - `() -> false`
* Remove all the internal `NullContext` implementations in favor of above mention Lambda
* In the `LockRegistryLeaderInitiator` use `CustomizableThreadFactory` instead of custom `ThreadFactory` for prefixing
* Add `zookeeper/leader/LeaderInitiator#getContext()` for external usage and consistency with other similar components
* Fix `CuratorContext.toString()` typo
2017-01-31 14:37:45 -05:00
Artem Bilan
a4bfd2cc42 INT-4221: Properly use Spring's Assert class
JIRA: https://jira.spring.io/browse/INT-4221

* Upgrade to those versions of Spring project dependencies which potentially will provide similar fix

**Cherry-pick to 4.3.x**
2017-01-30 22:27:59 -05:00
Artem Bilan
63e715a685 DSL-140: Improve Logic for outputChannel in DSL
Fixes spring-projects/spring-integration-java-dsl#140

Allow to provide any custom `MessageProducer` impl for the `.handle()`, not only `AbstractReplyProducingMessageHandler` extension

Polishing
2017-01-30 14:00:15 -05:00
Gary Russell
3276353bde INT-4217: Checkstyle Fix
JIRA: https://jira.spring.io/browse/INT-4217
2017-01-27 15:02:45 -05:00
Gary Russell
c5c874f563 INT-4217: SpEL Compilable for Required Header Args
JIRA: https://jira.spring.io/browse/INT-4217

Previously, SpEL method calls with required header parameters had the following form:

    #target.messageAndHeader(message, headers['number'] != null ? headers['number'] : T(org.springframework.util.Assert).isTrue(false, 'required header not available: number'))

The SpEL compiler cannot compile this because the else clause of the ternary has no `exitDescriptor` to indicate the type.

Change the expression to use a function for required headers.
Also use an Elvis operator when possible.

Some examples of new expressions:

    #target.optionalAndRequiredHeader(headers['prop'] ?: null, #requiredHeader(headers, 'num'))

    #target.optionalAndRequiredDottedHeader(headers['dot1'] != null ? headers['dot1'].foo : null,
         #requiredHeader(headers, 'dot2').baz

In the second case, we can't use an Elvis because we're accessing a `foo` property of the header.

__cherry-pick to 4.3.x__

- make `ParametersWrapper` `static`
- minor conflicts in imports
- remove the perf test

* Polishing: remove redundant annotation args for their default values usage
2017-01-27 14:40:04 -05:00
Aaron Grant
1f9d07ae24 INT-4216: Fix ClassCast in ChainFileListFilter
JIRA: https://jira.spring.io/browse/INT-4216

Add test for running empty array through `ChainFileListFilter`

Assure no exceptions are throw when filter input is empty.

INT-4216: Add fix for ChainFileListFilter edge case

INT-4216: Fix checkstyle error on test class

Add copyright header to test file

* Polishing for `ChainFileListFilter` JavaDocs
* Move `CompositeFileListFilterTests` and `ChainFileListFilterIntegrationTests` to the `filters` package instead of `file` core
2017-01-26 15:05:46 -05:00
Gary Russell
1674cd0f85 INT-4215: ChainFileListFilter Exit When Empty
JIRA: https://jira.spring.io/browse/INT-4215

Due to type erasure we can't create an empty generic array from an empty list.
Don't attempt to call remaining filters when the list is empty.
2017-01-25 15:35:29 -05:00
Artem Bilan
d47bca48cc INT-4215: Add ChainFileListFilter
JIRA: https://jira.spring.io/browse/INT-4215
Fixes GH-1998 (https://github.com/spring-projects/spring-integration/issues/1998)

Just make an `CompositeFileListFilter` extension which chains result of the previous filter to the next

**Cherry-pick 4.3.x**
2017-01-25 14:37:33 -05:00
Gary Russell
eaaa21ef5d Fix Compiled SpEL Test
Several problems:

- Setting the system property is not enough since the `static` parser already has its configuration
- Changing the ParametersWrapper to `private` makes property accessing not compilable (the method and class must be public).
- The expression...

    #target.messageAndHeader(message, headers['number'] != null ? headers['number'] : T(org.springframework.util.Assert).isTrue(false, 'required header not available: number'))

...is not compilable anyway because the right arguent to the `!=` is not compilable because the `TypeReference.exitTypeDescriptor` is `null`.

This commit addresses the first two.

Polishing

Use a compilable method.

* Simple polishing
2017-01-24 19:01:32 -05:00
Artem Bilan
3b82c698f3 Fix CollectionArgumentResolver JavaDoc typo 2017-01-24 12:22:41 -05:00
Artem Bilan
b3db6a97a2 INT-4214: Migrate to InvocableHandlerMethod
JIRA: https://jira.spring.io/browse/INT-4214

* Rework `MessagingMethodInvokerHelper` to delegate to the `InvocableHandlerMethod` with its `HandlerMethodArgumentResolver` infrastructure instead of SpEL
* Introduce several `HandlerMethodArgumentResolver` to address some SI use-cases like `@Payloads`, `@Payload(expression = "")` and `Collection` as argument
* Initialize `DefaultMessageHandlerMethodFactory` in the `MessagingMethodInvokerHelper.start()`.
With that I observed several `Lifecycle` problem when we don't have proper delegate from the top.
* Fix `AbstractCorrelatingMessageHandler` and similar to delegate `Lifecycle` properly
* Fix `ReactiveConsumer` to delegate `Lifecycle` to the `MessageHandler`
* Fix `MutableMessage` do not `generateId()` and set `timestamp` headers if we already have them in the provided headers
* With all that `Lifecycle` many tests must be fixed to call `start()`

Add SpEL fallback variant to the MessagingMethodInvokerHelper

Add `MessagingMethodInvokerHelper.setUseSpelInvoker(boolean)`

Add `MethodInvokingMessageProcessorTests.testPerformanceSpelVersusInvocable()`

Add Compiled SpEL comparison

* Add `MapArgumentResolver` to cover `Properties` case
* add `MessagingMethodInvokerHelper.HandlerMethod.spelOnly` state, when we definitely can perform ony SpEL for provided arguments, e.g. `@Header` with expression
* Catch `IllegalStateException` with the `"argument type mismatch"` message to fallback to SpEL invocation
* Add `Iterator` support for the `CollectionArgumentResolver`
* Add `integrationConversionService` bean registration into the `TestUtils.createTestApplicationContext()`
* Tweak `.travis.yml` to try to download latest JDK, the current `1.8.0_31` is pretty old already and has some bugs
* Adjust some failing tests to use `TestUtils.createTestApplicationContext()` to rely on newly added `integrationConversionService` bean

Fix failed tests: `ctx.refresh()`

Polishing current year in Copyright

* JavaDocs for `CollectionArgumentResolver` and `MapArgumentResolver`
* Propagate `ConversionService` from the `MessagingMethodInvokerHelper` to the `MapArgumentResolver.java`

Fix `MessagingMethodInvokerHelper` to propagate `BeanFactory` into `MapArgumentResolver` as well
The `MapArgumentResolver` now `extends AbstractExpressionEvaluator`, too
Fix JavaDoc typo
2017-01-24 12:15:22 -05:00
Artem Bilan
2c3d88bac6 INT-4211: Un@Ignore Gemfire tests
JIRA: https://jira.spring.io/browse/INT-4211

The latest Spring Data Gemfire fixed `BeanFactoryLocator` issue.

* Now we can remove `@Ignore` from tests which have failed before by the `ClassNotFaoud` reason
* Also fix Checkstyle violations in the Gemfire module classes
2017-01-23 13:28:24 -05:00
Artem Bilan
2659baa821 Checkstyle ImportOrder for main and fixes 2017-01-23 12:58:36 -05:00
Artem Bilan
6ac0c7316a Add IntegrationFlowDefinition.implicitChannel state to be sure that we don't add nullChannel if we wire-tap the real channel.
Otherwise we end up with the case to break the flow which expect message from the explicit channel.
Add JavDocs to `.wireTap()` to explain behaviour in the end of flow
2017-01-23 12:45:09 -05:00
Artem Bilan
36f3c533aa INT-4210: DSL: Make a final .log() Terminal
JIRA: https://jira.spring.io/browse/INT-4210

Previously use-case like:
```
.transform()
.log()
.get();
```
failed with the `Dispatcher has no subscribers` for an implicit channel populated by the `.wireTap()` because actually `LoggingHandler` is placed on the wire-tapped channel

Since logically it looks like end-user tries to have `LoggingHandler` as a terminal of the flow, we add `nullChannel` if `WireTapSpec` is in the end of the flow definition.

If user would like to continue flow (e.g. return reply to the `replyChannel`), he must end more EIP-methods after `.log()` (like before, of course)
2017-01-23 12:45:09 -05:00
Gary Russell
8b591482c1 INT-4212: FWMH Predicates and DSL: flushWhenIdle
JIRA: https://jira.spring.io/browse/INT-4212

Add `firstWrite` to predicate methods.
Add DSL support for `flushWhenIdle`

While these are breaking API changes on the interfaces, I feel this is
likely not going to affect many users and this is a major release after
all.

I have added a note to the 5.0 migration guide.
2017-01-23 11:56:44 -05:00
Gary Russell
5f450ed959 INT-4212: FileWritingMessageHandler.flushWhenIdle
JIRA: https://jira.spring.io/browse/INT-4212

Add an option to flush after the `flushInterval`, regardless of intermediate writes.

Rename `lastFlush` to `firstWrite`

Polishing

**Cherry-pick to 4.3.x**
2017-01-23 09:50:41 -05:00
Gary Russell
2f7dfbde53 AMQP: Async Gateway, Start Template
https://build.spring.io/browse/INT-MJATS41-884/

The gateway must start the template.
2017-01-21 10:14:26 -05:00
Gary Russell
6cf901896e Doc Copyright 2017 2017-01-20 10:01:23 -05:00
Artem Bilan
9836828f54 INT-4204: Introduce ExpressionFileListFilter
JIRA: https://jira.spring.io/browse/INT-4204

Fix error message in the `AbstractRemoteFileOutboundGatewayParser`
2017-01-19 16:30:44 -05:00
Gary Russell
33b60c9601 FWMH - Improve FlushInterval Javadocs 2017-01-19 10:53:47 -05:00
Artem Bilan
f4fdec9195 @Ignore failed Gemfire tests until SDG solution
See https://jira.spring.io/browse/INT-4211
2017-01-18 17:51:55 -05:00
Gary Russell
00b2e7d102 INT-4131: Fix @Since (AMQP)
JIRA: https://jira.spring.io/browse/INT-4131

Feature was backported to 4.3.x.
2017-01-16 10:26:14 -05:00
Artem Bilan
c886b3bf68 Fix HttpDslTests for proper Mock request handling
https://build.spring.io/browse/INT-MASTER-513

See https://jira.spring.io/browse/SPR-15116
2017-01-13 14:15:11 -05:00
Artem Bilan
bc5910b4e1 Fix JavaDoc typo in the IntegrationFlowDefinition
https://build.spring.io/browse/INT-MASTER-512
2017-01-13 13:55:22 -05:00
Artem Bilan
129ebdc625 INT-4207: Fallback for replyChannel Resolution
JIRA: https://jira.spring.io/browse/INT-4207

Enhance `AbstractMessageProducingHandler` to fallback for `replyChannel` to the `reply` if it is `Message`.
That lets to avoid extra `bridge` configuration afterwards to make that `reply` as `request` for the same `replyChannel` resolution.

This situation happens in case of error handling when the request message is `ErrorMessage`, typically without original headers to properly consult.
But at the same time `failedMessage` in the `MessagingException` has all required headers.
2017-01-13 11:10:51 -05:00
Gary Russell
fd082db245 Minor Polishing
Unused imports etc.
2017-01-12 09:22:02 -05:00
Gary Russell
c8c8160e2d Sonar Fixes
https://sonar.spring.io/component_issues/index?id=org.springframework.integration%3Aspring-integration%3Amaster#resolved=false|severities=CRITICAL

Fix the only 2 code smells that Sonar deems "critical".
2017-01-11 10:35:56 -05:00
Gary Russell
4c462a8972 Update Tomcat to 8.5.6
Align with Boot 2.0

* Align some other version with Boot and IO
2017-01-10 14:04:31 -05:00
Artem Bilan
bc525cf6ea Fix early sourceSets access in spring-io plugin
https://build.spring.io/browse/INT-FATS5IC-46

SI places XML configs alongside with test classes for better navigation from IDE.
For this purpose we configure  `sourceSets.test.resources` for `src/test/java` as well.

Looks like `spring-io-0.0.6` read such a configuration very early and we end up with a default value for `resources`.

* Moving `sourceSets` before applying `spring-io` plugin makes everything working again
2017-01-10 11:40:29 -05:00
Artem Bilan
54654546b9 INT-4206: Upgrade to Mockito 2.5
JIRA: https://jira.spring.io/browse/INT-4206

* Fix unnecessary dependency resolution in BOM module
* Fix `MessagingMethodInvokerHelper` to handle `$MockitoMock$` generated classed which isn't CGLib `Proxies` any more
* Provide fixes for test classes according upgrade to Mockito `2.5`
* Fix Ceckstyle do not allow static imports for deprecated Mockito classes
2017-01-09 18:39:25 -05:00