mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
77154: Merged PLATFORM1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud) 74004: ACE-1802 "MT / Cloud Restrict namespace URI of dynamic models." ACE-955 "Custom Content Models in Cloud" fix tests git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@78012 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -22,6 +22,7 @@ package org.alfresco.opencmis;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
@@ -40,14 +41,20 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper;
|
||||
import org.alfresco.opencmis.search.CMISQueryOptions;
|
||||
import org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode;
|
||||
import org.alfresco.repo.action.evaluator.ComparePropertyValueEvaluator;
|
||||
import org.alfresco.repo.action.executer.AddFeaturesActionExecuter;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.dictionary.DictionaryDAO;
|
||||
import org.alfresco.repo.dictionary.M2Model;
|
||||
import org.alfresco.repo.domain.node.NodeDAO;
|
||||
import org.alfresco.repo.model.Repository;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.tenant.TenantUtil;
|
||||
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.action.ActionCondition;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
@@ -137,6 +144,8 @@ public class CMISTest
|
||||
private NamespaceService namespaceService;
|
||||
private AuthorityService authorityService;
|
||||
private PermissionService permissionService;
|
||||
private DictionaryDAO dictionaryDAO;
|
||||
private CMISDictionaryService cmisDictionaryService;
|
||||
|
||||
private AlfrescoCmisServiceFactory factory;
|
||||
|
||||
@@ -305,6 +314,8 @@ public class CMISTest
|
||||
this.nodeDAO = (NodeDAO) ctx.getBean("nodeDAO");
|
||||
this.authorityService = (AuthorityService)ctx.getBean("AuthorityService");
|
||||
this.permissionService = (PermissionService) ctx.getBean("permissionService");
|
||||
this.dictionaryDAO = (DictionaryDAO)ctx.getBean("dictionaryDAO");
|
||||
this.cmisDictionaryService = (CMISDictionaryService)ctx.getBean("OpenCMISDictionaryService1.1");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2217,9 +2228,9 @@ public class CMISTest
|
||||
AccessControlEntryImpl ace = new AccessControlEntryImpl();
|
||||
ace.setPrincipal(new AccessControlPrincipalDataImpl(testGroup));
|
||||
List<String> putPermissions = new ArrayList<String>();
|
||||
putPermissions.add(BasicPermissions.ALL);
|
||||
putPermissions.add(BasicPermissions.READ);
|
||||
putPermissions.add(BasicPermissions.WRITE);
|
||||
putPermissions.add(CMISAccessControlService.CMIS_ALL_PERMISSION);
|
||||
putPermissions.add(CMISAccessControlService.CMIS_READ_PERMISSION);
|
||||
putPermissions.add(CMISAccessControlService.CMIS_WRITE_PERMISSION);
|
||||
ace.setPermissions(putPermissions);
|
||||
ace.setDirect(true);
|
||||
acesList.add(ace);
|
||||
@@ -2314,4 +2325,37 @@ public class CMISTest
|
||||
AuthenticationUtil.popAuthentication();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dictionaryTest()
|
||||
{
|
||||
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
M2Model customModel = M2Model.createModel(
|
||||
Thread.currentThread().getContextClassLoader().
|
||||
getResourceAsStream("dictionary/dictionarydaotest_model1.xml"));
|
||||
dictionaryDAO.putModel(customModel);
|
||||
assertNotNull(cmisDictionaryService.findType("P:cm:dublincore"));
|
||||
TypeDefinitionWrapper td = cmisDictionaryService.findType("D:daotest1:type1");
|
||||
assertNotNull(td);
|
||||
return null;
|
||||
}
|
||||
}, "user1", "tenant1");
|
||||
|
||||
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
assertNotNull(cmisDictionaryService.findType("P:cm:dublincore"));
|
||||
TypeDefinitionWrapper td = cmisDictionaryService.findType("D:daotest1:type1");
|
||||
assertNull(td);
|
||||
return null;
|
||||
}
|
||||
}, "user2", "tenant2");
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user