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)
77150: Merged PLATFORM1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud) 73977: ACE-1802 "MT / Cloud Restrict namespace URI of dynamic models." ACE-955 "Custom Content Models in Cloud" git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@78008 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package org.alfresco.opencmis;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper;
|
||||
import org.alfresco.repo.dictionary.DictionaryDAO;
|
||||
import org.alfresco.repo.dictionary.M2Model;
|
||||
import org.alfresco.repo.tenant.TenantUtil;
|
||||
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations={"classpath:alfresco/application-context.xml"})
|
||||
public class CMISDictionaryTest
|
||||
{
|
||||
private DictionaryDAO dictionaryDAO;
|
||||
private CMISDictionaryService cmisDictionaryService;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Before
|
||||
public void before()
|
||||
{
|
||||
this.dictionaryDAO = (DictionaryDAO)applicationContext.getBean("dictionaryDAO");
|
||||
this.cmisDictionaryService = (CMISDictionaryService)applicationContext.getBean("OpenCMISDictionaryService1.1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test1()
|
||||
{
|
||||
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