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

57086: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3)
      56571: Merged V4.1-BUG-FIX (4.1.7) to V4.2-BUG-FIX (4.2.1)
         56392: Merged DEV to V4.1-BUG-FIX (4.1.7)
            56379 : MNT-9502 : Unlocking working copy leaves node in an unacessible and undefined state 
               - Using aspect workingcopy for "Cancel checkout" and "Checkin" actions
               - Unit test to demonstrate fix


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61715 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-11 19:23:41 +00:00
parent a03e4305d7
commit 69811b41dc
3 changed files with 44 additions and 17 deletions

View File

@@ -39,6 +39,7 @@ import org.alfresco.repo.version.VersionModel;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.lock.LockService;
import org.alfresco.service.cmr.lock.LockType;
import org.alfresco.service.cmr.lock.NodeLockedException;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.AssociationRef;
@@ -1131,7 +1132,6 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
assertTrue(thrown);
////////////////////////////////////////////////
// testing "move" actions with non-owner user //
////////////////////////////////////////////////
// create another person
@@ -1187,8 +1187,6 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
/**
* MNT-2641
* <p/>
* Original cannot be deleted while it is checked out. No one should be able to delete or update the original.
*/
public void testDeleteUpdateOriginalOfCheckedOutDocument()
{
@@ -1398,7 +1396,6 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
{
return nodeService.createNode(parentRef, ContentModel.ASSOC_CONTAINS, QName.createQName(contentName), ContentModel.TYPE_CONTENT).getChildRef();
}
private void createPerson(String userName)
{
// if user with given user name doesn't already exist then create user
@@ -1433,4 +1430,27 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
}
}
/**
* <br>
* Creating node - CheckOut - Add write lock to working copy - Unlock working copy - CancelCheckOut
*/
public void testCancelCheckoutUnlockedWCopy()
{
ServiceRegistry serviceRegistry = (ServiceRegistry)this.applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
CheckOutCheckInService securityCOCIService = serviceRegistry.getCheckOutCheckInService();
NodeRef folderA = createFolder(rootNodeRef, "testMnt9502_" + System.currentTimeMillis());
assertNotNull(folderA);
NodeRef clucc = createContent("checkout_lock_unlock_cancelCO", folderA);
assertNotNull(clucc);
NodeRef wc = securityCOCIService.checkout(clucc);
lockService.lock(wc, LockType.WRITE_LOCK, 60*60);
lockService.unlock(wc);
securityCOCIService.cancelCheckout(wc);
}
private NodeRef createFolder(NodeRef rootNodeRef, String fName)
{
return nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(fName), ContentModel.TYPE_FOLDER).getChildRef();
}
}