public abstract class AbstractTestFileService extends Object implements TestFileService, org.springframework.beans.factory.InitializingBean
FileDataService
based on MongoDB.Constructor and Description |
---|
AbstractTestFileService(FileDataService fileDataService,
String localDir) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected abstract void |
downloadRemoteFile(FileData fileData,
File localFile)
Download the file represented from the remote location to the local file.
|
File |
getFile()
Get a random file of any description
|
File |
getFile(String extension)
Get a random file with the given extension
|
File |
getFileByName(String filename)
Find a specific file by name
|
protected abstract String |
getMirrorPath()
Get the data mirror path (relative to the root location).
|
protected abstract List<FileData> |
listRemoteFiles()
List all files on the remote server
|
public AbstractTestFileService(FileDataService fileDataService, String localDir)
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
protected abstract String getMirrorPath()
protected abstract List<FileData> listRemoteFiles()
remote name
populatedprotected abstract void downloadRemoteFile(FileData fileData, File localFile) throws IOException
fileData
- data containing details of the remote filelocalFile
- the local file to write toIOException
- will be handled by the calling codepublic File getFileByName(String filename)
TestFileService
getFileByName
in interface TestFileService
filename
- the name of the remote file to findpublic File getFile()
TestFileService
getFile
in interface TestFileService
public File getFile(String extension)
TestFileService
getFile
in interface TestFileService
extension
- the file extension, which is no guarantee of mimetypeCopyright © 2014. All rights reserved.