Module EDTestCaseEDActionCluster
[hide private]
[frames] | no frames]

Source Code for Module EDTestCaseEDActionCluster

 1  # 
 2  #    Project: The EDNA Kernel 
 3  #             http://www.edna-site.org 
 4  # 
 5  #    File: "$Id: EDTestCaseEDActionCluster.py 1472 2010-05-03 12:51:05Z svensson $" 
 6  # 
 7  #    Copyright (C) 2008-2011 European Synchrotron Radiation Facility 
 8  #                            Grenoble, France 
 9  # 
10  #    Principal authors: Marie-Francoise Incardona (incardon@esrf.fr) 
11  #                       Olof Svensson (svensson@esrf.fr)  
12  # 
13  #    This program is free software: you can redistribute it and/or modify 
14  #    it under the terms of the GNU Lesser General Public License as published 
15  #    by the Free Software Foundation, either version 3 of the License, or 
16  #    (at your option) any later version. 
17  # 
18  #    This program is distributed in the hope that it will be useful, 
19  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
20  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
21  #    GNU Lesser General Public License for more details. 
22  # 
23  #    You should have received a copy of the GNU General Public License 
24  #    and the GNU Lesser General Public License  along with this program.   
25  #    If not, see <http://www.gnu.org/licenses/>. 
26  # 
27   
28  __author__ = "Olof Svensson"  
29  __contact__ = "svensson@esrf.fr" 
30  __license__ = "LGPLv3+" 
31  __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" 
32   
33  import os 
34   
35  from EDAction import EDAction 
36  from EDActionCluster import EDActionCluster 
37  from EDAssert import EDAssert 
38  from EDTestCase import EDTestCase 
39   
40   
41 -class EDActionSuccess(EDAction):
42
43 - def process(self, _edAction=None):
44 self.DEBUG("Processing EDActionSuccess with id %s" % str(self.getId()))
45 46
47 -class EDActionFailure(EDAction):
48
49 - def process(self, _edAction=None):
50 self.DEBUG("Processing EDActionFailure with id %s" % str(self.getId())) 51 self.setFailure()
52 53
54 -class EDTestCaseEDActionCluster(EDTestCase):
55 """ 56 This is the test case for the plugin base class EDPlugin. 57 """ 58
60 """ 61 Test the EDActionCluster with actions ending in success 62 """ 63 edActionCluster = EDActionCluster() 64 for i in range(10): 65 edAction = EDActionSuccess() 66 edActionCluster.addAction(edAction) 67 edActionCluster.executeSynchronous() 68 EDAssert.equal(False, edActionCluster.isFailure(), "EDActionCluster ended in success")
69 70
72 """ 73 Test the EDActionCluster with actions ending in success 74 """ 75 edActionCluster = EDActionCluster() 76 for i in range(10): 77 edAction = EDActionSuccess() 78 edActionCluster.addAction(edAction) 79 edActionFailure = EDActionFailure() 80 edActionCluster.addAction(edActionFailure) 81 edActionCluster.executeSynchronous() 82 EDAssert.equal(True, edActionCluster.isFailure(), "EDActionCluster ended in failure")
83 84 85
86 - def process(self):
89 90 91 92 93 if __name__ == '__main__': 94 95 EDTestCaseEDActionCluster = EDTestCaseEDActionCluster("TestCase EDPluginExecProcessScript") 96 EDTestCaseEDActionCluster.execute() 97