diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/FileToChannelIntegrationTests-context.xml b/spring-integration-file/src/test/java/org/springframework/integration/file/FileToChannelIntegrationTests-context.xml
index d4e365144d..a342db3147 100644
--- a/spring-integration-file/src/test/java/org/springframework/integration/file/FileToChannelIntegrationTests-context.xml
+++ b/spring-integration-file/src/test/java/org/springframework/integration/file/FileToChannelIntegrationTests-context.xml
@@ -1,18 +1,25 @@
+ http://www.springframework.org/schema/integration/file/spring-integration-file.xsd">
+ directory="#{inputDirectory.path}"
+ channel="fileMessages" filter="compositeFilter"/>
+
+
+
+
+
+
@@ -20,25 +27,20 @@
+ class="org.springframework.integration.file.CompositeFileListFilter">
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/FileToChannelIntegrationTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/FileToChannelIntegrationTests.java
index d9e92a8e00..001388b5fd 100644
--- a/spring-integration-file/src/test/java/org/springframework/integration/file/FileToChannelIntegrationTests.java
+++ b/spring-integration-file/src/test/java/org/springframework/integration/file/FileToChannelIntegrationTests.java
@@ -16,24 +16,19 @@
package org.springframework.integration.file;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.io.File;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
-
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.core.Message;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import java.io.File;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
/**
* @author Iwein Fuld
*/
@@ -41,35 +36,14 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
public class FileToChannelIntegrationTests {
- private static File inputDir;
+ @Autowired File inputDirectory;
@Autowired
- @Qualifier("fileMessages")
PollableChannel fileMessages;
- @BeforeClass
- public static void setupInputDir() {
- inputDir = new File(System.getProperty("java.io.tmpdir") + "/"
- + FileToChannelIntegrationTests.class.getSimpleName());
- inputDir.mkdir();
- }
-
- @After
- public void cleanoutInputDir() throws Exception {
- File[] listFiles = inputDir.listFiles();
- for (int i = 0; i < listFiles.length; i++) {
- listFiles[i].delete();
- }
- }
-
- @AfterClass
- public static void removeInputDir() throws Exception {
- inputDir.delete();
- }
-
@Test(timeout = 2000)
public void fileMessageToChannel() throws Exception {
- File.createTempFile("test", null, inputDir).setLastModified(System.currentTimeMillis() - 1000);
+ File.createTempFile("test", null, inputDirectory).setLastModified(System.currentTimeMillis() - 1000);
Message received = receiveFileMessage();
while (received == null) {
Thread.sleep(50);
@@ -85,7 +59,7 @@ public class FileToChannelIntegrationTests {
@Test(timeout = 2000)
public void directoryExhaustion() throws Exception {
- File.createTempFile("test", null, inputDir).setLastModified(System.currentTimeMillis() - 1000);
+ File.createTempFile("test", null, inputDirectory).setLastModified(System.currentTimeMillis() - 1000);
Message received = receiveFileMessage();
while (received == null) {
Thread.sleep(5);