mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.1 to HEAD
13033: Back end support for ETHREEOH-1179 13038: JAWS-436 - refactor WCM submit dialog to use WCM sandbox service + update unit tests 13046: Merged V3.0 to V3.1 13043: Merged V2.2 to V3.0 13016: Fix for ETWOTWO-1088 (reset layer using flatten rather than delete & add, users can flatten in stores they own but not delete) 13049: Build/test fix (WCM AssetTest) 13057: Merged V2.1-A to V3.1 8770: Added Flex SDK module 8771: Added Flex SDK binary (swc) DH: I'm not sure about the svn:eol-style property appearing here. SVN Clients? 13059: Added 'AIX' as a platform type, from Adobe V2.1A, missed checkin. 13060: [no comments] 13061: [no comments] 13063: [no comments] 13064: [no comments] 13066: [no comments] 13067: Add NodeService.getChildrenByName 13072: Added new NodeService.getChildrenByName() method to public-services-security-context. ___________________________________________________________________ Modified: svn:mergeinfo Merged /alfresco/BRANCHES/V3.0:r13043 Merged /alfresco/BRANCHES/V2.2:r13016 Merged /alfresco/BRANCHES/V3.1:r13033,13038,13046,13049,13057,13059-13061,13063-13064,13066-13067,13072 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13552 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -32,42 +32,27 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.avm.AVMNotFoundException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.alfresco.util.PropertyMap;
|
||||
import org.alfresco.wcm.AbstractWCMServiceImplTest;
|
||||
import org.alfresco.wcm.sandbox.SandboxInfo;
|
||||
import org.alfresco.wcm.sandbox.SandboxService;
|
||||
import org.alfresco.wcm.util.WCMUtil;
|
||||
import org.alfresco.wcm.webproject.WebProjectInfo;
|
||||
import org.alfresco.wcm.webproject.WebProjectService;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
/**
|
||||
* Asset Service implementation unit test
|
||||
*
|
||||
* @author janv
|
||||
*/
|
||||
public class AssetServiceImplTest extends TestCase
|
||||
public class AssetServiceImplTest extends AbstractWCMServiceImplTest
|
||||
{
|
||||
private static final ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
|
||||
|
||||
//
|
||||
// test data
|
||||
//
|
||||
|
||||
private static final String TEST_RUN = ""+System.currentTimeMillis();
|
||||
private static final boolean CLEAN = true; // cleanup during teardown
|
||||
|
||||
// base web project
|
||||
private static final String TEST_WEBPROJ_DNS = "testAsset-"+TEST_RUN;
|
||||
private static final String TEST_WEBPROJ_NAME = "testAsset Web Project Display Name - "+TEST_RUN;
|
||||
@@ -83,7 +68,7 @@ public class AssetServiceImplTest extends TestCase
|
||||
private static final String USER_ONE = TEST_USER+"-One";
|
||||
private static final String USER_TWO = TEST_USER+"-Two";
|
||||
private static final String USER_THREE = TEST_USER+"-Three";
|
||||
|
||||
|
||||
//
|
||||
// services
|
||||
//
|
||||
@@ -92,20 +77,16 @@ public class AssetServiceImplTest extends TestCase
|
||||
private SandboxService sbService;
|
||||
private AssetService assetService;
|
||||
|
||||
private AuthenticationService authenticationService;
|
||||
private PersonService personService;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
// Get the required services
|
||||
wpService = (WebProjectService)ctx.getBean("WebProjectService");
|
||||
sbService = (SandboxService)ctx.getBean("SandboxService");
|
||||
assetService = (AssetService)ctx.getBean("AssetService");
|
||||
|
||||
authenticationService = (AuthenticationService)ctx.getBean("AuthenticationService");
|
||||
personService = (PersonService)ctx.getBean("PersonService");
|
||||
|
||||
|
||||
// By default run as Admin
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(USER_ADMIN);
|
||||
|
||||
@@ -140,32 +121,6 @@ public class AssetServiceImplTest extends TestCase
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
private void createUser(String userName)
|
||||
{
|
||||
if (authenticationService.authenticationExists(userName) == false)
|
||||
{
|
||||
authenticationService.createAuthentication(userName, "PWD".toCharArray());
|
||||
|
||||
PropertyMap ppOne = new PropertyMap(4);
|
||||
ppOne.put(ContentModel.PROP_USERNAME, userName);
|
||||
ppOne.put(ContentModel.PROP_FIRSTNAME, "firstName");
|
||||
ppOne.put(ContentModel.PROP_LASTNAME, "lastName");
|
||||
ppOne.put(ContentModel.PROP_EMAIL, "email@email.com");
|
||||
ppOne.put(ContentModel.PROP_JOBTITLE, "jobTitle");
|
||||
|
||||
personService.createPerson(ppOne);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteUser(String userName)
|
||||
{
|
||||
if (authenticationService.authenticationExists(userName) == true)
|
||||
{
|
||||
personService.deletePerson(userName);
|
||||
authenticationService.deleteAuthentication(userName);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAssetInfo(AssetInfo assetInfo, String expectedName, String expectedPath, String expectedCreator, boolean expectedIsFile, boolean expectedIsFolder, boolean expectedIsDeleted, boolean expectedIsLocked, String expectedLockOwner)
|
||||
{
|
||||
assertNotNull(assetInfo);
|
||||
@@ -720,7 +675,7 @@ public class AssetServiceImplTest extends TestCase
|
||||
checkAssetInfo(myMovedFile1Asset, "myFile1", path+"/myFolder2/myFile1", USER_ONE, true, false, false, false, null);
|
||||
}
|
||||
|
||||
public void testProperties()
|
||||
public void testProperties() throws InterruptedException
|
||||
{
|
||||
// create web project (also creates staging sandbox and admin's author sandbox)
|
||||
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-properties", TEST_WEBPROJ_NAME+"-properties", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION, TEST_WEBPROJ_DEFAULT_WEBAPP, TEST_WEBPROJ_DONT_USE_AS_TEMPLATE, null);
|
||||
@@ -760,6 +715,8 @@ public class AssetServiceImplTest extends TestCase
|
||||
|
||||
sbService.submitWebApp(sbStoreId, defaultWebApp, "submit1 label", "submit1 comment");
|
||||
|
||||
Thread.sleep(SUBMIT_DELAY);
|
||||
|
||||
assertNull(assetService.getLockOwner(myFile1Asset));
|
||||
|
||||
// update (or set, if not already set) specific properties - eg. title and description
|
||||
@@ -873,7 +830,7 @@ public class AssetServiceImplTest extends TestCase
|
||||
}
|
||||
|
||||
|
||||
public void testSimpleLockFile()
|
||||
public void testSimpleLockFile() throws InterruptedException
|
||||
{
|
||||
// create web project (also creates staging sandbox and admin's author sandbox)
|
||||
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-simpleLock", TEST_WEBPROJ_NAME+"-simpleLock", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION, TEST_WEBPROJ_DEFAULT_WEBAPP, TEST_WEBPROJ_DONT_USE_AS_TEMPLATE, null);
|
||||
@@ -918,6 +875,8 @@ public class AssetServiceImplTest extends TestCase
|
||||
|
||||
sbService.submitWebApp(sbStoreId, defaultWebApp, "submit1 label", "submit1 comment");
|
||||
|
||||
Thread.sleep(SUBMIT_DELAY);
|
||||
|
||||
assertNull(assetService.getLockOwner(myFile1Asset));
|
||||
assertTrue(assetService.hasLockAccess(myFile1Asset));
|
||||
|
||||
|
Reference in New Issue
Block a user