Merged BRANCHES/DEV/BRIAN/PUBLISHING to HEAD:

29482: Publishing:
   - Added support for LinkedIn status updates
 29486: Social Publishing UI Updates, including:
   - Dialogue: Complete UI rework
   - Publishing History: display of unpublish event support
   - Created Alfresco.util.toggleClass function
 29491: Publishing:
   - Added correct list of supported MIME types the the YouTube channel type
 29493: Publishing:
   - Added video/mp4 to YouTube supported MIME types
 29496: ChannelsGet now filters out channels that are not authorised. Added a space before the node URL on status updates. Extended unit tests to check behaviour for non-Admin users.
 29513: Adds specific http client libraries to prevent the mac falling back to it's buggy default implementation (which, e.g. doesn't send Content-Length headers if the content length is zero). Required for Flickr support (their publish API requires both a content length header and zero length content. It returns a 411 error using the default Mac libs).
 29534: Fixed PublishingEventsGet REST method. ChannelService getChannels() methods now support filtering by publish permissions.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29542 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Brian Remmington
2011-08-04 08:26:41 +00:00
parent 34585f5f2e
commit 7ceaf0a9b0
39 changed files with 1114 additions and 384 deletions

View File

@@ -19,22 +19,17 @@
package org.alfresco.repo.publishing;
import static org.alfresco.repo.publishing.PublishingModel.TYPE_DELIVERY_CHANNEL;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import javax.transaction.Status;
import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.person.TestPersonManager;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.publishing.channels.ChannelType;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.publishing.PublishingService;
import org.alfresco.service.cmr.publishing.channels.ChannelService;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.MutableAuthenticationService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.cmr.site.SiteService;
import org.alfresco.service.cmr.site.SiteVisibility;
import org.alfresco.util.BaseSpringTest;
import org.alfresco.util.GUID;
import org.junit.After;
@@ -49,50 +44,42 @@ public abstract class AbstractPublishingIntegrationTest extends BaseSpringTest
{
protected static final String channelTypeId = "MockChannelType";
protected PublishingRootObject rootObject;
protected ServiceRegistry serviceRegistry;
protected SiteService siteService;
protected FileFolderService fileFolderService;
protected NodeService nodeService;
protected PublishingTestHelper testHelper;
protected TestPersonManager personManager;
protected String username;
protected String siteId;
protected PublishingQueueImpl queue;
protected Environment environment;
protected NodeRef docLib;
@Override
@Before
public void onSetUp() throws Exception
{
super.onSetUp();
this.rootObject = (PublishingRootObject) getApplicationContext().getBean("publishingRootObject");
serviceRegistry = (ServiceRegistry) getApplicationContext().getBean("ServiceRegistry");
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
this.siteService = serviceRegistry.getSiteService();
this.fileFolderService = serviceRegistry.getFileFolderService();
this.nodeService = serviceRegistry.getNodeService();
this.siteId = GUID.generate();
siteService.createSite("test", siteId,
"Site created by publishing test",
"Site created by publishing test",
SiteVisibility.PUBLIC);
this.docLib = siteService.createContainer(siteId, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null);
this.environment = rootObject.getEnvironment();
this.queue = rootObject.getPublishingQueue();
serviceRegistry = (ServiceRegistry) getApplicationContext().getBean(ServiceRegistry.SERVICE_REGISTRY);
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
SiteService siteService = serviceRegistry.getSiteService();
FileFolderService fileFolderService = serviceRegistry.getFileFolderService();
PermissionService permissionService = serviceRegistry.getPermissionService();
this.nodeService = serviceRegistry.getNodeService();
ChannelService channelService = (ChannelService) getApplicationContext().getBean(ChannelServiceImpl.NAME);
PublishingService publishingService = (PublishingService) getApplicationContext().getBean(PublishServiceImpl.NAME);
MutableAuthenticationService authenticationService= (MutableAuthenticationService) getApplicationContext().getBean(ServiceRegistry.AUTHENTICATION_SERVICE.getLocalName());
PersonService personService= (PersonService) getApplicationContext().getBean(ServiceRegistry.PERSON_SERVICE.getLocalName());
this.personManager = new TestPersonManager(authenticationService, personService, nodeService);
this.testHelper = new PublishingTestHelper(channelService, publishingService, siteService, fileFolderService, permissionService);
this.username = GUID.generate();
personManager.createPerson(username);
}
@After
public void onTearDown() throws Exception
{
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
try
{
siteService.deleteSite(siteId);
testHelper.tearDown();
}
finally
{
@@ -100,17 +87,4 @@ public abstract class AbstractPublishingIntegrationTest extends BaseSpringTest
}
}
protected ChannelType mockChannelType()
{
ChannelType channelType = mock(ChannelType.class);
mockChannelTypeBehaviour(channelType);
return channelType;
}
protected void mockChannelTypeBehaviour(ChannelType channelType)
{
when(channelType.getId()).thenReturn(channelTypeId);
when(channelType.getChannelNodeType()).thenReturn(TYPE_DELIVERY_CHANNEL);
}
}