Merged V3.1 to HEAD

13256: Fix ETHREEOH-1221   Hard-coded use of "admin" username
   ___________________________________________________________________
   Modified: svn:mergeinfo
      Merged /alfresco/BRANCHES/V3.1:r13256


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13613 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-03-12 21:48:15 +00:00
parent 78dea7096a
commit 66a8e117e1
14 changed files with 70 additions and 55 deletions

View File

@@ -26,6 +26,7 @@ package org.alfresco.repo.web.scripts;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.util.PropertyMap;
@@ -117,9 +118,9 @@ public class LoginTest extends BaseWebScriptTest
String ticketURL = "/api/login/ticket/"+ticket;
/**
* Negative test - validate as "admin" - should fail with a 404
* Negative test - validate as AuthenticationUtil.getAdminUserName() - should fail with a 404
*/
setDefaultRunAs("admin");
setDefaultRunAs(AuthenticationUtil.getAdminUserName());
sendRequest(new GetRequest(ticketURL), Status.STATUS_NOT_FOUND);
/**

View File

@@ -87,7 +87,7 @@ public class RepositoryContainerTest extends BaseWebScriptTest
public void testRunAs() throws Exception
{
Response response = sendRequest(new GetRequest(URL_RUNAS), 200, "admin");
Response response = sendRequest(new GetRequest(URL_RUNAS), 200, AuthenticationUtil.getAdminUserName());
assertEquals(USER_ONE, response.getContentAsString());
}
}

View File

@@ -67,6 +67,14 @@ public class TestWebScriptRepoServer extends TestWebScriptServer
}
/**
* Get default user name
*/
protected String getDefaultUserName()
{
return AuthenticationUtil.getAdminUserName();
}
/**
* Main entry point.
*/
public static void main(String[] args)
@@ -91,12 +99,12 @@ public class TestWebScriptRepoServer extends TestWebScriptServer
}
private final static String[] CONFIG_LOCATIONS = new String[]
{
"classpath:alfresco/application-context.xml",
"classpath:alfresco/webscript-framework-application-context.xml",
"classpath:alfresco/web-scripts-application-context.xml",
"classpath:alfresco/web-scripts-application-context-test.xml"
};
{
"classpath:alfresco/application-context.xml",
"classpath:alfresco/webscript-framework-application-context.xml",
"classpath:alfresco/web-scripts-application-context.xml",
"classpath:alfresco/web-scripts-application-context-test.xml"
};
/**
* Retrieve an instance of the TestWebScriptServer
@@ -155,7 +163,7 @@ public class TestWebScriptRepoServer extends TestWebScriptServer
}
catch(AuthenticationException e)
{
executeCommand("user admin");
executeCommand("user " + getDefaultUserName());
}
// execute command in context of currently selected user

View File

@@ -38,6 +38,7 @@ import java.util.Date;
import junit.framework.TestCase;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.site.SiteModel;
import org.alfresco.util.Base64;
import org.alfresco.util.ISO8601DateFormat;

View File

@@ -26,6 +26,7 @@ package org.alfresco.repo.web.scripts.activities.feed.control;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
@@ -70,7 +71,7 @@ public class FeedControlTest extends BaseWebScriptTest
this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent");
this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService");
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// Create users
createUser(TEST_USER);

View File

@@ -30,12 +30,14 @@ import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.site.SiteModel;
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.cmr.site.SiteInfo;
import org.alfresco.service.cmr.site.SiteService;
import org.alfresco.service.cmr.site.SiteVisibility;
import org.alfresco.util.PropertyMap;
import org.alfresco.web.scripts.TestWebScriptServer.DeleteRequest;
import org.alfresco.web.scripts.TestWebScriptServer.GetRequest;
@@ -62,7 +64,6 @@ public class BlogServiceTest extends BaseWebScriptTest
private PersonService personService;
private SiteService siteService;
private static final String USER_ADMIN = "admin";
private static final String USER_ONE = "UserOneSecondToo";
private static final String USER_TWO = "UserTwoSecondToo";
private static final String SITE_SHORT_NAME_BLOG = "BlogSiteShortNameTest";
@@ -88,14 +89,14 @@ public class BlogServiceTest extends BaseWebScriptTest
this.siteService = (SiteService)getServer().getApplicationContext().getBean("SiteService");
// Authenticate as user
this.authenticationComponent.setCurrentUser(USER_ADMIN);
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// Create test site
// - only create the site if it doesn't already exist
SiteInfo siteInfo = this.siteService.getSite(SITE_SHORT_NAME_BLOG);
if (siteInfo == null)
{
this.siteService.createSite("BlogSitePreset", SITE_SHORT_NAME_BLOG, "BlogSiteTitle", "BlogSiteDescription", true);
this.siteService.createSite("BlogSitePreset", SITE_SHORT_NAME_BLOG, "BlogSiteTitle", "BlogSiteDescription", SiteVisibility.PUBLIC);
}
// Create users
@@ -112,7 +113,7 @@ public class BlogServiceTest extends BaseWebScriptTest
super.tearDown();
// admin user required to delete user
this.authenticationComponent.setCurrentUser(USER_ADMIN);
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// TODO don't delete them as it seems they don't get cleaned up correctly
// delete the inviter user

View File

@@ -29,6 +29,7 @@ import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.site.SiteModel;
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.alfresco.service.cmr.security.AuthenticationService;
@@ -59,7 +60,6 @@ public class DiscussionServiceTest extends BaseWebScriptTest
private PersonService personService;
private SiteService siteService;
private static final String USER_ADMIN = "admin";
private static final String USER_ONE = "UserOneThird";
private static final String USER_TWO = "UserTwoThird";
private static final String SITE_SHORT_NAME_DISCUSSION = "DiscussionSiteShortNameThree";
@@ -84,7 +84,7 @@ public class DiscussionServiceTest extends BaseWebScriptTest
this.siteService = (SiteService)getServer().getApplicationContext().getBean("SiteService");
// Authenticate as user
this.authenticationComponent.setCurrentUser(USER_ADMIN);
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// Create test site
// - only create the site if it doesn't already exist
@@ -109,7 +109,7 @@ public class DiscussionServiceTest extends BaseWebScriptTest
super.tearDown();
// admin user required to delete user
this.authenticationComponent.setCurrentUser(USER_ADMIN);
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// delete the inviter user
//personService.deletePerson(USER_ONE);

View File

@@ -26,6 +26,7 @@ package org.alfresco.repo.web.scripts.preference;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
@@ -92,7 +93,7 @@ public class PreferenceServiceTest extends BaseWebScriptTest
protected void tearDown() throws Exception
{
super.tearDown();
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
}

View File

@@ -34,6 +34,7 @@ import java.util.Set;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.site.SiteModel;
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -52,7 +53,6 @@ import org.alfresco.web.scripts.TestWebScriptServer.GetRequest;
import org.alfresco.web.scripts.TestWebScriptServer.PostRequest;
import org.alfresco.web.scripts.TestWebScriptServer.PutRequest;
import org.alfresco.web.scripts.TestWebScriptServer.Response;
import org.htmlparser.parserapplications.SiteCapturer;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -122,7 +122,7 @@ public class SiteServiceTest extends BaseWebScriptTest
protected void tearDown() throws Exception
{
super.tearDown();
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// Tidy-up any site's create during the execution of the test
for (String shortName : this.createdSites)

View File

@@ -27,6 +27,7 @@ package org.alfresco.repo.web.scripts.tagging;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.model.Repository;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -128,7 +129,7 @@ public class TaggingServiceTest extends BaseWebScriptTest
protected void tearDown() throws Exception
{
super.tearDown();
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
this.taggingService.deleteTag(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"), TAG_1);
this.taggingService.deleteTag(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"), TAG_2);

View File

@@ -29,6 +29,7 @@ import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
@@ -112,7 +113,7 @@ public class WebProjectTest extends BaseWebScriptTest
protected void tearDown() throws Exception
{
super.tearDown();
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// Tidy-up any web projects created during the execution of the test
for (String webProjectRef : this.createdWebProjects)
@@ -133,7 +134,7 @@ public class WebProjectTest extends BaseWebScriptTest
public void testBasicCRUDWebProject() throws Exception
{
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
sendRequest(new DeleteRequest(URL_WEB_PROJECTS + "/" + BASIC_DNSNAME),0 );
@@ -201,7 +202,7 @@ public class WebProjectTest extends BaseWebScriptTest
{
int LOOP_COUNT = 5;
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
for(int i = 0; i < LOOP_COUNT; i++)
{
@@ -262,7 +263,7 @@ public class WebProjectTest extends BaseWebScriptTest
public void testUpdateWebProject() throws Exception
{
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
/**
* Create a web site

View File

@@ -29,6 +29,7 @@ import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
@@ -55,7 +56,6 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
private static final String USER_ONE = "WebProjectTestOne";
private static final String USER_TWO = "WebProjectTestTwo";
private static final String USER_THREE = "WebProjectTestThree";
private static final String USER_ADMIN = "admin";
public static final String ROLE_CONTENT_MANAGER = "ContentManager";
public static final String ROLE_CONTENT_PUBLISHER = "ContentPublisher";
public static final String ROLE_CONTENT_REVIEWER = "ContentReviewer";
@@ -113,7 +113,7 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
protected void tearDown() throws Exception
{
super.tearDown();
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// Tidy-up any web projects created during the execution of the test
for (String webProjectRef : this.createdWebProjects)
@@ -161,7 +161,7 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
public void testListMemberships() throws Exception
{
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// Create a site
String webProjectRef = createWebProject();
@@ -268,7 +268,7 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
public void testCreateMemberships() throws Exception
{
this.authenticationComponent.setCurrentUser(USER_ADMIN);
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webProjectRef = createWebProject();
@@ -356,7 +356,7 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
public void testGetMembership() throws Exception
{
this.authenticationComponent.setCurrentUser(USER_ADMIN);
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// Create a site
String webProjectRef = createWebProject();
@@ -371,13 +371,13 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
/**
* Now lookup the admin user and check they are a content manager
*/
Response response = sendRequest(new GetRequest(validURL + "/" + USER_ADMIN), Status.STATUS_OK);
Response response = sendRequest(new GetRequest(validURL + "/" + AuthenticationUtil.getAdminUserName()), Status.STATUS_OK);
JSONObject result = new JSONObject(response.getContentAsString());
JSONObject data = result.getJSONObject("data");
// Check the result
assertEquals(ROLE_CONTENT_MANAGER, data.get("role"));
assertEquals(USER_ADMIN, data.getJSONObject("person").get("userName"));
assertEquals(AuthenticationUtil.getAdminUserName(), data.getJSONObject("person").get("userName"));
}
// Update Not yet implemented
@@ -468,7 +468,7 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
public void testDeleteMembership() throws Exception
{
this.authenticationComponent.setCurrentUser(USER_ADMIN);
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webProjectRef = createWebProject();

View File

@@ -31,6 +31,7 @@ import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
@@ -57,7 +58,6 @@ public class AssetTest extends BaseWebScriptTest {
private static final String USER_TWO = "WebProjectTestTwo";
private static final String USER_THREE = "WebProjectTestThree";
private static final String USER_FOUR = "WebProjectTestFour";
private static final String USER_ADMIN = "admin";
public static final String ROLE_CONTENT_MANAGER = "ContentManager";
public static final String ROLE_CONTENT_PUBLISHER = "ContentPublisher";
public static final String ROLE_CONTENT_REVIEWER = "ContentReviewer";
@@ -199,7 +199,7 @@ public class AssetTest extends BaseWebScriptTest {
protected void tearDown() throws Exception
{
super.tearDown();
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// Tidy-up any web projects created during the execution of the test
for (String webProjectRef : this.createdWebProjects)
@@ -224,7 +224,7 @@ public class AssetTest extends BaseWebScriptTest {
*/
public void testModifiedAssetsWebAppTest() throws Exception
{
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
String sandboxref = createSandbox(webprojref, USER_ONE);
@@ -268,7 +268,7 @@ public class AssetTest extends BaseWebScriptTest {
assertNotNull("name is null", name);
assertEquals("name is wrong", "yellowFile1", name);
assertEquals("creator is wrong", "admin", creator);
assertEquals("creator is wrong", AuthenticationUtil.getAdminUserName(), creator);
assertTrue("not isFile", isFile);
assertFalse("not isFolder", isFolder);
assertFalse("not isDeleted", isDeleted);
@@ -284,7 +284,7 @@ public class AssetTest extends BaseWebScriptTest {
*/
public void testModifiedAssetsTest() throws Exception
{
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
String sandboxref = createSandbox(webprojref, USER_ONE);
@@ -344,7 +344,7 @@ public class AssetTest extends BaseWebScriptTest {
assertNotNull("name is null", name);
assertEquals("name is wrong", "myFile1", name);
assertEquals("creator is wrong", "admin", creator);
assertEquals("creator is wrong", AuthenticationUtil.getAdminUserName(), creator);
assertTrue("not isFile", isFile);
assertFalse("not isDirectory", isFolder);
assertFalse("not isDeleted", isDeleted);
@@ -398,7 +398,7 @@ public class AssetTest extends BaseWebScriptTest {
*/
public void testSubmitAssetsTest() throws Exception
{
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
String sandboxref = createSandbox(webprojref, USER_ONE);
@@ -671,7 +671,7 @@ public class AssetTest extends BaseWebScriptTest {
*/
public void testSubmitAssetsWebAppTest() throws Exception
{
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
String sandboxref = createSandbox(webprojref, USER_ONE);
@@ -727,7 +727,7 @@ public class AssetTest extends BaseWebScriptTest {
*/
public void testRevertAssetsTest() throws Exception
{
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
String sandboxref = createSandbox(webprojref, USER_ONE);
@@ -961,7 +961,7 @@ public class AssetTest extends BaseWebScriptTest {
*/
public void testRevertAssetsWebAppTest() throws Exception
{
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
String sandboxref = createSandbox(webprojref, USER_ONE);
@@ -1017,7 +1017,7 @@ public class AssetTest extends BaseWebScriptTest {
final String YELLOW_FILE = "YellowFile.xyz";
final String ROOT_FILE = "index.htm";
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
String sandboxref = createSandbox(webprojref, USER_ONE);
@@ -1119,7 +1119,7 @@ public class AssetTest extends BaseWebScriptTest {
final String YELLOW_FILE2 = "Buffy.jpg";
final String ROOT_FILE = "index.htm";
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
String sandboxref = createSandbox(webprojref, USER_ONE);
@@ -1206,7 +1206,7 @@ public class AssetTest extends BaseWebScriptTest {
final String YELLOW_FILE = "YellowFile.xyz";
final String ROOT_FILE = "index.htm";
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
String sandboxref = createSandbox(webprojref, USER_ONE);
@@ -1311,7 +1311,7 @@ public class AssetTest extends BaseWebScriptTest {
final String PURPLE_FILE2 = "willow.htm";
final String ROOT_MOVED_FILE = "smashing.htm";
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
String sandboxref = createSandbox(webprojref, USER_ONE);
@@ -1391,7 +1391,7 @@ public class AssetTest extends BaseWebScriptTest {
final String YELLOW_FILE = "buffy.jpg";
final String ROOT_FILE = "index.htm";
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
String sandboxref = createSandbox(webprojref, USER_ONE);

View File

@@ -31,6 +31,7 @@ import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
@@ -59,7 +60,6 @@ public class SandboxTest extends BaseWebScriptTest {
private static final String USER_TWO = "WebProjectTestTwo";
private static final String USER_THREE = "WebProjectTestThree";
private static final String USER_FOUR = "WebProjectTestFour";
private static final String USER_ADMIN = "admin";
public static final String ROLE_CONTENT_MANAGER = "ContentManager";
public static final String ROLE_CONTENT_PUBLISHER = "ContentPublisher";
public static final String ROLE_CONTENT_REVIEWER = "ContentReviewer";
@@ -133,7 +133,7 @@ public class SandboxTest extends BaseWebScriptTest {
protected void tearDown() throws Exception
{
super.tearDown();
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// Tidy-up any web projects created during the execution of the test
for (String webProjectRef : this.createdWebProjects)
@@ -187,7 +187,7 @@ public class SandboxTest extends BaseWebScriptTest {
*/
public void testCreateSandbox() throws Exception
{
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
@@ -259,7 +259,7 @@ public class SandboxTest extends BaseWebScriptTest {
*/
public void testListSandbox() throws Exception
{
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
/**
@@ -363,7 +363,7 @@ public class SandboxTest extends BaseWebScriptTest {
*/
public void testGetSandbox() throws Exception
{
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
@@ -432,7 +432,7 @@ public class SandboxTest extends BaseWebScriptTest {
*/
public void testDeleteSandbox() throws Exception
{
this.authenticationComponent.setCurrentUser("admin");
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
String webprojref = createWebProject();
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);