|
|
@ -15,6 +15,7 @@ import tools.job_tool |
|
|
|
import tools.path_tool |
|
|
|
import tools.path_const as P |
|
|
|
import model.entity |
|
|
|
import tools.file_type |
|
|
|
|
|
|
|
TABLE_NAMES = ["application", "ap_project", "ap_component"] |
|
|
|
STORAGES = [model.entity.STORAGE_FILE, model.entity.STORAGE_DB] |
|
|
@ -44,6 +45,12 @@ 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 of object-attributes """ |
|
|
|
LIST_NODES = [B.NODE_ATTRIBUTES] |
|
|
|
|
|
|
|
LIST_SUBTABLES = [B.SUBJECT_USECASES, B.SUBJECT_STEPS, B.SUBJECT_TESTCASES] |
|
|
|
name = "" |
|
|
|
description = "" |
|
|
|
application = "" |
|
|
@ -52,17 +59,8 @@ class Testsuite(model.entity.Entity): |
|
|
|
tables = {} |
|
|
|
steps = [] |
|
|
|
|
|
|
|
def __init__(self, job, project, name=""): |
|
|
|
""" |
|
|
|
to be initialized by readSpec |
|
|
|
:param job: |
|
|
|
""" |
|
|
|
self.job = job |
|
|
|
self.project = project |
|
|
|
if len(name) > 1: |
|
|
|
self.name = name |
|
|
|
|
|
|
|
def read_unique_names(self, job, project, application, gran, args): |
|
|
|
def read_unique_names(self, job, project, application, gran, args, ttype: str=""): |
|
|
|
""" |
|
|
|
reads the entity-names from file-storage |
|
|
|
:param job: |
|
|
@ -78,6 +76,44 @@ class Testsuite(model.entity.Entity): |
|
|
|
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_TESTSUITE, tools.config_tool.get_plain_filename(job, name), "", ttype=B.SUBJECT_TESTSUITE) |
|
|
|
return self.setAttributes(job, config, name, self.LIST_FIELDS, self.LIST_NODES, self.LIST_SUBTABLES) |
|
|
|
|
|
|
|
@staticmethod |
|
|
|
def rebuild_data(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.popSubjectsNode(job, data) |
|
|
|
# data = tools.file_type.popNameNode(job, data) |
|
|
|
return data |
|
|
|
|
|
|
|
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_TESTCASES] |
|
|
|
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_APPS, B.SUBJECT_USECASES] |
|
|
|
tools.file_type.check_nodes(job, data, checkNodes) |
|
|
|
return data |
|
|
|
|
|
|
|
|
|
|
|
def old_read_entity(self, job, name): |
|
|
|
""" |
|
|
|
reads the entity from the file-system |
|
|
|
:param job: |
|
|
@ -105,64 +141,6 @@ class Testsuite(model.entity.Entity): |
|
|
|
setattr(self, k, values) |
|
|
|
return self |
|
|
|
|
|
|
|
def getFieldList(self): |
|
|
|
""" |
|
|
|
returns a list of scalar attributes |
|
|
|
:return: LIST_FIELDS |
|
|
|
""" |
|
|
|
return LIST_FIELDS |
|
|
|
|
|
|
|
def getNodeList(self): |
|
|
|
""" |
|
|
|
returns a list of sub-nodes - which can be persisted in a clob-field |
|
|
|
:return: LIST_NODES |
|
|
|
""" |
|
|
|
return LIST_NODES |
|
|
|
|
|
|
|
def getSubtableList(self): |
|
|
|
""" |
|
|
|
returns a list of sub-tables |
|
|
|
:return: LIST_SUBTABLES |
|
|
|
""" |
|
|
|
return LIST_SUBTABLES |
|
|
|
|
|
|
|
def getName(self): |
|
|
|
""" |
|
|
|
returns the name - maybe build from other attributes |
|
|
|
:return: |
|
|
|
""" |
|
|
|
return self.name |
|
|
|
|
|
|
|
def getIDName(self): |
|
|
|
""" |
|
|
|
it returns the name as unique-id - maybe build from few attributes |
|
|
|
:return: |
|
|
|
""" |
|
|
|
return self.name |
|
|
|
|
|
|
|
def get_schema(self, tableName="", tableObject=None): |
|
|
|
#TODO veraltet |
|
|
|
dbtype = self.job.conf[B.TOPIC_NODE_DB][B.ATTR_TYPE] |
|
|
|
dbi = basic.toolHandling.getDbTool(self.job, None, dbtype) |
|
|
|
sql = dbi.getCreateTable("testsuite") |
|
|
|
sql += dbi.getSchemaAttribut("tsid", "id")+"," |
|
|
|
sql += dbi.getSchemaAttribut("name", D.TYPE_STR)+"," |
|
|
|
sql += dbi.getSchemaAttribut(B.SUBJECT_REFERENCE, D.TYPE_TEXT)+"," |
|
|
|
sql += dbi.getSchemaAttribut("project", D.TYPE_STR)+"," |
|
|
|
sql += dbi.getSchemaAttribut("usecase", D.TYPE_STR)+"," |
|
|
|
sql += dbi.getSchemaAttribut(B.NODE_ATTRIBUTES, D.TYPE_TEXT)+"," |
|
|
|
sql += self.getHistoryFields() |
|
|
|
sql += ");\n" |
|
|
|
sql += self.getHistoryIndex("testsuite") |
|
|
|
for attr in ["application", "testcase"]: |
|
|
|
sql += dbi.getSchemaSubtable("ts", [{"attr":attr, "atype": D.TYPE_STR}])+"\n" |
|
|
|
sql += dbi.getSchemaIndex(dbi.getIndexName("ts", attr), |
|
|
|
dbi.getSubTableId(dbi.getSubTableName("ts", attr), attr))+"\n" |
|
|
|
for attr in ["dtable", "step"]: |
|
|
|
sql += dbi.getSchemaSubtable("ts", [{"attr":attr, "atype": D.TYPE_STR}, {"attr":B.NODE_ATTRIBUTES, "atype": D.TYPE_TEXT}])+"\n" |
|
|
|
sql += dbi.getSchemaIndex(dbi.getSubTableName("ts", attr), |
|
|
|
dbi.getSubTableId(dbi.getSubTableName("ts", attr), attr))+"\n" |
|
|
|
return sql |
|
|
|
|
|
|
|
def select_testsuite(job, project, testsuite): |
|
|
|
jobProj = None |
|
|
|