mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Fixed ALF-10333: Publishing: Multiple publishing events are processed sequentially rather than in parallel
Publishing: Remove some operations from the Channel and ChannelType interface that really shouldn't be exposed. Also removed the PublishingQueue interface - the two operations it had are now on the PublishingService. WQS: Removed obsolete references to publishing channels. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30794 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -29,6 +29,7 @@ import java.util.List;
|
|||||||
import org.alfresco.repo.node.NodeUtils;
|
import org.alfresco.repo.node.NodeUtils;
|
||||||
import org.alfresco.service.cmr.publishing.PublishingDetails;
|
import org.alfresco.service.cmr.publishing.PublishingDetails;
|
||||||
import org.alfresco.service.cmr.publishing.PublishingQueue;
|
import org.alfresco.service.cmr.publishing.PublishingQueue;
|
||||||
|
import org.alfresco.service.cmr.publishing.PublishingService;
|
||||||
import org.alfresco.service.cmr.publishing.channels.Channel;
|
import org.alfresco.service.cmr.publishing.channels.Channel;
|
||||||
import org.alfresco.service.cmr.publishing.channels.ChannelService;
|
import org.alfresco.service.cmr.publishing.channels.ChannelService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -64,10 +65,10 @@ public class PublishingJsonParser implements PublishingWebScriptConstants
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String schedulePublishingEvent(PublishingQueue queue, String jsonStr) throws ParseException, JSONException
|
public String schedulePublishingEvent(PublishingService publishingService, String jsonStr) throws ParseException, JSONException
|
||||||
{
|
{
|
||||||
JSONObject json = getJson(jsonStr);
|
JSONObject json = getJson(jsonStr);
|
||||||
PublishingDetails details = queue.createPublishingDetails()
|
PublishingDetails details = publishingService.createPublishingDetails()
|
||||||
.setPublishChannel(json.optString(CHANNEL_ID))
|
.setPublishChannel(json.optString(CHANNEL_ID))
|
||||||
.setComment(json.optString(COMMENT))
|
.setComment(json.optString(COMMENT))
|
||||||
.setSchedule(getCalendar(json.optJSONObject(SCHEDULED_TIME)))
|
.setSchedule(getCalendar(json.optJSONObject(SCHEDULED_TIME)))
|
||||||
@@ -75,7 +76,7 @@ public class PublishingJsonParser implements PublishingWebScriptConstants
|
|||||||
.addNodesToUnpublish(toNodes(json.optJSONArray(UNPUBLISH_NODES)));
|
.addNodesToUnpublish(toNodes(json.optJSONArray(UNPUBLISH_NODES)));
|
||||||
|
|
||||||
details = setStatusUpdate(details, json.optJSONObject(STATUS_UPDATE));
|
details = setStatusUpdate(details, json.optJSONObject(STATUS_UPDATE));
|
||||||
return queue.scheduleNewEvent(details);
|
return publishingService.scheduleNewEvent(details);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PublishingDetails setStatusUpdate(PublishingDetails details, JSONObject json)
|
public PublishingDetails setStatusUpdate(PublishingDetails details, JSONObject json)
|
||||||
|
@@ -50,7 +50,7 @@ public class PublishingQueuePost extends PublishingWebScript
|
|||||||
{
|
{
|
||||||
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "No publishing event was posted!");
|
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "No publishing event was posted!");
|
||||||
}
|
}
|
||||||
String eventId = jsonParser.schedulePublishingEvent(getQueue(), content);
|
String eventId = jsonParser.schedulePublishingEvent(publishingService, content);
|
||||||
PublishingEvent event = publishingService.getPublishingEvent(eventId);
|
PublishingEvent event = publishingService.getPublishingEvent(eventId);
|
||||||
Map<String, Object> eventModel = builder.buildPublishingEvent(event, channelService);
|
Map<String, Object> eventModel = builder.buildPublishingEvent(event, channelService);
|
||||||
return WebScriptUtil.createBaseModel(eventModel);
|
return WebScriptUtil.createBaseModel(eventModel);
|
||||||
|
@@ -72,6 +72,7 @@ import java.util.Set;
|
|||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
import org.alfresco.repo.content.transform.AbstractContentTransformerTest;
|
import org.alfresco.repo.content.transform.AbstractContentTransformerTest;
|
||||||
|
import org.alfresco.repo.publishing.AbstractChannelType;
|
||||||
import org.alfresco.repo.publishing.ChannelHelper;
|
import org.alfresco.repo.publishing.ChannelHelper;
|
||||||
import org.alfresco.repo.publishing.ChannelServiceImpl;
|
import org.alfresco.repo.publishing.ChannelServiceImpl;
|
||||||
import org.alfresco.repo.publishing.PublishServiceImpl;
|
import org.alfresco.repo.publishing.PublishServiceImpl;
|
||||||
@@ -329,8 +330,8 @@ public class PublishingRestApiTest extends BaseWebScriptTest
|
|||||||
// Wait for Publishing Event to execute asynchronously
|
// Wait for Publishing Event to execute asynchronously
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
|
|
||||||
ChannelType publishAnyChannelType = channelService.getChannelType(publishAnyType);
|
AbstractChannelType publishAnyChannelType = (AbstractChannelType) channelService.getChannelType(publishAnyType);
|
||||||
ChannelType statusUpdateChannelType = channelService.getChannelType(statusUpdateType);
|
AbstractChannelType statusUpdateChannelType = (AbstractChannelType) channelService.getChannelType(statusUpdateType);
|
||||||
|
|
||||||
NodeRef mappedTextNode = channelHelper.mapSourceToEnvironment(textNode, publishChannel.getNodeRef());
|
NodeRef mappedTextNode = channelHelper.mapSourceToEnvironment(textNode, publishChannel.getNodeRef());
|
||||||
|
|
||||||
@@ -341,12 +342,12 @@ public class PublishingRestApiTest extends BaseWebScriptTest
|
|||||||
// Check updateStatus is called correctly.
|
// Check updateStatus is called correctly.
|
||||||
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
|
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
|
||||||
verify(statusUpdateChannelType)
|
verify(statusUpdateChannelType)
|
||||||
.updateStatus(any(Channel.class), captor.capture(), anyMap());
|
.sendStatusUpdate(any(Channel.class), captor.capture());
|
||||||
String actualStatusMessage = captor.getValue();
|
String actualStatusMessage = captor.getValue();
|
||||||
assertTrue(actualStatusMessage.startsWith(statusMessage));
|
assertTrue(actualStatusMessage.startsWith(statusMessage));
|
||||||
|
|
||||||
verify(statusUpdateChannelType, never()).publish(any(NodeRef.class), anyMap());
|
verify(statusUpdateChannelType, never()).publish(any(NodeRef.class), anyMap());
|
||||||
verify(publishAnyChannelType, never()).updateStatus(any(Channel.class), anyString(), anyMap());
|
verify(publishAnyChannelType, never()).sendStatusUpdate(any(Channel.class), anyString());
|
||||||
|
|
||||||
JSONObject status = json.optJSONObject(STATUS_UPDATE);
|
JSONObject status = json.optJSONObject(STATUS_UPDATE);
|
||||||
status.remove(NODE_REF);
|
status.remove(NODE_REF);
|
||||||
@@ -425,7 +426,7 @@ public class PublishingRestApiTest extends BaseWebScriptTest
|
|||||||
|
|
||||||
// Create publishing event for textNode1.
|
// Create publishing event for textNode1.
|
||||||
String comment = "This is a comment";
|
String comment = "This is a comment";
|
||||||
PublishingDetails details = publishingService.getPublishingQueue().createPublishingDetails()
|
PublishingDetails details = publishingService.createPublishingDetails()
|
||||||
.setPublishChannel(publishChannel.getId())
|
.setPublishChannel(publishChannel.getId())
|
||||||
.addNodesToPublish(textNode1)
|
.addNodesToPublish(textNode1)
|
||||||
.setComment(comment);
|
.setComment(comment);
|
||||||
|
@@ -36,11 +36,6 @@ public abstract class PublishingWebScript extends DeclarativeWebScript
|
|||||||
protected PublishingService publishingService;
|
protected PublishingService publishingService;
|
||||||
protected ChannelService channelService;
|
protected ChannelService channelService;
|
||||||
|
|
||||||
protected PublishingQueue getQueue()
|
|
||||||
{
|
|
||||||
return publishingService.getPublishingQueue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param publishingService the publishingService to set
|
* @param publishingService the publishingService to set
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user