2 Created on Mar 27, 2014 6 @link: http://hierarchical-cluster-engine.com/ 7 @copyright: Copyright © 2013-2014 IOIX Ukraine 8 @license: http://hierarchical-cluster-engine.com/license/ 13 from mock
import MagicMock
31 if event.eventType == EVENT_TYPES.ADMIN_FETCH_STAT_DATA: 32 print("-----------------------------------") 33 print(event.eventObj.className) 34 print(event.eventObj.fields) 47 if self.
eventType == EVENT_TYPES.ADMIN_FETCH_STAT_DATA:
48 retEventType = EVENT_TYPES.ADMIN_FETCH_STAT_DATA_RESPONSE
50 elif self.
eventType == EVENT_TYPES.ADMIN_SET_CONFIG_VARS:
51 retEventType = EVENT_TYPES.ADMIN_SET_CONFIG_VARS_RESPONSE
53 elif self.
eventType == EVENT_TYPES.ADMIN_GET_CONFIG_VARS:
54 retEventType = EVENT_TYPES.ADMIN_GET_CONFIG_VARS_RESPONSE
56 elif self.
eventType == EVENT_TYPES.ADMIN_STATE:
57 retEventType = EVENT_TYPES.ADMIN_STATE_RESPONSE
59 retEvent = eventBulder.build(retEventType, eventObj)
73 unittest.TestCase.__init__(self, methodName)
96 except SystemExit
as excp:
97 print(
"\nEXIT CODE >>> " + str(excp.message))
98 exitCode = excp.message
101 self.assertTrue(exitCode == 0,
">>> Error! Exit code != 0")
103 self.assertTrue(exitCode != 0,
">>> Error! Exit code == 0")
107 print(
"HELP TEST START >>> \n")
112 print(
"testFunctionalSTATBadConfig TEST START >>> \n")
113 self.
commonTestCode([
"--cmd",
"STAT",
"--config",
"./bad"],
False)
117 print(
"testFunctionalSTATBad1 TEST START >>> \n")
118 self.
commonTestCode([
"--cmd",
"STAT",
"--config",
"./dtma.ini"],
False)
122 print(
"testFunctionalSTAT TEST START >>> \n")
126 "TasksManager,ExecutionEnvironmentManager ",
"--config",
"./dtma.ini"],
True)
130 print(
"testFunctionalSETBad TEST START >>> \n")
131 self.
commonTestCode([
"--cmd",
"SET",
"--fields",
"cl1,cl2",
"--classes",
"cl1,cl2",
"--config",
"./dtma.ini"],
False)
135 print(
"testFunctionalSET TEST START >>> \n")
136 self.
commonTestCode([
"--cmd",
"SET",
"--fields",
"cl1:cl2,cl4:",
"--classes",
"cl1,cl2",
137 "--config",
"./dtma.ini"],
True)
141 print(
"testFunctionalGETBad TEST START >>> \n")
142 self.
commonTestCode([
"--cmd",
"GET",
"--fields",
"",
"--classes",
"cl1,cl2",
"--config",
"./dtma.ini"],
False)
146 print(
"testFunctionalGET TEST START >>> \n")
147 self.
commonTestCode([
"--cmd",
"GET",
"--fields",
"any",
"--classes",
"cl1,cl2",
"--config",
"./dtma.ini"],
True)
151 print(
"testFunctionalSTOPBad TEST START >>> \n")
152 self.
commonTestCode([
"--cmd",
"STOP",
"--classes",
"",
"--config",
"./dtma.ini"],
False)
156 print(
"testFunctionalSTOP TEST START >>> \n")
157 self.
commonTestCode([
"--cmd",
"STOP",
"--classes",
"cl1,cl2",
"--config",
"./dtma.ini"],
True)
160 if __name__ ==
"__main__":
def testFunctionalHELP(self)
def testFunctionalGET(self)
def connectionBuilderMockBuild(type, addr, networkType)
def testFunctionalSTOP(self)
DTMA Class contents main functional of DTMA application, class inherits from foundation.CementApp.
def testFunctionalSTAT(self)
def testFunctionalSTATBad1(self)
GeneralResponse event object, represents general state response for multipurpose usage.
def testFunctionalSETBad(self)
def testFunctionalSTOPBad(self)
AdminConfigVars event object, for admin set or get config variables from any of threaded classes or a...
def commonTestCode(self, args, isZerro)
def testFunctionalGETBad(self)
def testFunctionalSTATBadConfig(self)
AdminStatData event object, for admin fetch stat fields and possible data from any threaded classes i...
def __init__(self, methodName='runTest')
Class TestDTMA, contains functional tests of DTMA module.
def testFunctionalSET(self)