Data-Test-Executer Framework speziell zum Test von Datenverarbeitungen mit Datengenerierung, Systemvorbereitungen, Einspielungen, ganzheitlicher diversifizierender Vergleich
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

121 lines
4.5 KiB

# ---------------------------------------------------------------------------------------------------------
# Author : Ulrich Carmesin
# Source : gitea.ucarmesin.de
# ---------------------------------------------------------------------------------------------------------
import basic.toolHandling
import basic.componentHandling
import basic.constants as B
import model.entity
import tools.path_const as P
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 """
IDENTIFYER_FIELDS = [FIELD_ID]
""" unique technical field as technical identifer """
class Release(model.entity.Entity):
FIELD_ID = "rlid"
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 = ""
application = ""
description = ""
attributes = ""
reference = ""
def read_unique_names(self, job, project, application, gran, args, ttype: str=""):
"""
reads the entity-names from file-storage
:param job:
:param opt. project: select-criteria if used and defined
:param opt. application: select-criteria if used and defined
:param opt. gran: granularity values testcase / testsuite / testplan
:param opt. args additional args
:return: list of entity-names
"""
config = self.getConfig(job, P.KEY_CATALOG, B.SUBJECT_RELS, tools.config_tool.get_plain_filename(job, ""), D.CSV_SPECTYPE_CTLG)
outList = list(config[B.SUBJECT_RELS][B.DATA_NODE_KEYS].keys())
return outList
def read_entity(self, job, name):
"""
reads the entity from the file-system
:param job:
:param name:
:return:
"""
config = self.getConfig(job, P.KEY_CATALOG, B.SUBJECT_RELS,
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)