PublishingQueueImpl implements PublishingQueue { public PublishingDetails createPublishingDetails() { return publishingEventHelper.createPublishingDetails(); } PublishingQueueImpl(NodeRef nodeRef, PublishingEventHelper publishingEventHelper); PublishingDetails createPublishingDetails(); StatusUpdate createStatusUpdate(String message, NodeRef nodeToLinkTo, String... channelNames); StatusUpdate createStatusUpdate(String message, NodeRef nodeToLinkTo, Collection<String> channelNames); List<PublishingEvent> getPublishingEvents(PublishingEventFilter filter); PublishingEventFilter createPublishingEventFilter(); String scheduleNewEvent(PublishingDetails publishingDetails); NodeRef getNodeRef();  }
@Test public void testScheduleNewPublishingEventWithStatusUpdate() throws Exception { NodeRef firstNode = createContent("First"); NodeRef secondNode = createContent("Second"); List<String> statusChannels = Arrays.asList("test: String message = "The message"; PublishingDetails details = publishingService.createPublishingDetails() .setPublishChannelId(channelId) .addNodesToPublish(firstNode, secondNode) .setStatusMessage(message) .setStatusNodeToLinkTo(secondNode) .addStatusUpdateChannels(statusChannels); String eventId = testHelper.scheduleEvent1Year(details); PublishingEvent event = publishingService.getPublishingEvent(eventId); StatusUpdate actualUpdate = event.getStatusUpdate(); assertEquals(message, actualUpdate.getMessage()); assertEquals(secondNode, actualUpdate.getNodeToLinkTo()); Set<String> names = actualUpdate.getChannelIds(); assertEquals(3, names.size()); assertTrue(names.containsAll(statusChannels)); }
@Test public void testScheduleNewEventPermissions() throws Exception { testHelper.mockChannelType(channelTypeId); Channel publishChannel = testHelper.createChannel(channelTypeId); Channel statusChannel = testHelper.createChannel(channelTypeId); NodeRef firstNode = createContent("First"); NodeRef secondNode = createContent("Second"); String user1 = GUID.generate(); personManager.createPerson(user1); testHelper.setChannelPermission(user1, publishChannel.getId(), PermissionService.READ); testHelper.setChannelPermission(user1, statusChannel.getId(), PermissionService.READ); personManager.setUser(user1); PublishingDetails details = publishingService.createPublishingDetails(); details.addNodesToPublish(firstNode, secondNode); details.setPublishChannelId(publishChannel.getId()); try { testHelper.scheduleEvent1Year(details); fail("shceduleNewEvent should have thrown an AccessDeniedException!"); } catch(AlfrescoRuntimeException e) { } testHelper.allowChannelAccess(user1, publishChannel.getId()); String eventId = testHelper.scheduleEvent1Year(details); assertNotNull(eventId); String message = "The message"; details.setStatusMessage(message) .setStatusNodeToLinkTo(secondNode) .addStatusUpdateChannels(statusChannel.getId()); try { eventId = testHelper.scheduleEvent1Year(details); fail("shceduleNewEvent with status update should have thrown an AccessDeniedException!"); } catch(AlfrescoRuntimeException e) { } testHelper.allowChannelAccess(user1, statusChannel.getId()); eventId = testHelper.scheduleEvent1Year(details); assertNotNull(eventId); }