mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixed unpublishing events.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29696 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -38,10 +38,14 @@ import java.util.Map;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.publishing.PublishingDetails;
|
||||
import org.alfresco.service.cmr.publishing.PublishingEvent;
|
||||
import org.alfresco.service.cmr.publishing.PublishingQueue;
|
||||
import org.alfresco.service.cmr.publishing.PublishingService;
|
||||
import org.alfresco.service.cmr.publishing.Status;
|
||||
import org.alfresco.service.cmr.publishing.channels.Channel;
|
||||
import org.alfresco.service.cmr.publishing.channels.ChannelService;
|
||||
import org.alfresco.service.cmr.publishing.channels.ChannelType;
|
||||
@@ -272,4 +276,31 @@ public class PublishingTestHelper
|
||||
writer.putContent(theContent);
|
||||
}
|
||||
|
||||
|
||||
public PublishingEvent publishAndWait(final PublishingDetails details, RetryingTransactionHelper transactionHelper) throws InterruptedException
|
||||
{
|
||||
RetryingTransactionCallback<String> startWorkflowCallback = new RetryingTransactionCallback<String>()
|
||||
{
|
||||
public String execute() throws Throwable
|
||||
{
|
||||
return scheduleEvent(details);
|
||||
}
|
||||
};
|
||||
String eventId = transactionHelper.doInTransaction(startWorkflowCallback);
|
||||
|
||||
int i = 0;
|
||||
while(i<100)
|
||||
{
|
||||
Thread.sleep(200);
|
||||
PublishingEvent event = publishingService.getPublishingEvent(eventId);
|
||||
Status status = event.getStatus();
|
||||
if(Status.IN_PROGRESS!=status && Status.SCHEDULED!=status)
|
||||
{
|
||||
return event;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
throw new IllegalStateException("The publishing event did not complete after 20s!");
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user