INT-1614 using File instead of Resource for localDirectory

This commit is contained in:
Mark Fisher
2010-11-19 21:40:22 -05:00
parent f14df7e59d
commit 294ffb2bfe
7 changed files with 19 additions and 25 deletions

View File

@@ -67,12 +67,12 @@ public class SftpInboundRemoteFileSystemSynchronizerTests {
public void testCopyAndRenameWhenLocalFileExists() throws Exception {
SftpInboundFileSynchronizer synchronizer = new SftpInboundFileSynchronizer(mock(SessionFactory.class));
Method method =
ReflectionUtils.findMethod(synchronizer.getClass(), "copyFromRemoteToLocalDirectory", Session.class, LsEntry.class, Resource.class);
ReflectionUtils.findMethod(synchronizer.getClass(), "copyFromRemoteToLocalDirectory", Session.class, LsEntry.class, File.class);
method.setAccessible(true);
Session session = mock(Session.class);
LsEntry entry = mock(LsEntry.class);
when(entry.getFilename()).thenReturn("foo.txt");
Resource localDir = new FileSystemResource(new File("target"));
File localDir = new File("target");
boolean success = (Boolean) method.invoke(synchronizer, session, entry, localDir);
assertTrue(success);
}

View File

@@ -33,8 +33,6 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.integration.file.filters.FileListFilter;
import org.springframework.integration.file.remote.session.Session;
import org.springframework.integration.file.remote.session.SessionFactory;
@@ -93,7 +91,7 @@ public class SftpInboundRemoteFileSystemSynchronizerTests {
syncronizer.setShouldDeleteSourceFile(true);
syncronizer.afterPropertiesSet();
Resource localDirectory = new FileSystemResource(System.getProperty("java.io.tmpdir"));
File localDirectory = new File(System.getProperty("java.io.tmpdir"));
syncronizer.synchronizeToLocalDirectory(localDirectory);
verify(sessionFactory, times(1)).getSession();