Renamed PollableFileSource tests according to earlier refactoring. Increased timout to 6 seconds, decreased repeats to 10 times. We don't want nightly failures.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
<!-- under test -->
|
||||
<bean id="pollableFileSource" class="org.springframework.integration.file.FileReadingMessageSource"
|
||||
p:inputDirectory="file:${java.io.tmpdir}/PollableFileSourceIntegrationTests"
|
||||
p:inputDirectory="file:${java.io.tmpdir}/FileReadingMessageSourceIntegrationTests"
|
||||
p:filter-ref="compositeFilter"/>
|
||||
|
||||
<!-- customized filter -->
|
||||
@@ -43,7 +43,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
public class PollableFileSourceIntegrationTests {
|
||||
public class FileReadingMessageSourceIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
FileReadingMessageSource pollableFileSource;
|
||||
@@ -54,7 +54,7 @@ public class PollableFileSourceIntegrationTests {
|
||||
@BeforeClass
|
||||
public static void setupInputDir() {
|
||||
inputDir = new File(System.getProperty("java.io.tmpdir") + "/"
|
||||
+ PollableFileSourceIntegrationTests.class.getSimpleName());
|
||||
+ FileReadingMessageSourceIntegrationTests.class.getSimpleName());
|
||||
inputDir.mkdir();
|
||||
}
|
||||
|
||||
@@ -111,8 +111,8 @@ public class PollableFileSourceIntegrationTests {
|
||||
assertNotSame(received2 + " == " + received3, received2, received3);
|
||||
}
|
||||
|
||||
@Test(timeout = 3000)
|
||||
@Repeat(15)
|
||||
@Test(timeout = 6000)
|
||||
@Repeat(10)
|
||||
public void concurrentProcessing() throws Exception {
|
||||
CountDownLatch go = new CountDownLatch(1);
|
||||
Runnable succesfulConsumer = new Runnable() {
|
||||
@@ -31,9 +31,9 @@ import org.springframework.integration.core.Message;
|
||||
* @author Iwein Fuld
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class PollableFileSourceTests {
|
||||
public class FileReadingMessageSourceTests {
|
||||
|
||||
private FileReadingMessageSource pollableFileSource;
|
||||
private FileReadingMessageSource source;
|
||||
|
||||
private File inputDirectoryMock = createMock(File.class);
|
||||
|
||||
@@ -53,8 +53,8 @@ public class PollableFileSourceTests {
|
||||
@Before
|
||||
public void initialize() throws Exception {
|
||||
prepResource();
|
||||
this.pollableFileSource = new FileReadingMessageSource();
|
||||
pollableFileSource.setInputDirectory(inputDirectoryResourceMock);
|
||||
this.source = new FileReadingMessageSource();
|
||||
source.setInputDirectory(inputDirectoryResourceMock);
|
||||
reset(allMocks);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PollableFileSourceTests {
|
||||
public void straightProcess() throws Exception {
|
||||
expect(inputDirectoryMock.listFiles()).andReturn(new File[] { fileMock });
|
||||
replay(allMocks);
|
||||
pollableFileSource.onSend(pollableFileSource.receive());
|
||||
source.onSend(source.receive());
|
||||
verify(allMocks);
|
||||
}
|
||||
|
||||
@@ -71,10 +71,10 @@ public class PollableFileSourceTests {
|
||||
expect(inputDirectoryMock.listFiles()).andReturn(new File[] { fileMock });
|
||||
expect(inputDirectoryMock.listFiles()).andReturn(new File[] {});
|
||||
replay(allMocks);
|
||||
Message received = pollableFileSource.receive();
|
||||
Message received = source.receive();
|
||||
assertNotNull(received);
|
||||
pollableFileSource.onFailure(received, new RuntimeException("failed"));
|
||||
assertEquals(received.getPayload(), pollableFileSource.receive().getPayload());
|
||||
source.onFailure(received, new RuntimeException("failed"));
|
||||
assertEquals(received.getPayload(), source.receive().getPayload());
|
||||
verify(allMocks);
|
||||
}
|
||||
|
||||
@@ -83,10 +83,10 @@ public class PollableFileSourceTests {
|
||||
expect(inputDirectoryMock.listFiles()).andReturn(new File[] { fileMock });
|
||||
expect(inputDirectoryMock.listFiles()).andReturn(new File[] {});
|
||||
replay(allMocks);
|
||||
Message<File> received = pollableFileSource.receive();
|
||||
Message<File> received = source.receive();
|
||||
assertNotNull(received);
|
||||
assertEquals(fileMock, received.getPayload());
|
||||
assertNull(pollableFileSource.receive());
|
||||
assertNull(source.receive());
|
||||
verify(allMocks);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user