Commit Graph

8500 Commits

Author SHA1 Message Date
Artem Bilan
f7def2d1de INT-4187: Add enable-status-reader for tailer to XSD
JIRA: https://jira.spring.io/browse/INT-4187
2016-12-19 16:10:16 -05:00
Ali Shahbour
d2f4b27f92 INT-4187: Add enable-status-reader for tailer
JIRA: https://jira.spring.io/browse/INT-4187

Add javadoc and test

- assertTrue on default adapter
- assertFalse check on nativeAdapter
- update XSD to add enable-status-reader

add `@auther`

add example in reference document

update adoc

* Fix minor typos in docs and allow to configure `enable-status-reader` with property placeholder

**Cherry-pick to 4.3.x**

(cherry picked from commit 16c7535)
2016-12-19 15:40:12 -05:00
Artem Bilan
176be69b0f Fix expected messages for the TcpNioConnReadTests
https://build.spring.io/browse/INT-MASTER-475/
https://build.spring.io/browse/INT-MJATS41-850/

**Cherry-pick to 4.3.x**

(cherry picked from commit 44ad811)
2016-12-19 11:09:57 -05:00
Artem Bilan
21d355c538 Assert for another exception in TcpNioConReadTests
https://build.spring.io/browse/INT-MJATS41-847/

**Cherry-pick to 4.3.x**

(cherry picked from commit 968812c)
2016-12-16 12:59:15 -05:00
Artem Bilan
3127f25bfe Fix Race Conditions in TcpNioConnectionReadTests
https://build.spring.io/browse/INT-SI43X-60

After introduction the `sendErrorToListener()` function for the `TcpConnectionSupport`, all the tests in the `TcpNioConnectionReadTests` have flaw to be affected by the race condition to release semaphore in the `onMessage()` and don't get a connection as closed yet.

* Fix the tests adding `CountDownLatch` for the `ErrorMessage` and `AtomicReference` to assert an Exception message afterwards.

**Cherry-pick to 4.3.x**

Add Travis diagnostic to determine what is the difference if that

Revert Travis diagnostic

Looks like would be better to wait for CI failure to determine the root of sporadic cause

Conflicts:
	spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionReadTests.java
2016-12-15 16:47:18 -05:00
Artem Bilan
6a51da65e6 INT-4185: Fix FileReadingMessageSource for Java 6
JIRA: https://jira.spring.io/browse/INT-4185

Even if `WatchEventType` doesn't expose Java 7 API, its instantiation leads to the `StandardWatchEventKinds` object which already isn't Java 6

* Move `this.watchEvents = new WatchEventType[] { WatchEventType.CREATE }` to the ctor and guard it with the `ClassUtils.isPresent("java.nio.file.WatchService")`

Assertions for `WatchService`-based setters
2016-12-15 16:34:44 -05:00
Gary Russell
21ee3c2259 Fix (S)FTP Java/DSL Config
JIRA: https://jira.spring.io/browse/INT-4184

Polishing

(cherry picked from commit cc9d825)
2016-12-14 17:24:44 -05:00
Gary Russell
e8eecc7d8f INT-4183: Add SSL Handshake Timeout for TCP
JIRA: https://jira.spring.io/browse/INT-4183

Previously, this was hard-coded to 30 seconds.

* Fix typos according PR comments

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

* Resolve conflicts for the  `SocketSupportTests` where `ApplicationEventPublisher` isn't `@FunctionalInterface` yet in SF-4.3.x
2016-12-13 18:54:38 -05:00
Yaron Yamin
e7f93b9e0b INT-4173 Add Query support for Mongo i-c-adapter
JIRA: https://jira.spring.io/browse/INT-4173

INT-4173 convert query-expression to BasicQuery - fix checkstyle violation

INT-4173 convert query-expression to BasicQuery - refactor. address CR comments

INT-4173 convert query-expression to BasicQuery - UT coverage, xsd attribute documentation

INT-4173 cr comments, refactoring, register mongo api package for int-mongo:inbound-channel-adapter query-expression

INT-4173: Documentation, address PR comments & checkstyle violations

Polishing code style and imports order

**Cherry-pick to 4.3.x**

Conflicts:
	spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/inbound/MongoDbMessageSourceTests.java
2016-12-12 17:15:44 -05:00
Artem Bilan
fa0ba9b84e Turn off beanFactoryReference for Gemfire Caches
Looks like there is some race condition around static fields in the `GemfireBeanFactoryLocator`

Also add `@DirtiesContext` to the `GemfireInboundChannelAdapterTests`

**Cherry-pick to 4.3.x and master**

(cherry picked from commit 90136d7)
2016-12-01 11:37:24 -05:00
Vedran Pavic
8198ff1861 INT-4178: Retry CannotSerializeTransactionException in JdbcLockRegistry
JIRA: https://jira.spring.io/browse/INT-4178

The `JdbcLockRegistry` does not retry `CannotSerializeTransactionException` thrown by `DefaultLockRepository.acquire` which in turn causes `LockRegistryLeaderInitiator`s thread to get stuck.

* catch `CannotSerializeTransactionException` on `DefaultLockRepository.acquire` and ignore it to ensure a retry

**Cherry-pick to 4.3.x**
2016-12-01 10:36:24 -05:00
Artem Bilan
67332ad93a Fix One More Address already in use Issue
https://build.spring.io/browse/INT-MASTER-350

There are so much other similar `SocketUtils` usage and it doesn't look so quickly to fix them all
Let's do that on demand!
Or just live with rebuild forever to believe that it was just a bad luck...

Fix race condition when we assign the `port` for client before server actually has obtained the real port from OS
2016-12-01 09:27:47 -05:00
Artem Bilan
514e693f49 INT-4176: Fix Gemfire tests
JIRA: https://jira.spring.io/browse/INT-4176

The `DelayerHandlerRescheduleIntegrationTests` doesn't close `context` in the end of test.
That causes clashes for `beanFactoryResolver` in other tests.
When those tests are fail, we come into condition when new processes can't be started/stopped because of effect of non-stopped context

* Fix all the `DelayerHandlerRescheduleIntegrationTests` to stop `context` in the end of test
* Remove unused files in the `gemfire/store` test package
* Add current date value to the `CacheServerProcess` name to avoid clashes with other ran on the same host
* Add NPE check for `region` in the `GemfireMetadataStoreTests`
* Extract `@BeforeClass/@AfterClass` for the `CacheWritingMessageHandlerTests` to start only one Gemfire cache per class

**Cherry-pick to 4.3.x & 4.2.x**
2016-11-30 14:32:13 -05:00
Artem Bilan
ad08d9add0 INT-4175: Fix SftpSessionFactory Race Condition
JIRA: https://jira.spring.io/browse/INT-4175
Fixes GH-1980 (https://github.com/spring-projects/spring-integration/issues/1980)

When the `isSharedSession` is used for the `DefaultSftpSessionFactory`,
there is some race condition window when we can call the target `this.jschSession.connect()` several times and end up with the session is already connected.

Wrap `sftpSession.connect()` to the `this.sharedSessionLock.readLock().lock()` when `isSharedSession` to protect from that race condition.

Note: there is no test for this change because it is pretty tricky to build barriers between threads for this kind of race conditions.
Especially after introduction `this.sharedSessionLock.readLock().lock()` around guilty code

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

Move `sharedJschSession` connect logic to the existing locking block

Fix mock test to reflect the current ConnectionFactory state

Conflicts:
	spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpOutboundTests.java
Resolved.
2016-11-30 14:26:21 -05:00
Gary Russell
ce2092c267 INT-4174: Expose Channel Subscriber Count
JIRA: https://jira.spring.io/browse/INT-4174

I considered just using the channel counter but I suppose there is a (small) possibility
that someone might possibly use a custom dispatcher and subscribe to it directly.

(cherry picked from commit bd68eff)
2016-11-29 12:49:03 -05:00
Artem Bilan
ccc228854e Fix [artifactory-release] Next development version
Looks like there was a mistake during `4.3.5` release and a project version hasn't been moved

* Fix `gradle.properties` for the correct version `4.3.6.BUILD-SNAPSHOT`
2016-11-11 12:44:53 -05:00
Artem Bilan
476a0b706c Port TestMailServer to the SI-test module
To avoid copy/paste of `TestMailServer` in other projects (e.g. samples or Java DSL),
port `TestMailServer` from SI-5.0 to the shared `spring-integration-test` module

That allows to avoid unexpected SI-5.0 dependency in samples for SI-4.3
2016-11-11 12:30:03 -05:00
Artem Bilan
7d2120afb6 INT-4167: Fix ZkLockRegistryTests race condition
JIRA: https://jira.spring.io/browse/INT-4167

Since the current `ZkLock.tryLock()` is based on the fact of waiting for **at most 1 second**, that still has some timing issue for test-case, when the network delay may affect our expectation.

* Add `Thread.sleep()` with `while()` to the `ZkLockRegistryTests.testTryLock()` test to spin until successful `tryLock()`

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

Note: to avoid cherry-pick conflict for `4.2.x` just fully copy/paste the modified test
2016-11-10 12:43:15 -05:00
Romain Purchla
7408afbeaa Upgrade Jsch to 0.1.54: Fix SFTP stream connection 2016-11-08 11:41:55 -05:00
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