Commit 6b0b7d70 authored by Benjamin Blanc's avatar Benjamin Blanc

ERP5ProjectUnitTestDistributor: add getTestType and subscribeNode methods (for...

ERP5ProjectUnitTestDistributor: add getTestType and subscribeNode methods (for scalaility compatibility)
parent ac4390fb
......@@ -190,6 +190,42 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
"task_distribution", "default_memcached_plugin")
return memcached_dict
security.declarePublic("getTestType")
def getTestType(self, batch_mode=0):
"""
getTestType : return a string defining the test type
"""
return 'UnitTest'
security.declarePublic("subscribeNode")
def subscribeNode(self,title,computer_guid,batch_mode=0):
"""
subscribeNode doc
"""
test_node_module = self._getTestNodeModule()
portal = self.getPortalObject()
tag = "%s_%s" % (self.getRelativeUrl(), title)
if portal.portal_activities.countMessageWithTag(tag) == 0:
test_node_list = test_node_module.searchFolder(portal_type="Test Node",title=title)
assert len(test_node_list) in (0, 1), "Unable to find testnode : %s" % title
test_node = None
if len(test_node_list) == 1:
test_node = test_node_list[0].getObject()
if test_node.getValidationState() != 'validated':
try:
test_node.validate()
except e:
LOG('Test Node Validate',ERROR,'%s' %e)
if test_node is None:
test_node = test_node_module.newContent(portal_type="Test Node", title=title, computer_guid=computer_guid,
specialise=self.getRelativeUrl(),
activate_kw={'tag': tag})
self.activate(after_tag=tag).optimizeConfiguration()
test_node.setPingDate()
return test_node
return None
security.declarePublic("startTestSuite")
def startTestSuite(self,title, batch_mode=0):
"""
......
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