mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Added channel-types.get REST method. Also made the versioning work when publishing nodes.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28923 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -19,10 +19,7 @@
|
||||
|
||||
package org.alfresco.repo.publishing;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNull;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.alfresco.model.ContentModel.PROP_VERSION_LABEL;
|
||||
import static org.alfresco.repo.publishing.PublishingModel.PROP_PUBLISHING_EVENT_WORKFLOW_ID;
|
||||
import static org.alfresco.repo.publishing.PublishingModel.PROP_WF_PUBLISHING_EVENT;
|
||||
import static org.alfresco.repo.publishing.PublishingModel.PROP_WF_SCHEDULED_PUBLISH_DATE;
|
||||
@@ -35,8 +32,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.publishing.MutablePublishingPackage;
|
||||
@@ -75,6 +70,8 @@ public class PublishingQueueImplTest extends AbstractPublishingIntegrationTest
|
||||
NodeRef firstNode = createContent("First");
|
||||
NodeRef secondNode = createContent("second");
|
||||
|
||||
assertNull(nodeService.getProperty(firstNode, PROP_VERSION_LABEL));
|
||||
assertNull(nodeService.getProperty(firstNode, PROP_VERSION_LABEL));
|
||||
MutablePublishingPackage publishingPackage = queue.createPublishingPackage();
|
||||
publishingPackage.addNodesToPublish(firstNode, secondNode);
|
||||
|
||||
@@ -87,6 +84,10 @@ public class PublishingQueueImplTest extends AbstractPublishingIntegrationTest
|
||||
|
||||
this.eventId = queue.scheduleNewEvent(publishingPackage, channelName, schedule, comment, null);
|
||||
|
||||
//Check schedule triggered versioning.
|
||||
Serializable version = nodeService.getProperty(firstNode, PROP_VERSION_LABEL);
|
||||
assertNotNull(version);
|
||||
|
||||
PublishingEvent event = publishingService.getPublishingEvent(eventId);
|
||||
assertEquals(eventId, event.getId());
|
||||
assertEquals(comment, event.getComment());
|
||||
@@ -119,6 +120,10 @@ public class PublishingQueueImplTest extends AbstractPublishingIntegrationTest
|
||||
// assertEquals(1, toUnpublish.size());
|
||||
// assertTrue(toUnpublish.contains(thirdNode));
|
||||
|
||||
// Check the correct version is recorded in the entry.
|
||||
PublishingPackageEntry entry = publishingPackage.getEntryMap().get(firstNode);
|
||||
assertEquals(version, entry.getSnapshot().getVersion());
|
||||
|
||||
NodeRef eventNode = new NodeRef(eventId);
|
||||
String wfId = (String) nodeService.getProperty(eventNode, PROP_PUBLISHING_EVENT_WORKFLOW_ID);
|
||||
|
||||
@@ -131,6 +136,7 @@ public class PublishingQueueImplTest extends AbstractPublishingIntegrationTest
|
||||
assertEquals(schedule, props.get(PROP_WF_SCHEDULED_PUBLISH_DATE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScheduleNewPublishingEventWithStatusUpdate() throws Exception
|
||||
{
|
||||
NodeRef firstNode = createContent("First");
|
||||
@@ -138,22 +144,22 @@ public class PublishingQueueImplTest extends AbstractPublishingIntegrationTest
|
||||
|
||||
List<String> channelNames = Arrays.asList("Channel1", "Channel2", "Channel3" );
|
||||
String message = "The message";
|
||||
queue.createStatusUpdate(message, secondNode, channelNames);
|
||||
StatusUpdate update = queue.createStatusUpdate(message, secondNode, channelNames);
|
||||
|
||||
// Publish an event with the StatusUpdate
|
||||
MutablePublishingPackage publishingPackage = queue.createPublishingPackage();
|
||||
publishingPackage.addNodesToPublish(firstNode, secondNode);
|
||||
Calendar schedule = Calendar.getInstance();
|
||||
schedule.add(Calendar.HOUR, 2);
|
||||
this.eventId = queue.scheduleNewEvent(publishingPackage, channelName, schedule, comment, null);
|
||||
this.eventId = queue.scheduleNewEvent(publishingPackage, channelName, schedule, comment, update);
|
||||
|
||||
PublishingEvent event = publishingService.getPublishingEvent(eventId);
|
||||
StatusUpdate update = event.getStatusUpdate();
|
||||
// assertEquals(message, update.getMessage());
|
||||
// assertEquals(secondNode, update.getNodeToLinkTo());
|
||||
// Set<String> names = update.getChannelNames();
|
||||
// assertEquals(3, names.size());
|
||||
// assertTrue(names.containsAll(channelNames));
|
||||
StatusUpdate actualUpdate = event.getStatusUpdate();
|
||||
assertEquals(message, actualUpdate.getMessage());
|
||||
assertEquals(secondNode, actualUpdate.getNodeToLinkTo());
|
||||
Set<String> names = actualUpdate.getChannelNames();
|
||||
assertEquals(3, names.size());
|
||||
assertTrue(names.containsAll(channelNames));
|
||||
}
|
||||
|
||||
private NodeRef createContent(String name)
|
||||
|
Reference in New Issue
Block a user