CronTrigger expressions may now contain any amount of whitespace between fields. Also, removed inaccessible core TestUtils dependency from the mail module.
This commit is contained in:
@@ -26,10 +26,11 @@ import javax.mail.internet.MimeMessage;
|
||||
import org.easymock.classextension.EasyMock;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.message.Message;
|
||||
import org.springframework.integration.scheduling.SimpleTaskScheduler;
|
||||
import org.springframework.integration.scheduling.TaskScheduler;
|
||||
import org.springframework.integration.util.TestUtils;
|
||||
|
||||
/**
|
||||
* @author Jonas Partner
|
||||
@@ -41,7 +42,7 @@ public class SubscribableMailSourceTests {
|
||||
javax.mail.Message message = EasyMock.createMock(MimeMessage.class);
|
||||
StubFolderConnection folderConnection = new StubFolderConnection(message);
|
||||
QueueChannel channel = new QueueChannel();
|
||||
TaskScheduler scheduler = TestUtils.createTaskScheduler(5);
|
||||
TaskScheduler scheduler = new SimpleTaskScheduler(new SimpleAsyncTaskExecutor());
|
||||
scheduler.start();
|
||||
ListeningMailSource mailSource = new ListeningMailSource(folderConnection);
|
||||
mailSource.setTaskScheduler(scheduler);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class CronSequenceGenerator {
|
||||
/**
|
||||
* Construct a {@link CronSequenceGenerator} from the pattern provided.
|
||||
*
|
||||
* @param pattern a single space separated list of time fields
|
||||
* @param pattern a space separated list of time fields
|
||||
*
|
||||
* @throws IllegalArgumentException if the pattern cannot be parsed
|
||||
*/
|
||||
@@ -175,7 +175,7 @@ public class CronSequenceGenerator {
|
||||
* @param expression
|
||||
*/
|
||||
private void parse(String expression) throws IllegalArgumentException {
|
||||
String[] fields = StringUtils.delimitedListToStringArray(expression, " ");
|
||||
String[] fields = StringUtils.tokenizeToStringArray(expression, " ");
|
||||
if (fields.length != 6) {
|
||||
throw new IllegalArgumentException(String.format("Expression must consist of 6 fields (found %d in %s)",
|
||||
fields.length, expression));
|
||||
|
||||
Reference in New Issue
Block a user