testDownloadFile(
final int testSize,
final int chunkSize )
throws IOException
{
final UploadDownloadMgr mgr =
getDomainRoot().getUploadDownloadMgr();
final File testFile = createTempFile( testSize );
final long start = now();
final Object id = mgr.initiateDownload( testFile, true );
//trace( "initated download for: " + id + " file = " + testFile.toString() );
final int maxChunkSize = mgr.getMaxDownloadChunkSize();
final int actualChunkSize = chunkSize < maxChunkSize ?
chunkSize : maxChunkSize;
final long length = mgr.getDownloadLength( id );
long doneSoFar = 0;
while ( doneSoFar < length )
{
final byte[] bytes = mgr.downloadBytes( id, actualChunkSize );
doneSoFar += bytes.length;
}
printElapsed( "UploadDownloadMgr.testDownloadFile: " +
testSize + " bytes" + " chunksize = " + actualChunkSize, start );