MOB-659 (part 2 of 2) - improve dictionary cache reset (should work even with null / cache)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14059 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2009-04-23 10:29:32 +00:00
parent 9c91679af7
commit f28579cc8e
24 changed files with 777 additions and 532 deletions

View File

@@ -27,7 +27,6 @@ package org.alfresco.repo.dictionary;
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import junit.framework.TestCase;
import net.sf.ehcache.Cache;
@@ -35,7 +34,8 @@ import net.sf.ehcache.CacheManager;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.cache.EhCacheAdapter;
import org.alfresco.repo.dictionary.NamespaceDAOImpl.NamespaceData;
import org.alfresco.repo.dictionary.DictionaryDAOImpl.DictionaryRegistry;
import org.alfresco.repo.dictionary.NamespaceDAOImpl.NamespaceRegistry;
import org.alfresco.repo.tenant.SingleTServiceImpl;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.service.namespace.QName;
@@ -789,19 +789,12 @@ public class DiffModelTest extends TestCase
{
CacheManager cacheManager = new CacheManager();
Cache uriToModelsEhCache = new Cache("uriToModelsCache", 50, false, true, 0L, 0L);
cacheManager.addCache(uriToModelsEhCache);
EhCacheAdapter<String, Map<String, List<CompiledModel>>> uriToModelsCache = new EhCacheAdapter<String, Map<String, List<CompiledModel>>>();
uriToModelsCache.setCache(uriToModelsEhCache);
Cache dictionaryEhCache = new Cache("dictionaryCache", 50, false, true, 0L, 0L);
cacheManager.addCache(dictionaryEhCache);
EhCacheAdapter<String, DictionaryRegistry> dictionaryCache = new EhCacheAdapter<String, DictionaryRegistry>();
dictionaryCache.setCache(dictionaryEhCache);
dictionaryDAO.setUriToModelsCache(uriToModelsCache);
Cache compileModelsEhCache = new Cache("compiledModelsCache", 50, false, true, 0L, 0L);
cacheManager.addCache(compileModelsEhCache);
EhCacheAdapter<String, Map<QName,CompiledModel>> compileModelCache = new EhCacheAdapter<String, Map<QName,CompiledModel>>();
compileModelCache.setCache(compileModelsEhCache);
dictionaryDAO.setCompiledModelsCache(compileModelCache);
dictionaryDAO.setDictionaryRegistryCache(dictionaryCache);
}
private void initNamespaceCaches(NamespaceDAOImpl namespaceDAO)
@@ -810,10 +803,10 @@ public class DiffModelTest extends TestCase
Cache namespaceEhCache = new Cache("namespaceCache", 50, false, true, 0L, 0L);
cacheManager.addCache(namespaceEhCache);
EhCacheAdapter<String, NamespaceData> namespaceCache = new EhCacheAdapter<String, NamespaceData>();
EhCacheAdapter<String, NamespaceRegistry> namespaceCache = new EhCacheAdapter<String, NamespaceRegistry>();
namespaceCache.setCache(namespaceEhCache);
namespaceDAO.setNamespaceDataCache(namespaceCache);
namespaceDAO.setNamespaceRegistryCache(namespaceCache);
}
public void testDeleteModel()