diff --git a/org.springframework.integration.event/src/main/java/org/springframework/integration/event/ApplicationEventPublishingMessageHandler.java b/org.springframework.integration.event/src/main/java/org/springframework/integration/event/ApplicationEventPublishingMessageHandler.java
index cf764dea3a..91c65fac6b 100644
--- a/org.springframework.integration.event/src/main/java/org/springframework/integration/event/ApplicationEventPublishingMessageHandler.java
+++ b/org.springframework.integration.event/src/main/java/org/springframework/integration/event/ApplicationEventPublishingMessageHandler.java
@@ -24,7 +24,7 @@ import org.springframework.integration.handler.AbstractMessageHandler;
import org.springframework.util.Assert;
/**
- * A {@link MessageHandler} that publishes each {@link Message} it receives as
+ * A {@link org.springframework.integration.message.MessageHandler} that publishes each {@link Message} it receives as
* a {@link MessagingEvent}. The {@link MessagingEvent} is a subclass of
* Spring's {@link ApplicationEvent} used by this adapter to simply wrap the
* {@link Message}.
diff --git a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/FileReadingMessageSource.java b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/FileReadingMessageSource.java
index 14d04c7e01..daa8cce496 100644
--- a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/FileReadingMessageSource.java
+++ b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/FileReadingMessageSource.java
@@ -19,7 +19,6 @@ package org.springframework.integration.file;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
-import org.springframework.core.io.Resource;
import org.springframework.integration.aggregator.Resequencer;
import org.springframework.integration.core.Message;
import org.springframework.integration.core.MessagingException;
@@ -29,7 +28,6 @@ import org.springframework.integration.message.MessageSource;
import org.springframework.util.Assert;
import java.io.File;
-import java.io.IOException;
import java.util.*;
import java.util.concurrent.PriorityBlockingQueue;
@@ -55,212 +53,202 @@ import java.util.concurrent.PriorityBlockingQueue;
*
* FileReadingMessageSource is fully thread-safe under concurrent
* receive() invocations and message delivery callbacks.
- *
+ *
* @author Iwein Fuld
* @author Mark Fisher
*/
public class FileReadingMessageSource implements MessageSource,
- InitializingBean {
+ InitializingBean {
- private static final int INTERNAL_QUEUE_CAPACITY = 5;
+ private static final int INTERNAL_QUEUE_CAPACITY = 5;
- private static final Log logger = LogFactory
- .getLog(FileReadingMessageSource.class);
+ private static final Log logger = LogFactory
+ .getLog(FileReadingMessageSource.class);
- private volatile File inputDirectory;
+ private volatile File directory;
- private volatile boolean autoCreateDirectory = true;
+ private volatile boolean autoCreateDirectory = true;
- /**
- * {@link PriorityBlockingQueue#iterator()} throws
- * {@link java.util.ConcurrentModificationException} in Java 5. There is no
- * locking around the queue, so there is also no iteration.
- */
- private final Queue toBeReceived;
+ /**
+ * {@link PriorityBlockingQueue#iterator()} throws
+ * {@link java.util.ConcurrentModificationException} in Java 5. There is no
+ * locking around the queue, so there is also no iteration.
+ */
+ private final Queue toBeReceived;
- private volatile FileListFilter filter = new AcceptOnceFileListFilter();
+ private volatile FileListFilter filter = new AcceptOnceFileListFilter();
- private volatile FileLocker locker = new NoopFileLocker();
+ private volatile FileLocker locker = new NoopFileLocker();
- private boolean scanEachPoll = false;
+ private boolean scanEachPoll = false;
- /**
- * Creates a FileReadingMessageSource with a naturally ordered queue.
- */
- public FileReadingMessageSource() {
- toBeReceived = new PriorityBlockingQueue(INTERNAL_QUEUE_CAPACITY);
- }
+ /**
+ * Creates a FileReadingMessageSource with a naturally ordered queue.
+ */
+ public FileReadingMessageSource() {
+ toBeReceived = new PriorityBlockingQueue(INTERNAL_QUEUE_CAPACITY);
+ }
- /**
- * Creates a FileReadingMessageSource with a {@link PriorityBlockingQueue}
- * ordered with the passed in {@link Comparator}
- *
- * No guarantees about file delivery order can be made under concurrent
- * access.
- */
- public FileReadingMessageSource(Comparator receptionOrderComparator) {
- toBeReceived = new PriorityBlockingQueue(INTERNAL_QUEUE_CAPACITY,
- receptionOrderComparator);
- }
+ /**
+ * Creates a FileReadingMessageSource with a {@link PriorityBlockingQueue}
+ * ordered with the passed in {@link Comparator}
+ *
+ * No guarantees about file delivery order can be made under concurrent
+ * access.
+ */
+ public FileReadingMessageSource(Comparator receptionOrderComparator) {
+ toBeReceived = new PriorityBlockingQueue(INTERNAL_QUEUE_CAPACITY,
+ receptionOrderComparator);
+ }
- /**
- * Specify the input directory.
- */
- public void setInputDirectory(Resource inputDirectory) {
- Assert.notNull(inputDirectory, "inputDirectory must not be null");
- try {
- this.inputDirectory = inputDirectory.getFile();
- } catch (IOException ioe) {
- try {
- // fallback to the URI
- this.inputDirectory = new File(inputDirectory.getURI());
- } catch (Exception e) {
- throw new IllegalArgumentException(
- "Unexpected IOException when looking for source directory: "
- + inputDirectory, ioe);
- }
- }
- }
+ /**
+ * Specify the input directory.
+ */
+ public void setDirectory(File directory) {
+ Assert.notNull(directory, "directory must not be null");
+ this.directory = directory;
+ }
- /**
- * Specify whether to create the source directory automatically if it does
- * not yet exist upon initialization. By default, this value is
- * true. If set to false and the
- * source directory does not exist, an Exception will be thrown upon
- * initialization.
- */
- public void setAutoCreateDirectory(boolean autoCreateDirectory) {
- this.autoCreateDirectory = autoCreateDirectory;
- }
+ /**
+ * Specify whether to create the source directory automatically if it does
+ * not yet exist upon initialization. By default, this value is
+ * true. If set to false and the
+ * source directory does not exist, an Exception will be thrown upon
+ * initialization.
+ */
+ public void setAutoCreateDirectory(boolean autoCreateDirectory) {
+ this.autoCreateDirectory = autoCreateDirectory;
+ }
- /**
- * Sets a {@link FileListFilter}. By default a
- * {@link AcceptOnceFileListFilter} with no bounds is used. In most cases a
- * customized {@link FileListFilter} will be needed to deal with
- * modification and duplication concerns. If multiple filters are required a
- * {@link CompositeFileListFilter} can be used to group them together.
- *
- * The supplied filter must be thread safe..
- */
- public void setFilter(FileListFilter filter) {
- Assert.notNull(filter, "'filter' must not be null");
- this.filter = filter;
- if (filter instanceof FileLocker && locker instanceof NoopFileLocker) {
- this.locker = (FileLocker) filter;
- }
- }
+ /**
+ * Sets a {@link FileListFilter}. By default a
+ * {@link AcceptOnceFileListFilter} with no bounds is used. In most cases a
+ * customized {@link FileListFilter} will be needed to deal with
+ * modification and duplication concerns. If multiple filters are required a
+ * {@link CompositeFileListFilter} can be used to group them together.
+ *
+ * The supplied filter must be thread safe..
+ */
+ public void setFilter(FileListFilter filter) {
+ Assert.notNull(filter, "'filter' must not be null");
+ this.filter = filter;
+ if (filter instanceof FileLocker && locker instanceof NoopFileLocker) {
+ this.locker = (FileLocker) filter;
+ }
+ }
- /**
- * Optional. Sets a
- * {@link org.springframework.integration.file.locking.FileLocker} to be
- * used instead of the default NoopFileLocker. Note that the locker is not
- * queried by this FileReadingMessageSource: integration with a
- * FileListFilter is an external concern.
- *
- * The supplied FileLocker must be thread safe
- */
- public void setLocker(FileLocker locker) {
- Assert.notNull(locker, "'fileLocker' must not be null.");
- this.locker = locker;
- }
+ /**
+ * Optional. Sets a
+ * {@link org.springframework.integration.file.locking.FileLocker} to be
+ * used instead of the default NoopFileLocker. Note that the locker is not
+ * queried by this FileReadingMessageSource: integration with a
+ * FileListFilter is an external concern.
+ *
+ * The supplied FileLocker must be thread safe
+ */
+ public void setLocker(FileLocker locker) {
+ Assert.notNull(locker, "'fileLocker' must not be null.");
+ this.locker = locker;
+ }
- /**
- * Optional. Set this flag if you want to make sure the internal queue is
- * refreshed with the latest content of the input directory on each poll.
- *
- * By default this implementation will empty its queue before looking at the
- * directory again. In cases where order is relevant it is important to
- * consider the effects of setting this flag. The internal
- * {@link PriorityBlockingQueue} that this class is keeping will more likely
- * be out of sync with the filesystem if this flag is set to
- * false, but it will change more often (causing reordering) if
- * it is set to true.
- */
- public void setScanEachPoll(boolean scanEachPoll) {
- this.scanEachPoll = scanEachPoll;
- }
+ /**
+ * Optional. Set this flag if you want to make sure the internal queue is
+ * refreshed with the latest content of the input directory on each poll.
+ *
+ * By default this implementation will empty its queue before looking at the
+ * directory again. In cases where order is relevant it is important to
+ * consider the effects of setting this flag. The internal
+ * {@link PriorityBlockingQueue} that this class is keeping will more likely
+ * be out of sync with the filesystem if this flag is set to
+ * false, but it will change more often (causing reordering) if
+ * it is set to true.
+ */
+ public void setScanEachPoll(boolean scanEachPoll) {
+ this.scanEachPoll = scanEachPoll;
+ }
- public final void afterPropertiesSet() {
- if (!this.inputDirectory.exists() && this.autoCreateDirectory) {
- this.inputDirectory.mkdirs();
- }
- Assert.isTrue(this.inputDirectory.exists(), "Source directory ["
- + inputDirectory + "] does not exist.");
- Assert.isTrue(this.inputDirectory.isDirectory(), "Source path ["
- + this.inputDirectory + "] does not point to a directory.");
- Assert.isTrue(this.inputDirectory.canRead(), "Source directory ["
- + this.inputDirectory + "] is not readable.");
- }
+ public final void afterPropertiesSet() {
+ Assert.notNull(directory, "'directory' must not be set before initialization");
+ if (!this.directory.exists() && this.autoCreateDirectory) {
+ this.directory.mkdirs();
+ }
+ Assert.isTrue(this.directory.exists(), "Source directory ["
+ + directory + "] does not exist.");
+ Assert.isTrue(this.directory.isDirectory(), "Source path ["
+ + this.directory + "] does not point to a directory.");
+ Assert.isTrue(this.directory.canRead(), "Source directory ["
+ + this.directory + "] is not readable.");
+ }
- public Message receive() throws MessagingException {
- Message message = null;
- // rescan only if needed or explicitly configured
- if (scanEachPoll || toBeReceived.isEmpty()) {
- scanInputDirectory();
- }
- File file = toBeReceived.poll();
- // file == null means the queue was empty
- // we can't rely on isEmpty for concurrency reasons
- while (file != null && !locker.lock(file)) {
- file = toBeReceived.poll();
- }
- if (file != null) {
- message = MessageBuilder.withPayload(file).build();
- if (logger.isInfoEnabled()) {
- logger.info("Created message: [" + message + "]");
- }
- }
- return message;
- }
+ public Message receive() throws MessagingException {
+ Message message = null;
+ // rescan only if needed or explicitly configured
+ if (scanEachPoll || toBeReceived.isEmpty()) {
+ scanInputDirectory();
+ }
+ File file = toBeReceived.poll();
+ // file == null means the queue was empty
+ // we can't rely on isEmpty for concurrency reasons
+ while (file != null && !locker.lock(file)) {
+ file = toBeReceived.poll();
+ }
+ if (file != null) {
+ message = MessageBuilder.withPayload(file).build();
+ if (logger.isInfoEnabled()) {
+ logger.info("Created message: [" + message + "]");
+ }
+ }
+ return message;
+ }
- private void scanInputDirectory() {
- File[] fileArray = inputDirectory.listFiles();
- if (fileArray == null) {
- throw new MessagingException("The path [" + this.inputDirectory
- + "] does not denote a properly accessible directory.");
- }
- List filteredFiles = this.filter.filterFiles(fileArray);
- Set freshFiles = new HashSet(filteredFiles);
- if (!freshFiles.isEmpty()) {
- toBeReceived.addAll(freshFiles);
- if (logger.isDebugEnabled()) {
- logger.debug("Added to queue: " + freshFiles);
- }
- }
- }
+ private void scanInputDirectory() {
+ File[] fileArray = directory.listFiles();
+ if (fileArray == null) {
+ throw new MessagingException("The path [" + this.directory
+ + "] does not denote a properly accessible directory.");
+ }
+ List filteredFiles = this.filter.filterFiles(fileArray);
+ Set freshFiles = new HashSet(filteredFiles);
+ if (!freshFiles.isEmpty()) {
+ toBeReceived.addAll(freshFiles);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Added to queue: " + freshFiles);
+ }
+ }
+ }
- /**
- * Adds the failed message back to the 'toBeReceived' queue.
- */
- public void onFailure(Message failedMessage, Throwable t) {
- if (logger.isWarnEnabled()) {
- logger.warn("Failed to send: " + failedMessage);
- }
- toBeReceived.offer(failedMessage.getPayload());
- }
+ /**
+ * Adds the failed message back to the 'toBeReceived' queue.
+ */
+ public void onFailure(Message failedMessage, Throwable t) {
+ if (logger.isWarnEnabled()) {
+ logger.warn("Failed to send: " + failedMessage);
+ }
+ toBeReceived.offer(failedMessage.getPayload());
+ }
- /**
- * The message is just logged. It was already removed from the queue during
- * the call to receive()
- */
- public void onSend(Message sentMessage) {
- if (logger.isDebugEnabled()) {
- logger.debug("Sent: " + sentMessage);
- }
- }
+ /**
+ * The message is just logged. It was already removed from the queue during
+ * the call to receive()
+ */
+ public void onSend(Message sentMessage) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Sent: " + sentMessage);
+ }
+ }
- /**
- * Implementation of FileLocker that doesn't provide any protection against
- * duplicate listing.
- */
- class NoopFileLocker implements FileLocker {
+ /**
+ * Implementation of FileLocker that doesn't provide any protection against
+ * duplicate listing.
+ */
+ class NoopFileLocker implements FileLocker {
- public boolean lock(File fileToLock) {
- return true;
- }
+ public boolean lock(File fileToLock) {
+ return true;
+ }
- public void unlock(File fileToUnlock) {
- // noop
- }
- }
+ public void unlock(File fileToUnlock) {
+ // noop
+ }
+ }
}
diff --git a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileReadingMessageSourceFactoryBean.java b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileReadingMessageSourceFactoryBean.java
index 0b8d76679d..1d21c08dc8 100644
--- a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileReadingMessageSourceFactoryBean.java
+++ b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileReadingMessageSourceFactoryBean.java
@@ -16,20 +16,18 @@
package org.springframework.integration.file.config;
-import java.io.File;
-import java.util.Comparator;
-
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.ResourceLoaderAware;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.ResourceEditor;
import org.springframework.core.io.ResourceLoader;
import org.springframework.integration.file.FileListFilter;
import org.springframework.integration.file.FileReadingMessageSource;
-import org.springframework.util.Assert;
+
+import java.io.File;
+import java.util.Comparator;
/**
* @author Mark Fisher
+ * @author Iwein Fuld
* @since 1.0.3
*/
public class FileReadingMessageSourceFactoryBean implements FactoryBean, ResourceLoaderAware {
@@ -38,7 +36,7 @@ public class FileReadingMessageSourceFactoryBean implements FactoryBean, Resourc
private volatile ResourceLoader resourceLoader;
- private volatile String directory;
+ private volatile File directory;
private volatile FileListFilter filter;
@@ -55,11 +53,7 @@ public class FileReadingMessageSourceFactoryBean implements FactoryBean, Resourc
this.resourceLoader = resourceLoader;
}
- public void setDirectory(String directory) {
- Assert.hasText(directory, "directory must not be empty");
- if (directory.indexOf(':') == -1) {
- directory = "file:" + directory;
- }
+ public void setDirectory(File directory) {
this.directory = directory;
}
@@ -101,9 +95,7 @@ public class FileReadingMessageSourceFactoryBean implements FactoryBean, Resourc
}
this.source = (this.comparator != null) ?
new FileReadingMessageSource(this.comparator) : new FileReadingMessageSource();
- ResourceEditor editor = new ResourceEditor(this.resourceLoader);
- editor.setAsText(this.directory);
- this.source.setInputDirectory((Resource) editor.getValue());
+ this.source.setDirectory(this.directory);
if (this.filter != null) {
this.source.setFilter(this.filter);
}
diff --git a/org.springframework.integration.file/src/main/resources/org/springframework/integration/file/config/spring-integration-file-2.0.xsd b/org.springframework.integration.file/src/main/resources/org/springframework/integration/file/config/spring-integration-file-2.0.xsd
index 896c1e6667..042602e910 100644
--- a/org.springframework.integration.file/src/main/resources/org/springframework/integration/file/config/spring-integration-file-2.0.xsd
+++ b/org.springframework.integration.file/src/main/resources/org/springframework/integration/file/config/spring-integration-file-2.0.xsd
@@ -9,7 +9,6 @@
attributeFormDefault="unqualified">
-
diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/AutoCreateDirectoryTests.java b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/AutoCreateDirectoryTests.java
index b8a46af571..570bddd1b0 100644
--- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/AutoCreateDirectoryTests.java
+++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/AutoCreateDirectoryTests.java
@@ -16,16 +16,15 @@
package org.springframework.integration.file;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-
import org.springframework.core.io.FileSystemResource;
+import java.io.File;
+
+import static org.junit.Assert.assertTrue;
+
/**
* @author Mark Fisher
* @since 1.0.3
@@ -39,7 +38,6 @@ public class AutoCreateDirectoryTests {
private static final String OUTBOUND_PATH = BASE_PATH + File.separator + "outbound";
-
@Before
@After
public void clearDirectories() {
@@ -60,7 +58,7 @@ public class AutoCreateDirectoryTests {
@Test
public void autoCreateForInboundEnabledByDefault() {
FileReadingMessageSource source = new FileReadingMessageSource();
- source.setInputDirectory(new FileSystemResource(INBOUND_PATH));
+ source.setDirectory(new File(INBOUND_PATH));
source.afterPropertiesSet();
assertTrue(new File(INBOUND_PATH).exists());
}
@@ -68,7 +66,7 @@ public class AutoCreateDirectoryTests {
@Test(expected = IllegalArgumentException.class)
public void autoCreateForInboundDisabled() {
FileReadingMessageSource source = new FileReadingMessageSource();
- source.setInputDirectory(new FileSystemResource(INBOUND_PATH));
+ source.setDirectory(new File(INBOUND_PATH));
source.setAutoCreateDirectory(false);
source.afterPropertiesSet();
}
diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceIntegrationTests-context.xml b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceIntegrationTests-context.xml
index d9ac05318a..f6c205b022 100644
--- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceIntegrationTests-context.xml
+++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceIntegrationTests-context.xml
@@ -7,7 +7,7 @@
diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceIntegrationTests.java b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceIntegrationTests.java
index d0e8fbc8fe..be06120137 100644
--- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceIntegrationTests.java
+++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceIntegrationTests.java
@@ -16,21 +16,8 @@
package org.springframework.integration.file;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-
-import java.io.File;
-import java.util.concurrent.CountDownLatch;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.*;
import org.junit.runner.RunWith;
-
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.core.Message;
@@ -38,6 +25,11 @@ import org.springframework.test.annotation.Repeat;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import java.io.File;
+import java.util.concurrent.CountDownLatch;
+
+import static org.junit.Assert.*;
+
/**
* @author Iwein Fuld
*/
@@ -82,7 +74,7 @@ public class FileReadingMessageSourceIntegrationTests {
@Test
public void configured() throws Exception {
DirectFieldAccessor accessor = new DirectFieldAccessor(pollableFileSource);
- assertEquals(inputDir, accessor.getPropertyValue("inputDirectory"));
+ assertEquals(inputDir, accessor.getPropertyValue("directory"));
}
@Test
diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceTests.java b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceTests.java
index b1ea3833c3..d878395a6f 100644
--- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceTests.java
+++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceTests.java
@@ -16,14 +16,11 @@
package org.springframework.integration.file;
-import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import static org.mockito.Mockito.*;
-import org.mockito.runners.MockitoJUnit44Runner;
-import org.springframework.core.io.Resource;
+import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.integration.core.Message;
import org.springframework.integration.file.locking.FileLocker;
@@ -31,12 +28,15 @@ import java.io.File;
import java.io.IOException;
import java.util.Comparator;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
/**
* @author Iwein Fuld
* @author Mark Fisher
*/
@SuppressWarnings("unchecked")
-@RunWith(MockitoJUnit44Runner.class)
+@RunWith(MockitoJUnitRunner.class)
public class FileReadingMessageSourceTests {
private FileReadingMessageSource source;
@@ -44,9 +44,6 @@ public class FileReadingMessageSourceTests {
@Mock
private File inputDirectoryMock;
- @Mock
- private Resource inputDirectoryResourceMock;
-
@Mock
private File fileMock;
@@ -57,8 +54,7 @@ public class FileReadingMessageSourceTests {
private Comparator comparator;
public void prepResource() throws Exception {
- when(inputDirectoryResourceMock.exists()).thenReturn(true);
- when(inputDirectoryResourceMock.getFile()).thenReturn(inputDirectoryMock);
+ when(inputDirectoryMock.exists()).thenReturn(true);
when(inputDirectoryMock.canRead()).thenReturn(true);
when(locker.lock(isA(File.class))).thenReturn(true);
}
@@ -67,7 +63,7 @@ public class FileReadingMessageSourceTests {
public void initialize() throws Exception {
prepResource();
this.source = new FileReadingMessageSource(comparator);
- source.setInputDirectory(inputDirectoryResourceMock);
+ source.setDirectory(inputDirectoryMock);
source.setLocker(locker);
}
@@ -131,8 +127,6 @@ public class FileReadingMessageSourceTests {
verify(locker).lock(fileMock);
}
-
-
@Test
public void orderedReception() throws Exception {
File file1 = mock(File.class);
diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests-context.xml b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests-context.xml
index bef019ffa0..add210d348 100644
--- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests-context.xml
+++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests-context.xml
@@ -11,7 +11,7 @@
http://www.springframework.org/schema/integration/file/spring-integration-file.xsd">
diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests.java b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests.java
index 5dd72c685f..2372a7f77f 100644
--- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests.java
+++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests.java
@@ -16,18 +16,9 @@
package org.springframework.integration.file.config;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.util.Comparator;
-import java.util.concurrent.PriorityBlockingQueue;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@@ -37,6 +28,12 @@ import org.springframework.integration.file.FileReadingMessageSource;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import java.io.File;
+import java.util.Comparator;
+import java.util.concurrent.PriorityBlockingQueue;
+
+import static org.junit.Assert.*;
+
/**
* @author Iwein Fuld
* @author Mark Fisher
@@ -69,8 +66,8 @@ public class FileInboundChannelAdapterParserTests {
@Test
public void inputDirectory() {
File expected = new File(System.getProperty("java.io.tmpdir"));
- File actual = (File) accessor.getPropertyValue("inputDirectory");
- assertEquals("'inputDirectory' should be set", expected, actual);
+ File actual = (File) accessor.getPropertyValue("directory");
+ assertEquals("'directory' should be set", expected, actual);
}
@Test
diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithClasspathInPropertiesTests.java b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithClasspathInPropertiesTests.java
index ba372c2719..f6b585c18a 100644
--- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithClasspathInPropertiesTests.java
+++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithClasspathInPropertiesTests.java
@@ -16,14 +16,9 @@
package org.springframework.integration.file.config;
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
@@ -31,6 +26,10 @@ import org.springframework.integration.file.FileReadingMessageSource;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import java.io.File;
+
+import static org.junit.Assert.assertEquals;
+
/**
* @author Iwein Fuld
*/
@@ -51,8 +50,8 @@ public class FileInboundChannelAdapterWithClasspathInPropertiesTests {
@Test
public void inputDirectory() throws Exception {
File expected = new ClassPathResource("").getFile();
- File actual = (File) accessor.getPropertyValue("inputDirectory");
- assertEquals("'inputDirectory' should be set", expected, actual);
+ File actual = (File) accessor.getPropertyValue("directory");
+ assertEquals("'directory' should be set", expected, actual);
}
}
diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithPatternParserTests.java b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithPatternParserTests.java
index a3e3086c37..0e71dd2deb 100644
--- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithPatternParserTests.java
+++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithPatternParserTests.java
@@ -16,32 +16,24 @@
package org.springframework.integration.file.config;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.util.Set;
-import java.util.regex.Pattern;
-
import org.junit.Test;
import org.junit.runner.RunWith;
-
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.endpoint.AbstractEndpoint;
-import org.springframework.integration.file.AcceptOnceFileListFilter;
-import org.springframework.integration.file.CompositeFileListFilter;
-import org.springframework.integration.file.FileListFilter;
-import org.springframework.integration.file.FileReadingMessageSource;
-import org.springframework.integration.file.PatternMatchingFileListFilter;
+import org.springframework.integration.file.*;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import java.io.File;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+import static org.junit.Assert.*;
+
/**
* @author Mark Fisher
*/
@@ -79,7 +71,7 @@ public class FileInboundChannelAdapterWithPatternParserTests {
@Test
public void inputDirectory() {
File expected = new File(System.getProperty("java.io.tmpdir"));
- File actual = (File) accessor.getPropertyValue("inputDirectory");
+ File actual = (File) accessor.getPropertyValue("directory");
assertEquals(expected, actual);
}
diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/locking/FileLockingWithMultipleSourcesIntegrationTests-context.xml b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/locking/FileLockingWithMultipleSourcesIntegrationTests-context.xml
index e7acd0332c..ff98e8a726 100644
--- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/locking/FileLockingWithMultipleSourcesIntegrationTests-context.xml
+++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/locking/FileLockingWithMultipleSourcesIntegrationTests-context.xml
@@ -7,10 +7,10 @@