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

77169: Merged PLATFORM1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud)
      74318: ACE-1996: Cluster: Web client extensions not distributed:
       - Remove initial title/description resolving in CMIS dictionaries
       Merged DEV to PLATFORM1(4.3.0) with corrections
         72232: MNT-9882: Cluster: Web client extensions not distributed
          - Use asynchronously refreshed cache in diactionaryDAO
         73275: MNT-9882: Cluster: Web client extensions not distributed
          - Add javadocs, remove excess classes.
         73509: MNT-9882: Cluster: Web client extensions not distributed
          - Remove stale configs for "compiledModelsSharedCache", remove unreachable code from DictionaryDAOImpl, return value from NoOpCompiledModelsCache.get() method.
         73591: ACE-1996: Cluster: Web client extensions not distributed
          - Remove NoOpCompiledModelsCache.
          - Modify unit tests that uses CompiledModelCache 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@78027 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2014-07-23 16:14:52 +00:00
parent 8c1ce90649
commit eaf4f69cdd
8 changed files with 100 additions and 54 deletions

View File

@@ -23,6 +23,7 @@ import static org.junit.Assert.assertNull;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.cache.MemoryCache;
@@ -33,6 +34,10 @@ import org.alfresco.repo.tenant.SingleTServiceImpl;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.repo.tenant.TenantUtil;
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
import org.alfresco.util.DynamicallySizedThreadPoolExecutor;
import org.alfresco.util.TraceableThreadFactory;
import org.alfresco.util.ThreadPoolExecutorFactoryBean;
import org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.TypeDefinition;
import org.alfresco.service.namespace.QName;
@@ -40,6 +45,7 @@ import org.junit.Before;
import org.junit.Test;
import org.springframework.extensions.surf.util.I18NUtil;
/**
*
* @author sglover
@@ -64,7 +70,7 @@ public class DictionaryDAOTest
this.dictionaryDAO = new DictionaryDAOImpl();
dictionaryDAO.setTenantService(tenantService);
initDictionaryCaches(dictionaryDAO);
initDictionaryCaches(dictionaryDAO, tenantService);
new AuthenticationUtil().afterPropertiesSet();
@@ -87,19 +93,27 @@ public class DictionaryDAOTest
service = component;
}
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO)
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO, TenantService tenantService) throws Exception
{
dictionaryDAO.setDictionaryRegistryCache(new MemoryCache<String, DictionaryRegistry>());
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();
}
@Test
public void testBootstrap()
public void testBootstrap() throws Exception
{
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>();