mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Fix NPEs in unit tests
- The next problem will be that WQS doesn't compile anymore! git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@42245 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -20,6 +20,7 @@ package org.alfresco.repo.cache;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.AbstractMap.SimpleImmutableEntry;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -50,6 +51,20 @@ public final class DefaultSimpleCache<K extends Serializable, V extends Object>
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for programmatic use.
|
||||
* @param maxItems
|
||||
* @param cacheName
|
||||
*/
|
||||
public DefaultSimpleCache(int maxItems, String cacheName)
|
||||
{
|
||||
setMaxItems(maxItems);
|
||||
setBeanName(cacheName);
|
||||
afterPropertiesSet();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean contains(K key)
|
||||
{
|
||||
@@ -128,7 +143,7 @@ public final class DefaultSimpleCache<K extends Serializable, V extends Object>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public synchronized void afterPropertiesSet() throws Exception
|
||||
public synchronized void afterPropertiesSet()
|
||||
{
|
||||
if (maxItems < 1)
|
||||
{
|
||||
|
@@ -156,7 +156,7 @@ public class RoutingContentStoreTest extends AbstractWritableContentStoreTest
|
||||
{
|
||||
this.stores.add(store);
|
||||
}
|
||||
SimpleCache<Pair<String,String>, ContentStore> cache = new DefaultSimpleCache<Pair<String,String>, ContentStore>();
|
||||
SimpleCache<Pair<String,String>, ContentStore> cache = new DefaultSimpleCache<Pair<String,String>, ContentStore>(11, getClass().getName());
|
||||
super.setStoresCache(cache);
|
||||
}
|
||||
|
||||
|
@@ -116,7 +116,7 @@ public class RepoDictionaryDAOTest extends TestCase
|
||||
|
||||
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO)
|
||||
{
|
||||
SimpleCache<String,DictionaryRegistry> dictionaryCache = new DefaultSimpleCache<String, DictionaryRegistry>();
|
||||
SimpleCache<String,DictionaryRegistry> dictionaryCache = new DefaultSimpleCache<String, DictionaryRegistry>(11, getClass().getName());
|
||||
dictionaryDAO.setDictionaryRegistryCache(dictionaryCache);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user