Commit Graph

492 Commits

Author SHA1 Message Date
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
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
Gary Russell
77fd8a4684 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
2017-01-04 15:55:55 -05:00
Ali Shahbour
f7b1ec8885 INT-4188: Add Idle Event Interval Support
JIRA: https://jira.springsource.org/browse/INT-4188

* add `<idle-event-interval>` XSD element
* add `FileTailingIdleEvent`
* move `TaskScheduler` and `getRequiredTaskScheduler` to `FileTailingMessageProducerSupport`
* add `setIdleEventInterval`

use taskExecutor instead of creating one
stop the scheduled task in case of `doStop()`
other required changes

update Test and Reference

implement changes required

What do you think about this checking if file exist before sending event.

Mock is used for `file.exist()` plus other minor updates

Polishing
* Some typos in the code as well as in the docs
* Fix `FileTailingMessageProducerTests.testIdleEvent()` to verify that `FileTailingIdleEvent` isn't emitted when file does not exist
2016-12-27 12:58:15 -05:00
Ali Shahbour
16c7535577 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**
2016-12-19 15:38:55 -05:00
Artem Bilan
c0a507c36c Prepare for Milestone Release
Change all the `BUILD-SNAPSHOT`s to their latest Milestones
Fix compatibility with those Milestones

Upgrade to Spring AMQP 2.0.0.M1

Upgrade to Spring Data Kay

Gemfire now is based on the Apache Geode, so changed all the imports to proper new packages
MongoDB now is based on the Mongo 3 Driver, therefore many breaking changes. Mostly to the mapping part

Fix Checkstyle violation

Fix race condition in the  `MongoDbInboundChannelAdapterIntegrationTests` around `QueueChannel` and tx commit

Add `-s` to Travis Gradle command to see stack trace about `MongoDbMetadataStoreTests` problem

Test only MongoDB module on Travis with -d

Add addon to Travis to pull MongoDB-3.0

Fix `MongoDbAvailableRule` for MongoDB 3.0 Driver style

Increase `serverSelectionTimeout` to `100` in the `MongoDbAvailableRule`.
Looks like `0` isn't good value to get immediate answer
2016-12-01 14:56:50 -05:00
Gary Russell
8070f72c44 INT-4155: Port FTP DSL
JIRA: https://jira.spring.io/browse/INT-4155

- Add streaming support
- Rework tests to use dynamic flow registrations due to the test FTP server is now a test support class.

Javadoc fixes

Checkstyle fix

Polishing - PR Comments

Polishing and Port SFTP
2016-11-14 13:22:45 -05:00
Artem Bilan
f96c42d156 Rename setOptions(Option...) to setOption()
Since Spring XML properties population is based on the JavaBeans convention, two setters with the same name but different argument types clashes and we can sporadically end up with:
```
 java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type
'org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway$Option' for property 'options[0]':
no matching editors or conversion strategy found
```

So, rename the new method for Java configuration to the `setOption(Option...)`
2016-11-11 12:06:59 -05:00
Artem Bilan
f71d6a0e66 INT-4154: Merge Files Java DSL
JIRA: https://jira.spring.io/browse/INT-4154

* Move `Transformers` for files to the `Files` factory
* Remove `@Deprecated` methods
* Fix `FilesTests` for new packages and removed methods like `.handleWithAdapter()`

Provide JavaDocs for File DSL and implement some new methods like `chmod()` and `renameFunction()`

Fix race condition in the `ScriptsTests` when even small time window delay may lead us to one more message in the queue
2016-11-11 10:16:10 -05:00
Artem Bilan
5cca8e8e01 INT-3770: Add TX Support from Mid-flow
JIRA: https://jira.spring.io/browse/INT-3770,
https://jira.spring.io/browse/INT-4107

Having `TransactionHandleMessageAdvice` we can start TX from any `MessageHandler.handleMessage()`

* Add `<transactional>` alongside with the `<request-handler-advice-chain>` for those components which produce reply
* Merge `<transactional>` and `<request-handler-advice-chain>` configuration to a single `ManagedList`
* Rework JPA `<transactional>` in favor of common solution
* Some polishing and refactoring

AbstractPollingEndpoint: avoid `new ArrayList` if we don't  have `receiveOnlyAdvice`s
2016-11-07 09:06:17 -05:00
Gary Russell
a43299213e INT-4149: Improve (S)FTP Recursive MGET
JIRA: https://jira.spring.io/browse/INT-4149

Add an option to always pass directories while recursing.

* Fix typos in docs
* Revert `SyslogReceivingChannelAdapterTests` `Thread.sleep()` fixes
2016-10-28 16:22:46 -04:00
Gary Russell
67d6cd0c89 Lambdas for Remaining Modules JPA -> ZK
Polishing - PR Comments and Closeable Warnings

Eclipse emits bogus warnings with exceptions in lambdas.
Even though the lambda might run on another thread, elipse thinks it could
cause the context to not be closed.

SPR-14854: MessageChannel is now a @FunctionalInterface

* Additional Lambda polishing and some code style fixes
2016-10-28 16:06:11 -04:00
Gary Russell
c5fbd93787 Mockito Polishing
`$ find spring-integration-* | grep '\.java$' | xargs sed -E -i '' -e 's/(\(?)\(([^<()]*)\) *invocation.getArguments\(\)\[([0-9]*)\]/\1invocation.getArgumentAt(\3, \2.class)/'`
2016-10-28 11:06:05 -04:00
Artem Bilan
c6026ce8fe Remove Java 7 restriction in FileWritingMH
Since SI-5.0 is based on Java 8 no reason to have condition for the `java.nio.Files` class in the `FileWritingMessageHandler`
Also add package protected ctors to the inner private classes in the `FileWritingMessageHandler` to avoid generated synthetic classes in case of default ctor

Address PR comments

Remove redundant log for `IOException` on `Files.move()`
2016-10-26 14:38:49 -04:00
Gary Russell
7b1d43a6dc INT-4147: Remove Unnecessary null Check
JIRA: https://jira.spring.io/browse/INT-4147

instanceof returns false for null.
2016-10-25 11:55:20 -04:00
Artem Bilan
8c95f001da 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**
2016-10-25 11:43:36 -04:00
Artem Bilan
a1a3c2a1ac 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 13:38:38 -04:00
Gary Russell
0c1a7658d7 INT-4141: (S)FTP Streaming - throw Exception
JIRA: https://jira.spring.io/browse/INT-4141

MessageSource incorrectly returned the exception instead of throwing it.
2016-10-18 15:58:42 -04:00
Gary Russell
5a44216201 INT-4140: File Streaming Adapter: Add maxFetchSize
JIRA: https://jira.spring.io/browse/INT-4140
2016-10-18 10:32:23 -04:00
Artem Bilan
8f0fa3468f INT-832: Add File Relative Path to Message Headers
JIRA: https://jira.spring.io/browse/INT-832

When we scan directory recursively for files (e.g. `WatchServiceDirectoryScanner`), it can be useful to get access to the relative path from the `Message`, e.g. on the `FileWritingMessageHandler` side to restore the original structure

* Add a `FileHeaders.FILENAME` into the outbound `Message` from the `FileReadingMessageSource`
* The result of that header is like a removal of leading `this.directory.getAbsolutePath()` in the target `File.getAbsolutePath()`.
In case of not recursion we get just only regular file name.

* Introduce `FileHeaders.RELATIVE_PATH`
* Populated `FileHeaders.RELATIVE_PATH`, `FileHeaders.FILENAME`, `FileHeaders.ORIGINAL_FILE` in the `FileReadingMessageSource`
* File `FileTailingMessageProducerSupport` to populate `FileHeaders` properly
* Introduce ctor for the `LastModifiedFileListFilter` for better Java configuration experience
* Add docs for changes

Doc Polishing
2016-10-11 13:04:21 -04:00
Gary Russell
e5ae7d886d (S)FTP Lambdas
AMQP Lambdas

Event Lambdas

Feed/File Lambdas

Gemfile/Groovy Lambdas

* Ensure that JavaDocs are checked via `	check.dependsOn javadoc`
* Add `@return` tag to the `MessageBuilder.readOnlyHeaders()`
2016-09-26 16:50:01 -04:00
Artem Bilan
12fb590b95 Mainly Checkstyle Violation Fixes
* Upgrade to Checkstyle `7.1`
* Relax `RequireThis` rule a bit. Right now it does the effort only in case of overlapping. See https://github.com/checkstyle/checkstyle/issues/2362 for more info
* Enable some annotation rules and provide fixes for violations
* Enable `tabs indents` rule. This was the biggest fix in this PR
* Resolve `TODO` in the `MessagingMethodInvokerHelper` and fix tests to meet `IllegalStateException` now

Remain Checkstyle version `6.16.1` and reinstate `RequireThis` rule

The latest Checkstyle has a bug with local scope variables if they have the same names as property.

Revert some literals splitting

Fix some line length exceeding and code style
2016-09-22 13:23:51 -04:00
Artem Bilan
dbcebebf38 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

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/context/IntegrationProperties.java
	spring-integration-core/src/main/resources/META-INF/spring.integration.default.properties

Some polishing and documentation

Localize `readOnly.headers` customization only in the `ObjectToJsonTransformerParserTests-context.xml`

Otherwise ti might affect many other tests and the search for the reason of failure would be enough complicated

Doc Polish
2016-09-15 15:32:20 -04:00
Artem Bilan
6c6e1d319d 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 12:09:56 -04:00
Artem Bilan
370be4853d Apply Some Java 8 Code Changes
* Make most functional interfaces as `@FunctionalInterface`
* Convert some abstract classes to `@FunctionalInterface` with `default` methods
* Apply Lambda style implementation in some places
* Remove `Function` in favor of similar in Java 8

*  Remove redundant code from `DefaultAmqpHeaderMapper` since we are already on Spring AMQP-2.0
* Add several ctors to the `ExpressionEvaluatingMessageListProcessor`
* Populate explicit `Boolean.class` `expectedType` from the `ExpressionEvaluatingReleaseStrategy`
2016-08-29 09:14:31 -04:00
Artem Bilan
eaed954458 INT-3913 Remove/resolve deprecation from the past
JIRA: https://jira.spring.io/browse/INT-3913

* Remove deprecated classes and methods/constructors, deprecated XML attributes
* Remove `TcpConnectionEventListeningMessageProducer` and rework tests logic to the `ApplicationEventListeningMessageProducer`
* Fix several typos
* Remove/rework deprecated entities mentioning
2016-08-26 13:42:47 -04:00
Gary Russell
ea4763faa9 INT-4095: Support Limiting (S)FTP Files Fetched
JIRA: https://jira.spring.io/browse/INT-4095

Limit the number of remote files fetched on each poll (when it is necessary to fetch files).

Polishing - PR Comments

Polishing - Decouple MaxFetchSize from Poller

Polishing - PR Comments

Schemas and Docs

More Polishing

* Polishing according PR comments
2016-08-26 13:36:14 -04:00
Gary Russell
04a42f54be Rename Schemas to 5.0
Fix Schema Imports

spring.schemas
2016-08-18 14:40:38 -04:00
Artem Bilan
11151efc8c Upgrade to SF-5.0 and Reactor-3.0 2016-08-17 16:23:21 -04:00
Artem Bilan
7124136091 Some Fixes and Improvements
* Fix several typos in log messages. And some test on the matter as well
* Add comment to `AbstractPersistentAcceptOnceFileListFilter.rollback()` to clarify the reason of `rollingBack` variable
* Make `RemoteFileTemplate.StreamHolder` as `static` to avoid extra internal variable to outer class instance
* Replace `MessagingException` with `AbstractInboundFileSynchronizingMessageSource` in `init()` method of some components. It isn't Messaging yet in that phase
* Fix `SubscribableRedisChannel.MessageListenerDelegate` to handle `Object` not `String`, because with the `serializer` injection there is no guaranty that incoming is always `String`
* Move `JSch.setLogger(new JschLogger());` in the `DefaultSftpSessionFactory` to `static` block. It really should be done only once
* Remove `Assert.isTrue(this.port >= 0)` from the `DefaultSftpSessionFactory`. The subsequant `initJschSession()` convert it to default `22` port
* Change in the `JschProxyFactoryBean` `UnsupportedOperationException` to `IllegalArgumentException`. Wrong enum is wrong argument. That isn't a problem of operation
* Simplify `stop()` in the `CuratorFrameworkFactoryBean` and mark it as a `this.running = false`. Otherwise it wasn't able to be restarted
* Expose `leaderEventPublisher` in the `LeaderInitiatorFactoryBean`  and fix `stop(Runnable callback)` with propagation `callback` to delegate.

Fix `SubscribableRedisChannelTests` for new `handleMessage(Object)` signature
2016-08-12 12:47:32 -04:00
Artem Bilan
4cef58bc86 INT-4067: Cover empty file case in FileSplitter
JIRA: https://jira.spring.io/browse/INT-4067

When `FileSplitter` is configured with `markers = true` and file is empty, an `iterator` for file throws `IOException: Stream closed`,
because we close the `buffer` just after the first `readLine()` attempt, but still return `true` from the first `hasNext()` call
where the `this.sof` and `this.eof` are `true` for markers.

Add logic to mark internal splitter `iterator` as `done` where we don't have content and still in `sof` state.
2016-07-11 14:25:18 +01:00
Artem Bilan
eca8536678 INT-4053: Avoid Reactor dependency requirement
JIRA: https://jira.spring.io/browse/INT-4053

The recent changes to the `FileSplitter` introduced (by IDE autocompletion mistake) hidden dependency of Reactor using its `Assert` class instead of Spring's one

**Cherry-pick to 4.2.x**
2016-06-10 16:40:06 -04:00
Artem Bilan
dbd034c17a Fix unused import in FileSplitter
https://build.spring.io/browse/INT-B43-230/
2016-06-08 22:21:36 -04:00
Gary Russell
d521031a7d INT-4049: FileSplitter: JSON File Markers
JIRA: https://jira.spring.io/browse/INT-4049

INT-4049: Json FileMarker Namespace Support

* Address PR comments
2016-06-08 22:07:55 -04:00
Artem Bilan
c620438913 INT-4046: Add FtpRemoteFileTemplate.ExistsMode
JIRA: https://jira.spring.io/browse/INT-4046

Since not all FTP servers provide proper `STAT` command implementation,
plus the `NLIST` doesn't work properly for directories cases, introduce the `FtpRemoteFileTemplate.ExistsMode`
to let:
* to perform `STAT` by default (previous) behavior;
* to switch to `NLIST` for `FtpRemoteFileTemplate` internal use;
* perform the full `NLIST` and `FTPClient.changeWorkingDirectory()` algorithm if needed.

* Improve (S)Ftp components to use proper `RemoteFileTemplate` for internal instantiation
* Introduce `FtpMessageHandler` to wrap `FtpRemoteFileTemplate` with the proper `NLIST` `ExistsMode`
* Cover `NLIST` switching from the `FtpOutboundChannelAdapterParser` and `FtpOutboundGatewayParser`
* Document the `FtpRemoteFileTemplate.ExistsMode`

* Fix typo in the recently introduced `RemoteFileOperations.getSession()` method name
* Add JavaDoc to `Session.exists()`
* Add `NLIST` support for the `FtpSession.exists()` to meet the API requirements

**Cherry-pick to 4.2.x and 4.1.x**

Addressing PR comments

Doc Polishing
2016-06-08 14:34:35 -04:00
Gary Russell
8e3622757d File Cleanup - Event to JMX 2016-06-04 11:39:43 -04:00
Gary Russell
a30809be38 INT-4042: Support Known Router Channels in Graph
JIRA: https://jira.spring.io/browse/INT-4042

```
...
  }, {
    "nodeId" : 24,
    "name" : "integrationGraphServerTests.Config.router.router",
    "stats" : {
       ...
      }
    },
    "componentType" : "router",
    "output" : "discards",
    "input" : "four",
    "routes" : [ "barChannel", "bazChannel" ],
    "errors" : "myErrors"
  }, {
...
    "from" : 3,
    "to" : 24,
    "type" : "input"
  }, {
    "from" : 24,
    "to" : 7,
    "type" : "output"
  }, {
    "from" : 24,
    "to" : 2,
    "type" : "error"
  }, {
    "from" : 24,
    "to" : 5,
    "type" : "route"
  }, {
    "from" : 24,
    "to" : 6,
    "type" : "route"
...
```

Add Graph Support for RecipientListRouter

The RLR is not an AMMR; it's the only router outside of that class hierarchy.

Polishing

Add Dynamically Routed-to Channels to Graph

Add ExpressionBased and Expose Expression in Graph

Polishing

Add getExpressionString() to IOS

Add ExpressionCapable; Set Primary Expression

Polishing - PR Comments

Router/Expression Docs

* Simple Java Docs polishing
2016-06-03 18:36:43 -04:00
Artem Bilan
10a6abf688 Add Xlint:-processing Compiler Option
* To avoid a compiling noise like:
```
warning: No processor claimed any of these annotations: org.springframework.integration.support.management.IntegrationManagedResource,org.springframework.jmx.export.annotation.ManagedResource
```
add `-processing` option to the `compileTestJava.options.compilerArgs`
* Remove such an option from the `JPA` module as redundant
* Fix typos in the `spring-integration-file-4.3.xsd`
2016-05-04 14:49:46 -04:00
Gary Russell
287d924fc0 INT-4015: Streaming Remote File Inbound Adapter
JIRA: https://jira.spring.io/browse/INT-4015
      https://jira.spring.io/browse/INT-3854

Initial commit.

Reworked to emit an input stream and use the file splitter.

Add StreamTransformer.

Add CLOSABLE_RESOURCE header so we can close the session automatically.

Implement INT-3854, FTP, SFTP

(S)FTP Namespace Changes

Docs - also fixes a PDF overflow

Polishing - PR Comments

checkstyle fixes

Polishing - Add Namespace for StreamParser

Polishing - PR Comments
2016-04-29 13:24:23 -04:00
Artem Bilan
47d7a67bda Some various upgrades, fixes and refactoring
* Upgrade to SA and SF snapshots
* Address TODOs regarding those upgrades
* Resolve some other TODOs
* Replace `PropertyPlaceholderConfigurer` beans with the `<context:property-placeholder>`
* Upgrade to Spring Social Twitter 1.1.2 and resolve deprecations via mocks (https://github.com/spring-projects/spring-social-twitter/issues/91)
* Upgrade to Curator `3.1.0` and resolve deprecation in the `ZookeeperMetadataStore`
2016-04-25 23:32:14 -04:00
Gary Russell
b84747b090 INT-3989: WatchService Scanner Fix Checkstyle 2016-04-22 14:26:01 -04:00
Gary Russell
06703c8368 Fix WatchService Scanner Tests 2016-04-22 14:17:37 -04:00
Artem Bilan
7b1f77ac1f INT-3989: WatchServiceDirectoryScanner Improvement
JIRA: https://jira.spring.io/browse/INT-3989,
https://jira.spring.io/browse/INT-3990,
https://jira.spring.io/browse/INT-3988

INT-3989: Add `FileReadingMessageSource.WatchServiceDirectoryScanner`

* Deprecate top-level `WatchServiceDirectoryScanner` because of inconsistency around `Lifecycle` and shared `directory` property
* Copy/paste its logic into the `FileReadingMessageSource.WatchServiceDirectoryScanner` to hide that inconsistency, but still get a gain from the `WatchService` benefits
* Add support for the `StandardWatchEventKinds.ENTRY_MODIFY` and `StandardWatchEventKinds.ENTRY_DELETE` events in the `FileReadingMessageSource.WatchServiceDirectoryScanner`
* Introduce `useWatchService` option to switch to the internal `FileReadingMessageSource.WatchServiceDirectoryScanner`
* Make `CompositeFileListFilter` also as `ResettableFileListFilter`
* Deprecate weird `FileReadingMessageSource.onSend()` method and remove its usage from tests
* Modify `WatchServiceDirectoryScannerTests` for the new logic
* Document changes

Add `MODIFY` and `DELETE` test coverage

Optimize the `filesFromEvents()` logic replacing item with the fresh event sources.
Remove the item from the result set in case of `DELETE` event, because file removal generates both `MODIFY` and `DELETE` events.

* Add `FileReadingMessageSource.setWatchEvents` to allow to listen to the specific events,
not only `CREATE` or all of them.
* Modify tests and docs to reflect the new API

Address PR comments

* Improve `FileReadingMessageSource.setWatchEvents()`
* Add `file.exists()` before adding file from event.

Add more DEBUG logs into the `WatchServiceDirectoryScanner`

With the fact of those logs provide more optimizations:
* Don't register the same directory for watching:
  - use the `ConcurrentMap<Path, WatchKey> pathKeys` to track registrations
  - any modification within the directory causes the `ENTRY_MODIFY` for the directory as well.
    So, skip such an event exactly for the directory during `walkDirectory`
* Add debug logs in case of `ENTRY_DELETE`
2016-04-22 13:29:10 -04:00
Artem Bilan
cfdfa62745 Fix some latest test failures
https://build.spring.io/browse/INT-B43-164/

* Fix CheckStyle for `System. out .println(` expression commenting out such a code line
* Fix generics in the `JdbcMessageStoreTests`
* Increase receive timeout in the `FileMessageHistoryTests`
* Change the `AsyncAmqpGatewayTests` logic to deal with the same channel for both `ack/nack`.
The `timeout` case without reply may end up with the `Consumer cancel`, therefore `nack` not `ack` like we expected
2016-04-21 19:03:35 -04:00
Artem Bilan
286c421c1a INT-3387: MessageGroupStore Improvements
JIRA: https://jira.spring.io/browse/INT-3387,
https://jira.spring.io/browse/INT-3806

* Introduce
```
MessageGroupStore

void addMessagesToGroup(Object groupId, Message<?>... messages);
```
And implement it in all stores.

* Use new `addMessagesToGroup` where it is reasonable, e.g. `DelayHandler`
* Optimize test-case to use a new store method (where it is possible)
* Fix timing delays in the `JdbcMessageStoreTests`
* Introduce `PersistentMessageGroup`
* Add `AbstractMessageGroupStore#proxyMessageGroupForLazyLoad` to wrap the raw `MessageGroup` to the `PersistentMessageGroup` for lazy-load
* Rework `MessageGroupMetadata` do not be `immutable` and allow to store/restore in the `AbstractKeyValueMessageStore` only the `MessageGroupMetadata`
* Refactor `ResequencingMessageHandler` and `SequenceSizeReleaseStrategy` a bit for better performance when interact with the `MessageGroup`
* Add `AbstractMessageGroupStore#setLazyLoadMessageGroups` to switch off the `lazy-load` behavior and restore the previous full `MessageGroup` logic
* Add `What's New` note and `message-store.adoc` paragraph for the lazy-load functionality

`GroupType.PERSISTENT` and not lazy by default

PR Comments

Fix `JdbcMessageStoreTests` timing issues

Address PR comments

* Add performance test to the `ConfigurableMongoDbMessageGroupStoreTests`
* Add JavaDocs for the `MessageGroupFactory` methods
* Add `log4j.properties` into the `test` MongoDB module for better traceability
* Fix `JdbcMessageStore#getOneMessageFromGroup()` over the `doPollForMessage()` delegation.
The `jdbcTemplate.queryForObject()` requires exactly one and only one raw in `resultSet`
* Add performance test results into the `message-store.adoc`
2016-04-21 17:47:20 -04:00
Gary Russell
020aa019a1 Sonar Fixes after Checkstyle Updates
https://sonar.spring.io/issues/search#componentRoots=org.springframework.integration%3Aspring-integration|createdAt=2016-04-07T03%3A04%3A31%2B0000|sort=UPDATE_DATE|asc=false
2016-04-07 09:01:17 -04:00
Gary Russell
57f96bb759 checkstyle Misc Rules
checkstyle Nesting

checkstyle GenericWhitespace

checkstyle MethodParamPad

checkstyle NoWhiteSpace

checkstyle ParenPad Script

checkstyle ParenPad
2016-04-05 17:21:29 -04:00
Gary Russell
05cc7be644 checkstyle WhiteAround
WhiteAroundCheck script
2016-04-05 13:50:11 -04:00
Gary Russell
842aded9a4 checkstyle MutableException
checkstyle EmptyBlock

checkstyle fixRightCurly Script

checkstyle EmptyStatement

checkstyle RightCurly

checkstyle TailingWhite

checkstyle NeedBraces

Fix the line separator in the `fixRightCurly.gradle`
2016-04-05 13:10:33 -04:00
Gary Russell
4ac3a79df7 checkstyle FinalClassCheck
fixes

fixModifiers after fixFinal

Revert CachingSessionFactory

Class is spied in tests.

checkstyle - Import Rules

checkstyle InterfaceIsType

checkstyle InnerTypeLast

checkstyle OneStatementPerLine

CovariantEquals
OneTopLevelClass

* Revert `'\n'` -> `System.lineSeparator()` in the Gradle scripts to meet Git `autocrlf = true` on Windows
* Fix timing issue with the `LastModifiedFileListFilterTests`, when the `age = 1` might not be enough for the file object when we have some delay before checking
2016-04-04 13:49:56 -04:00