Commit Graph

8554 Commits

Author SHA1 Message Date
Gary Russell
849e3538de Sonar Fixes 2016-11-19 11:20:30 -05:00
Gary Russell
f070de0b7e Sonar Fixes
https://sonar.spring.io/component_issues?id=org.springframework.integration%3Aspring-integration%3Amaster#resolved=false|types=BUG

In `IntegrationFlowRegistration` double check locking is ok for `inputChannel`
because we're assigning an existing object, but `MessagingTemplate` constructs
a new object for which double check locking doesn't work.

In any case, for both these items, the chance of concurrent access is extremely low
and is idempotent anyway, so remove double check locking.

Several inner classes can be static.

Other minor fixes.
2016-11-18 14:08:35 -05:00
Artem Bilan
1bba73fc06 INT-4158: Port Java DSL for JPA Module
JIRA: https://jira.spring.io/browse/INT-4158

* Add JavaDocs
* De-Boot `JpaDslTests`
* Fix typos and generics inconsistency in the `JpaOutboundGatewayFactoryBean`

Address PR comments

* Get rid of `JpaOutboundGatewayFactoryBean` usage in the `JpaBaseOutboundEndpointSpec`
* Rework `JpaBaseOutboundEndpointSpec` and its inheritors logic to use  `JpaOutboundGateway` directly
* Rename to the `JpaTests`
* Fix JavaDoc in the `IntegrationFlowDefinition`
* Do not use `jpaParameters` in the `JpaExecutor` if it is empty collection, not only null
2016-11-17 14:31:07 -05:00
Gary Russell
3035bc716d INT-4138: MQTT: Outbound Adapter Improvements
JIRA:https://jira.spring.io/browse/INT-4138

Expressions for topic, qos, retained.

Also change inbound mapping to `RECEIVED_...` headers.

Fix some minor asciidoc problems in (s)ftp.

Rework Qos/Retained Expressions/Defaults

Encapsulate the logic entirely in the converter.

Polishing - PR Comments
2016-11-16 11:22:10 -05:00
Artem Bilan
d42357ba02 Increase timeout in the ReactiveStreamsTests 2016-11-16 10:33:43 -05:00
Artem Bilan
ba576bbc0d ReactiveConsumer Improvements
* Add `ConsumerSubscriber` to adapt `Consumer<?>` to the `Subscriber<?>`
* Add `SubscribableChannelPublisherAdapter` to adapt `SubscribableChannel` to `Publisher<?>` via `Flux.create()` on subscription
* Add `PollableChannelPublisherAdapter` to adapt `PollableChannel` to `Publisher<?>` via `Mono.delayMillis()` and `flatMap()` for `channel.receive()`

Use `concatMap()` for `PollableChannel`

Iterate `PollableChannel` until there is a data

Fix Lambda signature error via explicit class declaration:
```
java.lang.ClassFormatError: Duplicate field name&signature in class file org/springframework/integration/endpoint/ReactiveConsumer$PollableChannelPublisherAdapter$1
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at org.springframework.integration.endpoint.ReactiveConsumer$PollableChannelPublisherAdapter.lambda$new$2(ReactiveConsumer.java:163)
```
Looks like Java bug:

Move `Iterator<Message<?>>` instance to the `subscribe()` to avoid race conditions when we have several subscribers.

In other words make `Iterator<Message<?>>` subscriber-specific, but at the same time avoid re-instantiation for each `Flux.concatMap()` call caused by the previous `repeat()`

Upgrade to Reactor 3.0.3 and others

* Make fixes according Reactor 3.0.3 changes
* Remove redundant `TestSubscriber` in favor of `StepVerifier` and `mock(Subscriber)`
* Rework `PublisherIntegrationFlow` Reactive Streams implementation to the out-of-the-box `ReactiveConsumer` and `ReactiveChannel`
2016-11-16 09:23:10 -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
6c4d9b2111 INT-4156: Merge HTTP Java DSL and Some Refinements
JIRA: https://jira.spring.io/browse/INT-4156

* Copy `Http` Java DSL from with some fixes to the `HttpMessageHandlerSpec` and Java 8 style
* Port `HttpDslTests` and "de-Boot" it with the Mock MVC
* Upgrade to Spring Security 4.2.0
* Make `spring-integration-security` as a dependency for HTTP module for better test coverage for Security from SI Web perspective

No need in `AuthenticationManager` bean

JavaDocs for HTTP DSL components and some JavaDocs improvements for `HttpRequestHandlingEndpointSupport` and `HttpRequestExecutingMessageHandler`

Restore optional ROME dependency for proper HTTP module compilation

Add missed JavaDoc and mark all HTTP tests with `@DirtiesContext`

Add JavaDocs for `Http` factory methods
2016-11-12 13:31:55 -05:00
Gary Russell
803d9f0875 INT-4159: Port Mail DSL and Improvements
JIRA: https://jira.spring.io/browse/INT-4159

Port over DSL for the Mail module

- make tests compatible with the s-i-test TestMailServer
- add `simpleContent` boolean to inbound spec

Polishing - add tx() to ImapIdleChannelAdapterSpec

More Polishing

Rename `Mail.fromMail()` to `Mail.toStringTransformer()` to better reflect reality
2016-11-11 12:34:33 -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
507764a3d6 INT-4153: Feed Java DSL and other improvements
JIRA: https://jira.spring.io/browse/INT-4153

* Remove deprecated `FeedFetcher` usage
* Introduce `Resource` based ctor for the `FeedEntryMessageSource`
* Add `SyndFeedInput` option and short-hand `preserveWireFeed` for internal `SyndFeedInput` instance
* Reflect the changes in the XSD for Feed
* Change ROME dependency from deprecated `rome-fetcher` to just `rome` as it is recommended by ROME team
* Port Java DSL for Feed module and reflect aforementioned changes in the `Feed` factory and `FeedEntryMessageSourceSpec` as well
* Document changes and mention Feed Java DSL, too
2016-11-10 14:44:23 -05:00
Artem Bilan
1871b11e85 INT-4160: Port Scripts DSL
JIRA: https://jira.spring.io/browse/INT-4160

* Rename `Scripts.script()` to processor() for better context
* Add `Scripts.messageSource()` for the `ScriptMessageSourceSpec`
* Redo `DslScriptExecutingMessageProcessor` logic to deal with `GroovyScriptExecutingMessageProcessor` via reflection, since that class is a part of `SI-Groovy` module
* Upgrade to `JRuby-9.1.5.0`

* Get rid of reflection in the `DslScriptExecutingMessageProcessor`
* Introduce `ScriptExecutingProcessorFactory` and its `GroovyAwareScriptExecutingProcessorFactory` extension in the `groovy` module
* Register `GroovyAwareScriptExecutingProcessorFactory` as a bean via `GroovyIntegrationConfigurationInitializer`
* Use bean for `ScriptExecutingProcessorFactory.BEAN_NAME` in the `DslScriptExecutingMessageProcessor` to populate `delegate` and fallback to the regular `ScriptExecutingMessageProcessor` instantiation if there is no such a `ScriptExecutingProcessorFactory.BEAN_NAME` bean
2016-11-10 14:24:01 -05:00
Artem Bilan
47cd4e4540 INT-4012: PriorityChannel refinement
JIRA: https://jira.spring.io/browse/INT-4012

Previously to configure a `priority` for the `MessageChannel` we should configure `QueueChannel` for particular `MessageStore`.
Although the target priority logic is really in the `MessageStore` implementation, it isn't so obvious why we can't use `PriorityChannel` instance for `MessageStore` case as well.

* Add `PriorityCapableChannelMessageStore` and `MessageGroupQueue` based ctors to the `PriorityChannel` for consistency.
* Delegate the logic to the super `QueueChannel` as before
* Rework `PointToPointChannelParser` and Java DSL components to reflect a new state of the `PriorityChannel`
* Improve Docs on the matter
2016-11-10 14:19:26 -05:00
Artem Bilan
8fd4564f80 INT-3870: Un@Ignore IP and JMS tests
JIRA: https://jira.spring.io/browse/INT-3870

Looks like something has been changed in the IP and JMS modules or their dependencies.
Right now they pass (on Windows) independently of the way to run testing (Gradle or from IDE)
2016-11-10 12:56:16 -05:00
Artem Bilan
4cb456c074 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 10:34:57 -05:00
Gary Russell
65ec234697 INT-4162: TCP/UDP DSL
JIRA: https://jira.spring.io/browse/INT-4162

INT-4162: IP DSL - Phase I Connection Factories

Phase 2 - Adapters/Gateways

Phase 3 - UDP

Polishing - PR Comments

Remove unnecessary generics.

More Polishing - PR Comments

Checkstyle/Javadoc Fixes

ComponentsRegistration Improvements

Add ...Spec CTORs to avoid the issue described here:
https://github.com/spring-projects/spring-integration-java-dsl/issues/137

Also other PR comments.

Fix UDP Spec Inheritance

Jdbc Lock Test Log Adjuster

Fix Mongo Test Race Conditions

* Fox typos in the `AbstractUdpOutboundChannelAdapterSpec`
* Improve `IpIntegrationTests.testUdpInheritance()`
* Change `fixed-rate` to `fixed-delay` in the `MongoDbInboundChannelAdapterIntegrationTests-context` to pursue single-threaded environment from poller for test
2016-11-09 17:56:14 -05:00
Romain Purchla
46348291ff Upgrade Jsch to 0.1.54: Fix SFTP stream connection
(cherry picked from commit 7408afb)
2016-11-08 11:44:40 -05:00
Artem Bilan
7ad8f50a47 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:31:58 -05:00
Gary Russell
12ef5cfaa8 TCP Serializer/Deserializer Factory Class
To simplify Java config and in preparation for DSL support.

Polishing; rename class; lengthen method names
2016-11-07 14:13:50 -05:00
Artem Bilan
2aadf5ee3d Fix receiveOnlyAdviceChain condition
https://build.spring.io/browse/INT-MASTER-415/

The `Stream` `Collectors.toList()` returns empty list if nothing pass the `.filter()`, therefore condition as `if (receiveOnlyAdviceChain != null)` is not enough
and since `SourcePollingChannelAdapter.applyReceiveOnlyAdviceChain()` doesn't have conditions as well, the target `MessageSource` is proxyed for nothing.
When `TransactionSynchronizationManager.getResource(this)` is called for the `MessageSource` it can't find it because the proxy doesn't match an original object.

* Make condition as `if (!CollectionUtils.isEmpty(receiveOnlyAdviceChain))` in the `AbstractPollingEndpoint` and `SourcePollingChannelAdapter`
* Increase group removal wait timeout in the `gemfire.DelayerHandlerRescheduleIntegrationTests`
2016-11-07 10:02:39 -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
cfceca8518 INT-4157: Migrate JMS DSL
JIRA: https://jira.spring.io/browse/INT-4157

- Refactor the core message-driven endpoint to be `MessageProducerSupport`, eliminating the DSL wrapper
- Retain and refactor the DSL gateway wrapper - still required because it needs to be a MGS
- Port the (core) `Channels` factory

Fix Javadoc

Remove Deprecated setter

Move JmsInboundGateway to the jms Package

* Some polishing for `@Copyright`s
* Remove `@Deprecated` methods in the `Jms`
* Reinstate `IntegrationFlows.from(Function<Channels, MessageChannelSpec<?, ?>>)`
* Typos fixes in the `JmsTests`
2016-11-03 13:06:08 -04:00
Gary Russell
e0b0c29ce1 INT-4152: Migrate AMQP DSL
JIRA: https://jira.spring.io/browse/INT-4152

Move the AMQP DSL implementation to spring-integration-amqp.

Polishing
2016-11-02 19:35:47 -04:00
Artem Bilan
bde1efa9ee INT-4133: Merge Java DSL Core functionality
JIRA: https://jira.spring.io/browse/INT-4133

Mostly copy/paste and changes according Java 8 and Reactor 3.0 foundations

Fix `IntegrationFlow` JavaDocs

Increase timeout in the `AbstractCorrelatingMessageHandlerTests`

Polishing - reduce timeout after first expire attempt
2016-11-02 13:49:35 -04:00
Artem Bilan
2f0b377cfb INT-4091: Aggregator: Removal for Empty Groups
JIRA: https://jira.spring.io/browse/INT-4091

When `empty-group-min-timeout` is configured and `expireGroupsUponCompletion == false` and normal or partial sequences group release happens,
schedule the group for removal after `empty-group-min-timeout`, since it is empty already.
That lets to avoid `MessageGroupStoreReaper` configuration just for cleaning empty groups.

* Retrieve the group `lastModified` to check if group is still valid for removal
* Remove `ScheduledFeature` in the remove task
* Polishing for debug messages to reflect the current logic
* Reschedule empty group removal task in case of `InterruptedException` on the `lock.lockInterruptibly()`
* Fix typos in docs

Fix race condition between `groupStore.expireMessageGroups()`and `TaskScheduler`  in the `AbstractCorrelatingMessageHandlerTests.testReaperReapsAnEmptyGroupAfterConfiguredDelay()`

Also check groupSize for removal decision

Address PR comments
2016-11-01 13:50:09 -04:00
Artem Bilan
9ae8f329d7 Reinstate public ctor for ReplyContainerProperties
The `JmsOutboundGateway.ReplyContainerProperties` and really can be used for options, like in the Java DSL.

Revert changes which applied package protected modifier for ctor and reinstate `public` ctor consequently
2016-11-01 13:43:19 -04:00
Gary Russell
dfa061f1cc INT-4151: MessageSource Advice Improvement
JIRA: https://jira.spring.io/browse/INT-4151

If the `MessageSource` is already a proxy, we only advise the `receive()` method.
If it's not, we advise all methods, which is incorrect.

* Use `NameMatchMethodPointcutAdvisor` in all advising cases
* Prove with the test case that only `receive()` method is advised for the `MessageSource` proxy
2016-10-31 17:29:25 -04:00
Artem Bilan
0488b1e2ec Fix AggregatorParserTests according latest SF
Fix JavaDocs for the `IntegrationComponentScan`
2016-10-31 15:30:09 -04: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
Artem Bilan
16be9fc47d INT-3502: filters for @IntegrationComponentScan
JIRA: https://jira.spring.io/browse/INT-3502

For some use-cases it is really useful to filter `@MessagingGateway` components as any other `@ComponentScan` capable.

* Add `useDefaultFilters()`, `includeFilters()` and `excludeFilters()` to the `@IntegrationComponentScan`
* Modify `GatewayInterfaceTests` to reflect changes and be sure that logic is applied properly
2016-10-28 15:26:21 -04:00
Gary Russell
49638fdea2 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.
2016-10-28 11:31:13 -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
Gary Russell
9225c514fe Core Lambdas - Phase 1 src/main
Also package-protect private inner class ctors.

Core Lambdas - Phase 2 src/test
2016-10-26 18:02:38 -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
c865d38576 More Lambdas
Also, make inner ctors package rather than private to avoid the synthetic class and method
the compiler has to create.

See: http://stackoverflow.com/questions/921025/eclipse-warning-about-synthetic-accessor-for-private-static-nested-classes-in-jav

JMX Lambdas

Polishing - clean up

More
2016-10-26 09:54: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
Andriy Kryvtsun
ee848e9ecf 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**
2016-10-25 10:52:30 -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
e6c70b5cc6 File Streaming Doc Polishing
http://stackoverflow.com/questions/40135591/get-string-from-spring-ftp-streaming-inbound-channel-adapter/40136021#40136021

Show an example for removing the remote file after processing.
2016-10-23 10:16:40 -04:00
Artem Bilan
93d932c095 SftpOutboundGateway: DFA -> Method Invocation
**Cherry-pick to 4.3.x**

Polishing - Make Method Accessible
2016-10-23 09:59:48 -04:00
Gary Russell
2ad0a44083 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
2016-10-20 15:02:33 -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
5d04e31e42 4.0.0 amqp-client compatibility (test channel) 2016-10-18 15:58:23 -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
Gary Russell
3c284871c3 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.
2016-10-17 14:49:30 -04:00
Gary Russell
8d70463c7a Update spring-retry to 1.2.0.RC1 2016-10-14 10:44:45 -04:00
Artem Bilan
a1f554c04d INT-2460: Remove Message Modification Logic in MS
JIRA: https://jira.spring.io/browse/INT-2460,
https://jira.spring.io/browse/INT-4122

Since the main purpose of the `MessageStore` to persist message for durability and only,
it doesn't make sense to modify `Message` for additional headers like `SAVED` and `CREATED_DATE`.
Such a logic should be a part of metadata stored together with the message.
And it is provided by the out-of-the-box `MessageStore` implementation.
In addition we free ourselves from the reflection operations to retain `ID` and `TIMESTAMP` headers when we add `SAVED` and `CREATED_DATE`

* Control "already saved" logic in the `JdbcMessageStore`s via `DuplicateKeyException` on the `INSERT`.
This is much effective then additional `SELECT` in case of `SAVED` before
* Control "already saved" logic in the  `AbstractConfigurableMongoDbMessageStore` via `DuplicateKeyException` on the `INSERT`.
Since `MongoDbMessageStore` doesn't provide extra `messageId` field, perform extra `SELECT` before store document.
Anyway the `MongoDbMessageStore` isn't recommended for use.
We may consider to deprecate it
* Control "already saved" logic  in the `AbstractKeyValueMessageStore` via `putIfAbsent` operation

With this fix we persist message in the store as is without any modifications when we perform standard serialization procedure.
Any custom serializers should consider to use `MutableMessageBuilder` if there is a requirement to retain `ID` and `TIMESTAMP`

Rework `MongoDbMetadataStore.putIfAbsent()` to normal `findAndModify()` with particular `$setOnInsert`.
Technically the MongoDB query looks like:
```
db.collection.findAndModify({
  query: { _id: $key },
  update: {
    $setOnInsert: { value: $value } // perform modification only on upsert
  },
  new: false,   // don't return new doc if one is upserted
  upsert: true // insert the document if it does not exist
})
```

Move single import to the appropriate JavaDoc

Polishing after rebase
DEBUG messages in `doStoreIfAbsent()` implementations

* To keep track of the extra message information in the `MessageStore`, without `Message` modification, introduce `MessageMetadata` and `MessageHolder`
* Add `MessageStore#getMessageMetadata()`
* Modify MongoDb `MessageStore` to add extra `timestamp` for individual message
* Fix `ConcurrentAggregatorTests` race condition.
Since currently the default release strategy is `SimpleSequenceSizeReleaseStrategy` which is just based on the `MessageGroup` size, there is no guaranty which messages will complete the group in concurrent environment.
The test is really based on the `SequenceAwareMessageGroup` logic to discard the message with the same `correlationId`

Fix `@Copyright` format

Move cast to `MessageHolder` after `Assert.isInstanceOf(MessageHolder.class, messageHolder)`

Retain backward compatibility in the `AbstractKeyValueMessageStore`

Polishing
2016-10-13 13:19:37 -04:00