Browse Source

refactoring: basic-model - bugfixe

refactor
Ulrich 1 year ago
parent
commit
5beb75faab
  1. 2
      basic/Testserver.py
  2. 7
      model/co_components.csv
  3. 14
      model/en_components.csv
  4. 3
      model/entity.py
  5. 1
      model/environment.py
  6. 18
      model/table.csv
  7. 8
      model/tc_usecases.csv
  8. 8
      model/tc_variants.csv
  9. 2
      model/testcase.csv
  10. 1
      model/testcase.py
  11. 7
      model/testplan.py
  12. 2
      model/testsuite.py
  13. 8
      model/ts_steps.csv
  14. 2
      test/test_90testserver.py
  15. 4
      tools/config_tool.py
  16. 1
      tools/filecsv_fcts.py

2
basic/Testserver.py

@ -100,7 +100,7 @@ class Testserver():
return "No DB in job-config" return "No DB in job-config"
# the model for administration # the model for administration
for m in self.model.keys(): for m in self.model.keys():
print("model " + m) print("\n==== model " + m)
self.createDBTable(job, B.ATTR_INST_TESTSERVER, B.ATTR_INST_TESTSERVER, m) self.createDBTable(job, B.ATTR_INST_TESTSERVER, B.ATTR_INST_TESTSERVER, m)
enty = self.model[m] enty = self.model[m]
for t in enty.getSubtableNames(): for t in enty.getSubtableNames():

7
model/co_components.csv

@ -0,0 +1,7 @@
_type;ddl;;;;;;;;;
_key;_field;;;;;;;;;
table:en_components;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;encomid;pk;int;N;;;;;;
;enid;int;int;I;;;;;;
;coid;int;int;I;;;;;;
;component;str;vchar(256);N;;;;;;
1 _type ddl
2 _key _field
3 table:en_components _field type format index generic aggregat key acceptance alias description
4 encomid pk int N
5 enid int int I
6 coid int int I
7 component str vchar(256) N

14
model/en_components.csv

@ -2,14 +2,6 @@ _type;ddl;;;;;;;;;
_key;_field;;;;;;;;; _key;_field;;;;;;;;;
table:en_components;_field;type;format;index;generic;aggregat;key;acceptance;alias;description table:en_components;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;encomid;pk;int;N;;;;;; ;encomid;pk;int;N;;;;;;
;enid;int;vchar(256);I;;;;;; ;enid;int;int;I;;;;;;
;component;str;vchar(256);I;;;;;; ;coid;int;int;I;;;;;;
;instance;int;vchar(256);N;;;;;; ;component;str;vchar(256);N;;;;;;
;type;str;vchar(256);N;;;;;;
;ip;str;vchar(256);N;;;;;;
;port;str;vchar(256);N;;;;;;
;hostname;str;vchar(256);N;;;;;;
;dompath;str;vchar(256);N;;;;;;
;user;str;vchar(256);N;;;;;;
;password;str;vchar(256);N;;;;;;
;attributes;string;vchar(256);N;;;;;;

1 _type ddl
2 _key _field
3 table:en_components _field type format index generic aggregat key acceptance alias description
4 encomid pk int N
5 enid int vchar(256) int I
6 component coid str int vchar(256) int I
7 instance component int str vchar(256) N
type str vchar(256) N
ip str vchar(256) N
port str vchar(256) N
hostname str vchar(256) N
dompath str vchar(256) N
user str vchar(256) N
password str vchar(256) N
attributes string vchar(256) N

3
model/entity.py

@ -370,11 +370,8 @@ class Entity:
verify = False verify = False
if not job is None: if not job is None:
self.job = job self.job = job
try:
if rootname not in config: if rootname not in config:
return self return self
except:
pass
for k in fields + nodes: for k in fields + nodes:
key = tools.data_tool.getExistKeyword(k, config[rootname]) key = tools.data_tool.getExistKeyword(k, config[rootname])
if verify: print("setFields " + k + " / " + key) if verify: print("setFields " + k + " / " + key)

1
model/environment.py

@ -60,6 +60,7 @@ class Environment(model.entity.Entity):
""" list of object-attributes """ """ list of object-attributes """
LIST_SUBTABLES = [B.SUBJECT_COMPS, B.SUBJECT_PROJECTS] LIST_SUBTABLES = [B.SUBJECT_COMPS, B.SUBJECT_PROJECTS]
LIST_NODES = [B.NODE_ATTRIBUTES] LIST_NODES = [B.NODE_ATTRIBUTES]
PREFIX_SUBTABLE = "en"
name = "" name = ""
description = "" description = ""

18
model/table.csv

@ -0,0 +1,18 @@
_type;ctlg;;;;;;;;;
_key;_field;;;;;;;;;
table:datatable;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;dtid;pk;integer;N;;;T:1;;;
;name;str;vchar(256);I;;;F:3;;;
;database;str;vchar(256);I;;;F:1;;;
;schema;str;vchar(256);I;;;F:2;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;story
;attributes;jlob;clob;N;;;;;;
;fieldnames;jlob;clob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;datetime;N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;datetime;N;;;;;;
;actual;int;integer;I;;;;;;
1 _type ctlg
2 _key _field
3 table:datatable _field type format index generic aggregat key acceptance alias description
4 dtid pk integer N T:1
5 name str vchar(256) I F:3
6 database str vchar(256) I F:1
7 schema str vchar(256) I F:2
8 description string vchar(256) N
9 reference str vchar(256) N story
10 attributes jlob clob N
11 fieldnames jlob clob N
12 insauthor str vchar(256) N
13 inscommit str vchar(256) N
14 instime time datetime N
15 updauthor str vchar(256) N
16 updcommit str vchar(256) N
17 updtime time datetime N
18 actual int integer I

8
model/tc_usecases.csv

@ -0,0 +1,8 @@
_type;ddl;;;;;;;;;
_key;_field;;;;;;;;;
table:tc_usecases;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tcucsid;pk;integer;N;;;;;;
;tcid;int;integer;I;;;T:1;;;
;ucid;int;integer;I;;;T:2;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
1 _type ddl
2 _key _field
3 table:tc_usecases _field type format index generic aggregat key acceptance alias description
4 tcucsid pk integer N
5 tcid int integer I T:1
6 ucid int integer I T:2
7 description string vchar(256) N
8 reference str vchar(256) N

8
model/tc_variants.csv

@ -0,0 +1,8 @@
_type;ddl;;;;;;;;;
_key;_field;;;;;;;;;
table:tc_variants;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tcvarid;pk;integer;N;;;;;;
;tcid;int;integer;I;;;T:1;;;
;vaid;int;integer;I;;;T:2;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
1 _type ddl
2 _key _field
3 table:tc_variants _field type format index generic aggregat key acceptance alias description
4 tcvarid pk integer N
5 tcid int integer I T:1
6 vaid int integer I T:2
7 description string vchar(256) N
8 reference str vchar(256) N

2
model/testcase.csv

@ -2,7 +2,7 @@ _type;ctlg;;;;;;;;;
_key;_field;;;;;;;;; _key;_field;;;;;;;;;
table:testcase;_field;type;format;index;generic;aggregat;key;acceptance;alias;description table:testcase;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tcid;pk;integer;N;;;T:1;;; ;tcid;pk;integer;N;;;T:1;;;
;name;str;vchar(256);I;;;F:1;;;# name of the component-table ;name;str;vchar(256);I;;;F:1;;;
;description;string;vchar(256);N;;;;;; ;description;string;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;; ;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;; ;application;string;vchar(256);N;;;;;;

1 _type ctlg
2 _key _field
3 table:testcase _field type format index generic aggregat key acceptance alias description
4 tcid pk integer N T:1
5 name str vchar(256) I F:1 # name of the component-table
6 description string vchar(256) N
7 project string vchar(256) I
8 application string vchar(256) N

1
model/testcase.py

@ -57,6 +57,7 @@ class Testcase(model.entity.Entity):
B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE, B.SUBJECT_PROJECT] B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE, B.SUBJECT_PROJECT]
LIST_NODES = [B.NODE_ATTRIBUTES] LIST_NODES = [B.NODE_ATTRIBUTES]
LIST_SUBTABLES = [B.SUBJECT_VARIANTS, B.SUBJECT_USECASES, B.SUBJECT_STORIES, B.SUBJECT_DATATABLES, B.SUBJECT_STEPS] LIST_SUBTABLES = [B.SUBJECT_VARIANTS, B.SUBJECT_USECASES, B.SUBJECT_STORIES, B.SUBJECT_DATATABLES, B.SUBJECT_STEPS]
PREFIX_SUBTABLE = "tc"
tcid = "" tcid = ""
name = "" name = ""

7
model/testplan.py

@ -32,13 +32,6 @@ class Testplan(model.entity.Entity):
testsuites = {} testsuites = {}
steps = [] steps = []
def __init__(self, job, project=""):
"""
to be initialized by readSpec
:param job:
"""
self.job = job
def read_entity(self, job, name): def read_entity(self, job, name):
""" """
reads the entity from the file-system reads the entity from the file-system

2
model/testsuite.py

@ -49,8 +49,8 @@ class Testsuite(model.entity.Entity):
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE, B.SUBJECT_PROJECT] LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE, B.SUBJECT_PROJECT]
""" list of object-attributes """ """ list of object-attributes """
LIST_NODES = [B.NODE_ATTRIBUTES] LIST_NODES = [B.NODE_ATTRIBUTES]
LIST_SUBTABLES = [B.SUBJECT_USECASES, B.SUBJECT_STEPS, B.SUBJECT_TESTCASES] LIST_SUBTABLES = [B.SUBJECT_USECASES, B.SUBJECT_STEPS, B.SUBJECT_TESTCASES]
PREFIX_SUBTABLE = "ts"
name = "" name = ""
description = "" description = ""
application = "" application = ""

8
model/ts_steps.csv

@ -0,0 +1,8 @@
_type;ddl;;;;;;;;;
_key;_field;;;;;;;;;
table:ts_steps;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tsstpid;pk;integer;N;;;;;;
;tsid;int;integer;I;;;T:1;;;
;spid;int;integer;I;;;T:2;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
1 _type ddl
2 _key _field
3 table:ts_steps _field type format index generic aggregat key acceptance alias description
4 tsstpid pk integer N
5 tsid int integer I T:1
6 spid int integer I T:2
7 description string vchar(256) N
8 reference str vchar(256) N

2
test/test_90testserver.py

@ -56,6 +56,7 @@ class MyTestCase(unittest.TestCase):
dbi = basic.toolHandling.getDbTool(job, self, "rel") dbi = basic.toolHandling.getDbTool(job, self, "rel")
# return "No DB in job-config" # return "No DB in job-config"
testserver.createAdminDBTables(job) testserver.createAdminDBTables(job)
"""
t = "application" t = "application"
sql = testserver.model[t].get_schema(tableName=t, tableObject=testserver.model[t]) sql = testserver.model[t].get_schema(tableName=t, tableObject=testserver.model[t])
#sql = testserver.getDBSchema(job, dbi, "application") #sql = testserver.getDBSchema(job, dbi, "application")
@ -80,6 +81,7 @@ class MyTestCase(unittest.TestCase):
self.assertEqual(4, len(lines)) self.assertEqual(4, len(lines))
self.assertIn("CREATE TABLE", lines[0]) self.assertIn("CREATE TABLE", lines[0])
self.assertIn("CREATE INDEX", lines[1]) self.assertIn("CREATE INDEX", lines[1])
"""
def test_11createDBTables(self): def test_11createDBTables(self):

4
tools/config_tool.py

@ -176,7 +176,9 @@ def getTablePath(job, name, subname, filename):
pathnames.append(os.path.join(job.conf[B.TOPIC_PATH][P.ATTR_PATH_PROGRAM], P.VAL_BASIC, filename)) pathnames.append(os.path.join(job.conf[B.TOPIC_PATH][P.ATTR_PATH_PROGRAM], P.VAL_BASIC, filename))
pathnames.append(os.path.join(job.conf[B.TOPIC_PATH][P.ATTR_PATH_PROGRAM], P.VAL_BASIC, subname)) pathnames.append(os.path.join(job.conf[B.TOPIC_PATH][P.ATTR_PATH_PROGRAM], P.VAL_BASIC, subname))
""" """
print("pathnames "+str(pathnames))
configpath = getExistingPath(job, pathnames) configpath = getExistingPath(job, pathnames)
print("configpath "+str(configpath))
if configpath is not None: if configpath is not None:
return configpath return configpath
if name == B.ATTR_INST_TESTSERVER: if name == B.ATTR_INST_TESTSERVER:
@ -335,7 +337,7 @@ def getConfig(job, modul: str, name: str, subname: str = "", ttype: str = D.CSV_
msg = None msg = None
if hasattr(job, "m"): msg = job.m if hasattr(job, "m"): msg = job.m
pathname = select_config_path(job, modul, name, subname) pathname = select_config_path(job, modul, name, subname)
print("+++ " + str(pathname)) # print("+++ " + str(pathname))
confs = {} confs = {}
if pathname is None: if pathname is None:
return None return None

1
tools/filecsv_fcts.py

@ -553,6 +553,7 @@ def setTableData(tableDict: dict, fields: list, ttype: str, job):
row[B.DATA_NODE_ARGS][a[0]] = a[1] row[B.DATA_NODE_ARGS][a[0]] = a[1]
# <-- still not used # <-- still not used
else: else:
# print(str(i)+" "+f+" "+str(len(fields))+" "+str(len(row)))
row[f] = fields[i] row[f] = fields[i]
i += 1 i += 1
ln = len(tableDict[B.DATA_NODE_HEADER]) ln = len(tableDict[B.DATA_NODE_HEADER])

Loading…
Cancel
Save