Browse Source

refactoring: basic-model - check csv with py

refactor
Ulrich 1 year ago
parent
commit
0d40652d81
  1. 2
      basic/Testserver.py
  2. 4
      basic/constants.py
  3. 11
      model/application.csv
  4. 14
      model/artifact.csv
  5. 2
      model/artifact.py
  6. 2
      model/co_datatables.csv
  7. 12
      model/component.csv
  8. 2
      model/component.py
  9. 12
      model/datatable.csv
  10. 5
      model/datatable.py
  11. 67
      model/entity.py
  12. 9
      model/environment.csv
  13. 12
      model/environment.py
  14. 90
      model/factory.py
  15. 11
      model/prelease.csv
  16. 62
      model/prelease.py
  17. 5
      model/rl_applications.csv
  18. 12
      model/step.csv
  19. 3
      model/step.py
  20. 8
      model/story.csv
  21. 2
      model/story.py
  22. 8
      model/table.py
  23. 2
      model/tc_datatables.csv
  24. 14
      model/testcase.csv
  25. 2
      model/testcase.py
  26. 13
      model/testplan.csv
  27. 17
      model/testplan.py
  28. 12
      model/testsuite.csv
  29. 2
      model/testsuite.py
  30. 6
      model/tp_applications.csv
  31. 8
      model/tp_steps.csv
  32. 2
      model/user.csv
  33. 6
      test/test_14entity.py
  34. 2
      test/test_14table.py
  35. 4
      test/test_21environment.py
  36. 1
      tools/config_tool.py

2
basic/Testserver.py

@ -14,8 +14,6 @@ import tools.value_tool
import tools.data_tool
COMP_NAME = B.ATTR_INST_TESTSERVER
COMP_TABLES = ["application", "ap_component", "ap_project", "ap_application",
"environment", "en_component", "en_project"]
# class Testserver(basic.component.Component):
class Testserver():

4
basic/constants.py

@ -197,7 +197,7 @@ SUBJECT_DESCRIPTION = "description" # --> MAIN-ATTR
SUBJECT_REFERENCE = "reference" # --> MAIN-ATTR
SUBJECT_STEP = "step"
SUBJECT_STEPS = "steps"
SUBJECT_DATATABLE = "table"
SUBJECT_DATATABLE = "datatable"
SUBJECT_DATATABLES = SUBJECT_DATATABLE + "s"
# List of persistent models
LIST_SUBJECTS = [SUBJECT_PROJECTS, SUBJECT_APPS, SUBJECT_USECASES, SUBJECT_VARIANTS, SUBJECT_RELS, SUBJECT_STORIES,
@ -348,7 +348,7 @@ DATA_NODE_PAR = "par"
DATA_NODE_CATALOG = "_catalog"
DATA_NODE_ROW = "_row"
DATA_NODE_SUBTABLES = "subtables" # ?? SUBJECT
DATA_NODE_TOPICS = "_topics"
DATA_NODE_TOPICS = "topics"
DATA_NODE_PATH = "_path"
LIST_DATA_NODE = [DATA_NODE_HEADER, DATA_NODE_DATA, DATA_NODE_DDL, DATA_NODE_TOPICS,
DATA_NODE_TABLES, DATA_NODE_STEPS, DATA_NODE_OPTION, DATA_NODE_ROW, DATA_NODE_PATH]

11
model/application.csv

@ -7,10 +7,7 @@ table:application;_field;type;format;index;generic;aggregat;key;acceptance;alias
;reference;str;vchar(256);N;;;;;;
;project;str;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
;applications;subtable;subtable;N;;;;;;
;components;subtable;subtable;N;;;;;;
;usecases;subtable;subtable;N;;;;;;
;variants;subtable;subtable;N;;;;;;

1 _type ctlg
7 reference str vchar(256) N
8 project str vchar(256) N
9 attributes string jlob N
10 insauthor applications str subtable vchar(256) subtable N
11 inscommit components str subtable vchar(256) subtable N
12 instime usecases time subtable vchar(256) subtable N
13 updauthor variants str subtable vchar(256) subtable N
updcommit str vchar(256) N
updtime time vchar(256) N
actual int vchar(256) I

14
model/artifact.csv

@ -1,14 +1,10 @@
table:artifact;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;afid;pk;int;N;;;;;;
;arid;pk;int;N;;;;;;
;name;str;vchar(256);I;;;;;;
;aftype;str;vchar(256);I;;;;;;
;artype;str;vchar(256);I;;;;;;
;project;str;vchar(256);I;;;;;;
;component;str;vchar(256);I;;;;;;
;testcase;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;

1 table:artifact _field type format index generic aggregat key acceptance alias description
2 afid arid pk int N
3 name str vchar(256) I
4 aftype artype str vchar(256) I
5 project str vchar(256) I
6 component str vchar(256) I
7 testcase str vchar(256) I
8 description string vchar(256) N
9 reference str vchar(256) N
10 attributes string jlob N
insauthor str vchar(256) N
inscommit str vchar(256) N
instime time vchar(256) N
updauthor str vchar(256) N
updcommit str vchar(256) N
updtime time vchar(256) N
actual int vchar(256) I

2
model/artifact.py

@ -21,7 +21,7 @@ LIST_SUBTABLES = []
class Artifact(model.entity.Entity):
FIELD_ID = "arid"
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE,
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, "artype", B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE,
B.SUBJECT_PROJECT, B.SUBJECT_COMP, B.SUBJECT_TESTCASE]
""" list of object-attributes """
LIST_NODES = [B.NODE_ATTRIBUTES]

2
model/co_tables.csv → model/co_datatables.csv

@ -1,6 +1,6 @@
_type;ddl;;;;;;;;;
_key;_field;;;;;;;;;
table:co_tables;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
table:co_datatables;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;codtbid;pk;int;N;;;;;;
;coid;int;integer;I;;;T:1;;;
;dtid;int;integer;I;;;T:2;;;
1 _type ddl
2 _key _field
3 table:co_datatables _field type format index generic aggregat key acceptance alias description
4 codtbid pk int N
5 coid int integer I T:1
6 dtid int integer I T:2
7 datatable str vchar(256) I
8 description string vchar(256) N
9 reference str vchar(256) N
10 acceptcriteria str clob N

12
model/component.csv

@ -5,13 +5,9 @@ table:component;_field;type;format;index;generic;aggregat;key;acceptance;alias;d
;name;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
;components;subtable;subtable;N;;;;;;
;datatables;subtable;subtable;N;;;;;;
;steps;subtable;subtable;N;;;;;;
;artifacts;subtable;subtable;N;;;;;;

1 _type ctlg
5 name str vchar(256) I
6 description string vchar(256) N
7 project string vchar(256) I
application string vchar(256) N
8 reference str vchar(256) N
9 attributes string jlob N
10 insauthor components str subtable vchar(256) subtable N
11 inscommit datatables str subtable vchar(256) subtable N
12 instime steps time subtable vchar(256) subtable N
13 updauthor artifacts str subtable vchar(256) subtable N
updcommit str vchar(256) N
updtime time vchar(256) N
actual int vchar(256) I

2
model/component.py

@ -60,7 +60,7 @@ def select_components(job, project, application):
class Component(model.entity.Entity):
FIELD_ID = "coid"
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE]
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE, B.SUBJECT_PROJECT]
""" list of object-attributes """
LIST_NODES = [B.NODE_ATTRIBUTES, B.DATA_NODE_TOPICS]
LIST_SUBTABLES = [B.SUBJECT_ARTIFACTS, B.SUBJECT_COMPS, B.SUBJECT_STEPS, B.SUBJECT_DATATABLES]

12
model/datatable.csv

@ -3,16 +3,10 @@ _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;;;
;component;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;;;;;;
;attributes;jlob;jlob;N;;;;;;
;fieldnames;jlob;jlob;N;;;;;;

1 _type ctlg
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 component str vchar(256) I F:3
7 database str vchar(256) I F:1
8 schema str vchar(256) I F:2
9 description string vchar(256) N
10 reference str vchar(256) N story
11 attributes jlob clob jlob N
12 fieldnames jlob clob jlob 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

5
model/datatable.py

@ -25,8 +25,9 @@ LIST_SUBTABLES = {}
class Datatable(model.entity.Entity):
FIELD_ID = "dtid"
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE, B.SUBJECT_COMP, B.NODE_ATTRIBUTES]
LIST_NODES = [B.DATA_NODE_HEADER, B.DATA_NODE_DATA, B.DATA_NODE_FIELDS]
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, "database", "schema",
B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE, B.SUBJECT_COMP]
LIST_NODES = [B.DATA_NODE_HEADER, B.DATA_NODE_DATA, B.DATA_NODE_FIELDS, B.NODE_ATTRIBUTES, "fieldnames"]
LIST_SUBTABLES = []
dcid = 0

67
model/entity.py

@ -63,11 +63,76 @@ class Entity:
LIST_SUBTABLES = []
PREFIX_SUBTABLE = ""
def __init__(self, job, name: str="", args: dict={}):
def __init__(self, job, entityname: str="" , name: str="", args: dict={}):
import model.table
self.job = job
if entityname == "":
classname = str(self)
a = classname.split(".")
entityname = a[1]
entityname = tools.data_tool.getSingularKeyword(entityname)
self.entityname = entityname
if entityname not in ["", "table"]:
self.setDdlAttributes(job, entityname)
for f in self.ddls[entityname][model.table.LISTNAME_SUBTABLE]:
self.setDdlAttributes(job, self.PREFIX_SUBTABLE + "_" + tools.data_tool.getSingularKeyword(f))
if len(name) > 1:
self.getEntity(job, name, args)
def setDdlAttributes(self, job, entityname: str=""):
"""
:param job:
:return:
"""
import model.table
self.ddls = {}
ddlargs = {model.table.TYPE_CONTEXT: B.ATTR_INST_TESTSERVER}
if entityname not in ["", B.SUBJECT_DATATABLES]:
table = model.table.Table(job)
table = table.read_entity(job, self.entityname, args=ddlargs)
self.ddls[entityname] = {}
self.ddls[entityname][model.table.LISTNAME_DDLNAMES] = getattr(table, model.table.LISTNAME_DDLNAMES)
self.ddls[entityname][model.table.LISTNAME_DDLFIELDS] = getattr(table, model.table.LISTNAME_DDLFIELDS)
listFields = []
listNodes = []
listSubtables = []
for f in self.ddls[entityname][model.table.LISTNAME_DDLNAMES]:
if self.ddls[entityname][model.table.LISTNAME_DDLFIELDS][f][D.DDL_FIELD] in B.LIST_SUBJECTS:
listSubtables.append(f)
elif self.ddls[entityname][model.table.LISTNAME_DDLFIELDS][f][D.DDL_FORMAT] in ["jlob"]:
listNodes.append(f)
elif self.ddls[entityname][model.table.LISTNAME_DDLFIELDS][f][D.DDL_FIELD] in table.LIST_ADMINFIELDS:
pass
else:
listFields.append(f)
self.ddls[entityname][model.table.LISTNAME_FIELDS] = listFields
self.ddls[entityname][model.table.LISTNAME_NODES] = listNodes
self.ddls[entityname][model.table.LISTNAME_SUBTABLE] = listSubtables
# check LISTEN
for f in listFields:
if f not in self.LIST_FIELDS:
raise Exception(entityname + " " + str(self) + " a check list <-> LIST_FIELDS " + f)
for f in listNodes:
if f not in self.LIST_NODES:
raise Exception(entityname + " " + str(self) + " a check list <-> LIST_NODES " + f)
for f in listSubtables:
if f not in self.LIST_SUBTABLES:
raise Exception(entityname + " " + str(self) + " a check list <-> LIST_SUBTABLES " + f)
for f in self.LIST_FIELDS:
if f not in listFields:
raise Exception(entityname + " " + str(self) + " b check list <-> LIST_FIELDS " + f)
for f in self.LIST_NODES:
if f in B.LIST_DATA_NODE or f[:1] == "_":
continue
if f not in listNodes:
raise Exception(entityname + " " + str(self) + " b check list <-> LIST_NODES " + f)
for f in self.LIST_SUBTABLES:
if f not in listSubtables:
raise Exception(entityname + " " + str(self) + " b check list <-> LIST_SUBTABLES " + f)
def get_unique_names(self, job, storage="", project="", application="", gran="", args={}, ttype: str=""):
"""
gets the entity-names from the defined storage - the field name must be an unique identifier

9
model/environment.csv

@ -6,10 +6,5 @@ table:environment;_field;type;format;index;generic;aggregat;key;acceptance;alias
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
;components;subtable;subtable;N;;;;;;
;projects;subtable;subtable;N;;;;;;

1 _type ctlg
6 description string vchar(256) N
7 reference str vchar(256) N
8 attributes string jlob N
9 insauthor components str subtable vchar(256) subtable N
10 inscommit projects str subtable vchar(256) subtable N
instime time vchar(256) N
updauthor str vchar(256) N
updcommit str vchar(256) N
updtime time vchar(256) N
actual int vchar(256) I

12
model/environment.py

@ -69,18 +69,6 @@ class Environment(model.entity.Entity):
project = ""
component = ""
def __init__(self, job, project="", name=""):
"""
to be initialized by readSpec
project : optional
alternative parameter
name : name of variant or default - only from testspec
obj : object with main attributes
:param job:
"""
self.job = job
if project != "":
self.project = project
def read_unique_names(self, job, project, application, gran, args, ttype: str=""):
"""

90
model/factory.py

@ -31,98 +31,98 @@ def get_entity_object(job, entityname: str, name: str="", args: dict={}):
if name == "" and len(args) == 0 and Magazin.hasEntity(entityname):
return Magazin.getEntity(entityname)
if entityname in [B.SUBJECT_STEPS, B.SUBJECT_STEP]:
entity = getStep(job, name, args)
entity = getStep(job, entityname, name, args)
elif entityname in [B.SUBJECT_STORIES, B.SUBJECT_STORY, "storys"]:
entity = getStory(job, name, args)
entity = getStory(job, entityname, name, args)
elif entityname in [B.SUBJECT_VARIANTS, B.SUBJECT_VARIANT]:
entity = getVariant(job, name, args)
entity = getVariant(job, entityname, name, args)
elif entityname in [B.SUBJECT_DATATABLES, B.SUBJECT_DATATABLE]:
entity = getDatatable(job, name, args)
entity = getDatatable(job, entityname, name, args)
elif entityname in [B.SUBJECT_USECASES, B.SUBJECT_USECASE]:
entity = getUsecase(job, name, args)
entity = getUsecase(job, entityname, name, args)
elif entityname in [B.SUBJECT_PROJECTS, B.SUBJECT_PROJECT]:
entity = getProject(job, name, args)
entity = getProject(job, entityname, name, args)
elif entityname in [B.SUBJECT_APPS, B.SUBJECT_APP]:
entity = getApplication(job, name, args)
entity = getApplication(job, entityname, name, args)
elif entityname in [B.SUBJECT_COMPS, B.SUBJECT_COMP]:
entity = getComponent(job, name, args)
entity = getComponent(job, entityname, name, args)
elif entityname in [B.SUBJECT_ARTIFACTS, B.SUBJECT_ARTIFACT]:
entity = getEnvironment(job, name, args)
entity = getArtifact(job, entityname, name, args)
elif entityname in [B.SUBJECT_TESTCASES, B.SUBJECT_TESTCASE]:
entity = getTestcase(job, name, args)
entity = getTestcase(job, entityname, name, args)
elif entityname in [B.SUBJECT_TESTSUITES, B.SUBJECT_TESTSUITE]:
entity = getTestsuite(job, name, args)
entity = getTestsuite(job, entityname, name, args)
elif entityname in [B.SUBJECT_TESTPLANS, B.SUBJECT_TESTPLAN]:
entity = getTestplan(job, name, args)
entity = getTestplan(job, entityname, name, args)
elif entityname in [B.SUBJECT_USERS, B.SUBJECT_USER]:
entity = getUser(job, name, args)
entity = getUser(job, entityname, name, args)
elif entityname in [B.SUBJECT_REL, B.SUBJECT_RELS]:
entity = getRelease(job, name, args)
entity = getRelease(job, entityname, name, args)
elif entityname in [B.SUBJECT_ENVIRONMENT, B.SUBJECT_ENVIRONMENTS]:
entity = getEnvironment(job, name, args)
entity = getEnvironment(job, entityname, name, args)
else:
return None
if name == "" and len(args) == 0 and not Magazin.hasEntity(entityname):
return Magazin.setEntity(entityname, entity)
return entity
def getRelease(job=None, name: str="", args: dict={}):
def getRelease(job=None, entityname: str="" , name: str="", args: dict={}):
import model.prelease
return model.prelease.Release(job, name, args)
return model.prelease.Release(job, entityname, name, args)
def getEnvironment(job=None, name: str="", args: dict={}):
def getEnvironment(job=None, entityname: str="" , name: str="", args: dict={}):
import model.environment
return model.environment.Environment(job, name, args)
return model.environment.Environment(job, entityname, name, args)
def getArtifact(job=None, name: str="", args: dict={}):
def getArtifact(job=None, entityname: str="" , name: str="", args: dict={}):
import model.artifact
return model.artifact.Artifact(job, name, args)
return model.artifact.Artifact(job, entityname, name, args)
def getApplication(job=None, name: str="", args: dict={}):
def getApplication(job=None, entityname: str="" , name: str="", args: dict={}):
import model.application
return model.application.Application(job, name, args)
return model.application.Application(job, entityname, name, args)
def getProject(job=None, name: str="", args: dict={}):
def getProject(job=None, entityname: str="" , name: str="", args: dict={}):
import model.project
return model.project.Project(job, name, args)
return model.project.Project(job, entityname, name, args)
def getComponent(job=None, name: str="", args: dict={}):
def getComponent(job=None, entityname: str="" , name: str="", args: dict={}):
import model.component
return model.component.Component(job, name, args)
return model.component.Component(job, entityname, name, args)
def getTestplan(job=None, name: str="", args: dict={}):
def getTestplan(job=None, entityname: str="" , name: str="", args: dict={}):
import model.testplan
return model.testplan.Testplan(job, name, args)
return model.testplan.Testplan(job, entityname, name, args)
def getTestsuite(job=None, name: str="", args: dict={}):
def getTestsuite(job=None, entityname: str="" , name: str="", args: dict={}):
import model.testsuite
return model.testsuite.Testsuite(job, name, args)
return model.testsuite.Testsuite(job, entityname, name, args)
def getTestcase(job=None, name: str="", args: dict={}):
def getTestcase(job=None, entityname: str="" , name: str="", args: dict={}):
import model.testcase
return model.testcase.Testcase(job, name, args)
return model.testcase.Testcase(job, entityname, name, args)
def getStep(job=None, name: str="", args: dict={}):
def getStep(job=None, entityname: str="" , name: str="", args: dict={}):
import model.step
return model.step.Step(job, name, args)
return model.step.Step(job, entityname, name, args)
def getStory(job=None, name: str="", args: dict={}):
def getStory(job=None, entityname: str="" , name: str="", args: dict={}):
import model.story
return model.story.Story(job, name, args)
return model.story.Story(job, entityname, name, args)
def getUsecase(job=None, name: str="", args: dict={}):
def getUsecase(job=None, entityname: str="" , name: str="", args: dict={}):
import model.usecase
return model.usecase.Usecase(job, name, args)
return model.usecase.Usecase(job, entityname, name, args)
def getUser(job=None, name: str="", args: dict={}):
def getUser(job=None, entityname: str="" , name: str="", args: dict={}):
import model.user
return model.user.User(job, name, args)
return model.user.User(job, entityname, name, args)
def getVariant(job=None, name: str="", args: dict={}):
def getVariant(job=None, entityname: str="" , name: str="", args: dict={}):
import model.variant
return model.variant.Variant(job, name, args)
return model.variant.Variant(job, entityname, name, args)
def getDatatable(job=None, name: str="", args: dict={}):
def getDatatable(job=None, entityname: str="" , name: str="", args: dict={}):
import model.datatable
return model.datatable.Datatable(job, name, args)
return model.datatable.Datatable(job, entityname, name, args)

11
model/prelease.csv

@ -4,12 +4,7 @@ table:prelease;_field;type;format;index;generic;aggregat;key;acceptance;alias;de
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
;applications;subtable;subtable;N;;;;;;
;stories;subtable;subtable;N;;;;;;

1 table:prelease _field type format index generic aggregat key acceptance alias description
4 description string vchar(256) N
5 reference str vchar(256) N
6 project string vchar(256) I
application string vchar(256) N
7 attributes string jlob N
8 insauthor applications str subtable vchar(256) subtable N
9 inscommit stories str subtable vchar(256) subtable N
10
updauthor str vchar(256) N
updcommit str vchar(256) N
updtime time vchar(256) N
actual int vchar(256) I

62
model/prelease.py

@ -11,10 +11,14 @@ import tools.data_const as D
import tools.config_tool
import tools.file_tool
import tools.git_tool
import tools.file_type
TABLE_NAME = "prelease"
""" system-name for this entity """
FIELD_ID = "rlid"
FIELD_PRELEASE = "prelease"
""" project-release"""
FIELD_APPRELEASE = "apprelease"
FILE_EXTENSION = D.DFILE_TYPE_CSV
UNIQUE_FIELDS = [D.FIELD_NAME]
""" unique business field as human identifer """
@ -23,13 +27,13 @@ IDENTIFYER_FIELDS = [FIELD_ID]
class Release(model.entity.Entity):
FIELD_ID = "rlid"
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE, B.SUBJECT_PROJECT, B.SUBJECT_APP,
B.NODE_ATTRIBUTES]
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE, B.SUBJECT_PROJECT]
""" list of object-attributes """
LIST_NODES = [B.NODE_ATTRIBUTES]
LIST_SUBTABLES = [B.SUBJECT_APPS, B.SUBJECT_STORIES]
PREFIX_SUBTABLE = "rl"
rlid = 0
name = ""
project = ""
@ -60,6 +64,58 @@ class Release(model.entity.Entity):
:return:
"""
config = self.getConfig(job, P.KEY_CATALOG, B.SUBJECT_RELS,
tools.config_tool.get_plain_filename(job, name), ttype=D.CSV_SPECTYPE_CTLG)
tools.config_tool.get_plain_filename(job, name), ttype=B.SUBJECT_REL)
return self.setAttributes(job, config, name, self.LIST_FIELDS, self.LIST_NODES, self.LIST_SUBTABLES)
def rebuild_data(self, job, data: dict) -> dict:
"""
gets the subtable-tag from filecsv and sets the subtables in order to workable entity-elements
:param job:
:param data:
:return:
"""
data = tools.file_type.popTablesNode(job, data)
data = tools.file_type.popSubjectsNode(job, data)
data = self.rebuildReleases(job, data)
return data
def rebuildReleases(self, job, data: dict) -> dict:
outdata = {}
for row in data[B.DATA_NODE_DATA]:
if FIELD_PRELEASE not in row:
continue
if row[FIELD_PRELEASE] in outdata:
general = outdata[row[FIELD_PRELEASE]]
else:
general = {}
general[B.SUBJECT_APPS] = {}
if ( FIELD_APPRELEASE not in row
or len(FIELD_APPRELEASE) == 0
or row[FIELD_APPRELEASE] == row[FIELD_PRELEASE]):
for f in self.LIST_FIELDS:
if f in row:
general[f] = row[f]
if B.SUBJECT_APPS in row and len(row[B.SUBJECT_APPS]) > 0:
a = str(row[B.SUBJECT_APPS]).split(",")
for app in a:
o = {}
o["appname"] = app
o["apprelease"] = row[FIELD_APPRELEASE]
o["prelease"] = row[FIELD_PRELEASE]
general[B.SUBJECT_APPS][app] = o
outdata[row[FIELD_PRELEASE]] = general
return outdata
def check_data(self, job, data: dict) -> dict:
"""
it checks the data for the specific form
:param job:
:param tdata:
:param ttype:
:return:
"""
checkNodes = {}
checkNodes[tools.file_type.MUST_NODES] = [] #[B.SUBJECT_APPS]
checkNodes[tools.file_type.MUSTNT_NODES] = [] # [B.DATA_NODE_DATA, B.DATA_NODE_HEADER, B.DATA_NODE_FIELDS, B.DATA_NODE_KEYS]
checkNodes[tools.file_type.OPT_NODES] = [B.SUBJECT_PROJECTS]
return tools.file_type.check_nodes(job, data, checkNodes)

5
model/rl_applications.csv

@ -4,3 +4,8 @@ table:rl_applications;_field;type;format;index;generic;aggregat;key;acceptance;a
;rlappid;pk;vchar(256);N;;;;;;
;rlid;int;vchar(256);I;;;;;;
;appid;int;vchar(256);I;;;;;;
;appname;str;vchar(256);N;;;;;;
;apprelease;str;vchar(256);N;;;;;;
;appgenrelease;str;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;

1 _type ddl
4 rlappid pk vchar(256) N
5 rlid int vchar(256) I
6 appid int vchar(256) I
7 appname str vchar(256) N
8 apprelease str vchar(256) N
9 appgenrelease str vchar(256) N
10 reference str vchar(256) N
11

12
model/step.csv

@ -1,14 +1,12 @@
table:step;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;spid;pk;int;N;;;;;;
;name;str;vchar(256);I;;;;;;
;sortnr;int;int;;;;;;;
;stepnr;int;int;;;;;;;
;dataref;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;component;str;vchar(256);N;;;;;;
;variant;str;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
;topics;string;jlob;N;;;;;;

1 table:step _field type format index generic aggregat key acceptance alias description
2 spid pk int N
3 name str vchar(256) I
4 sortnr int int
5 stepnr int int
6 dataref str vchar(256) I
7 description string vchar(256) N
8 reference str vchar(256) N
9 component str vchar(256) N
10 variant str vchar(256) N
11 attributes string jlob N
12 insauthor topics str string vchar(256) jlob N
inscommit str vchar(256) N
instime time vchar(256) N
updauthor str vchar(256) N
updcommit str vchar(256) N
updtime time vchar(256) N
actual int vchar(256) I

3
model/step.py

@ -53,7 +53,8 @@ class Step(model.entity.Entity):
FIELD_SORTNR = "sortnr" # testcase
FIELD_STEPNR = "stepnr" # testcase
FIELD_DATAREF = "dataref" # testcase
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, B.SUBJECT_VARIANT, B.SUBJECT_COMP, FIELD_SORTNR, FIELD_STEPNR, FIELD_DATAREF]
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, B.SUBJECT_VARIANT, B.SUBJECT_COMP, FIELD_SORTNR, FIELD_STEPNR, FIELD_DATAREF,
B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE]
""" list of object-attributes """
LIST_NODES = [B.NODE_ATTRIBUTES, B.DATA_NODE_TOPICS]
LIST_SUBTABLES = []

8
model/story.csv

@ -7,10 +7,4 @@ table:story;_field;type;format;index;generic;aggregat;key;acceptance;alias;descr
;reference;str;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
;preleases;subtable;subtable;N;;;;;;

1 _type ctlg
7 reference str vchar(256) N
8 project string vchar(256) I
9 attributes string jlob N
10 insauthor preleases str subtable vchar(256) subtable N
inscommit str vchar(256) N
instime time vchar(256) N
updauthor str vchar(256) N
updcommit str vchar(256) N
updtime time vchar(256) N
actual int vchar(256) I

2
model/story.py

@ -25,7 +25,7 @@ class Story(model.entity.Entity):
FIELD_ID = "stid"
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE, B.SUBJECT_PROJECT]
""" list of object-attributes """
LIST_NODES = []
LIST_NODES = [B.NODE_ATTRIBUTES]
LIST_SUBTABLES = [B.SUBJECT_RELS]
PREFIX_SUBTABLE = "st"

8
model/table.py

@ -14,6 +14,13 @@ import tools.git_tool
TYPE_ADMIN = "admin"
TYPE_CTLG = "catalog"
TYPE_CONTEXT = "context"
LISTNAME_DDLNAMES = "fieldnames"
LISTNAME_DDLFIELDS = "fielddef"
LISTNAME_FIELDS = "fieldlist"
LISTNAME_NODES = "nodelist"
LISTNAME_SUBTABLE = "subtables"
TABLE_NAME = "table"
""" system-name for this entity """
@ -272,6 +279,7 @@ class Table(model.entity.Entity):
sqlSub += dbi.getSchemaSubtable(a[1], attrList) + "\n"
sqlSub += dbi.getSchemaIndex(dbi.getSubtableName(a[1], fo[D.DDL_FIELD]), tableId) + "\n"
continue
if fo[D.DDL_TYPE] not in ["subtable"]:
sqlTable += dbi.getSchemaAttribut(fo[D.DDL_FIELD], fo[D.DDL_TYPE]) + ","
if fo[D.DDL_TYPE] == D.TYPE_PK:
tableId = fo[D.DDL_FIELD]

2
model/tc_tables.csv → model/tc_datatables.csv

@ -1,6 +1,6 @@
_type;ddl;;;;;;;;;
_key;_field;;;;;;;;;
table:tc_tables;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
table:tc_datatables;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tcdtbid;pk;integer;N;;;;;;
;tcid;int;integer;I;;;T:1;;;
;dtid;int;integer;I;;;T:2;;;
1 _type ddl
2 _key _field
3 table:tc_datatables _field type format index generic aggregat key acceptance alias description
4 tcdtbid pk integer N
5 tcid int integer I T:1
6 dtid int integer I T:2
7 count int int N
8 refdate date date N

14
model/testcase.csv

@ -7,11 +7,9 @@ table:testcase;_field;type;format;index;generic;aggregat;key;acceptance;alias;de
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;story
;attributes;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;;;;;;
;attributes;jlob;jlob;N;;;;;;
;steps;subtable;subtable;N;;;;;;
;datatables;subtable;subtable;N;;;;;;
;stories;subtable;subtable;N;;;;;;
;usecases;subtable;subtable;N;;;;;;
;variants;subtable;subtable;N;;;;;;

1 _type ctlg
7 project string vchar(256) I
8 application string vchar(256) N
9 reference str vchar(256) N story
10 attributes jlob clob jlob N
11 insauthor steps str subtable vchar(256) subtable N
12 inscommit datatables str subtable vchar(256) subtable N
13 instime stories time subtable datetime subtable N
14 updauthor usecases str subtable vchar(256) subtable N
15 updcommit variants str subtable vchar(256) subtable N
updtime time datetime N
actual int integer I

2
model/testcase.py

@ -147,6 +147,8 @@ class Testcase(model.entity.Entity):
attributes[l] = data[k][l]
else:
outdata[k][l] = data[k][l]
elif (k == B.DATA_NODE_TABLES and B.SUBJECT_DATATABLES in subtables):
outdata[tools.data_tool.getPluralKeyword(B.SUBJECT_DATATABLES)] = data[k]
elif k in B.LIST_DATA_NODE and tools.data_tool.getPluralKeyword(k) in subtables:
outdata[tools.data_tool.getPluralKeyword(k)] = data[k]
elif k[:1] == "_":

13
model/testplan.csv

@ -5,14 +5,9 @@ table:testplan;_field;type;format;index;generic;aggregat;key;acceptance;alias;de
;name;str;vchar(256);I;;;F:1;;;
;description;string;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;prelease;string;vchar(256);I;;;;;;
;reference;str;vchar(256);N;;;;;;story
;attributes;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;;;;;;
;attributes;jlob;jlob;N;;;;;;
;applications;subtable;subtable;N;;;;;;
;steps;subtable;subtable;N;;;;;;
;testsuites;subtable;subtable;N;;;;;;

1 _type ctlg
5 name str vchar(256) I F:1
6 description string vchar(256) N
7 project string vchar(256) I
application string vchar(256) N
8 prelease string vchar(256) I
9 reference str vchar(256) N story
10 attributes jlob clob jlob N
11 insauthor applications str subtable vchar(256) subtable N
12 inscommit steps str subtable vchar(256) subtable N
13 instime testsuites time subtable datetime subtable N
updauthor str vchar(256) N
updcommit str vchar(256) N
updtime time datetime N
actual int integer I

17
model/testplan.py

@ -7,25 +7,24 @@
import basic.toolHandling
import tools.data_const as D
import basic.constants as B
import tools.path_const as P
import model.entity
import tools.config_tool
FIELD_ID = "tcid"
FIELD_ID = "tpid"
FIELD_NAME = D.FIELD_NAME
FIELD_DESCRIPTION = B.SUBJECT_DESCRIPTION
FIELD_REFERENCE = B.SUBJECT_REFERENCE
FIELD_PROJECT = B.SUBJECT_PROJECT
FIELD_RELEASE = B.SUBJECT_REL
LIST_FIELDS = [FIELD_ID, FIELD_NAME, FIELD_DESCRIPTION, FIELD_REFERENCE, FIELD_PROJECT, FIELD_RELEASE]
""" list of object-attributes """
LIST_NODES = [B.NODE_ATTRIBUTES]
LIST_SUBTABLES = {
B.SUBJECT_STEPS: [],
B.SUBJECT_TESTSUITES: []
}
class Testplan(model.entity.Entity):
LIST_FIELDS = [FIELD_ID, FIELD_NAME, FIELD_DESCRIPTION, FIELD_REFERENCE, FIELD_PROJECT, FIELD_RELEASE]
""" list of object-attributes """
LIST_NODES = [B.NODE_ATTRIBUTES]
LIST_SUBTABLES = [B.SUBJECT_STEPS, B.SUBJECT_TESTSUITES, B.SUBJECT_APPS]
PREFIX_SUBTABLE = "tp"
name = ""
description = ""
prelease = ""

12
model/testsuite.csv

@ -7,11 +7,7 @@ table:testsuite;_field;type;format;index;generic;aggregat;key;acceptance;alias;d
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;story
;attributes;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;;;;;;
;attributes;jlob;jlob;N;;;;;;
;steps;subtable;subtable;N;;;;;;
;usecases;subtable;subtable;N;;;;;;
;testcases;subtable;subtable;N;;;;;;

1 _type ctlg
7 project string vchar(256) I
8 application string vchar(256) N
9 reference str vchar(256) N story
10 attributes jlob clob jlob N
11 insauthor steps str subtable vchar(256) subtable N
12 inscommit usecases str subtable vchar(256) subtable N
13 instime testcases time subtable datetime subtable N
updauthor str vchar(256) N
updcommit str vchar(256) N
updtime time datetime N
actual int integer I

2
model/testsuite.py

@ -46,7 +46,7 @@ IDENTIFYER_FIELDS = [FIELD_ID]
class Testsuite(model.entity.Entity):
FIELD_ID = "tsid"
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, B.SUBJECT_APP]
""" list of object-attributes """
LIST_NODES = [B.NODE_ATTRIBUTES]
LIST_SUBTABLES = [B.SUBJECT_USECASES, B.SUBJECT_STEPS, B.SUBJECT_TESTCASES]

6
model/tp_applications.csv

@ -0,0 +1,6 @@
_type;ddl;;;;;;;;;
_key;_field;;;;;;;;;
table:tp_applications;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tpappid;pk;vchar(256);N;;;;;;
;tpid;int;vchar(256);I;;;;;;
;appid;int;vchar(256);I;;;;;;
1 _type ddl
2 _key _field
3 table:tp_applications _field type format index generic aggregat key acceptance alias description
4 tpappid pk vchar(256) N
5 tpid int vchar(256) I
6 appid int vchar(256) I

8
model/tp_steps.csv

@ -0,0 +1,8 @@
_type;ddl;;;;;;;;;
_key;_field;;;;;;;;;
table:tp_steps;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tpstpid;pk;integer;N;;;;;;
;tpid;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:tp_steps _field type format index generic aggregat key acceptance alias description
4 tpstpid pk integer N
5 tpid 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
model/user.csv

@ -9,4 +9,4 @@ table:user;_field;type;format;index;generic;aggregat;key;acceptance;alias;descri
;password;string;vchar(256);N;;;;;;
;project;string;vchar(256);N;;;;;;
;role;string;vchar(256);N;;;;;;
;attributes;string;vchar(4098);N;;;;;;
;attributes;string;jlob;N;;;;;;

1 _type ddl
9 password string vchar(256) N
10 project string vchar(256) N
11 role string vchar(256) N
12 attributes string vchar(4098) jlob N

6
test/test_14entity.py

@ -33,10 +33,8 @@ class MyTestCase(unittest.TestCase):
return
job = test.testtools.getJob()
tcname = "TC0001"
tcproject = "TESTPROJ"
testcase = model.testcase.Testcase(job, tcname)
# eigene Attribute vollstaendig
testcase = model.testcase.Testcase(job, tcname)
testcase = model.testcase.Testcase(job, name=tcname)
args = {}
args[tcname] = {}
@ -53,7 +51,7 @@ class MyTestCase(unittest.TestCase):
self.assertEqual(hasattr(testcase, k), False)
self.assertEqual(hasattr(testcase, tools.data_tool.getPluralKeyword(B.DATA_NODE_TOPICS)), False)
# andere Attribute vollstaendig
testcase = model.testcase.Testcase(job, tcname)
testcase = model.testcase.Testcase(job, name=tcname)
args = {}
args[tcname] = {}
attr = {}

2
test/test_14table.py

@ -100,7 +100,7 @@ class MyTestCase(unittest.TestCase):
entityNames = table.read_unique_names(job, B.ATTR_INST_TESTSERVER, "", "", {})
args = {}
args["context"] = B.ATTR_INST_TESTSERVER
name = "tc_tables"
name = "tc_datatables"
print(name)
acttable = table.read_entity(job, name, args=args)
schema = acttable.get_schema(name)

4
test/test_21environment.py

@ -33,7 +33,7 @@ class MyTestCase(unittest.TestCase):
if actfunction not in TEST_FUNCTIONS:
return
job = test.testtools.getJob()
environment = model.environment.Environment(job, "TESTPROJ")
environment = model.environment.Environment(job)
entityNames = environment.read_unique_names(job, "", "", "", {})
self.assertEqual(type(entityNames), list)
#entityNames = environment.select_unique_names(job, "", "", "", {})
@ -61,7 +61,7 @@ class MyTestCase(unittest.TestCase):
if actfunction not in TEST_FUNCTIONS:
return
job = test.testtools.getJob()
environment = model.environment.Environment(job, "TESTPROJ")
environment = model.environment.Environment(job)
name = "ENV01"
actrelease = environment.read_entity(job, name)
self.assertEqual(getattr(actrelease, D.FIELD_NAME), name)

1
tools/config_tool.py

@ -17,6 +17,7 @@ except ImportError:
import basic.componentHandling
import tools.path_tool
import tools.file_tool
import tools.data_tool
import os.path
import basic.constants as B
import tools.data_const as D

Loading…
Cancel
Save