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)
77245: Merged PLATFORM1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud) 76227: Merged DEV to PLATFORM1 with corrections 75545: ACE-1996: Cluster: Web client extensions not distributed: - Remove initial title/description resolving in CMIS dictionaries - Use asynchronously refreshed cache in diactionaryDAO - Modify unit tests that uses CompiledModelCache - Make sure that rootNode exists before children retrieving in DictionaryRepositoryBootstrap.getNodes() git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@78101 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -21,16 +21,20 @@ package org.alfresco.repo.policy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.repo.cache.MemoryCache;
|
||||
import org.alfresco.repo.dictionary.CompiledModelsCache;
|
||||
import org.alfresco.repo.dictionary.DictionaryBootstrap;
|
||||
import org.alfresco.repo.dictionary.DictionaryComponent;
|
||||
import org.alfresco.repo.dictionary.DictionaryDAOImpl;
|
||||
import org.alfresco.repo.tenant.SingleTServiceImpl;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.ThreadPoolExecutorFactoryBean;
|
||||
import org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry;
|
||||
|
||||
|
||||
public class PolicyComponentTest extends TestCase
|
||||
@@ -58,7 +62,7 @@ public class PolicyComponentTest extends TestCase
|
||||
TenantService tenantService = new SingleTServiceImpl();
|
||||
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
||||
dictionaryDAO.setTenantService(tenantService);
|
||||
initDictionaryCaches(dictionaryDAO);
|
||||
initDictionaryCaches(dictionaryDAO, tenantService);
|
||||
|
||||
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
|
||||
List<String> bootstrapModels = new ArrayList<String>();
|
||||
@@ -77,11 +81,18 @@ public class PolicyComponentTest extends TestCase
|
||||
policyComponent = new PolicyComponentImpl(dictionary);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO)
|
||||
@SuppressWarnings("unchecked")
|
||||
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO, TenantService tenantService) throws Exception
|
||||
{
|
||||
// note: unit tested here with null cache
|
||||
dictionaryDAO.setDictionaryRegistryCache(new MemoryCache());
|
||||
CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
|
||||
compiledModelsCache.setDictionaryDAO(dictionaryDAO);
|
||||
compiledModelsCache.setTenantService(tenantService);
|
||||
compiledModelsCache.setRegistry(new DefaultAsynchronouslyRefreshedCacheRegistry());
|
||||
ThreadPoolExecutorFactoryBean threadPoolfactory = new ThreadPoolExecutorFactoryBean();
|
||||
threadPoolfactory.afterPropertiesSet();
|
||||
compiledModelsCache.setThreadPoolExecutor((ThreadPoolExecutor) threadPoolfactory.getObject());
|
||||
dictionaryDAO.setDictionaryRegistryCache(compiledModelsCache);
|
||||
dictionaryDAO.init();
|
||||
}
|
||||
|
||||
public void testJavaBehaviour()
|
||||
|
Reference in New Issue
Block a user