* Description: download big file uploaded via file-2 service<br>
* Expectation: passes
*/
@Test
public void t03_download200MBFile() throws Exception {
SCFileService service = client.newFileService(TestConstants.filServiceName2);
// upload file first
String localFile = "upload200MBFile.txt";
String localpath = "src/main/resources/";
TestUtil.create200MBFile(localpath + localFile);
String remoteFileName = localFile;
File inputFile = new File(localpath + localFile);
InputStream inpStream = new FileInputStream(inputFile);
service.uploadFile(300, remoteFileName, inpStream);
inpStream.close();
FileUtility.waitExists(TestConstants.filServiceLocation2 + remoteFileName, 0);
FileUtility.deleteFile(localpath + localFile);
// download now
localFile = "download200MBContent.txt";
localpath = "src/main/resources/";
remoteFileName = "upload200MBFile.txt";
File outputFile = new File(localpath + localFile);
FileOutputStream outStream = new FileOutputStream(outputFile);
service.downloadFile(300, remoteFileName, outStream); // regular download
outStream.close();
FileUtility.waitExists(localpath + localFile, 0);
FileUtility.deleteFile(localpath + localFile);
FileUtility.deleteFile(TestConstants.filServiceLocation2 + remoteFileName);
}