Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

78608: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud)
      78477: Merged DEV to V4.2-BUG-FIX (4.2.4)
         76926 : MNT-11931 : Exception when opening Document Details with QuickShare disabled
            - Test that quick share webscripts returns 403 if quick share is disabled 
         76939 : MNT-11931 : Exception when opening Document Details with QuickShare disabled
            - Implement quick share enabled web script. Don't display quick share link if quick share is turned off 
         78462 : MNT-11931 : Exception when opening Document Details with QuickShare disabled
             - Use SingletonValueProcessorExtension to check if quick share is enabled 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@82619 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Erik Winlof
2014-09-03 12:44:38 +00:00
parent ece89ceea0
commit 296077ace3
6 changed files with 127 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
/*
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.web.scripts.quickshare;
import java.io.IOException;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.springframework.extensions.webscripts.GUID;
import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest;
/**
* This class tests QuickShare REST API with disabled QuickShare feature
*
* @author sergey.shcherbovich
* @since 4.2
*/
public class QuickShareTurnedOffRestApiTest extends BaseWebScriptTest
{
private static final String APPLICATION_JSON = "application/json";
private final static String SHARE_URL = "/api/internal/shared/share/{node_ref}";
@Override
protected void setUp() throws Exception
{
setCustomContext("classpath:alfresco/quick-share-turned-off-test-context.xml");
super.setUp();
getServer().getApplicationContext();
}
public void testQuickShareDisabled() throws IOException
{
String testNodeRef = "workspace://SpacesStore/" + GUID.generate();
sendRequest(new PostRequest(SHARE_URL.replace("{node_ref}", testNodeRef), "", APPLICATION_JSON), 403, AuthenticationUtil.getAdminUserName());
}
}