#!/usr/bin/python # -*- coding: utf-8 -*- # --------------------------------------------------------------------------------------------------------- # Author : Ulrich Carmesin # Source : gitea.ucarmesin.de # --------------------------------------------------------------------------------------------------------- import basic.toolHandling import utils.data_const as D import basic.constants as B import model.entity class Testexecution(model.entity.Entity): name = "" description = "" # from testplan, testsuite, testcase release = "" path = "" level = "" # testplan, testsuite, testcase entities = {} def __init__(self, job): """ to be initialized by readSpec :param job: """ self.job = job def get_schema(self): dbtype = self.job.conf[B.TOPIC_NODE_DB][B.ATTR_TYPE] dbi = basic.toolHandling.getDbTool(self.job, None, dbtype) sql = dbi.getCreateTable("testexecution") sql += dbi.getSchemaAttribut("teid", "id")+"," sql += dbi.getSchemaAttribut("name", D.TYPE_STR)+"," sql += dbi.getSchemaAttribut("description", D.TYPE_TEXT)+"," sql += dbi.getSchemaAttribut("prelease", D.TYPE_STR)+"," sql += dbi.getSchemaAttribut("type", D.TYPE_STR)+"," sql += dbi.getSchemaAttribut("entity", D.TYPE_STR)+"," sql += dbi.getSchemaAttribut("path", D.TYPE_STRING)+"," sql += dbi.getSchemaAttribut("starttime", D.TYPE_TIME)+"," sql += dbi.getSchemaAttribut("finishtime", D.TYPE_TIME)+"," sql += dbi.getSchemaAttribut("attributes", D.TYPE_TEXT)+"," sql += self.getHistoryFields() sql += ");\n" sql += dbi.getSchemaIndex("testexecution", "release") + "\n" sql += self.getHistoryIndex("testplan") for attr in ["entity"]: sql += dbi.getSchemaSubtable("te", [{"attr":attr, "atype": D.TYPE_STR}, {"attr":"type", "atype": D.TYPE_STR}, {"attr":"path", "atype": D.TYPE_STRING}, {"attr":"attributes", "atype": D.TYPE_TEXT}])+"\n" sql += dbi.getSchemaIndex(dbi.getSubTableName("te", attr), dbi.getSubTableId(dbi.getSubTableName("te", attr), attr))+"\n" return sql