I have CreateFTPConnection class that creates a connection to FTPS. Using this connection, the files are transferred. Here is the code class TransferFile
public class TransferFile { private CreateFTPConnection ftpConnection; private FTPSClient client; public TransferFile(CreateFTPConnection ftpConnection) { this.ftpConnection = ftpConnection; this.client = ftpConnection.getClient(); } public void transfer(Message<?> msg) { InputStream inputStream = null; try { if(!client.isConnected()){ ftpConnection.init(); client = ftpConnection.getClient(); } File file = (File) msg.getPayload(); inputStream = new FileInputStream(file); client.storeFile(file.getName(), inputStream); client.sendNoOp(); } catch (Exception e) { try { client.disconnect(); } catch (IOException e1) { e1.printStackTrace(); } } finally { try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } }
I need to write jUnit Testcase for this class. To do this I need to create a connection FTPS Mock Server and use this link to check the file transfer. So can anyone PLZ give me any idea of ββhow to make FTPS Mock Server and do the test case. I googled this, but what I'm getting to an FTP or SFTP, FTPS instead. Please help me.
source share