Modified the 'onFailure' method signature in MessageDeliveryAware so that any Exception can be passed along with a separate Message parameter instead of always expecting a MessagingException.
This commit is contained in:
@@ -37,11 +37,14 @@ import org.easymock.IAnswer;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
import org.springframework.integration.message.Message;
|
||||
import org.springframework.integration.message.MessageCreator;
|
||||
import org.springframework.integration.message.MessagingException;
|
||||
|
||||
/**
|
||||
* @author Iwein Fuld
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class FtpSourceTests {
|
||||
|
||||
@@ -60,16 +63,11 @@ public class FtpSourceTests {
|
||||
|
||||
private Object[] globalMocks = new Object[] { messageCreator, ftpClient, ftpFile, ftpClientPool };
|
||||
|
||||
private static final String HOST = "testHost";
|
||||
|
||||
private static final String USER = "testUser";
|
||||
|
||||
private static final String PASS = "testPass";
|
||||
|
||||
private FtpSource ftpSource;
|
||||
|
||||
private Long size = 100l;
|
||||
|
||||
|
||||
@Before
|
||||
public void initializeFtpSource() {
|
||||
ftpSource = new FtpSource(messageCreator, ftpClientPool);
|
||||
@@ -80,6 +78,7 @@ public class FtpSourceTests {
|
||||
reset(globalMocks);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void retrieveSingleFile() throws Exception {
|
||||
|
||||
@@ -250,7 +249,7 @@ public class FtpSourceTests {
|
||||
new GenericMessage(Arrays.asList(new File("test1")))).times(2);
|
||||
replay(globalMocks);
|
||||
Message<List<File>> received = ftpSource.receive();
|
||||
ftpSource.onFailure(new MessagingException(received));
|
||||
ftpSource.onFailure(received, new Exception("test failure"));
|
||||
assertEquals(received, ftpSource.receive());
|
||||
verify(globalMocks);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user