Commit 095b868f authored by Ivan Tyagov's avatar Ivan Tyagov

Moved CacheTool from ERP5 to ERP5Type

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11067 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9a0583a5
...@@ -1005,6 +1005,9 @@ class ERP5Generator(PortalGenerator): ...@@ -1005,6 +1005,9 @@ class ERP5Generator(PortalGenerator):
addTool('ERP5 Order Tool', None) addTool('ERP5 Order Tool', None)
if not p.hasObject('portal_tests'): if not p.hasObject('portal_tests'):
addTool('ERP5 Test Tool', None) addTool('ERP5 Test Tool', None)
# Add ERP5Type Tool
addTool = p.manage_addProduct['ERP5Type'].manage_addTool
if not p.hasObject('portal_caches'): if not p.hasObject('portal_caches'):
addTool('ERP5 Cache Tool', None) addTool('ERP5 Cache Tool', None)
......
...@@ -46,7 +46,7 @@ product_path = package_home( globals() ) ...@@ -46,7 +46,7 @@ product_path = package_home( globals() )
# Define object classes and tools # Define object classes and tools
from Tool import CategoryTool, SimulationTool, RuleTool, IdTool, TemplateTool,\ from Tool import CategoryTool, SimulationTool, RuleTool, IdTool, TemplateTool,\
TestTool, DomainTool, AlarmTool, OrderTool, DeliveryTool,\ TestTool, DomainTool, AlarmTool, OrderTool, DeliveryTool,\
TrashTool, CacheTool TrashTool
import ERP5Site import ERP5Site
object_classes = ( ERP5Site.ERP5Site, object_classes = ( ERP5Site.ERP5Site,
) )
...@@ -61,7 +61,6 @@ portal_tools = ( CategoryTool.CategoryTool, ...@@ -61,7 +61,6 @@ portal_tools = ( CategoryTool.CategoryTool,
OrderTool.OrderTool, OrderTool.OrderTool,
DeliveryTool.DeliveryTool, DeliveryTool.DeliveryTool,
TrashTool.TrashTool, TrashTool.TrashTool,
CacheTool.CacheTool,
) )
content_classes = () content_classes = ()
content_constructors = () content_constructors = ()
......
This diff is collapsed.
...@@ -53,7 +53,7 @@ def allowClassTool(): ...@@ -53,7 +53,7 @@ def allowClassTool():
def initialize( context ): def initialize( context ):
# Import Product Components # Import Product Components
from Tool import ClassTool from Tool import ClassTool, CacheTool
import Document import Document
import Base, XMLObject import Base, XMLObject
from ERP5Type import ERP5TypeInformation from ERP5Type import ERP5TypeInformation
...@@ -61,7 +61,8 @@ def initialize( context ): ...@@ -61,7 +61,8 @@ def initialize( context ):
object_classes = () object_classes = ()
content_constructors = () content_constructors = ()
content_classes = (Base.Base, XMLObject.XMLObject,) content_classes = (Base.Base, XMLObject.XMLObject,)
portal_tools = (ClassTool.ClassTool, ) portal_tools = (ClassTool.ClassTool,
CacheTool.CacheTool,)
# Do initialization step # Do initialization step
initializeProduct(context, this_module, globals(), initializeProduct(context, this_module, globals(),
document_module = Document, document_module = Document,
......
...@@ -70,37 +70,39 @@ class TestCacheTool(ERP5TypeTestCase): ...@@ -70,37 +70,39 @@ class TestCacheTool(ERP5TypeTestCase):
user = uf.getUserById('seb').__of__(uf) user = uf.getUserById('seb').__of__(uf)
newSecurityManager(None, user) newSecurityManager(None, user)
def test_01_CheckCacheTool(self, quiet=0, run=run_all_test): def test_01_CreateCacheTool(self, quiet=0, run=run_all_test):
if not run: if not run:
return return
if not quiet: if not quiet:
message = '\nCheck CacheTool ' message = '\nCreate CacheTool '
ZopeTestCase._print(message) ZopeTestCase._print(message)
LOG('Testing... ',0,message) LOG('Testing... ',0,message)
portal = self.getPortal() portal = self.getPortal()
self.assertNotEqual(None,getattr(portal,'portal_caches',None)) addTool = portal.manage_addProduct['ERP5'].manage_addTool
addTool("ERP5 Cache Tool", None)
get_transaction().commit() get_transaction().commit()
def test_02_CheckPortalTypes(self, quiet=0, run=run_all_test): def test_02_CreatePortalTypes(self, quiet=0, run=run_all_test):
if not run: if not run:
return return
if not quiet: if not quiet:
message = '\nCheck Portal Types' message = '\nCreate Portal Types'
ZopeTestCase._print(message) ZopeTestCase._print(message)
LOG('Testing... ',0,message) LOG('Testing... ',0,message)
portal = self.getPortal() portal = self.getPortal()
portal_types = portal.portal_types portal_types = portal.portal_types
typeinfo_names = ("Cache Factory", typeinfo_names = ("ERP5Type: Cache Factory (ERP5 Cache Factory)",
"Ram Cache Plugin", "ERP5Type: Ram Cache Plugin (ERP5 Ram Cache Plugin)",
"Distributed Ram Cache Plugin", "ERP5Type: Distributed Ram Cache Plugin (ERP5 Distributed Ram Cache Plugin)",
"SQL Cache Plugin", "ERP5Type: SQL Cache Plugin (ERP5 SQL Cache Plugin)",
) )
for typeinfo_name in typeinfo_names: for typeinfo_name in typeinfo_names:
portal_type = getattr(portal_types,typeinfo_name,None) portal_types.manage_addTypeInformation(add_meta_type = "ERP5 Type Information",
self.assertNotEqual(None,portal_type) id = "",
typeinfo_name = typeinfo_name)
get_transaction().commit() get_transaction().commit()
def test_03_CreateCacheFactories(self, quiet=0, run=run_all_test): def test_03_CreateCacheFactories(self, quiet=0, run=run_all_test):
...@@ -156,11 +158,15 @@ class TestCacheTool(ERP5TypeTestCase): ...@@ -156,11 +158,15 @@ class TestCacheTool(ERP5TypeTestCase):
portal_caches.updateCache() portal_caches.updateCache()
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
## do we have cache enabled for this site?
erp5_site_id = portal.getId()
self.assert_(CachingMethod.factories.has_key(erp5_site_id))
## do we have the same structure we created above? ## do we have the same structure we created above?
self.assert_('ram_cache_factory' in CachingMethod.factories) self.assert_('ram_cache_factory' in CachingMethod.factories[erp5_site_id])
self.assert_('distributed_ram_cache_factory' in CachingMethod.factories) self.assert_('distributed_ram_cache_factory' in CachingMethod.factories[erp5_site_id])
self.assert_('sql_cache_factory' in CachingMethod.factories) self.assert_('sql_cache_factory' in CachingMethod.factories[erp5_site_id])
self.assert_('erp5_user_factory' in CachingMethod.factories) self.assert_('erp5_user_factory' in CachingMethod.factories[erp5_site_id])
def test_04_CreateCachedMethod(self, quiet=0, run=run_all_test): def test_04_CreateCachedMethod(self, quiet=0, run=run_all_test):
if not run: if not run:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment