|
@ -18,7 +18,7 @@ conf = {} |
|
|
# here you can select single testfunction for developping the tests |
|
|
# here you can select single testfunction for developping the tests |
|
|
TEST_FUNCTIONS = ["test_10actHandler", "test_21createInstance", "test_22createComponent", |
|
|
TEST_FUNCTIONS = ["test_10actHandler", "test_21createInstance", "test_22createComponent", |
|
|
"test_23getComponents", "test_24getComponent"] |
|
|
"test_23getComponents", "test_24getComponent"] |
|
|
#TEST_FUNCTIONS = ["test_formatDbRows"] |
|
|
TEST_FUNCTIONS = ["test_24getComponent"] |
|
|
|
|
|
|
|
|
class MyTestCase(unittest.TestCase): |
|
|
class MyTestCase(unittest.TestCase): |
|
|
mymsg = "--------------------------------------------------------------" |
|
|
mymsg = "--------------------------------------------------------------" |
|
@ -32,18 +32,18 @@ class MyTestCase(unittest.TestCase): |
|
|
return |
|
|
return |
|
|
job = test.testtools.getJob() |
|
|
job = test.testtools.getJob() |
|
|
cm = basic.componentHandling.ComponentManager() |
|
|
cm = basic.componentHandling.ComponentManager() |
|
|
cm.createComponent("testa21", 0, "") |
|
|
cm.createComponent("testpoldb", 0, "") |
|
|
self.assertIn("testa21", cm.comps, "component must be stored") |
|
|
self.assertIn("testpoldb", cm.comps, "component must be stored") |
|
|
self.assertEqual(len(cm.comps), 1, "component without subcomponents") |
|
|
self.assertEqual(len(cm.comps), 1, "component without subcomponents") |
|
|
cnttest += 2 |
|
|
cnttest += 2 |
|
|
cm.createComponent("testa1", 0, "") |
|
|
cm.createComponent("testprd", 0, "") |
|
|
self.assertIn("testa1", cm.comps, "component must be stored") |
|
|
self.assertIn("testprd", cm.comps, "component must be stored") |
|
|
self.assertIn("testa11", cm.comps, "subcomponent must be stored") |
|
|
self.assertIn("testprddb", cm.comps, "subcomponent must be stored") |
|
|
self.assertEqual(len(cm.comps), 3, "2 component with 1 subcomponents") |
|
|
self.assertEqual(len(cm.comps), 3, "2 component with 1 subcomponents") |
|
|
cnttest += 2 |
|
|
cnttest += 2 |
|
|
cm.createComponent("testa", 0, "") |
|
|
cm.createComponent("testcm", 0, "") |
|
|
self.assertIn("testa_01", cm.comps, "multiple component must be stored") |
|
|
self.assertIn("testcm_01", cm.comps, "multiple component must be stored") |
|
|
self.assertIn("testa_02", cm.comps, "multiple component must be stored") |
|
|
self.assertIn("testcm_02", cm.comps, "multiple component must be stored") |
|
|
self.assertEqual(len(cm.comps), 6, "2 component with 2 subcomponents and 2 sub-subcomponents") |
|
|
self.assertEqual(len(cm.comps), 6, "2 component with 2 subcomponents and 2 sub-subcomponents") |
|
|
cnttest += 2 |
|
|
cnttest += 2 |
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
@ -57,23 +57,23 @@ class MyTestCase(unittest.TestCase): |
|
|
return |
|
|
return |
|
|
job = test.testtools.getJob() |
|
|
job = test.testtools.getJob() |
|
|
cm = basic.componentHandling.ComponentManager.getInstance("J") |
|
|
cm = basic.componentHandling.ComponentManager.getInstance("J") |
|
|
componentName = "testa" |
|
|
componentName = "testcm" |
|
|
confs = utils.config_tool.getConfig("comp", componentName) |
|
|
confs = utils.config_tool.getConfig("comp", componentName) |
|
|
conns = utils.conn_tool.getConnections(componentName) |
|
|
conns = utils.conn_tool.getConnections(componentName) |
|
|
c = cm.createInstance(componentName, None, confs, conns, 1) |
|
|
c = cm.createInstance(componentName, None, confs, conns, 1) |
|
|
self.assertEqual(hasattr(c, "conf"), True, "cinfig-dict must be") |
|
|
self.assertEqual(hasattr(c, "conf"), True, "cinfig-dict must be") |
|
|
self.assertEqual(hasattr(c, "m"), True, "message-object must be") |
|
|
self.assertEqual(hasattr(c, "m"), True, "message-object must be") |
|
|
self.assertEqual(c.name, "testa_01", "classname with number") # classname with number |
|
|
self.assertEqual(c.name, "testcm_01", "classname with number") # classname with number |
|
|
cnttest += 3 |
|
|
cnttest += 3 |
|
|
self.assertEqual(c.conf[B.SUBJECT_INST][B.ATTR_INST_CNT], 2, "conn-attribute overwrites config-attribute") |
|
|
self.assertEqual(c.conf[B.SUBJECT_INST][B.ATTR_INST_CNT], 2, "conn-attribute overwrites config-attribute") |
|
|
cnttest += 1 # it overwrites |
|
|
cnttest += 1 # it overwrites |
|
|
self.assertEqual(c.conf[B.SUBJECT_INST][B.ATTR_INST_SGL], "n", "without conn-attribute the config-attribute keeps") |
|
|
self.assertEqual(c.conf[B.SUBJECT_INST][B.ATTR_INST_SGL], "n", "without conn-attribute the config-attribute keeps") |
|
|
cnttest += 1 # it keep |
|
|
cnttest += 1 # it keep |
|
|
componentName = "testa1" |
|
|
componentName = "testprddb" |
|
|
confs = utils.config_tool.getConfig("comp", componentName) |
|
|
confs = utils.config_tool.getConfig("comp", componentName) |
|
|
conns = utils.conn_tool.getConnections(componentName) |
|
|
conns = utils.conn_tool.getConnections(componentName) |
|
|
c = cm.createInstance(componentName, None, confs, conns, 0) |
|
|
c = cm.createInstance(componentName, None, confs, conns, 0) |
|
|
self.assertEqual(c.name, "testa1") |
|
|
self.assertEqual(c.name, "testprddb") |
|
|
self.assertIn(B.ATTR_DB_TYPE, c.conf[B.SUBJECT_ARTS][B.TOPIC_NODE_DB], "conn-attribute creates missing config-attribute") |
|
|
self.assertIn(B.ATTR_DB_TYPE, c.conf[B.SUBJECT_ARTS][B.TOPIC_NODE_DB], "conn-attribute creates missing config-attribute") |
|
|
cnttest += 2 # new attributes |
|
|
cnttest += 2 # new attributes |
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
@ -101,13 +101,14 @@ class MyTestCase(unittest.TestCase): |
|
|
return |
|
|
return |
|
|
job = test.testtools.getJob() |
|
|
job = test.testtools.getJob() |
|
|
cm = basic.componentHandling.ComponentManager() |
|
|
cm = basic.componentHandling.ComponentManager() |
|
|
cm.createComponent("testa", 0, "") |
|
|
cm.createComponent("testcm", 0, "") |
|
|
|
|
|
cm.createComponent("testcrm", 0, "") |
|
|
prog = "init_testcase" |
|
|
prog = "init_testcase" |
|
|
comps = cm.getComponents(prog) |
|
|
comps = cm.getComponents(prog) |
|
|
self.assertEqual(len(comps), 5, "not all created comps for program "+prog) |
|
|
self.assertEqual(len(comps), 7, "not all created comps for program "+prog) |
|
|
prog = "finish_testcase" |
|
|
prog = "check_environment" |
|
|
comps = cm.getComponents(prog) |
|
|
comps = cm.getComponents(prog) |
|
|
self.assertEqual(len(comps), 6, "all created comps for program "+prog) |
|
|
self.assertEqual(len(comps), 8, "all created comps for program "+prog) |
|
|
cnttest += 2 |
|
|
cnttest += 2 |
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
|
|
|
|
|
@ -120,15 +121,15 @@ class MyTestCase(unittest.TestCase): |
|
|
return |
|
|
return |
|
|
job = test.testtools.getJob() |
|
|
job = test.testtools.getJob() |
|
|
cm = basic.componentHandling.ComponentManager() |
|
|
cm = basic.componentHandling.ComponentManager() |
|
|
cm.createComponent("testa", 0, "") |
|
|
cm.createComponent("testcm", 0, "") |
|
|
self.assertEqual(len(cm.comps), 6, "6 components inside") |
|
|
self.assertEqual(len(cm.comps), 6, "6 components inside") |
|
|
comp = cm.getComponent("testa1") |
|
|
comp = cm.getComponent("testprd") |
|
|
self.assertEqual(len(cm.comps), 6, "6 components inside") |
|
|
self.assertEqual(len(cm.comps), 6, "6 components inside") |
|
|
self.assertEqual(comp.name, "testa1", "component found") |
|
|
self.assertEqual(comp.name, "testprd", "component found") |
|
|
cnttest += 2 |
|
|
cnttest += 2 |
|
|
comp = cm.getComponent("testb1") |
|
|
comp = cm.getComponent("testcrm") |
|
|
self.assertEqual(len(cm.comps), 6, "6 components inside and nothing added") |
|
|
self.assertEqual(len(cm.comps), 6, "6 components inside and nothing added") |
|
|
self.assertIsNotNone("terstb1") |
|
|
self.assertIsNotNone("terstcrm") |
|
|
cnttest += 2 |
|
|
cnttest += 2 |
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
|
|
|
|
|
|