Fixes to replication job status handling:

- success, error and cancelled states now correctly reported
- source and target reports now correctly provided for each of above

Changes:
- deprecated TransferService interface, replaced by TransferService2
  - introduces new sync transfer methods
  - new TransferServiceImpl2 class, old TransferServiceImpl delegates to new class
- sync transfer now returns TransferEndEvent
- sync transfer now raises TransferFailureException
- success, error and cancelled events are now end events (raised after report events)
- transfer client handling refactored to support cancel and errors appropriately
  - converted to event loop with polling of server status for all states
  - cancel request may now end with success or error (depending on when cancel requested)
  - extract transfer errors from server
  - only raise exception for errors (cancelled now returns)
  - source and destination reports written for all states
- Added TransferEndEvent interface for end events - reports attached to end event
- replication service fixed to record source and dest reports in error case
- action service fixed to record cancelled state

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22390 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2010-09-10 14:00:05 +00:00
parent 82955f3ae2
commit 35b2b7a122
25 changed files with 2176 additions and 1492 deletions

View File

@@ -39,6 +39,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transfer.manifest.TransferManifestNodeFactory;
@@ -95,7 +96,7 @@ public class TransferServiceImplTest extends BaseAlfrescoSpringTest
{
private TransferService transferService;
private ContentService contentService;
private TransferServiceImpl transferServiceImpl;
private TransferServiceImpl2 transferServiceImpl;
private SearchService searchService;
private TransactionService transactionService;
private TransferReceiver receiver;
@@ -130,7 +131,7 @@ public class TransferServiceImplTest extends BaseAlfrescoSpringTest
// Get the required services
this.transferService = (TransferService)this.applicationContext.getBean("TransferService");
this.contentService = (ContentService)this.applicationContext.getBean("ContentService");
this.transferServiceImpl = (TransferServiceImpl)this.applicationContext.getBean("transferService");
this.transferServiceImpl = (TransferServiceImpl2)this.applicationContext.getBean("transferService2");
this.searchService = (SearchService)this.applicationContext.getBean("SearchService");
this.transactionService = (TransactionService)this.applicationContext.getBean("TransactionService");
this.nodeService = (NodeService) this.applicationContext.getBean("nodeService");
@@ -1803,7 +1804,7 @@ public class TransferServiceImplTest extends BaseAlfrescoSpringTest
*/
assertTrue("transfer report is too small", transferReport.size() > 3);
assertTrue("transfer report does not start with START", transferReport.get(0).getTransferState().equals(TransferEvent.TransferState.START));
assertTrue("transfer report does not end with ERROR", transferReport.get(transferReport.size()-2).getTransferState().equals(TransferEvent.TransferState.ERROR));
assertTrue("transfer report does not end with CANCELLED", transferReport.get(transferReport.size()-1).getTransferState().equals(TransferEvent.TransferState.CANCELLED));
// last event is the transfer report event.
}
finally
@@ -2057,16 +2058,18 @@ public class TransferServiceImplTest extends BaseAlfrescoSpringTest
// Now validate the destination side transfer report against the XSD
ContentReader reader = contentService.getReader(reportNode, ContentModel.PROP_CONTENT);
assertNotNull("transfer reader is null", reader);
Source transferReportSource = new StreamSource(reader.getContentInputStream());
try
if (reader.getMimetype().equals(MimetypeMap.MIMETYPE_XML))
{
validator.validate(transferReportSource);
Source transferReportSource = new StreamSource(reader.getContentInputStream());
try
{
validator.validate(transferReportSource);
}
catch (Exception e)
{
fail("Destination Transfer Report reportNode:" + reportNode + " message :" + e.getMessage() );
}
}
catch (Exception e)
{
fail("Destination Transfer Report reportNode:" + reportNode + " message :" + e.getMessage() );
}
}
}
finally