mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
63670: Merged DEV to HEAD-BUG-FIX (4.3) 63618: Fixed ACE-762: BM-0012: NodeLockedException not handled by CMIS - Refactored interceptor to handle previous TODO: Dig into exceptions to find deep causal issues of interest - Added unit test - Translate lock-related Alfresco exception into CMIS exception 63619: Further testing for ACE-762: BM-0012: NodeLockedException not handled by CMIS - Extended test to ensure that locked nodes generate the correct CMIS exception 63630: Added test for ACE-762 and cleaned up pointless warnings git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@64309 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -36,6 +36,7 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
|||||||
import org.alfresco.repo.tenant.TenantService;
|
import org.alfresco.repo.tenant.TenantService;
|
||||||
import org.alfresco.repo.tenant.TenantUtil;
|
import org.alfresco.repo.tenant.TenantUtil;
|
||||||
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.rest.api.tests.RepoService.SiteInformation;
|
import org.alfresco.rest.api.tests.RepoService.SiteInformation;
|
||||||
import org.alfresco.rest.api.tests.RepoService.TestNetwork;
|
import org.alfresco.rest.api.tests.RepoService.TestNetwork;
|
||||||
import org.alfresco.rest.api.tests.RepoService.TestPerson;
|
import org.alfresco.rest.api.tests.RepoService.TestPerson;
|
||||||
@@ -56,6 +57,8 @@ import org.alfresco.rest.api.tests.client.data.NodeRating.Aggregate;
|
|||||||
import org.alfresco.rest.api.tests.client.data.Person;
|
import org.alfresco.rest.api.tests.client.data.Person;
|
||||||
import org.alfresco.rest.api.tests.client.data.SiteRole;
|
import org.alfresco.rest.api.tests.client.data.SiteRole;
|
||||||
import org.alfresco.rest.api.tests.client.data.Tag;
|
import org.alfresco.rest.api.tests.client.data.Tag;
|
||||||
|
import org.alfresco.service.cmr.lock.LockService;
|
||||||
|
import org.alfresco.service.cmr.lock.LockType;
|
||||||
import org.alfresco.service.cmr.repository.ContentReader;
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -81,6 +84,7 @@ import org.apache.chemistry.opencmis.commons.data.ContentStream;
|
|||||||
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
|
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
|
||||||
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||||
|
import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
|
||||||
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
|
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
|
||||||
import org.apache.commons.httpclient.HttpStatus;
|
import org.apache.commons.httpclient.HttpStatus;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
@@ -91,6 +95,7 @@ import org.springframework.context.ApplicationContext;
|
|||||||
public class TestCMIS extends EnterpriseTestApi
|
public class TestCMIS extends EnterpriseTestApi
|
||||||
{
|
{
|
||||||
private DictionaryDAO dictionaryDAO;
|
private DictionaryDAO dictionaryDAO;
|
||||||
|
private LockService lockService;
|
||||||
private TenantService tenantService;
|
private TenantService tenantService;
|
||||||
private CMISStrictDictionaryService cmisDictionary;
|
private CMISStrictDictionaryService cmisDictionary;
|
||||||
private QNameFilter cmisTypeExclusions;
|
private QNameFilter cmisTypeExclusions;
|
||||||
@@ -100,6 +105,7 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
{
|
{
|
||||||
ApplicationContext ctx = getTestFixture().getApplicationContext();
|
ApplicationContext ctx = getTestFixture().getApplicationContext();
|
||||||
this.dictionaryDAO = (DictionaryDAO)ctx.getBean("dictionaryDAO");
|
this.dictionaryDAO = (DictionaryDAO)ctx.getBean("dictionaryDAO");
|
||||||
|
this.lockService = (LockService) ctx.getBean("lockService");
|
||||||
this.tenantService = (TenantService)ctx.getBean("tenantService");
|
this.tenantService = (TenantService)ctx.getBean("tenantService");
|
||||||
this.cmisDictionary = (CMISStrictDictionaryService)ctx.getBean("OpenCMISDictionaryService");
|
this.cmisDictionary = (CMISStrictDictionaryService)ctx.getBean("OpenCMISDictionaryService");
|
||||||
this.cmisTypeExclusions = (QNameFilter)ctx.getBean("cmisTypeExclusions");
|
this.cmisTypeExclusions = (QNameFilter)ctx.getBean("cmisTypeExclusions");
|
||||||
@@ -558,7 +564,8 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
/**
|
/**
|
||||||
* Tests CMIS and non-CMIS public api interactions
|
* Tests CMIS and non-CMIS public api interactions
|
||||||
*/
|
*/
|
||||||
@Test
|
@SuppressWarnings("deprecation")
|
||||||
|
@Test
|
||||||
public void testScenario1() throws Exception
|
public void testScenario1() throws Exception
|
||||||
{
|
{
|
||||||
final TestNetwork network1 = getTestFixture().getRandomNetwork();
|
final TestNetwork network1 = getTestFixture().getRandomNetwork();
|
||||||
@@ -600,8 +607,41 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
Comment c = commentsProxy.createNodeComment(doc.getId(), new Comment("comment title 1", "comment 1"));
|
Comment c = commentsProxy.createNodeComment(doc.getId(), new Comment("comment title 1", "comment 1"));
|
||||||
|
|
||||||
System.out.println("Comment = " + c);
|
System.out.println("Comment = " + c);
|
||||||
|
|
||||||
|
// Now lock the document
|
||||||
|
String nodeRefStr = (String) doc.getPropertyValue("alfcmis:nodeRef");
|
||||||
|
final NodeRef nodeRef = new NodeRef(nodeRefStr);
|
||||||
|
final TenantRunAsWork<Void> runAsWork = new TenantRunAsWork<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
lockService.lock(nodeRef, LockType.WRITE_LOCK);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
RetryingTransactionCallback<Void> txnWork = new RetryingTransactionCallback<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void execute() throws Throwable
|
||||||
|
{
|
||||||
|
TenantUtil.runAsUserTenant(runAsWork, "bob", network1.getId());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
transactionHelper.doInTransaction(txnWork);
|
||||||
|
|
||||||
|
// Now attempt to update the document's metadata
|
||||||
|
try
|
||||||
|
{
|
||||||
|
doc.delete();
|
||||||
|
}
|
||||||
|
catch (CmisUpdateConflictException e)
|
||||||
|
{
|
||||||
|
// Expected: ACE-762 BM-0012: NodeLockedException not handled by CMIS
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
public void testInvalidMethods() throws Exception
|
public void testInvalidMethods() throws Exception
|
||||||
{
|
{
|
||||||
@@ -1289,7 +1329,8 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
|
|
||||||
doc1.setContentStream(fileContent, true);
|
doc1.setContentStream(fileContent, true);
|
||||||
AlfrescoDocument doc2 = (AlfrescoDocument)doc1.getObjectOfLatestVersion(false);
|
AlfrescoDocument doc2 = (AlfrescoDocument)doc1.getObjectOfLatestVersion(false);
|
||||||
String versionLabel2 = doc2.getVersionLabel();
|
@SuppressWarnings("unused")
|
||||||
|
String versionLabel2 = doc2.getVersionLabel();
|
||||||
|
|
||||||
assertTrue(Double.parseDouble(versionLabel) < Double.parseDouble(versionLabel1));
|
assertTrue(Double.parseDouble(versionLabel) < Double.parseDouble(versionLabel1));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user