Commit Graph

8481 Commits

Author SHA1 Message Date
Spring Buildmaster
ed2f298da1 [artifactory-release] Next development version 2016-11-07 22:54:42 +00:00
Spring Buildmaster
caabc29dc1 [artifactory-release] Release version 4.3.5.RELEASE 2016-11-07 22:54:38 +00:00
Gary Russell
901078c5e9 Upgrade to Spring AMQP 1.6.4 2016-11-07 17:15:25 -05:00
Gary Russell
5882feb9c2 Upgrade to Spring Framework 4.3.4 2016-11-07 17:05:57 -05:00
Artem Bilan
e2d18054e6 INT-4163: UnProxy MessageSource for TX Resource
JIRA: https://jira.spring.io/browse/INT-4163

When `MessageSource` is proxy, the `TransactionSynchronizationManager.getResource(this)` logic in the `MessageSource` doesn't work,
because TX resource is bound to the `Proxy` in the `SourcePollingChannelAdapter`

* Introduce `SourcePollingChannelAdapter.originalSource` property and store there a target `MessageSource` object extracted from the AOP Proxy
* Use `originalSource` as a resource to bind to the TX
* Modify `MongoDbInboundChannelAdapterIntegrationTests` to ensure that `AbstractMessageSourceAdvice` proxying the `MessageSource` doesn't effect `TransactionSynchronizationManager.getResource(this)` logic
* Refactor for some MongoDb test to rely on the `@RunWith(SpringJUnit4ClassRunner.class)` for context loading for better test class performance

**Cherry-pick to 4.3.x, 4.2.x**

Fallback to provided source if `target` from Proxy is `null`

Fix [UnusedImport] issue
2016-11-07 15:32:49 -05:00
Artem Bilan
acf7424dbc Fix AggregatorParserTests for latest SF changes
https://build.spring.io/browse/INT-MJATS41-802/
2016-11-01 09:24:47 -04:00
Gary Russell
63dd96364a INT-4148: Don't Wrap AMQP Listener Exceptions
JIRA: https://jira.spring.io/browse/INT-4148

The subscribable channel incorrectly wrapped exceptions such as `MessageConversionException`
preventing the error handler from properly handling them.

Conflicts:
	spring-integration-amqp/src/main/java/org/springframework/integration/amqp/channel/AbstractSubscribableAmqpChannel.java
2016-10-28 11:34:39 -04:00
Artem Bilan
4653090686 INT-4147: Fix NPE in the FileReadingMessageSource
JIRA: https://jira.spring.io/browse/INT-4147

By default `FileReadingMessageSource` is created without `filter`, at the same time internal `WatchServiceDirectoryScanner` is supplied with default `filter` by its `DefaultDirectoryScanner` super class.
A `DELETE` watch event condition around `FileReadingMessageSource.this.filter` is wrong, because it is `null` by default. Therefore `DELETE` events never succeed

* Modify `FileInboundTransactionTests` to accept `DELETE` watch event as well and verify that `ResettableFileListFilter.remove(File)` is performed
* Call newly created getter for `DefaultDirectoryScanner.filter` in the `WatchServiceDirectoryScanner` to assert against supplied `filter`

Polishing

**Cherry-pick to 4.3.x**

Conflicts:
	spring-integration-file/src/main/java/org/springframework/integration/file/DefaultDirectoryScanner.java
Resolved.
2016-10-25 11:54:29 -04:00
Andriy Kryvtsun
80b1f4c7bc INT-4144: Prevent NPE in the LoggingHandler
JIRA: https://jira.spring.io/browse/INT-4144
Fixes GH-1936 (https://github.com/spring-projects/spring-integration/issues/1936)

Previously `LoggingHandler` could be used as a standalone object, without any Spring Container initialization.
Even if that doesn't sound reasonable, we should reinstate the logic to avoid breaking changes

* Initialize `expression` and `evaluationContext` during object `<init>` phase
* Some code reformatting to avoid duplicate blocks and cyclomatic complexity

* Simple code formatting
* Additional JavaDocs for `LoggingHandler`

**Cherry-pick to 4.3.x**

(cherry picked from commit ee848e9)
2016-10-25 10:54:21 -04:00
Artem Bilan
c661808809 INT-4146: FileWriteMH: protect for OutStr errors
JIRA: https://jira.spring.io/browse/INT-4146
Fixes GH-1942 (https://github.com/spring-projects/spring-integration/issues/1942)

Previously the `FileWritingMessageHandler` didn't wrap `new OutputStream()` to the `try...catch...finally` block, therefore any errors on that (e.g. `FileNotFoundException` because of permissions) cause an early exist without `inputStream.close()`

* Move a `new OutputStream()` to the `try...catch`
* Change `destinationDirectory.canWrite()` to the `Files.isWritable(destinationDirectory.toPath())` because the first one doesn't work on Windows

**Cherry-pick to 4.3.x and 4.2.x but without Files.isWritable() change**
2016-10-24 14:07:25 -04:00
Gary Russell
5b41dc1513 INT-4131: Add delayExpression to AMQP Outbounds
JIRA: https://jira.spring.io/browse/INT-4131

Specify an expression on the outbound endpoints to set the `x-delay` header when
using the RabbitMQ Delayed Message Exchange plugin.

Polishing

- PR Comments
- Add `setDelay`
- Port `FunctionExpression` from DSL
- Add `SupplierExpression`

Javadoc Fixes

Use ValueExpression for delay

* Simple polishing for `SupplierExpression`
* Mention plain `delay` property in the `amqp.adoc`

Conflicts:
	spring-integration-amqp/src/test/java/org/springframework/integration/amqp/outbound/OutboundEndpointTests.java
Resolved.

Backport Polishing

Java 6 cpmpatibility; deprecation warnings.
2016-10-24 13:57:02 -04:00
Artem Bilan
8e33fa6b3d SftpOutboundGateway: DFA -> Method Invocation
**Cherry-pick to 4.3.x**

Polishing - Make Method Accessible
2016-10-23 10:01:23 -04:00
Gary Russell
27520589be INT-4145: Fix Mocking Issue
JIRA: https://jira.spring.io/browse/INT-4145

Strange stubbing failure on spied template.

Perhaps some JIT interaction since the method is used normally before stubbing.

Change the spy to a mock for the last part of the test.

Remove comment before the mock since it isn't relevant any more

(cherry picked from commit 2ad0a44)
2016-10-20 15:03:38 -04:00
Gary Russell
9b713762e2 INT-4141: (S)FTP Streaming - throw Exception
JIRA: https://jira.spring.io/browse/INT-4141

MessageSource incorrectly returned the exception instead of throwing it.

(cherry picked from commit 0c1a765)
2016-10-18 17:30:15 -04:00
Gary Russell
211647d6fe INT-4129: Add Discard Channel to Barrier Handler
JIRA: https://jira.spring.io/browse/INT-4129

Discard late arriving triggers.

* Minor code style polishing

Conflicts:
	src/reference/asciidoc/whats-new.adoc
Resolved.

* Fix trailing whitespaces in the `BarrierMessageHandlerTests`
2016-10-18 11:44:39 -04:00
Gary Russell
51b659b6d6 INT-4139: Add CORS Config to Graph Annotation
JIRA: https://jira.spring.io/browse/INT-4139

Doc Polishing

Polishing - Fix CORS Test and Revert XML

- Use standard CORS configuration with XML.

(cherry picked from commit 3c28487)
2016-10-17 14:50:54 -04:00
Gary Russell
c4908426fc Revert "INT-4135: Ignore case check for HTTP Content-Type"
This reverts commit a82bca653b.

Backporting causes some breaking changes.

The work around is to use a header enricher/filter to move the
content-type header to contentType.
2016-10-10 14:57:48 -04:00
Artem Bilan
a82bca653b INT-4135: Ignore case check for HTTP Content-Type
JIRA: https://jira.spring.io/browse/INT-4135

The incoming `Content-Type` HTTP header can be in any arbitrary case.

Fix `DefaultHttpHeaderMapper` `Content-Type` header re-mapping to the `MessageHeaders.CONTENT_TYPE` via `equalsIgnoreCase()` comparison

**Cherry-pick to 4.3.x**
2016-10-10 12:59:38 -04:00
Artem Bilan
c75b72ffe7 INT-4132: Start MS Before Scheduling Polling Task
JIRA: https://jira.spring.io/browse/INT-4132

The race condition is present when polling task may be ran before `MessageSource<?>` has been started.

* Swap the order of `start()` in the `SourcePollingChannelAdapter`.
Since proxying is now applied only for the `MessageSource.receive()` it doesn't hurt to start it before actual proxying.
Just because it is really should be started before performing its `receive()`
* Prove the proper order with the mock test and protect ourselves for the future similar changes
* Also swap the `stop()` order in the `SourcePollingChannelAdapter.
We have to stop/cancel the polling task before discarding internal `MessageSource` lifecycle.
 For example with the current state we may close an underlying resource already, but still have the last polling tick.
 That may cause any unexpected behaviour

 **Cherry-pick to 4.3.x**

Polishing
2016-10-06 17:45:02 -04:00
Spring Buildmaster
f15d8be33a [artifactory-release] Next development version 2016-10-03 17:03:07 +00:00
Spring Buildmaster
28ab4deaaf [artifactory-release] Release version 4.3.4.RELEASE 2016-10-03 17:03:03 +00:00
Spring Buildmaster
8813f77c11 [artifactory-release] Next development version 2016-09-30 18:25:20 +00:00
Spring Buildmaster
92260edd11 [artifactory-release] Release version 4.3.3.RELEASE 2016-09-30 18:25:17 +00:00
Artem Bilan
c41654f19d INT-4127: Fix ZkLock.tryLock() timing issue
JIRA: https://jira.spring.io/browse/INT-4127
Fixes GH-1913 (https://github.com/spring-projects/spring-integration/issues/1913)

The current `tryLock()` implementation with the `0` timeout to wait for underlying `InterProcessMutex` answer makes this function almost fully impossible

* Fix `ZkLock.tryLock()` to delegate with the `tryLock(1, TimeUnit.SECONDS)` to give some time window chance for network communication.
It isn't ideal for the `tryLock()` contract, but at least it is better then don't let the feature to work at all.

**Cherry-pick to 4.3.x & 4.2.x**
2016-09-30 10:04:49 -04:00
Artem Bilan
c114ed3101 Move test code base to Java 8
Upgrade to Spring AMQP 1.6.3
2016-09-29 11:07:46 -04:00
Gary Russell
df8b879095 INT-4128: FTP ControlEncoding Fix
JIRA: https://jira.spring.io/browse/INT-4128
2016-09-29 10:14:15 -04:00
Artem Bilan
035c407573 INT-4126: Fix Redis lock to use SET NX EX
JIRA: https://jira.spring.io/browse/INT-4126

Looks like `WATCH` doesn't provide good isolation when the call is performed concurrently at the same time from different Threads.

* Change locking algorithm as it is recommended by Redis `SET` command: http://redis.io/commands/set:
```
SET resource-name anystring NX EX max-lock-time
```

* Add `@Repeat(10)` to the `AggregatorWithRedisLocksTests#testDistributedAggregator()` since that helped to reproduce the issue

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

Conflicts:
	spring-integration-redis/src/main/java/org/springframework/integration/redis/util/RedisLockRegistry.java
Resolved.
2016-09-28 11:55:19 -04:00
Artem Bilan
5187cbf1a8 INT-4113: Add @Poller.errorChannel() Attribute
JIRA: https://jira.spring.io/browse/INT-4113

* To simplify `MessagePublishingErrorHandler` and avoid extra `PollerMetadata` beans, added the `errorChannel()` attribute to the `@Poller` annotation
* The `MessagePublishingErrorHandler` now supports the late-binding via new `defaultErrorChannelName`
* Docs about new `errorChannel()` attribute
* Some other docs polishing

Polishing

**Cherry-pick to 4.3.x**

Polishing docs according PR comments

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/config/annotation/AbstractMethodAnnotationPostProcessor.java

Resolved and reworked Java8 features in tests.
2016-09-27 18:08:30 -04:00
Gary Russell
166a732447 INT-4124: ByteBuffer.array() with Direct Buffers
JIRA: https://jira.spring.io/browse/INT-4124

`ByteBuffer.array()` returns null when Direct.

Change `ChannelInputStream` to use the `ByteBuffer` directly instead of
the underlying `byte[]`.

Conflicts:
	spring-integration-ip/src/test/java/org/springframework/integration/ip/util/SocketTestUtils.java

* Change Lambda for `EventPublisher` to `Mock`
2016-09-26 22:30:04 -04:00
Gary Russell
aafeb3a55f INT-4120: Poller Advice Chain Regression
JIRA: https://jira.spring.io/browse/INT-4120

INT-3899 moved creating the pollingTask to start() to allow modification
of the advice chain between starts.

Since a new pollingTask is created on each start, this was fine for general advices.

However, for `AbstractMessageSourceAdvice`s, which only advise the `receive()` operation,
the advices are re-applied on every start.

When starting, first remove any advices we added on the previous start.

This handles the case when the source is a naked object, or already a proxy when supplied
to the SPCA.

Remove uneeded cast

Polishing - PR Comments
2016-09-26 11:23:23 -04:00
Spring Buildmaster
9a20ea0a3b [artifactory-release] Next development version 2016-09-19 17:19:10 +00:00
Spring Buildmaster
4885eb7e72 [artifactory-release] Release version 4.3.2.RELEASE 2016-09-19 17:19:05 +00:00
Artem Bilan
7084270d4e Upgrade to SF-4.3.3 and some timing fixes
Also upgrade to SA-1.6.2 and Retry-1.1.3
2016-09-19 12:33:12 -04:00
Artem Bilan
49f145baf2 INT-4105: RedisLock: Unlock Local in obtain()
JIRA: https://jira.spring.io/browse/INT-4105
Fixes GH-1888

The lock in Redis can be expired in between `obtain()` calls.
So, even if we return a new lock instance, the old one must clear properly.

* Add `lock.unlock()` to the `obtain()` if the case of expiration in Redis.
* Add `warn` for the exception on the `lock.unlock()`. We don't care about error here and just proceed to a new instance.

**Chery-pick to 4.3.x**

Remove the lock reference from `weakThreadLocks` as well
Add `registry.setUseWeakReferences(true);` to test-case

* Add assert for `lock.unlock()` in case of expiration

* Add `UUID.randomUUID()` for the registry key to avoid cross-talking during concurrent builds, e.g. on the CI server
https://build.spring.io/browse/INT-MASTER-352

This is actually a fix for the

JIRA: https://jira.spring.io/browse/INT-4083
2016-09-15 12:54:46 -04:00
Artem Bilan
c20c38c06f INT-4109: Fix NPE in the IntegrationGraphServer
JIRA: https://jira.spring.io/browse/INT-4109

**Cherry-pick to 4.3.x**
2016-09-13 16:53:51 -04:00
Artem Bilan
d1ed66835d INT-4096: Allow Configuration of ReadOnly Headers
JIRA: https://jira.spring.io/browse/INT-4096

* Introduce `spring.integration.readOnly.headers` Integration property
* Introduce `IntegrationMessageHeaderAccessor.setReadOnlyHeaders()` and use it from the overridden `IntegrationMessageHeaderAccessor.isReadOnly()`
* Add `DefaultMessageBuilderFactory.setReadOnlyHeaders()` and delegate the value to the new `MessageBuilder.readOnlyHeaders()`
* Modify `spring.integration.properties` for the `contentType` as a `readOnly` header for testing
* Ensure that provided logic works via an appropriate modification to the `ObjectToJsonTransformerParserTests`

Increase receive timeouts in the `OutboundGatewayFunctionTests`

Fix `FileInboundTransactionTests` for slow `WatchService` issue on Linux/OS X

Also redo the `tmp` dir logic to the `TemporaryFolder` `@ClassRule`

Fix unused `import` in the `FileInboundTransactionTests`

Polishing
2016-09-13 16:50:37 -04:00
Artem Bilan
9101b6a6ef INT-4108: Fix idempotency for some Lifecycles
JIRA: https://jira.spring.io/browse/INT-4108

Some `Lifecycle.start()/stop()` usage doesn't ensure robustness for components causing unexpected and difficulty tracing issues

* Fix `Lifecycle.start()/stop()` for `FileReadingMessageSource`, `FileWritingMessageHandler`, `AbstractMqttMessageHandler`
* In the `DefaultHeaderChannelRegistry`, `LockRegistryLeaderInitiator`, `MqttPahoMessageHandler` rework logic for shared variables to avoid `NPE`
* Increase receive timeouts in the `PayloadDeserializingTransformerParserTests` and `UdpChannelAdapterTests`
* Prove with the `WatchServiceDirectoryScannerTests` changes that several invocation for `FileReadingMessageSource.start()` are idempotent

**Cherry-pick to 4.3.x**
2016-09-13 15:16:48 -04:00
Gary Russell
eb6daad3a6 INT-4103: Fix Amqp Channel Header Mappers
JIRA: https://jira.spring.io/browse/INT-4103
(cherry picked from commit 89e0d13)
2016-08-26 15:58:45 -04:00
Artem Bilan
09a07ef5de INT-4102: autoStartup = false for JMS container
JIRA: https://jira.spring.io/browse/INT-4102

There is inconsistency when we mark `JmsMessageDrivenEndpoint` for `autoStartup = false`,
but external container can still be started by the application context, because of it own default `autoStartup = true`.

* Mark `container` `autoStartup = false` in the `JmsMessageDrivenEndpoint` ctor to align lifecycles.

**Cherry-pick to 4.3.x**
2016-08-25 10:36:43 -04:00
Artem Bilan
741be087f8 Ignore Exponential Moving Average Tests
https://build.spring.io/browse/INT-SI43X-6/

Since Exponential Moving Average algorithm is fully based on the time in between events, it is very difficult to reach the stable tests.
All of them used to fail from time to time on the slow CI server.

Mark all Exponential Moving Average Tests with `@Ignore`.

The manual testing is required in case of some changes.

**Cherry-pick to 4.3.x**
(cherry picked from commit 76bb3ad)
2016-08-23 11:43:43 -04:00
Artem Bilan
0d7e3f7e60 ZkLockRegistryTests: increase tryLock timeout
https://build.spring.io/browse/INT-AT42SIO-253/

 ```
 java.lang.AssertionError: Should have been able to lock with zookeeper server restarted!
 	at org.junit.Assert.fail(Assert.java:88)
 	at org.junit.Assert.assertTrue(Assert.java:41)
 	at org.springframework.integration.zookeeper.lock.ZkLockRegistryTests.voidLockFailsWhenServerDown(ZkLockRegistryTests.java:339)
 ```

 When we do `testingServer.restart();` we should give more time to let it started on background, therefore increase the next `lock2.tryLock()` to 10 seconds.

 **Cherry-pick to 4.3.x and 4.2.x**
(cherry picked from commit 6ffdd5e)
2016-08-23 11:02:32 -04:00
Gary Russell
e18be4def6 INT-4066: Expose RMI Factory Bean
JIRA: https://jira.spring.io/browse/INT-4066

Allow customization.

Rename To RmiProxyFactoryBeanConfigurer

Polishing

More Polishing

Polishing

* Backport polishing
2016-08-22 15:57:40 -04:00
Artem Bilan
934b22cc79 jms.adoc: Fix typos in extract-payload paragraph
SO: http://stackoverflow.com/questions/39064020/spring-integration-jms
(cherry picked from commit 2a0e56b)
2016-08-22 10:05:24 -04:00
Artem Bilan
de0c13f882 INT-4099: Fix closableResource typo
JIRA: https://jira.spring.io/browse/INT-4099
2016-08-19 12:17:13 -04:00
Artem Bilan
64bdbf121a Fix version in the index.adoc.
Also add whitespace after colon for history link
2016-08-18 16:05:44 -04:00
Artem Bilan
e7b30eba5c INT-4082: Fix MongoDB MessageStore for auditing
JIRA: https://jira.spring.io/browse/INT-4082

Starting with Spring Data 1.9 the `MappingContextIsNewStrategyFactory` relies on a newly introduced `PersistentEntities` and doesn't register entities lazily any more.
Such a change finishes with the `Unsupported entity` exception when an auditing is switched on (`<mongo:auditing/>`)
for the `MongoDbMessageStore` and `AbstractConfigurableMongoDbMessageStore` internally created `MongoTemplate` and `MessageWrapper` and `MessageDocument` SI internal entities.

* Don't register `ApplicationContext` into internally created `MongoTemplate`s since to avoid entity events emitting for `MessageWrapper` and `MessageDocument`
* Pull `MongoDbMessageBytesConverter` to the top-level class to let customize `MappingMongoConverter` properly if there is need to audit `MessageDocument` anyway,
what can be possible via external injections into `AbstractConfigurableMongoDbMessageStore` implementation
* Fix `mongodb.adoc` for some typos

**Cherry-pick to 4.2.x**
2016-08-17 15:29:51 -04:00
Artem Bilan
63e36cadb6 INT-4087: Fix tryLock(timeout) Contract for ZK
JIRA: https://jira.spring.io/browse/INT-4087
Fixes GH-1863 (https://github.com/spring-projects/spring-integration/issues/1863)

If ZK Client loses the connection to ensemble, it tries to reconnect on the next operation and does that exactly for the `connectionTimeoutMs` and provided `RetryPolicy`.
According to the `Lock.tryLock(long time, TimeUnit unit)` contract we can wait for the lock only during provided `timeout`.

* Introduce `mutexTaskExecutor` and perform `ZK.forPath()` command in the separate `Thread` and wait for the `Future` during provided timeout.
* Perform `mutex.acquire()` only after successful `Future` result and only for the remained timeout.

**Cherry-pick to 4.2.x**

Add `setMutexTaskExecutor()`

Fix Checkstyle typo

Javadoc
2016-08-17 13:59:21 -04:00
Artem Bilan
191f3bb1fd Fix Spring AMQP JavaDocs link
https://build.spring.io/browse/INT-AT42SIO-247/

**Cherry-pick to 4.2.x**
2016-08-17 10:23:27 -04:00
Gary Russell
3b891e9e67 INT-4097: Fix Test IMAP Mail Server
JIRA: https://jira.spring.io/browse/INT-4097

Mismatched From/To headers when using a header mapper.
2016-08-16 18:24:53 -04:00
Gary Russell
c0f2d6d738 Overview Doc Polishing 2016-08-16 11:37:10 -04:00