Commit Graph

130 Commits

Author SHA1 Message Date
Artem Bilan
f3d3f4ee4b INT-2998: Channel Adapters' Lifecycle Refactoring
* Add XSD attributeGroup `smartLifeCycleAttributeGroup`
* Use it for all adapters tags
* Refactoring `AbstractChannelAdapterParser` hierarchy
* Refactoring some `MessageHandler`'s that should not have `autoStartup` & `phase`.
    It is the responsibility of `AbstrctEndpoint`
* Polishing some tests according new logic

JIRA: https://jira.springsource.org/browse/INT-2998

INT-2998: Polishing

Polishing

 - Reformat schemas where indentation changed
 - Add SLC to the UDP inbound adapter
2013-09-23 17:58:58 -04:00
Gary Russell
52b340956f INT-3115 Fix EvaluationContext Initialization
There were several "helper" classes where the context was initialized
in the constructor, before the BeanFactory was passed in.

Generally fixed by adding the BeanFactory to the constructor args.

Other cases where the container-managed bean instantiated a helper
and never passed in the BeanFactory.

Finally, a fix to ExpressionUtils where the caller had a BeanFactory
but the BF did not contain an EvaluationContext factory bean, the
BeanResolver was not set up. This is unlikely in a Spring Integration
application, but added for completeness.

INT-3115 Add a BeanFactory to Test Cases

Change the WARN log in ExpressionUtils to a fatal exception to detect
cases where an EvaluationContext was created without a BeanFactory.

While this was generally in test cases, it also exposed some cases
in code where the context was initialized without a BF.

polishing on merge
2013-08-27 00:28:00 -04:00
Gary Russell
7f008b58c2 INT-1639 Externalize SpEL Evaluation Context
Allow modification of context property accessors and
functions.

Polishing

- Fix tests to ensure the EvaluationContextFactoryBean is
available when necessary.

Polishing - Use Utility for ALL EvaluationContexts

Add Test Showing Custom Function

See SpelTransformerIntegrationTests-context.xml

Polishing

Polishing -fix Remote Sync

Polishing - Emit WARN if No BeanFactory

Polishing - Do Not Override ConversionService

Kludge to Prevent Warning When No BeanFactory

Expressions for method invoking in the MessagingMethodInvokerHelper
don't need a BeanFactory - suppress the warning.

Polishing - PR Comments - Invert Boolean
2013-08-25 20:01:14 -04:00
Gary Russell
5cbdfe9e43 INT-3099 Add IMAP Idle Application Events
Allow an application to be informed of problems on the IMAP idle
thread by emitting an event containing the exception.

Introduce IntegrationApplicationEvent hierarchy for all
events emitted by SI components.

INT-3099 Polishing (PR Comments)

Separate TCP events into discrete subclasses.
2013-08-14 17:42:57 -04:00
Artem Bilan
ecf15a9834 INT-2755: Support 'id' For <chain> Child Elements
* Introduce XSD 'id' attribute for all `<chain>` sub-components
* Register `<chain>` sub-components as Beans with names based on `<chain>` 'id'
* Generate aliases for sub-components based on element 'id'
* Add `<chain>` parser test to check sub-components as Beans within `BeanFactory`
* Ignore `NestedChainParserTests` as abnormal and confused for SI-configs
* Now `<chain>` sub-components are trackable by `MessageHistory`
* Now `<chain>` sub-components are eligible for JMX export
* Polishing some failed tests

https://jira.springsource.org/browse/INT-2755
https://jira.springsource.org/browse/INT-2321

INT-2755: Register as Beans only if 'id' provided

INT-2755: Set 'componentName' for handlers with 'id'

When components within `<chain>` are configured with an 'id' attribute
the 'componentName' of the handler is  constructed as:
chainHandler.componentName + '.' + handler.componentName.
Otherwise it is as was before.

INT-2755: Polishing

INT-2755: changes according PR's comments

* Add INFO about preference of `id` attribute for `<chain>` in the `ChainParser`
* Change `<chain>`'s sub-components `id` generation algorithm
* Configure `<chain>`'s sub-component `componentName` in the `ChainParser` instead of in the `MessageHandlerChain`
* Add `componentName` property to the `JpaOutboundGatewayFactoryBean`
* Add a note to the Reference Manual

INT-2755: Localize duplicate 'id' within chain

INT-2755: remove child beans aliasing

* Polishing tests
* Polishing docs

INT-2755 Polishing: Handle Nested Chain Bean Names

Previously named beans within a nested chain did not get unique
bean names.

INT-2755: Polishing nested chains

Doc Polishing
2013-05-21 12:26:27 -04:00
Gary Russell
c03ecebf19 INT-2991 Filtered Messages Marked SEEN
Missing else clause caused filtered email messages to
still be marked as SEEN. Also marked un-filtered messages
twice if a filter was present.

Add else; add tests.
2013-04-29 10:34:06 -04:00
Gunnar Hillert
0271acaf4c INT-2916 - Upgrade to JUnit 4.11 in support of JDK7
For reference see: https://jira.springsource.org/browse/INT-2916

Changes:

* INT-2919 - Upgrade Spring Data Gemfire to 1.2.2.RELEASE
* Exclude Hamcrest transitive dependency from JUnit (as already explicitly declared)
* Set sourceCompatibility in build.gradle to 1.6
* Set targetCompatibility in build.gradle to 1.6
* Upgrade Hamcrest to 1.3 and fix deprications
  - Corematcher is(*class) change to is(instanceOf(*class))
  - Change org.junit.internal.matchers.TypeSafeMatcher to org.hamcrest.TypeSafeMatcher
  - Change import org.junit.matchers.JUnitMatchers.containsString to org.hamcrest.CoreMatchers.containsString
  - Change import org.junit.matchers.JUnitMatchers.both to org.hamcrest.CoreMatchers.both
  - Change import org.junit.matchers.JUnitMatchers.containsString to org.hamcrest.CoreMatchers.containsString
* Fix JUnit deprecations
  - changed junit.framework.Assert to org.junit.Assert
* Add few missing licenses headers to tests
* Marked several test classes with: @DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD)
  - SplitterIntegrationTests
  - GatewayInvokingMessageHandlerTests
  - FileToChannelIntegrationTests
  - FileInboundChannelAdapterWithRecursiveDirectoryTests
  - JdbcMessageStoreChannelTests
  - ChatMessageInboundChannelAdapterParserTests
* 3 Tests ignored (Still needs to be addressed):
  - testOperationOnPrototypeBean
  - testFailOperationWithCustomScope
  - testOperationOfControlBus
* Update SQL script (test-failure):
  - spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/outboundSchema.sql
  - add drop table statements
  - add ignore-failures="DROPS" to "jdbcOutboundChannelAdapterCommonConfig.xml"

INT-2916 - Code Review Changes

INT-2916 - Fix ignored Tests

Fix 3 previously ignored tests in *GroovyControlBusTests*:

* testOperationOnPrototypeBean
* testFailOperationWithCustomScope
* testOperationOfControlBus

INT-2916 - CI Build Testing

INT-2963 - Remove JDK7 Compilation Warnings

* Upgrade Mockito to 1.9.5
* Fix failing SubscribableJmsChannelTests

INT-2916 - Standardize Hamcrest assertions
Ensure Hamcrest assertions are standardized to: is(instanceOf(...))
2013-04-04 13:40:46 -04:00
Gary Russell
ef29d6b2a2 INT-2913 Fix Looping Mail Tests
Causes excessive CPU utilization and OOM Errors with
Gradle 1.4 (and 1.2 on some platforms).

Stop adapters when tests complete.
2013-02-01 18:58:27 -05:00
Gary Russell
451beb424a INT-2873 Create 3.0 Schemas
Copy schemas, cleanup whitespace, update spring.schemas files,
update version in AbstractIntegrationNamespaceHandler.

For each schema compared the 2.2 version with the 3.0 version
(diff -w), ensuring the only difference is the import of
3.0 schemas (where appropriate) instead of 2.2.
2013-01-25 16:12:00 -05:00
Artem Bilan
2bc3ecb9d7 INT-2845: Gradle: Check XSD Versions in Tests
In many cases IDEs import into test configs Namespace-resources
with hardcoded versions of Spring & Spring Integration XSDs.

This may produce build issues with different Spring versions.

It also causes an issue during the transition to a new Spring Integration version (e.g. 3.0).

* Add Gradle task 'checkTestConfigs' to check test configs for hardcoded resources' versions.
* Add to 'test' task dependency on new task 'checkTestConfigs'
* Fix hadrcoded versions in the test configs.

JIRA: https://jira.springsource.org/browse/INT-2845
2013-01-14 10:45:03 -05:00
Artem Bilan
24bdd39790 INT-2846: ImapMailReceiverTests: fix OS newLine
* Add `trim()` to the actual value
* Remove '\n' from expected value
* Remove redundant Mocks

JIRA: https://jira.springsource.org/browse/INT-2846
2012-12-03 12:40:21 +02:00
Gary Russell
cb87246d47 INT-2820 Shutdown Default Idle Executor
The default executor for sending messages from the IMAP IDLE
channel adapter is a single threaded thread pool.

If the default executor is used (no executor injected), shut
it down when the adapter is stopped.

INT-2820 Polishing

If using the default sendingTaskExecutor, create a new one
when restarted.

Add test to restart adapter after stop.

INT-2820 Polishing

Review comments; protect for null sendingTaskExecutor.
2012-11-20 18:01:01 -05:00
Gary Russell
aa6d4a4ac7 INT-2821 Find Existing Mails if No RECENT Support
Previously, if an IMAP server supports IDLE, but not
RECENT, no existing messages were retrieved until a new
message arrived.

INT-2821 Polishing - Fix Race Condition

Use searchForMessages() when server doesn't support RECENT.

Simply skipping the first idle() doesn't work
because receive() closes the folder, there was a race condition
where a new message could arrive between the previous receive()
and folder.open() in waitForMessages().

Updated mock test so that first call to waitForMessages() finds
messages and does not idle(), and subsequent calls does not
find messages and goes to idle().

Also tested in the debugger against gmail which (at the time of
writing) does not support RECENT.
2012-11-20 12:50:18 -05:00
Mark Fisher
991818275e IntegrationMimeMessage wrapper class is now private 2012-11-05 13:00:37 -05:00
Gary Russell
413d5354a1 INT-2803 Fix Lazy Fetch of Email Messages
INT-2805 Update JavaMail to 1.4.5

There is a need to fetch the entire email message before the folder
is closed. Once the folder is closed, you cannot perform any
more operations on the message.

Prior to RC1, the message was copied, which forced an eager fetch.

Add code to copy the message.

Also, transaction synchronization operations need access to a folder
instance to perform operations, such as delete, on a message.

Add a wrapper to lazily create a folder instance in message.getFolder()
when needed.

Add documentation to explain that messages must be re-fetched before
performing transaction synchronization operations.

JavaMail 1.4.5 is now Open Source, which makes debugging much
easier.
2012-11-05 12:47:35 -05:00
Gary Russell
d8d77a9bbc INT-2800 Add search-term-strategy to IMAP Adapter
Previously, the ability to customize the search term
strategy was added to the IMAP Idle adapter; it should
also be available to the polled IMAP adapter.

Add the attribute.

Remove some obsolete code from the parser.
2012-11-05 12:32:36 -05:00
Oleg Zhurakousky
8c43c59c03 INT-2777 TransactionSynchronization
Ensured that bindings of the resource only happen if TransactionSynchronizationFactory is not null
Add documentation describing the expectation for the unbinding of the resource.

INT-2777 Polishing

Don't set up holder if it's not used.

Doc fixes.
2012-10-11 17:46:45 -04:00
Oleg Zhurakousky
ee91a6ce5a INT-1819 Mail pseudo-tx support
Added pseudo-tx support for Mail inbound adapters
For polling adapters no changes have been made other then returning a javax.mail.Message instead of its copy so
post-tx dispositions could be performed on it.
For Imap IDLE adapter changes are simiar to the once present in SPCA where TX synchronization logic was added to ImapIdleChannelAdapter
Couple of things to note:
First IDLE receives an array of messages while Polling task receives one message which means i need to sendMessage in the Polling task in the separate thread, so for maintaining single thread semantics we have now it uses single thread executor to send Messages
Renamed MSRH to TransactionalResourceHolder since we no longer use 'source' anywhere and in the case of IDLE there is no MessageSource. Its is truly a holder of attributes we want to make available for use (e.g., SpEL)

INT-1819 Polishing

- Change TransactionalResourceHolder to IntegrationResourceHolder
- Make messageSource available as an attribute
- Allow configuration of Executor for ImapIdle adapter
- Add parser test for TX ImapIdle adapter
- Fix bundlor config for mail
- Remove top level <transactional/> element that was added to core
- Restore 'legacy' mail attributes in TX, and add schema doc

INT-1819 Mail TX Reference Docs

Add reference documentation for mail transaction support.

INT-1819 Remove 'public abstract' from interface

Modifiers are not needed on an interface.
2012-09-19 12:12:31 -04:00
Oleg Zhurakousky
94cc5a73e2 INT-2727 PseudoTX Refactoring
Remove the need for pseudo-transactional element

INT-2727 PseudoTX
Add PseudoTransactionalTransactionManager

INT-2727
addressed PR comments
cherry picked previous code for mail module to eliminate breaking change

INT-2727
initial refactoring pseudo-tx support to use common configuration

INT-2727
finalizing pseudo-tx synchronization support

INT-2727 polishing

INT-2727 polishing based on PR comments

INT-2727 addressed PR comments

INT-2727 polishing

INT-2727 Remove PseudoTransactionalMessageSource

Instead of getResource, bind the resource holder before
receive() and then add attributes to the holder.

INT-2727 polishing

INT-2727 Polishing

Remove bind of #resource; add beforeCommit() test;
add TransactionTemplate tests.
2012-09-05 16:55:34 -04:00
Gary Russell
0da9baf26d INT-2702 Mail ThreadLocal Polishing
Change set(null) to remove()

Eliminate folder close from destroy() method. It no longer makes
sense to do that there.
2012-08-16 08:17:02 -04:00
Gary Russell
08cbab08c2 INT-2214, INT-343, INT-2250 MessageHandler Advice
Add general capability to advise just the handleRequestMessage
part of an AbstractReplyProducingMessageHandler.

This is to advise just the immediate operation, and not the
entire downstream flow.

Uses include:

* outbound gateway post processing
* adding retry behavior using spring-retry
* adding circuit breaker functionality

Initial commit for review.

Also need to advise simple message handlers (such as file
etc) to allow them to post-process file operations
with payload.delete(), payload.renameTo(...) etc.

INT-2250 Add Circuit Breaker Advice

INT-343 Add Retry Advice

Stateless and Stateful retry using spring-retry. Stateless
means the RetryTemplate performs the retries internally.
Stateful means the exception is thrown (e.g. to JMS container)
and the retry state is maintained by spring-retry.

INT-2215, INT-343, INT-2250 Refactoring

Factor out common abstract Advice class.

INT-2214 Catch Evaluation Expression Exceptions

If an onSuccess expression evaluation fails, add an
option so the user can decide whether such an exception is
caught, or propagated to the caller.

INT-2214 etc PR Review Polishing

INT-2214 etc Namespace Core, File, FTP

Add <request-handler-advice-chain/> to outbound endpoints.

INT-2214 etc. More Namespace Support

amqp, event, gemfire, groovy, http, ip, jdbc, jms, jmx, jpa, mail, rmi, sftp, twitter, ws, xmpp

INT-2214 etc Polishing

PR Review

INT-2214 etc Polishing

Don't catch Throwable.

Move Advice classes to handler.advice package.
2012-08-06 09:15:58 -04:00
Gary Russell
4de02fa75e INT-2685 Transaction Synchronization
Remove M3 disposition-* attributes on File/(S)FTP inbound adapters.

Add <pseudo-transactional/> and <transaction-synchronization/> elements
to <poller/>.

These elements provide the following attributes:

* on-success-expression
* on-success-result-channel
* on-failure-expression
* on-failure-result-channel
* send-timeout

<transaction-synchronization/> synchronizes these expression evaluations
with the transaction, such that they are executed immediately after
the commit/rollback.

<psuedo-transactional/> is used for a non-transactional poller.

When an <advice-chain/> is provided to the poller, <psuedo-transactional/>
and <transaction-synchronization/> are synonyms; and the behavior is
dictated by whether or not the <advice-chain/> contains a transaction
advice. It is recommended that <pseudo-transactional/> is used when the
<advice-chain/> does not have a txAdvice, and <transaction-synchronization/>
when it does, but the framework does not enforce this.

The expressions have the original (polled) message as the #root variable.
In addition, a BeanResolver is provided, allowing expressions such as
'@someBean.handleSuccess(payload)'.

MessageSources may also implement PseudoTransactionalMessageSource. This
has a number of methods allowing more flexibility in transactional and
non-transactional environents. For example, for backwards compatibility.
the mail-inbound-channel-adapter deletes its polled message after the
receive() rather than after the polled message is sent (when running in
a non-transactional poller). However, when running in a transactional
poller, the delete is done after the transaction commits (but not when
it rolls back).

In addition, MessageSources that implement this interface can optionally
provide an arbitrary object to the success/failure expressions in a
variable named '#resource'.

INT-2685 Polishing

PR Review Comments

Add tests for non-tx PseudoTransactionalMessageSource
2012-08-03 14:04:22 -04:00
Gunnar Hillert
39ee7a4429 INT-2657 - Spelling Error in AbstractMailReceiver
* Also fixed spelling error in *PollableJmsChannelTests*
2012-07-10 22:55:44 -04:00
Gunnar Hillert
e6a5eb925d INT-2656 - Fix Mail Adapter Exceptions
For reference see: https://jira.springsource.org/browse/INT-2656
2012-07-06 18:18:10 -04:00
Artem Bilan
dce4e8ec01 INT-2641: fix JavaDoc warnings
JIRA: https://jira.springsource.org/browse/INT-2641
2012-06-29 09:42:58 -04:00
Gary Russell
066eb91100 INT-1849/INT-2147 Add Disposition to File Adapter
* Add *disposition-expression* to the inbound file adapter. This allows for operations such as *payload.delete()*, *payload.renameTo()* after the file is processed.
* The result of executing the expression (if any) is sent to the disposition-result-channel.
2012-06-25 11:38:20 -04:00
Gary Russell
9bc9867d31 INT-1849/INT-2606 Pseudo Transactional Message Src
Initial commit.

Tested with POP3 and IMAP (James) with Sample app.

Essentially moved all the flagging and deleting code
from receive() to closeContextAfterSuccess().

For non-transactional cases, this new method is
called immediately after receiving the message(s),
essentially working as before.

When run from a <transactional/> poller it is
called using TransactionSynchronization after
the transaction commits.

This behavior can be changed by setting
'symchronized="false"' on the poller, which
removes the synchronization and the update
is called immediately after the receive().

Polishing

PR Comments

Update Reference
2012-06-14 16:55:53 -04:00
Oleg Zhurakousky
7207bb1840 INT-1929 Custom Mail SearchTerms
Add support for overriding default SeatchTerms in ImapMailReceiver

INT-1929 PR comments

Polish Docs
2012-06-07 14:45:16 -04:00
Artem Bilan
45c429ee2b INT-2275: any outbound-channel-adapter in <chain>
Add re-init logic for nested chains
Add logic about nested element for AbstractChannelAdapterParser
Refactor of DefaultOutboundChannelAdapterParser
Test for non-last nested chain with some outbound-channel-adapter
Improve XSD for chain-type
Manual outbound-channel-adapter ability for chain
Integration tests for all outbound-channel-adapter within <chain>
Remove redundant 'return-value-required' attribute from <stored-proc-outbound-channel-adapter>
Add support 'expectReply' for FileWritingMessageHandler

INT-2275 polishing & refactor FileOutbound*Parser

HttpRequestExecutingMessageHandlerTests polishing

INT-2275: polishing JavaDoc
2012-05-14 12:41:39 -04:00
Gary Russell
95cd202be6 INT-2536 Create 2.2 Schemas
Add 2.2 versions of module schemas.

JMX is already covered by an existing pull request.

INT-2536 Schema Check

Bump version for schema check in
AbstractIntegrationNamespaceHandler.

INT-2536 Remove Schema Versions

Some test config files had 2.1 versioned schemas.
2012-05-04 10:04:01 -04:00
Gary Russell
292aa90599 INT-2404 Fix Auto-Created Channel; Event, TCP, UDP
The AbstractChannelAdapterParser creates an implicit DirectChannel
if the adapter has no 'channel' attribute.

The Event, TCP, and UDP channel adapter parsers did not bind
this channel to the adapter and AC initialization failed with
'outputChannel is required'.

Further, the event schema marked the channel as being 'required',
precluding this feature.

INT-2407 Remove Channel use="required"

Parsers automatically generate the channel when none is provided.

- JMX
- JDBC
- SFTP
- Redis
- Feed
- XMPP
- Mail
- FTP
- HTTP
2012-01-23 10:12:34 -05:00
Gary Russell
f76f63f23a NT-2400 Fix tool:expected-type Classes
* MessageChannel was moved from core to the base package.
* ChannelResolver moved from core to support.
* TcpConnectionInterceptorFactoryChain was incorrect.
2012-01-13 13:21:41 -05:00
Gary Russell
89cdef7a90 INT-2373 package-info JMX
INT-2374 package-info Mail

INT-2375 package-info MongoDB

INT-2376 package-info Redis

INT-2377 package-info RMI

INT-2379 package-info Security

INT-2381 package-info Stream
2012-01-05 15:29:48 -05:00
Oleg Zhurakousky
a44d150009 INT-2323
made changes based on Sonar suggestions

added optional rome dependency to HTTP module
2011-12-20 12:12:20 -05:00
Mark Fisher
2dfbc8f355 versionless schemas for mail module 2011-10-10 13:30:50 -04:00
Oleg Zhurakousky
f5fe67ad67 INT-2100 addressed PR comments 2011-09-30 16:30:04 -04:00
Oleg Zhurakousky
675f851ad2 INT-2100 simplified ReceivingTask in ImapIdleChannelAdapter 2011-09-30 15:57:36 -04:00
Oleg Zhurakousky
0e57afe8e8 INT-2106 added support for poller to outboound mail adapter 2011-09-15 07:40:02 -04:00
Oleg Zhurakousky
a716b58055 INT-2104 fixed invalid check for open folder that was precluding ImapIdleChannelAdapter to receive subsequent email messages 2011-09-02 12:21:32 -04:00
Oleg Zhurakousky
4b007c365b removed deprecated use of task-executor 2011-09-01 17:35:03 -04:00
Mark Fisher
9f59001230 removed deprecated trigger sub-elements non-core 2011-08-31 12:54:22 -04:00
Mark Fisher
7c5603fe83 INT-2092 update schema imports to use 2.1 version 2011-08-31 05:26:02 -04:00
Mark Fisher
3e71b5a83b INT-2004 added 2.1 versions of all XML schemas and adjusted spring.schemas files accordingly 2011-08-05 11:07:20 -04:00
Mark Fisher
bb90ffc840 added @Deprecated annotation 2011-07-18 16:59:21 -04:00
Oleg Zhurakousky
36eb5b1ede INT-1923 polished IDLE adapter to accomodate deprecation of task-executor 2011-07-14 15:57:43 -04:00
Oleg Zhurakousky
73c1f3b4ee INT-1923 fixed broken test 2011-07-14 08:34:24 -04:00
Oleg Zhurakousky
286d5afdac INT-1923 refactored to simplify code (removed ResubmittingTask, fixed the use of TaskExecutor, other minor polishing) 2011-07-14 07:58:21 -04:00
Oleg Zhurakousky
e4b72d0b85 INT-1923 refactored Lifecycle support for IMAP adapter that was fixed earlier 2011-07-13 15:38:30 -04:00
Oleg Zhurakousky
9299c36953 INT-1934 changed the name of the element from attachment-file-name to attachment-filename 2011-06-23 15:59:22 -04:00
Oleg Zhurakousky
8737cf85e3 INT-1934 added support for missing Mail Headers to Mail Header Enricher 2011-06-23 15:03:03 -04:00