diff --git a/source/java/org/alfresco/repo/dictionary/TestModel.java b/source/java/org/alfresco/repo/dictionary/TestModel.java index ca77fa77ad..e775a8aa6b 100644 --- a/source/java/org/alfresco/repo/dictionary/TestModel.java +++ b/source/java/org/alfresco/repo/dictionary/TestModel.java @@ -78,11 +78,7 @@ public class TestModel // construct dictionary dao TenantService tenantService = new SingleTServiceImpl(); - -// NamespaceDAOImpl namespaceDAO = new NamespaceDAOImpl(); -// namespaceDAO.setTenantService(tenantService); -// initNamespaceCaches(namespaceDAO); - + DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl(); dictionaryDAO.setTenantService(tenantService); @@ -118,10 +114,4 @@ public class TestModel SimpleCache dictionaryCache = new DefaultSimpleCache(); dictionaryDAO.setDictionaryRegistryCache(dictionaryCache); } - -// private static void initNamespaceCaches(NamespaceDAOImpl namespaceDAO) -// { -// SimpleCache namespaceCache = new DefaultSimpleCache(); -// namespaceDAO.setNamespaceRegistryCache(namespaceCache); -// } } \ No newline at end of file diff --git a/source/test-java/org/alfresco/repo/dictionary/RepoDictionaryDAOTest.java b/source/test-java/org/alfresco/repo/dictionary/RepoDictionaryDAOTest.java index ea5beaad61..7cf56efe41 100644 --- a/source/test-java/org/alfresco/repo/dictionary/RepoDictionaryDAOTest.java +++ b/source/test-java/org/alfresco/repo/dictionary/RepoDictionaryDAOTest.java @@ -85,11 +85,8 @@ public class RepoDictionaryDAOTest extends TestCase I18NUtil.registerResourceBundle(TEST_RESOURCE_MESSAGES); // Instantiate Dictionary Service - TenantService tenantService = new SingleTServiceImpl(); -// NamespaceDAOImpl namespaceDAO = new NamespaceDAOImpl(); -// namespaceDAO.setTenantService(tenantService); -// initNamespaceCaches(namespaceDAO); - + TenantService tenantService = new SingleTServiceImpl(); + DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl(); dictionaryDAO.setTenantService(tenantService); initDictionaryCaches(dictionaryDAO); @@ -118,21 +115,11 @@ public class RepoDictionaryDAOTest extends TestCase SimpleCache dictionaryCache = new DefaultSimpleCache(11, getClass().getName() + ".dictionary"); dictionaryDAO.setDictionaryRegistryCache(dictionaryCache); } - -// private void initNamespaceCaches(NamespaceDAOImpl namespaceDAO) -// { -// SimpleCache namespaceCache = new DefaultSimpleCache(11, getClass().getName() + ".namespace"); -// namespaceDAO.setNamespaceRegistryCache(namespaceCache); -// } - public void testBootstrap() { TenantService tenantService = new SingleTServiceImpl(); -// NamespaceDAOImpl namespaceDAO = new NamespaceDAOImpl(); -// namespaceDAO.setTenantService(tenantService); -// initNamespaceCaches(namespaceDAO); - + DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl(); dictionaryDAO.setTenantService(tenantService); initDictionaryCaches(dictionaryDAO); @@ -416,17 +403,11 @@ public class RepoDictionaryDAOTest extends TestCase { // source dictionary TenantService tenantService = new SingleTServiceImpl(); -// NamespaceDAOImpl namespaceDAO = new NamespaceDAOImpl(); -// namespaceDAO.setTenantService(tenantService); -// initNamespaceCaches(namespaceDAO); DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl(); dictionaryDAO.setTenantService(tenantService); initDictionaryCaches(dictionaryDAO); // destination dictionary -// NamespaceDAOImpl namespaceDAO2 = new NamespaceDAOImpl(); -// namespaceDAO2.setTenantService(tenantService); -// initNamespaceCaches(namespaceDAO2); DictionaryDAOImpl dictionaryDAO2 = new DictionaryDAOImpl(); dictionaryDAO2.setTenantService(tenantService); initDictionaryCaches(dictionaryDAO2); diff --git a/source/test-java/org/alfresco/repo/policy/MTPolicyComponentTest.java b/source/test-java/org/alfresco/repo/policy/MTPolicyComponentTest.java index 59a474b5b5..53a38dd351 100644 --- a/source/test-java/org/alfresco/repo/policy/MTPolicyComponentTest.java +++ b/source/test-java/org/alfresco/repo/policy/MTPolicyComponentTest.java @@ -18,31 +18,27 @@ */ package org.alfresco.repo.policy; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.List; -import java.util.Map; import junit.framework.TestCase; -import org.alfresco.repo.cache.NullCache; -import org.alfresco.repo.dictionary.CompiledModel; +import org.alfresco.repo.cache.MemoryCache; import org.alfresco.repo.dictionary.DictionaryBootstrap; import org.alfresco.repo.dictionary.DictionaryComponent; import org.alfresco.repo.dictionary.DictionaryDAOImpl; -import org.alfresco.repo.dictionary.NamespaceDAOImpl; -import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.tenant.TenantService; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.namespace.QName; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - /** * Policy Component Tests * @@ -83,13 +79,10 @@ public class MTPolicyComponentTest extends TestCase when(mockTenantService.getBaseName(any(StoreRef.class))).thenReturn(new StoreRef(BASE_PROTOCOL, BASE_IDENTIFIER)); -// NamespaceDAOImpl namespaceDAO = new NamespaceDAOImpl(); -// namespaceDAO.setTenantService(mockTenantService); -// initNamespaceCaches(namespaceDAO); DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl(); dictionaryDAO.setTenantService(mockTenantService); initDictionaryCaches(dictionaryDAO); - + DictionaryBootstrap bootstrap = new DictionaryBootstrap(); List bootstrapModels = new ArrayList(); bootstrapModels.add("alfresco/model/dictionaryModel.xml"); @@ -109,19 +102,12 @@ public class MTPolicyComponentTest extends TestCase policyComponent = x; } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO) { // note: unit tested here with null cache - dictionaryDAO.setDictionaryRegistryCache(new NullCache()); + dictionaryDAO.setDictionaryRegistryCache(new MemoryCache()); } - -// @SuppressWarnings("unchecked") -// private void initNamespaceCaches(NamespaceDAOImpl namespaceDAO) -// { -// // note: unit tested here with null cache -// namespaceDAO.setNamespaceRegistryCache(new NullCache()); -// } public void testJavaBehaviour() { diff --git a/source/test-java/org/alfresco/repo/policy/PolicyComponentTest.java b/source/test-java/org/alfresco/repo/policy/PolicyComponentTest.java index 5e84294488..f09f103b81 100644 --- a/source/test-java/org/alfresco/repo/policy/PolicyComponentTest.java +++ b/source/test-java/org/alfresco/repo/policy/PolicyComponentTest.java @@ -28,7 +28,6 @@ import org.alfresco.repo.cache.NullCache; import org.alfresco.repo.dictionary.DictionaryBootstrap; import org.alfresco.repo.dictionary.DictionaryComponent; import org.alfresco.repo.dictionary.DictionaryDAOImpl; -import org.alfresco.repo.dictionary.NamespaceDAOImpl; import org.alfresco.repo.tenant.SingleTServiceImpl; import org.alfresco.repo.tenant.TenantService; import org.alfresco.service.namespace.QName; @@ -57,9 +56,6 @@ public class PolicyComponentTest extends TestCase { // Instantiate Dictionary Service TenantService tenantService = new SingleTServiceImpl(); -// NamespaceDAOImpl namespaceDAO = new NamespaceDAOImpl(); -// namespaceDAO.setTenantService(tenantService); -// initNamespaceCaches(namespaceDAO); DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl(); dictionaryDAO.setTenantService(tenantService); initDictionaryCaches(dictionaryDAO); @@ -87,13 +83,6 @@ public class PolicyComponentTest extends TestCase // note: unit tested here with null cache dictionaryDAO.setDictionaryRegistryCache(new NullCache()); } - -// @SuppressWarnings("unchecked") -// private void initNamespaceCaches(NamespaceDAOImpl namespaceDAO) -// { -// // note: unit tested here with null cache -// namespaceDAO.setNamespaceRegistryCache(new NullCache()); -// } public void testJavaBehaviour() {