ALF-4127 - F86 Provide target log to source repository

implemented with unit test.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21836 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2010-08-17 12:16:54 +00:00
parent f3ce6ac130
commit e0372702d3
16 changed files with 510 additions and 59 deletions

View File

@@ -18,6 +18,7 @@
*/
package org.alfresco.repo.transfer;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -42,7 +43,7 @@ import org.apache.commons.logging.LogFactory;
* using any networking.
*
* It is used for unit testing the transfer service without requiring two instance
* of the repository to be running.
* of the repository (and a http server) to be running.
*
* @author Mark Rogers
*/
@@ -179,5 +180,30 @@ public class UnitTestInProcessTransmitterImpl implements TransferTransmitter
{
return contentService;
}
public void getTransferReport(Transfer transfer, OutputStream results)
{
String transferId = transfer.getTransferId();
InputStream is = receiver.getTransferReport(transferId);
try
{
BufferedInputStream br = new BufferedInputStream(is);
byte[] buffer = new byte[1000];
int i = br.read(buffer);
while(i > 0)
{
results.write(buffer, 0, i);
i = br.read(buffer);
}
results.flush();
results.close();
}
catch(IOException ie)
{
log.error("Error in unit test code: should not get this", ie);
return;
}
}
}