org.alfresco.repo.transfer
Class UnitTestInProcessTransmitterImpl

java.lang.Object
  extended by org.alfresco.repo.transfer.UnitTestInProcessTransmitterImpl
All Implemented Interfaces:
TransferTransmitter

public class UnitTestInProcessTransmitterImpl
extends java.lang.Object
implements TransferTransmitter

This class delegates transfer service to the transfer receiver without using any networking. It is used for unit testing the transfer service without requiring two instance of the repository (and a http server) to be running.


Constructor Summary
UnitTestInProcessTransmitterImpl(TransferReceiver receiver, ContentService contentService, TransactionService transactionService)
           
 
Method Summary
 void abort(Transfer transfer)
          Abort the transfer
 Transfer begin(TransferTarget target, java.lang.String fromRepositoryId, TransferVersion fromVersion)
          Begin a transfer, the transfer object returned will be used by subsequent calls to the transfer service.
 void commit(Transfer transfer)
           
 TransferReceiver getReceiver()
           
 TransferProgress getStatus(Transfer transfer)
          Get the status of an in process transfer
 void getTransferReport(Transfer transfer, java.io.OutputStream results)
          Get the destination side transfer report from the destination and write it to the specified output stream.
 void prepare(Transfer transfer)
           
 void sendContent(Transfer transfer, java.util.Set data)
          Send the content of the specified urls
 void sendManifest(Transfer transfer, java.io.File manifest, java.io.OutputStream result)
           
 void setReceiver(TransferReceiver receiver)
           
 void verifyTarget(TransferTarget target)
          Verify that the target is available
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnitTestInProcessTransmitterImpl

public UnitTestInProcessTransmitterImpl(TransferReceiver receiver,
                                        ContentService contentService,
                                        TransactionService transactionService)
Method Detail

begin

public Transfer begin(TransferTarget target,
                      java.lang.String fromRepositoryId,
                      TransferVersion fromVersion)
               throws TransferException
Description copied from interface: TransferTransmitter
Begin a transfer, the transfer object returned will be used by subsequent calls to the transfer service.

Specified by:
begin in interface TransferTransmitter
Parameters:
target - definition of where to transfer to.
fromRepositoryId - the repositoryID of the sending system
fromVersion - the version of the repository sending
Returns:
the transfer object or null if the target cannot be locked.
Throws:
TransferException

abort

public void abort(Transfer transfer)
           throws TransferException
Description copied from interface: TransferTransmitter
Abort the transfer

Specified by:
abort in interface TransferTransmitter
Parameters:
transfer - the transfer object returned by an earlier call to begin
Throws:
TransferException

commit

public void commit(Transfer transfer)
            throws TransferException
Specified by:
commit in interface TransferTransmitter
Parameters:
transfer - the transfer object returned by an earlier call to begin
Throws:
TransferException

prepare

public void prepare(Transfer transfer)
             throws TransferException
Specified by:
prepare in interface TransferTransmitter
Parameters:
transfer - the transfer object returned by an earlier call to begin
Throws:
TransferException

sendContent

public void sendContent(Transfer transfer,
                        java.util.Set data)
Description copied from interface: TransferTransmitter
Send the content of the specified urls

Specified by:
sendContent in interface TransferTransmitter
Parameters:
transfer - the transfer object returned by an earlier call to begin
data - the content to send

sendManifest

public void sendManifest(Transfer transfer,
                         java.io.File manifest,
                         java.io.OutputStream result)
                  throws TransferException
Specified by:
sendManifest in interface TransferTransmitter
Parameters:
transfer - the transfer object returned by an earlier call to begin
result - - where to write the results, probably a temporary file the output steam should be open and will be closed before the method returns.
Throws:
TransferException

verifyTarget

public void verifyTarget(TransferTarget target)
                  throws TransferException
Description copied from interface: TransferTransmitter
Verify that the target is available

Specified by:
verifyTarget in interface TransferTransmitter
Throws:
TransferException

getStatus

public TransferProgress getStatus(Transfer transfer)
                           throws TransferException
Description copied from interface: TransferTransmitter
Get the status of an in process transfer

Specified by:
getStatus in interface TransferTransmitter
Throws:
TransferException

setReceiver

public void setReceiver(TransferReceiver receiver)

getReceiver

public TransferReceiver getReceiver()

getTransferReport

public void getTransferReport(Transfer transfer,
                              java.io.OutputStream results)
Description copied from interface: TransferTransmitter
Get the destination side transfer report from the destination and write it to the specified output stream.

The result stream will be closed.

Specified by:
getTransferReport in interface TransferTransmitter
Parameters:
transfer - the transfer object returned by an earlier call to begin
results - - where to write the contents of the transfer report.


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.