Commit Graph

71 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Mark Fisher
2dfbc8f355 versionless schemas for mail module 2011-10-10 13:30:50 -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
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
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
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
Gary Russell
076a0dad1f INT-1848 Add order Attribute (mail) 2011-04-30 13:39:13 -04:00
Oleg Zhurakousky
faee3ec1a6 INT-1839 fixed AbstractMailReceiver to be compliant with MailReceiver interface and throw javax.mail.MessagingException 2011-03-24 07:54:17 -04:00
Oleg Zhurakousky
d16ba3061d INT-1804 removed custom matcher function in favor of the already existing Regex support in SpEL 2011-03-09 08:26:51 -05:00
Oleg Zhurakousky
ff46bec6ad INT-1804, INT-1825 finished up with support for filtering email messages and flagging messages with arbitrary flags if RECENT flag is not supported (e.g., GMAIL) 2011-03-08 15:43:41 -05:00
Oleg Zhurakousky
7c83bb17c6 INT-1824, INT-1825 1. Fixed INT-1824
2. Flagged all messages that passed ImapMailReceiver with either system flag (Flag.FLAGGED) or user flag (if supported. there is a check for that as well)
3. Modified initial SearchTerm (see compileSearchTerms()) to include checking for such flags. Now both IMAP IDLE and IMAP Polling only receive messages that are NOT SEEN and NOT FLAGGED with system or user flags.
4. Folder is now always opened in READ-WRITE mode.
5. Set PEEK flag on every incoming message to 'true' before the messages are fetched.
2011-03-07 10:32:51 -05:00
Oleg Zhurakousky
e1b51bec3a INT-1801 fixed the NPE during shutdown of Mail receiver, fixed the dead code in ImapIdleChannelAdapter, polished IdleTask (it now throws IllegalStateException which means resubmit after delay or SI MessagingException if resubmit flag is set to 'false') 2011-03-01 09:02:58 -05:00
Oleg Zhurakousky
c86ad76323 INT-1713 added content-type to Mail Header Enricher 2011-01-20 12:18:14 -05:00
Oleg Zhurakousky
93511fa616 INT-1713 fixed test 2011-01-20 12:06:13 -05:00
Oleg Zhurakousky
1d78a113ef INT-1713 added initial support for sending a Mail message with content type 2011-01-20 12:05:15 -05:00
Oleg Zhurakousky
bc9c189ef4 INT-1701 added reconnect logic to ImapIdleChannelAdapter 2011-01-08 12:07:19 -05:00
Oleg Zhurakousky
fb08b166a5 INT-1712 fixed typo in the test 2010-12-22 16:06:55 -05:00
Oleg Zhurakousky
7519200d43 INT-1712 added more assertioins to the test 2010-12-22 15:46:43 -05:00
Oleg Zhurakousky
b4d56160ec INT-1712 fixed the way MailOutboundChannelAdapterParser sets the javaMailProperties 2010-12-22 15:42:29 -05:00
Mark Fisher
d0f1fdde10 fixing typos in comments and tests 2010-11-22 18:28:02 -05:00
Gary Russell
3af7a939db INT-1624 @author tags 2010-11-17 16:13:02 -05:00
Gary Russell
031ab1424e INT-1624 Add error-channel to imap idle inbound channel adapter XSD, Parser, Test 2010-11-17 15:53:13 -05:00
Mark Fisher
53b132b7b5 removed unused imports 2010-11-05 18:48:58 -04:00
Oleg Zhurakousky
daa25d30e3 INT-1475 more polishing code and actually fixed an invalid test 2010-09-23 21:57:35 -04:00
Oleg Zhurakousky
325f8cff71 INT-1475 polishing code 2010-09-23 21:36:28 -04:00
Oleg Zhurakousky
76fc874be4 INT-1475, addressed the issue. Made 'should-delete-messages' required by the schema and added tests to validate it. Added more tests for Pop3MailReceiever. Modified documentation to explain the change and reasoning behind the change 2010-09-23 20:43:44 -04:00
Oleg Zhurakousky
5209db5793 INT-1475 fixed the 'flderOpenMode' setting to ensure that it is set to TRUE if deleteMessages flag is set to TRUE, introduced bunchof test cases to make sure that these setting are covered and could be cought in the future if more refactoring is required 2010-09-23 13:46:31 -04:00
Oleg Zhurakousky
b6e058c59b INT-1263, added more changes and tests related valdating MessageHistory in every module 2010-09-22 18:44:51 -04:00
Oleg Zhurakousky
c4d31af848 INT-1257, added tests and minor modification to support MessageHistory in MAIL, JDBC, IP, HTTP modules 2010-09-21 22:15:37 -04:00
Oleg Zhurakousky
ce5a597658 INT-1415 more polishing 2010-09-17 12:39:12 -04:00
Oleg Zhurakousky
c14f29e9b6 INT-1415 more polishing 2010-09-17 12:14:01 -04:00
Oleg Zhurakousky
00f777366f INT-1415 added check for expanged messages, see JIRA for more details on this issue 2010-09-17 11:25:03 -04:00
Oleg Zhurakousky
6421c1cf78 INT-1375, moved 'shouldMarkMessagesAsRead' attribute to ImapMailReceiver, added additional test for when attribute is not set onthe namespace (e.g., null in other words) 2010-09-17 09:17:11 -04:00