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)
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:
@@ -378,8 +378,8 @@
|
|||||||
|
|
||||||
<!-- The cross-transaction shared cache for Dictionary Models -->
|
<!-- The cross-transaction shared cache for Dictionary Models -->
|
||||||
|
|
||||||
<bean name="compiledModelsCache" factory-bean="cacheFactory" factory-method="createCache">
|
<bean name="compiledModelsCache" class="org.alfresco.repo.dictionary.CompiledModelsCache" parent="abstractAsynchronouslyRefreshedCache">
|
||||||
<constructor-arg value="cache.compiledModelsSharedCache"/>
|
<property name="dictionaryDAO" ref="dictionaryDAO" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- The cross-transaction shared cache for Dictionary Namespaces [Must be non-clustered, non-txn and UNLIMITED IN SIZE]-->
|
<!-- The cross-transaction shared cache for Dictionary Namespaces [Must be non-clustered, non-txn and UNLIMITED IN SIZE]-->
|
||||||
|
@@ -373,15 +373,6 @@ cache.messagesSharedCache.eviction-policy=LRU
|
|||||||
cache.messagesSharedCache.eviction-percentage=25
|
cache.messagesSharedCache.eviction-percentage=25
|
||||||
cache.messagesSharedCache.merge-policy=hz.ADD_NEW_ENTRY
|
cache.messagesSharedCache.merge-policy=hz.ADD_NEW_ENTRY
|
||||||
|
|
||||||
cache.compiledModelsSharedCache.maxItems=1000
|
|
||||||
cache.compiledModelsSharedCache.timeToLiveSeconds=0
|
|
||||||
cache.compiledModelsSharedCache.maxIdleSeconds=0
|
|
||||||
cache.compiledModelsSharedCache.cluster.type=invalidating
|
|
||||||
cache.compiledModelsSharedCache.backup-count=1
|
|
||||||
cache.compiledModelsSharedCache.eviction-policy=LRU
|
|
||||||
cache.compiledModelsSharedCache.eviction-percentage=25
|
|
||||||
cache.compiledModelsSharedCache.merge-policy=hz.ADD_NEW_ENTRY
|
|
||||||
|
|
||||||
cache.webScriptsRegistrySharedCache.maxItems=1000
|
cache.webScriptsRegistrySharedCache.maxItems=1000
|
||||||
cache.webScriptsRegistrySharedCache.timeToLiveSeconds=0
|
cache.webScriptsRegistrySharedCache.timeToLiveSeconds=0
|
||||||
cache.webScriptsRegistrySharedCache.maxIdleSeconds=0
|
cache.webScriptsRegistrySharedCache.maxIdleSeconds=0
|
||||||
|
@@ -20,11 +20,14 @@ package org.alfresco.repo.dictionary;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
import org.alfresco.repo.cache.DefaultSimpleCache;
|
import org.alfresco.repo.cache.DefaultSimpleCache;
|
||||||
import org.alfresco.repo.cache.SimpleCache;
|
import org.alfresco.repo.cache.SimpleCache;
|
||||||
import org.alfresco.repo.tenant.SingleTServiceImpl;
|
import org.alfresco.repo.tenant.SingleTServiceImpl;
|
||||||
import org.alfresco.repo.tenant.TenantService;
|
import org.alfresco.repo.tenant.TenantService;
|
||||||
|
import org.alfresco.util.ThreadPoolExecutorFactoryBean;
|
||||||
|
import org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,8 +45,9 @@ public class TestModel
|
|||||||
* TestModel [-h] [model filename]*
|
* TestModel [-h] [model filename]*
|
||||||
* <p>
|
* <p>
|
||||||
* Returns 0 for success.
|
* Returns 0 for success.
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args)
|
public static void main(String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args != null && args.length > 0 && args[0].equals("-h"))
|
if (args != null && args.length > 0 && args[0].equals("-h"))
|
||||||
{
|
{
|
||||||
@@ -82,7 +86,7 @@ public class TestModel
|
|||||||
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
||||||
dictionaryDAO.setTenantService(tenantService);
|
dictionaryDAO.setTenantService(tenantService);
|
||||||
|
|
||||||
initDictionaryCaches(dictionaryDAO);
|
initDictionaryCaches(dictionaryDAO, tenantService);
|
||||||
|
|
||||||
// bootstrap dao
|
// bootstrap dao
|
||||||
try
|
try
|
||||||
@@ -109,9 +113,16 @@ public class TestModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO)
|
private static void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO, TenantService tenantService) throws Exception
|
||||||
{
|
{
|
||||||
SimpleCache<String, DictionaryRegistry> dictionaryCache = new DefaultSimpleCache<String, DictionaryRegistry>();
|
CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
|
||||||
dictionaryDAO.setDictionaryRegistryCache(dictionaryCache);
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertNull;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.cache.MemoryCache;
|
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.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.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.DictionaryService;
|
||||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@@ -40,6 +45,7 @@ import org.junit.Before;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author sglover
|
* @author sglover
|
||||||
@@ -64,7 +70,7 @@ public class DictionaryDAOTest
|
|||||||
this.dictionaryDAO = new DictionaryDAOImpl();
|
this.dictionaryDAO = new DictionaryDAOImpl();
|
||||||
dictionaryDAO.setTenantService(tenantService);
|
dictionaryDAO.setTenantService(tenantService);
|
||||||
|
|
||||||
initDictionaryCaches(dictionaryDAO);
|
initDictionaryCaches(dictionaryDAO, tenantService);
|
||||||
|
|
||||||
new AuthenticationUtil().afterPropertiesSet();
|
new AuthenticationUtil().afterPropertiesSet();
|
||||||
|
|
||||||
@@ -87,19 +93,27 @@ public class DictionaryDAOTest
|
|||||||
service = component;
|
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
|
@Test
|
||||||
public void testBootstrap()
|
public void testBootstrap() throws Exception
|
||||||
{
|
{
|
||||||
TenantService tenantService = new SingleTServiceImpl();
|
TenantService tenantService = new SingleTServiceImpl();
|
||||||
|
|
||||||
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
||||||
dictionaryDAO.setTenantService(tenantService);
|
dictionaryDAO.setTenantService(tenantService);
|
||||||
initDictionaryCaches(dictionaryDAO);
|
initDictionaryCaches(dictionaryDAO, tenantService);
|
||||||
|
|
||||||
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
|
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
|
||||||
List<String> bootstrapModels = new ArrayList<String>();
|
List<String> bootstrapModels = new ArrayList<String>();
|
||||||
|
@@ -113,20 +113,18 @@ public class DictionaryLoadDAOTest
|
|||||||
|
|
||||||
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO, TenantService tenantService) throws Exception
|
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());
|
||||||
|
TraceableThreadFactory threadFactory = new TraceableThreadFactory();
|
||||||
|
threadFactory.setThreadDaemon(true);
|
||||||
|
threadFactory.setThreadPriority(Thread.NORM_PRIORITY);
|
||||||
|
|
||||||
// CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
|
ThreadPoolExecutor threadPoolExecutor = new DynamicallySizedThreadPoolExecutor(20, 20, 90, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), threadFactory,
|
||||||
// compiledModelsCache.setDictionaryDAO(dictionaryDAO);
|
new ThreadPoolExecutor.CallerRunsPolicy());
|
||||||
// compiledModelsCache.setTenantService(tenantService);
|
compiledModelsCache.setThreadPoolExecutor(threadPoolExecutor);
|
||||||
// compiledModelsCache.setRegistry(new DefaultAsynchronouslyRefreshedCacheRegistry());
|
dictionaryDAO.setDictionaryRegistryCache(compiledModelsCache);
|
||||||
// TraceableThreadFactory threadFactory = new TraceableThreadFactory();
|
|
||||||
// threadFactory.setThreadDaemon(true);
|
|
||||||
// threadFactory.setThreadPriority(Thread.NORM_PRIORITY);
|
|
||||||
//
|
|
||||||
// ThreadPoolExecutor threadPoolExecutor = new DynamicallySizedThreadPoolExecutor(20, 20, 90, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), threadFactory,
|
|
||||||
// new ThreadPoolExecutor.CallerRunsPolicy());
|
|
||||||
// compiledModelsCache.setThreadPoolExecutor(threadPoolExecutor);
|
|
||||||
// dictionaryDAO.setDictionaryRegistryCache(compiledModelsCache);
|
|
||||||
dictionaryDAO.init();
|
dictionaryDAO.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
@@ -54,6 +55,8 @@ import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
|||||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.util.ThreadPoolExecutorFactoryBean;
|
||||||
|
import org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry;
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
|
|
||||||
@@ -68,7 +71,7 @@ public class RepoDictionaryDAOTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUp()
|
public void setUp() throws Exception
|
||||||
{
|
{
|
||||||
// Registered the required constraints
|
// Registered the required constraints
|
||||||
ConstraintRegistry constraintRegistry = ConstraintRegistry.getInstance();
|
ConstraintRegistry constraintRegistry = ConstraintRegistry.getInstance();
|
||||||
@@ -89,7 +92,7 @@ public class RepoDictionaryDAOTest extends TestCase
|
|||||||
|
|
||||||
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
||||||
dictionaryDAO.setTenantService(tenantService);
|
dictionaryDAO.setTenantService(tenantService);
|
||||||
initDictionaryCaches(dictionaryDAO);
|
initDictionaryCaches(dictionaryDAO, tenantService);
|
||||||
|
|
||||||
// Populate with appropriate models
|
// Populate with appropriate models
|
||||||
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
|
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
|
||||||
@@ -110,19 +113,26 @@ public class RepoDictionaryDAOTest extends TestCase
|
|||||||
service = component;
|
service = component;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO)
|
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO, TenantService tenantService) throws Exception
|
||||||
{
|
{
|
||||||
SimpleCache<String,DictionaryRegistry> dictionaryCache = new DefaultSimpleCache<String, DictionaryRegistry>(11, getClass().getName() + ".dictionary");
|
CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
|
||||||
dictionaryDAO.setDictionaryRegistryCache(dictionaryCache);
|
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 testBootstrap()
|
public void testBootstrap() throws Exception
|
||||||
{
|
{
|
||||||
TenantService tenantService = new SingleTServiceImpl();
|
TenantService tenantService = new SingleTServiceImpl();
|
||||||
|
|
||||||
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
||||||
dictionaryDAO.setTenantService(tenantService);
|
dictionaryDAO.setTenantService(tenantService);
|
||||||
initDictionaryCaches(dictionaryDAO);
|
initDictionaryCaches(dictionaryDAO, tenantService);
|
||||||
|
|
||||||
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
|
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
|
||||||
List<String> bootstrapModels = new ArrayList<String>();
|
List<String> bootstrapModels = new ArrayList<String>();
|
||||||
@@ -399,18 +409,18 @@ public class RepoDictionaryDAOTest extends TestCase
|
|||||||
assertTrue("Expected 'true' for timestamp propagation", childAssocDef.getPropagateTimestamps());
|
assertTrue("Expected 'true' for timestamp propagation", childAssocDef.getPropagateTimestamps());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testADB159() throws UnsupportedEncodingException
|
public void testADB159() throws Exception
|
||||||
{
|
{
|
||||||
// source dictionary
|
// source dictionary
|
||||||
TenantService tenantService = new SingleTServiceImpl();
|
TenantService tenantService = new SingleTServiceImpl();
|
||||||
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
||||||
dictionaryDAO.setTenantService(tenantService);
|
dictionaryDAO.setTenantService(tenantService);
|
||||||
initDictionaryCaches(dictionaryDAO);
|
initDictionaryCaches(dictionaryDAO, tenantService);
|
||||||
|
|
||||||
// destination dictionary
|
// destination dictionary
|
||||||
DictionaryDAOImpl dictionaryDAO2 = new DictionaryDAOImpl();
|
DictionaryDAOImpl dictionaryDAO2 = new DictionaryDAOImpl();
|
||||||
dictionaryDAO2.setTenantService(tenantService);
|
dictionaryDAO2.setTenantService(tenantService);
|
||||||
initDictionaryCaches(dictionaryDAO2);
|
initDictionaryCaches(dictionaryDAO2, tenantService);
|
||||||
|
|
||||||
List<String> models = new ArrayList<String>();
|
List<String> models = new ArrayList<String>();
|
||||||
models.add("alfresco/model/dictionaryModel.xml");
|
models.add("alfresco/model/dictionaryModel.xml");
|
||||||
|
@@ -26,10 +26,12 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.alfresco.repo.cache.MemoryCache;
|
import org.alfresco.repo.cache.MemoryCache;
|
||||||
|
import org.alfresco.repo.dictionary.CompiledModelsCache;
|
||||||
import org.alfresco.repo.dictionary.DictionaryBootstrap;
|
import org.alfresco.repo.dictionary.DictionaryBootstrap;
|
||||||
import org.alfresco.repo.dictionary.DictionaryComponent;
|
import org.alfresco.repo.dictionary.DictionaryComponent;
|
||||||
import org.alfresco.repo.dictionary.DictionaryDAOImpl;
|
import org.alfresco.repo.dictionary.DictionaryDAOImpl;
|
||||||
@@ -38,6 +40,8 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.util.ThreadPoolExecutorFactoryBean;
|
||||||
|
import org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Policy Component Tests
|
* Policy Component Tests
|
||||||
@@ -81,7 +85,7 @@ public class MTPolicyComponentTest extends TestCase
|
|||||||
|
|
||||||
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
||||||
dictionaryDAO.setTenantService(mockTenantService);
|
dictionaryDAO.setTenantService(mockTenantService);
|
||||||
initDictionaryCaches(dictionaryDAO);
|
initDictionaryCaches(dictionaryDAO, mockTenantService);
|
||||||
|
|
||||||
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
|
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
|
||||||
List<String> bootstrapModels = new ArrayList<String>();
|
List<String> bootstrapModels = new ArrayList<String>();
|
||||||
@@ -102,11 +106,18 @@ public class MTPolicyComponentTest extends TestCase
|
|||||||
policyComponent = x;
|
policyComponent = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings("unchecked")
|
||||||
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO)
|
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO, TenantService tenantService) throws Exception
|
||||||
{
|
{
|
||||||
// note: unit tested here with null cache
|
CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
|
||||||
dictionaryDAO.setDictionaryRegistryCache(new MemoryCache());
|
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()
|
public void testJavaBehaviour()
|
||||||
|
@@ -21,16 +21,20 @@ package org.alfresco.repo.policy;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.alfresco.repo.cache.MemoryCache;
|
import org.alfresco.repo.cache.MemoryCache;
|
||||||
|
import org.alfresco.repo.dictionary.CompiledModelsCache;
|
||||||
import org.alfresco.repo.dictionary.DictionaryBootstrap;
|
import org.alfresco.repo.dictionary.DictionaryBootstrap;
|
||||||
import org.alfresco.repo.dictionary.DictionaryComponent;
|
import org.alfresco.repo.dictionary.DictionaryComponent;
|
||||||
import org.alfresco.repo.dictionary.DictionaryDAOImpl;
|
import org.alfresco.repo.dictionary.DictionaryDAOImpl;
|
||||||
import org.alfresco.repo.tenant.SingleTServiceImpl;
|
import org.alfresco.repo.tenant.SingleTServiceImpl;
|
||||||
import org.alfresco.repo.tenant.TenantService;
|
import org.alfresco.repo.tenant.TenantService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.util.ThreadPoolExecutorFactoryBean;
|
||||||
|
import org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry;
|
||||||
|
|
||||||
|
|
||||||
public class PolicyComponentTest extends TestCase
|
public class PolicyComponentTest extends TestCase
|
||||||
@@ -58,7 +62,7 @@ public class PolicyComponentTest extends TestCase
|
|||||||
TenantService tenantService = new SingleTServiceImpl();
|
TenantService tenantService = new SingleTServiceImpl();
|
||||||
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
|
||||||
dictionaryDAO.setTenantService(tenantService);
|
dictionaryDAO.setTenantService(tenantService);
|
||||||
initDictionaryCaches(dictionaryDAO);
|
initDictionaryCaches(dictionaryDAO, tenantService);
|
||||||
|
|
||||||
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
|
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
|
||||||
List<String> bootstrapModels = new ArrayList<String>();
|
List<String> bootstrapModels = new ArrayList<String>();
|
||||||
@@ -77,11 +81,18 @@ public class PolicyComponentTest extends TestCase
|
|||||||
policyComponent = new PolicyComponentImpl(dictionary);
|
policyComponent = new PolicyComponentImpl(dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings("unchecked")
|
||||||
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO)
|
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO, TenantService tenantService) throws Exception
|
||||||
{
|
{
|
||||||
// note: unit tested here with null cache
|
CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
|
||||||
dictionaryDAO.setDictionaryRegistryCache(new MemoryCache());
|
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()
|
public void testJavaBehaviour()
|
||||||
|
Reference in New Issue
Block a user