Commit Graph

8563 Commits

Author SHA1 Message Date
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
Artem Bilan
dd72b9b63d INT-4197: Fix Annotation Case when not messages
JIRA: https://jira.spring.io/browse/INT-4197

Since `Collection<Message<?>>` can be possible only if we are dealing with messages as a group (`MethodInvokingMessageListProcessor`), the case with the `List<?>` param for Messaging Annotation method should not be treated as candidate for `messages` collection.

* Add `this.canProcessMessageList` condition to avoid `messages` SpEL expression when we are not in the `MethodInvokingMessageListProcessor` environment

**Cherry-pick to 4.3.x**

* Fix Array creating formatting
* Add comment about `ReflectiveMethodExecutor` to the `testRouterWithListParam()`
* Send one test data as as `Collection` to be sure that `@Router` parameters mapping works well
2017-01-03 15:05:41 -05:00
Gary Russell
3ce1fcb110 INT-4199: Fix Asserts with no Message
JIRA: https://jira.spring.io/browse/INT-4199

MQTT and JDBC.

Conflicts:
	spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java
Resolved.
2017-01-03 13:23:15 -05:00
Gary Russell
8fd9290509 INT-4201: Fix Gateway Param Annotation Aliases
JIRA: https://jira.spring.io/browse/INT-4201

name<->value alias was not processed correctly so using
`@Header(name = "baz") String baz` did not work.

Use `SynthesizingMethodParameter`.

(cherry picked from commit 0cbfd6e)
2017-01-03 11:44:03 -05:00
Gary Russell
6cd0845cfa INT-4198: TCP: Add Hook to Customize SSLEngine
JIRA: https://jira.spring.io/browse/INT-4198

Enable setting properties like `needClientAuth` on the `SSLEngine` - when not using
NIO, this can be set on the server socket with a socket support implementation.

Add `nio-connection-support` to namespace.

Improved "Advanced Techniques" documentation, using this use case as an example.

Fail fast with NIO when SSL handshaking fails.

Polishing - PR Comments

More Polishing

* Final polishing
- fix several typos in log messages
- clean up `TcpConnectionFactoryFactoryBean` JavaDocs from redundant imports
- remove redundant `InitializationBean` functionality from the `DefaultTcpNetSSLSocketFactorySupport` as well

Conflicts:
	spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/SocketSupportTests.java

* Resolve Java 8 code style and revert `afterPropertiesSet()` with `@Deprecated`
2016-12-29 18:15:18 -05:00
Artem Bilan
8d703992ea MongoDbInboundChAdapterIntTests race condition
Since we can have a result message in the `replyChannel` before the TX commit, a subsequent adapter `stop()` causes the current task interruption,
 therefore TX rallback.
That's why we see `semaphore.acquire()` interruption and don't see message in the  `afterCommitChannel`

**Cherry-pick to 4.3.x**

(cherry picked from commit bdab0aa)
2016-12-29 11:59:11 -05:00
Artem Bilan
f0a48dd89e LockRegistryLeaderInitiatorTests race condition
There is tiny time window when `LockRegistryLeaderInitiator` can be stopped during `Context.yield()` invocation.
In this case the `LockRegistryLeaderInitiator` goes to the stopped state, but a new `leaderSelector` is submitted for election.

Therefore in the `LockRegistryLeaderInitiatorTests.competing()` the second initiator may not get be granted because there is uncontrolled `leaderSelector` task on background.

We can overcome it with always `this.initiator.stop()` for the `LockRegistryLeaderInitiatorTests`, but to be sure in the fix it would be better to leave as is.

Also add `@Rule Log4jLevelAdjuster` for future diagnostics

**Cherry-pick to 4.3.x**

(cherry picked from commit 56929cd)
2016-12-27 14:09:53 -05:00