Commit Graph

8569 Commits

Author SHA1 Message Date
Artem Bilan
0fe4c2e8ae INT-4248-4.3.x: Fix LockRegistryLeaderInitiator
JIRA: https://jira.spring.io/browse/INT-4248

The `RedisLockRegistry` doesn't update store for `expire` property on the
subsequent lock interaction.
Only `RedisLockRegistry.obtain()` lets us to know if we expired already or not

To minimize the time window between `lock` and `expire` facts, move `obtain()`
function in the `LockRegistryLeaderInitiator` close to `Lock` usage.
2017-04-18 16:38:11 -04:00
Artem Bilan
2dc21e5d40 INT-4254: LockRegLInit: Fix unconditional unlock
JIRA: https://jira.spring.io/browse/INT-4254

The `LockRegistryLeaderInitiator#LeaderSelector` unconditional calls
`unlock()` in the `finally` block when the `Lock` might not be locked.

Another problem that `running = true` is set after submitting `LeaderSelector` task.
That might bring the problem that `LeaderSelector` won't be selected because of
`this.running` race condition

* Move `this.running = true` before submitting `LeaderSelector` task
* Move `unlock()` into the `if (this.locked)` condition

**Cherry-pick to 4.3.x**

Conflicts:
	spring-integration-core/src/test/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiatorTests.java
Resolved.
2017-04-18 15:28:02 -04:00
Artem Bilan
71b118ed61 INT-2625(4.3.x): Refactoring for JdbcMessageStore
JIRA: https://jira.spring.io/browse/INT-2625

Since `jdbcOperations` is mandatory property of the `JdbcMessageStore`,
make it as constructor arg to encourage users always specify `DataSource`
or `JdbcOperations`.
With that we don't need `afterPropertiesSet()` any more
2017-04-18 15:17:21 -04:00
Gary Russell
a422631ef5 Increase Timeout for Promise Test 2017-04-16 13:16:21 -04:00
Artem Bilan
d41f77bc66 Fix LockRegLeaderInitiatorTests race condition
https://build.spring.io/browse/INT-FATS5IC-129/

Since leader selection is done on background thread in the
`LockRegistryLeaderInitiatorTests`, there is no guarantee that
after `Thread.sleep(100)` the lock will be obtained and leader state is
changed.

* Waiting for the `granted` `CountDownLatch` is much robust condition

(cherry picked from commit d5c633d)
2017-04-07 09:02:05 -04:00
Gary Russell
a48b5393cb INT-4250: Fix Statistics Mean Decay with Time
JIRA: https://jira.spring.io/browse/INT-4250

When retrieving the mean from `ExponentialMovingAverageRate` or
`ExponentialMovingAverageRatio` via `getStatistics()` the mean did not
decay over time.

The mean did decay when using `getMean()`.

This was caused by the statistics performance refactoring.

(cherry picked from commit fac04ae)
2017-03-29 13:54:33 -04:00
Gary Russell
03793e3dc4 INT-4247: Jdbc Lock Registry Test Diagnostics
https://jira.spring.io/browse/INT-4247
2017-03-24 12:52:28 -04:00
Artem Bilan
b86f90a69b Stop more initiators in LeaderInitiatorTests
JIRA: https://jira.spring.io/browse/INT-4246

**Cherry-pick to master**
2017-03-23 11:50:01 -04:00
Artem Bilan
5ae2edb548 Stop initiators in the end of test
JIRA: https://jira.spring.io/browse/INT-4246
2017-03-23 11:12:06 -04:00
Vedran Pavic
d9340030bb INT-4246: Revoke leader when lock isn't acquired
JIRA: https://jira.spring.io/browse/INT-4246

The `LockRegistryLeaderInitiator` currently does not revoke leadership
when leading instance is unable to acquire lock from the underlying lock.
This can result in multiple `LockRegistryLeaderInitiator` instances becoming
 leaders in the exceptional situations such as lock timeouts.

* Handle leadership revoking when leading `LockRegistryLeaderInitiator`
is unable to acquire lock

Polish javadoc

**Cherry-pick to master**
2017-03-23 10:04:34 -04:00
Artem Bilan
decfb9d86c Fix Checkstyle violations
https://build.spring.io/browse/INT-SI43X-123
2017-03-11 13:50:23 -05:00
Artem Bilan
dade5d9f00 Add Comparator to (S)FTP order-sensitive tests
https://build.spring.io/browse/INT-MASTER-583/

**Cherry-pick to 4.3.x**

Conflicts:
	spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpStreamingMessageSourceTests.java
	spring-integration-sftp/src/test/java/org/springframework/integration/sftp/dsl/SftpTests.java
	spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpStreamingMessageSourceTests.java
2017-03-11 13:32:39 -05:00
Gary Russell
96331d5415 INT-4243: Upgrade to sshd 1.4
JIRA: https://jira.spring.io/browse/INT-4243

Remove newline char from key exchange.

Fix CR and Add Windows Delete Diagnostics

Fix For Windows

More diagnostics.

It appears the new server doesn't close the file when the session is closed.

In the streaming test, consume the stream before closing the session.

Polishing - PR Comments

* More polishing according PR comments

Conflicts:
	spring-integration-sftp/src/test/java/org/springframework/integration/sftp/SftpTestSupport.java
	spring-integration-sftp/src/test/java/org/springframework/integration/sftp/dsl/SftpTests.java
	spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpRemoteFileTemplateTests.java
	spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpServerTests.java
	spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpSessionFactoryTests.java
2017-03-11 13:18:25 -05:00
Gary Russell
f47b4bf222 INT-4240: Redis Delayer Test Diagnostics
https://jira.spring.io/browse/INT-4240

(cherry picked from commit 6a88328)
2017-03-08 15:37:33 -05:00
Gary Russell
789ed9d1b8 AMQP-4238: Detect Subscription Failures and QOS
JIRA: https://jira.spring.io/browse/INT-4238

Revert to using the sync client in the message-driven adapter so we can detect
subscription failures (the sync client throws an exception).

The only reason to use the async client was to timeout disconnects; this can
be achieved with the sync client and `disconnectForcibly`.

Also, the subscribe method updates the qos argument with the granted QOS values.

Detect and log if any QOS does not match the request.

Polishing

Polishing - PR Comments

Conflicts:
	spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/MqttAdapterTests.java

* Remove all new tests since Paho lib has class signature check, so we can't mock its classes
2017-03-06 20:48:31 -05:00
Gary Russell
0070d38d0c Update to S-D-Gemfire 1.8.8 (Hopper SR8) 2017-03-06 15:17:21 -05:00
Gary Russell
099ab8a6ae Fix Sporadic Test Failure
https://build.spring.io/browse/INT-MJATS41-925/
2017-03-03 09:49:58 -05:00
Gary Russell
4ada89d0c6 Javadoc Polishing 2017-03-02 09:11:38 -05:00
Spring Buildmaster
7ed6151913 [artifactory-release] Next development version 2017-03-01 20:14:57 +00:00
Spring Buildmaster
32282e1da8 [artifactory-release] Release version 4.3.8.RELEASE 2017-03-01 20:14:52 +00:00
Artem Bilan
9a19607f51 Upgrade to SF 4.3.7 and Spring AMQP 1.6.8 2017-03-01 14:50:02 -05:00
Artem Bilan
3bf2ca12ba INT-4229: SpEL Customization Via Java Config
JIRA: https://jira.spring.io/browse/INT-4229

* Make `SpelPropertyAccessorRegistrar` as `public` class and provide more API to customize it.
This class allows to register `PropertyAccessor` s for shared `EvaluationContext`
* Document how to configure SpEL functions and `PropertyAccessor` s with Java Config

**cherry-pick to 4.3.x**
2017-03-01 11:20:32 -05:00
Gary Russell
e872791a69 INT-4237: FWMH: Acquire Lock Before Flushing
JIRA: https://jira.spring.io/browse/INT-4237

It was possible to flush (close) the file while a write was in process; more likely when
`flushWhenIdle` is false.

This probably would not occur in the real world, just tests with short flush intervals,
but certainly possible.

There is already a lock used to prevent concurrent writes while appending; use the same
lock when flushing.

Conflicts:
	spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java
	spring-integration-file/src/test/java/org/springframework/integration/file/FileWritingMessageHandlerTests.java
2017-03-01 11:18:57 -05:00
Artem Bilan
909060abd5 INT-4232: (S)FTP inbound: Fix lastModified Logic
JIRA: https://jira.spring.io/browse/INT-4232

Currently to implement the synchronization logic when remote file is modified there is only one way: remove local file and provide a `localFilter` which can be clear from the removed file as well.

The Reference Manual claims that `FileSystemPersistentAcceptOnceFileListFilter` can let us pick up a fresh version of the remote file if we configure `preserveTimestamp = true`, but actually `AbstractInboundFileSynchronizer` just bypass that logic because it check a local file for existence.

* Modify `AbstractInboundFileSynchronizer` to compare `lastModified` of the remote file with local version if `preserveTimestamp == true`
* Also replace `AcceptOnceFileListFilter` to the `FileSystemPersistentAcceptOnceFileListFilter` since the first one doesn't care about `lastModified`.
If `preserveTimestamp` isn't in use the `FileSystemPersistentAcceptOnceFileListFilter` works fully similar to the `AcceptOnceFileListFilter`

**Cherry-pick to 4.3.x except test-case**

Make `SftpStreamingMessageSourceTests` compatible with Windows

Looks like SFTP embedded server provides different permissions for files on different OSs

Doc Polishing

Conflicts:
	spring-integration-file/src/test/java/org/springframework/integration/file/remote/synchronizer/AbstractRemoteFileSynchronizerTests.java
	spring-integration-ftp/src/test/java/org/springframework/integration/ftp/dsl/FtpTests.java
	spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpStreamingMessageSourceTests.java
	src/reference/asciidoc/whats-new.adoc
Resolved.
2017-02-24 15:20:11 -05:00
Artem Bilan
2d4385a871 Fix tests for wrong messages in assertions
https://build.spring.io/browse/INT-MASTER-560/

**Cherry-pick to 4.3.x**

(cherry picked from commit af711a0)
2017-02-24 13:14:24 -05:00
Gary Russell
250405ddb8 INT-4224: Improve Direct Handler Binding Docs
JIRA: https://jira.spring.io/browse/INT-4224

Explain when `ref` can can be used on certain endpoints.

(cherry picked from commit 56f72cb)
2017-02-24 12:32:01 -05:00
Artem Bilan
73e4bdc6b6 INT-4227: (4.3) Allow Custom Messaging Annotations
JIRA: https://jira.spring.io/browse/INT-4227

Expose `MessagingAnnotationPostProcessor` for inheritors.
The `CustomMessagingAnnotationTests` demonstrates how custom Messaging Annotation can be registered and used

**Cherry-pick to 4.3.x**

Add `setupCustomPostProcessors()` and `addMessagingAnnotationPostProcessor` to the `MessagingAnnotationPostProcessor`

Expose some API for inheritors

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessor.java
2017-02-24 12:22:55 -05:00
Gary Russell
006f7cfd66 INT-4236: Status for SmartLifecycleRoleControlller
JIRA: https://jira.spring.io/browse/INT-4236

Add methods to obtain status from the `SmartLifecycleRoleController`.

* Polishing according PR comments.
* Fix log messages in the `SmartLifecycleRoleController` from the Zookeeper mentioning

Conflicts:
	src/reference/asciidoc/endpoint.adoc
Resolved.

Also Java 6 Compatibility.
2017-02-23 16:42:41 -05:00
Gary Russell
9f7e10f927 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.

Conflicts:
	spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java
	spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests-context.xml
	spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests-context.xml
2017-02-21 12:56:07 -05:00
Gary Russell
17dd47b1ac Update to Java Mail 1.5.6
Align with Boot.

Conflicts:
	build.gradle
Resolved.
2017-02-18 09:18:16 -05:00
Gary Russell
1756bd15cb 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
```

* Resolve Mockito conflicts in the `MessagingAnnotationPostProcessorChannelCreationTests`
2017-02-14 16:48:58 -05:00
Gary Russell
75ae23ab90 INT-4223: Gemfire: Ignore Cq Inbound Tests
JIRA: https://jira.spring.io/browse/INT-4223
2017-02-03 11:10:07 -05:00
Gary Russell
4c68e22d87 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`.

Conflicts:
	spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/MqttPahoMessageDrivenChannelAdapter.java
	spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/MqttAdapterTests.java

* Fix single-arg `Assert` method usage in the `AbstractCorrelatingMessageHandler`
2017-02-02 13:54:26 -05:00
Artem Bilan
6e7653f18f 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:47:16 -05:00
Gary Russell
d9c6ffee74 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
* Revert `java.util.Optional` import in favor of literal for Java < 8
* Make `AnnotatedTestService` as `public` to get compilable SpELs
* Remove performance test from the `MethodInvokingMessageProcessorTests`
2017-01-27 15:30:45 -05:00
Aaron Grant
2f00285c3b 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

(cherry picked from commit 1f9d07a)
2017-01-26 15:07:53 -05:00
Spring Buildmaster
4f4b2681b6 [artifactory-release] Next development version 2017-01-25 21:04:14 +00:00
Spring Buildmaster
5417468eb8 [artifactory-release] Release version 4.3.7.RELEASE 2017-01-25 21:04:08 +00:00
Artem Bilan
35a633d304 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 15:24:59 -05:00
Artem Bilan
9dfc7f4671 Fix Mockito import 2017-01-23 10:05:46 -05:00
Gary Russell
0c95a399e5 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:51:53 -05:00
Gary Russell
f23c679f67 Update to Spring AMQP 1.6.7
Also added a note to the 5.0 migration guide about the change of
`AMQPHeaders.CORRELATION_ID` from `byte[]` to `String`.
2017-01-21 11:15:51 -05:00
Gary Russell
e6e2e01951 Polishing for Previous Commmit
Container needs a queue.
2017-01-21 10:45:17 -05:00
Gary Russell
d6f8120393 AMQP IO Platform Brussels Compatibility
https://build.spring.io/browse/INT-MJATS41-884/

The gateway must start the template.
2017-01-21 09:53:39 -05:00
Gary Russell
8a1aa98f72 Doc Copyright 2017 2017-01-20 10:02:14 -05:00
Artem Bilan
626466bac8 Compatibility with previous SF versions
https://build.spring.io/browse/INT-MJATS41-872
2017-01-09 10:34:57 -05:00
Artem Bilan
a39c8bef41 Fix compatibility with the latest SF
https://build.spring.io/browse/INT-MJATS41-869

* Revert to `B-S` versions for SA
* Since `MessagingException.toString()` now includes and `failedMessage` as well, a comparision with `TcpConnectionExceptionEvent.toString()` should be a bit different

See https://jira.spring.io/browse/SPR-15091
2017-01-06 10:38:01 -05:00
Artem Bilan
0c2ba3f761 INT-4202: Fix StoredProcOutboundGateway NPE
JIRA: https://jira.spring.io/browse/INT-4202

The `StoredProcOutboundGateway` uses `MessageBuilder` directly for procedure result without any conditions.
If procedure result is `null`, `MessageBuilder.withPayload` throws `java.lang.IllegalArgumentException: payload must not be null`.

* Since the super `AbstractReplyProducingMessageHandler` class takes care about `null` reply properly via its `requiresReply` property and really uses `MessageBuilder`
 for reply, just fix `StoredProcOutboundGateway` to return procedure result as is from the `handleRequestMessage()` implementation
* Fix some typos and code style
* Increase some JDBC tests performance changing `Thread.sleep()` solution to proper `PollableChannel.receive()` or iterations over expected result

**Cherry-pick to 4.3.x**

Update `@Copyright` to 2017

Make `StoredProcOutboundGateway` as `requiresReply = true` by default

Revert `setRequiresReply(true)` change

Specify `setRequiresReply(true)` only if `expectSingleResult == true` and `setRequiresReply()` hasn't been called explicitly

Conflicts:
	spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcOutboundGateway.java
	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelIntegrationTests.java
	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcOutboundGatewayParserTests.java
Resolved.
2017-01-04 18:24:10 -05:00
Gary Russell
85a825cd75 INT-4203: Fix Docs
Change setter name.
2017-01-04 17:37:36 -05:00
Gary Russell
3301da4157 INT-4203: Expression RH Advice Improvements
JIRA: https://jira.spring.io/browse/INT-4203

Add channel names for easier use in DSL.

Add documentation (boot) example.

Normalize Expression Setters; add Javadocs

Polishing - SPR-15091

Tiny code style polishing

Conflicts:
	spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java
	src/reference/asciidoc/handler-advice.adoc
    spring-integration-core/src/test/java/org/springframework/integration/handler/advice/ExpressionEvaluatingRequestHandlerAdviceTests.java

* Restore removed methods in the `ExpressionEvaluatingRequestHandlerAdvice` and deprecate them
* Remove methods in the `ExpressionEvaluatingRequestHandlerAdvice` introduced since `5.0`
2017-01-04 16:21:48 -05:00