diff --git a/basic/constants.py b/basic/constants.py index 64bfeb9..d132de7 100644 --- a/basic/constants.py +++ b/basic/constants.py @@ -193,11 +193,14 @@ SUBJECT_STORY = "story" SUBJECT_STORIES = "stories" SUBJECT_DESCRIPTION = "description" # --> MAIN-ATTR SUBJECT_REFERENCE = "reference" # --> MAIN-ATTR -LIST_SUBJECTS = [SUBJECT_APPS, SUBJECT_ARTIFACT, SUBJECT_COMPS, SUBJECT_PROJECTS] SUBJECT_STEP = "step" SUBJECT_STEPS = "steps" SUBJECT_DATATABLE = "table" SUBJECT_DATATABLES = SUBJECT_DATATABLE + "s" +# List of persistent models +LIST_SUBJECTS = [SUBJECT_PROJECTS, SUBJECT_APPS, SUBJECT_USECASES, SUBJECT_VARIANTS, SUBJECT_RELS, SUBJECT_STORIES, + SUBJECT_TESTPLANS, SUBJECT_TESTSUITES, SUBJECT_TESTCASES, SUBJECT_STEPS, SUBJECT_DATATABLES, + SUBJECT_ENVIRONMENTS, SUBJECT_COMPS, SUBJECT_ARTIFACTS] # --Topic ----------------------------------------------------- # _____ _ diff --git a/model/ap_application.csv b/model/ap_application.csv index 393b2b1..ed907a9 100644 --- a/model/ap_application.csv +++ b/model/ap_application.csv @@ -1,4 +1,6 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:ap_application;_field;type;format;index;generic;aggregat;key;acceptance;alias;description ;apappid;pk;vchar(256);N;;;;;; ;apid;int;vchar(256);I;;;;;; -;component;str;vchar(256);I;;;;;; +;appid;int;vchar(256);I;;;;;; diff --git a/model/ap_component.csv b/model/ap_component.csv index eb79c33..84fdf69 100644 --- a/model/ap_component.csv +++ b/model/ap_component.csv @@ -1,3 +1,5 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:ap_component;_field;type;format;index;generic;aggregat;key;acceptance;alias;description ;apcomid;pk;int;N;;;;;; ;apid;int;int;I;;;;;; diff --git a/model/ap_project.csv b/model/ap_project.csv index 68bb588..f6ff5e4 100644 --- a/model/ap_project.csv +++ b/model/ap_project.csv @@ -1,3 +1,5 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:ap_project;_field;type;format;index;generic;aggregat;key;acceptance;alias;description ;pjid;pk;int;N;;;;;; ;apid;int;int;I;;;;;; diff --git a/model/application.py b/model/application.py index 5168328..2205ecc 100644 --- a/model/application.py +++ b/model/application.py @@ -434,10 +434,3 @@ class Application_old(model.entity.Entity): def writeEntity(self): pass - - def get_schema(self, tableName="", tableObject=None): - """ - ersetzt durch testserver.createDB - :return: - """ - return "" \ No newline at end of file diff --git a/model/co_artifact.csv b/model/co_artifact.csv index ffde721..e425fdd 100644 --- a/model/co_artifact.csv +++ b/model/co_artifact.csv @@ -1,5 +1,8 @@ -table:tc_story;_field;type;format;index;generic;aggregat;key;acceptance;alias;description -;tcid;int;integer;I;;;T:1;;; +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; +table:co_artifact;_field;type;format;index;generic;aggregat;key;acceptance;alias;description +;coartid;pk;int;N;;;;;; +;coid;int;integer;I;;;T:1;;; ;stid;int;integer;I;;;T:2;;; ;story;str;vchar(256);I;;;;;; ;description;string;vchar(256);N;;;;;; diff --git a/model/co_step.csv b/model/co_step.csv index ffde721..003db12 100644 --- a/model/co_step.csv +++ b/model/co_step.csv @@ -1,5 +1,8 @@ -table:tc_story;_field;type;format;index;generic;aggregat;key;acceptance;alias;description -;tcid;int;integer;I;;;T:1;;; +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; +table:co_step;_field;type;format;index;generic;aggregat;key;acceptance;alias;description +;costpid;pk;int;N;;;;;; +;coid;int;integer;I;;;T:1;;; ;stid;int;integer;I;;;T:2;;; ;story;str;vchar(256);I;;;;;; ;description;string;vchar(256);N;;;;;; diff --git a/model/co_table.csv b/model/co_table.csv index ffde721..c6db209 100644 --- a/model/co_table.csv +++ b/model/co_table.csv @@ -1,7 +1,10 @@ -table:tc_story;_field;type;format;index;generic;aggregat;key;acceptance;alias;description -;tcid;int;integer;I;;;T:1;;; -;stid;int;integer;I;;;T:2;;; -;story;str;vchar(256);I;;;;;; +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; +table:co_table;_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;;; +;datatable;str;vchar(256);I;;;;;; ;description;string;vchar(256);N;;;;;; ;reference;str;vchar(256);N;;;;;; ;acceptcriteria;str;clob;N;;;;;; diff --git a/model/component.csv b/model/component.csv index cb28dfe..8af71aa 100644 --- a/model/component.csv +++ b/model/component.csv @@ -1,3 +1,5 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:component;_field;type;format;index;generic;aggregat;key;acceptance;alias;description ;coid;pk;int;N;;;;;; ;name;str;vchar(256);I;;;;;; diff --git a/model/datatable.csv b/model/datatable.csv index f15672b..275a7de 100644 --- a/model/datatable.csv +++ b/model/datatable.csv @@ -1,5 +1,7 @@ -table:table;_field;type;format;index;generic;aggregat;key;acceptance;alias;description -;tbid;pk;integer;N;;;T:1;;; +_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:1;;; ;description;string;vchar(256);N;;;;;; ;reference;str;vchar(256);N;;;;;;story diff --git a/model/en_component.csv b/model/en_component.csv index 7b9e52d..45e04a3 100644 --- a/model/en_component.csv +++ b/model/en_component.csv @@ -1,5 +1,7 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:en_component;_field;type;format;index;generic;aggregat;key;acceptance;alias;description -;encomid;pk;vchar(256);N;;;;;; +;encomid;pk;int;N;;;;;; ;enid;int;vchar(256);I;;;;;; ;component;str;vchar(256);I;;;;;; ;instance;int;vchar(256);N;;;;;; diff --git a/model/en_project.csv b/model/en_project.csv index 12a60d3..8ddd26d 100644 --- a/model/en_project.csv +++ b/model/en_project.csv @@ -1,4 +1,6 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:en_project;_field;type;format;index;generic;aggregat;key;acceptance;alias;description -;enproid;pk;vchar(256);N;;;;;; +;enproid;pk;int;N;;;;;; ;enid;int;vchar(256);I;;;;;; ;project;str;vchar(256);I;;;;;; diff --git a/model/environment.csv b/model/environment.csv index a149a90..79eb169 100644 --- a/model/environment.csv +++ b/model/environment.csv @@ -1,3 +1,5 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:environment;_field;type;format;index;generic;aggregat;key;acceptance;alias;description ;enid;pk;int;N;;;;;; ;name;str;vchar(256);I;;;;;; diff --git a/model/story.csv b/model/story.csv index d512930..d636272 100644 --- a/model/story.csv +++ b/model/story.csv @@ -1,3 +1,5 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:story;_field;type;format;index;generic;aggregat;key;acceptance;alias;description ;stid;pk;int;N;;;;;; ;name;str;vchar(256);I;;;;;; diff --git a/model/table.py b/model/table.py index 2834db1..d7f9b85 100644 --- a/model/table.py +++ b/model/table.py @@ -23,7 +23,7 @@ FIELD_PROJECT = B.SUBJECT_PROJECT FIELD_APPLICATION = B.SUBJECT_APP LIST_FIELDS = [FIELD_ID, FIELD_NAME, FIELD_DESCRIPTION, FIELD_REFERENCE] """ list of object-attributes """ -LIST_NODES = [B.DATA_NODE_HEADER, B.DATA_NODE_DATA, B.DATA_NODE_FIELDS] +LIST_NODES = [B.DATA_NODE_HEADER, B.DATA_NODE_DATA, B.DATA_NODE_FIELDS, B.DATA_NODE_KEYS] LIST_SUBTABLES = {} @@ -63,28 +63,30 @@ def select_tables(job, project="", application="", component=""): return outList class Table(model.entity.Entity): + """ + table-object as part of a database + in different of datatable it is neither a concrete table in the automation-model + nor a concrete table in the system-model + it is an abstract super-class in order to relation to the database-management-system + """ tbid = 0 name = "" project = "" - application = "" - component = "" fieldnames = [] fielddef = {} - def __init__(self, job, project="", application="", component="", name=""): + def __init__(self, job, project="", name=""): """ - to be initialized by readSpec + to be initialized :param job: """ self.job = job - if len(project) > 1: + if project != "": self.project = project - if len(application) > 1: - self.application = application - if len(component) > 1: - self.component = component - if len(name) > 1: - self.read_ddl(job, name) + + def set_object(self, project, name): + self.project = project + self.name = name def get_schema(self, tableName="", tableObject=None): """ @@ -138,13 +140,22 @@ class Table(model.entity.Entity): :param opt. args additional args :return: list of entity-names """ - path = os.path.join(job.conf[B.TOPIC_PATH][B.ATTR_PATH_COMPS], P.KEY_CATALOG, P.VAL_TABLES) + if project == B.ATTR_INST_TESTSERVER: + path = os.path.join(job.conf[B.TOPIC_PATH][B.ATTR_PATH_PROGRAM], P.ATTR_PATH_MODEL) + else: + path = os.path.join(job.conf[B.TOPIC_PATH][B.ATTR_PATH_COMPS], P.KEY_CATALOG, P.VAL_TABLES) outList = self.getDirlist(job, path, "csv") return outList - def read_entity(self, job, name): - config = self.getConfig(job, P.KEY_CATALOG, name, tools.config_tool.get_plain_filename(job, name)) - return self.setAttributes(job, config, name, LIST_FIELDS, LIST_NODES, LIST_SUBTABLES) + def read_entity(self, job, name, project=""): + if project == B.ATTR_INST_TESTSERVER: + config = self.getConfig(job, P.KEY_MODEL, name, tools.config_tool.get_plain_filename(job, name)) + else: + config = self.getConfig(job, P.KEY_CATALOG, name, tools.config_tool.get_plain_filename(job, name)) + self.setAttributes(job, config, name, LIST_FIELDS, LIST_NODES, LIST_SUBTABLES) + self.fielddef = self.key + self.fieldnames = list(self.key.keys()) + return self def getFieldList(self): """ diff --git a/model/tc_step.csv b/model/tc_step.csv index 62aa270..745fc68 100644 --- a/model/tc_step.csv +++ b/model/tc_step.csv @@ -1,4 +1,7 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:tc_step;_field;type;format;index;generic;aggregat;key;acceptance;alias;description +;tcstpid;pk;integer;N;;;;;; ;tcid;int;integer;I;;;T:1;;; ;spid;int;integer;I;;;T:2;;; ;description;string;vchar(256);N;;;;;; diff --git a/model/tc_story.csv b/model/tc_story.csv index ffde721..cd2aae8 100644 --- a/model/tc_story.csv +++ b/model/tc_story.csv @@ -1,4 +1,7 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:tc_story;_field;type;format;index;generic;aggregat;key;acceptance;alias;description +;tcstrid;pk;integer;N;;;T:1;;; ;tcid;int;integer;I;;;T:1;;; ;stid;int;integer;I;;;T:2;;; ;story;str;vchar(256);I;;;;;; diff --git a/model/tc_table.csv b/model/tc_table.csv index 6d332f2..645fce5 100644 --- a/model/tc_table.csv +++ b/model/tc_table.csv @@ -1,5 +1,8 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:tc_table;_field;type;format;index;generic;aggregat;key;acceptance;alias;description +;tcdtbid;pk;integer;N;;;;;; ;tcid;int;integer;I;;;T:1;;; -;tbid;int;integer;I;;;T:2;;; +;dtid;int;integer;I;;;T:2;;; ;count;int;int;N;;;;;; ;refdate;date;date;N;;;;;; diff --git a/model/testcase.csv b/model/testcase.csv index 604c383..048df19 100644 --- a/model/testcase.csv +++ b/model/testcase.csv @@ -1,3 +1,5 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:testcase;_field;type;format;index;generic;aggregat;key;acceptance;alias;description ;tcid;pk;integer;N;;;T:1;;; ;name;str;vchar(256);I;;;F:1;;; diff --git a/model/testplan.csv b/model/testplan.csv index 3ef9315..c4bd882 100644 --- a/model/testplan.csv +++ b/model/testplan.csv @@ -1,3 +1,5 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:testplan;_field;type;format;index;generic;aggregat;key;acceptance;alias;description ;tpid;pk;integer;N;;;T:1;;; ;name;str;vchar(256);I;;;F:1;;; diff --git a/model/testreport.csv b/model/testreport.csv index c633b7a..5777f36 100644 --- a/model/testreport.csv +++ b/model/testreport.csv @@ -1,5 +1,7 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:testreport;_field;type;format;index;generic;aggregat;key;acceptance;alias;description -;tcid;pk;integer;N;;;T:1;;; +;trid;pk;integer;N;;;T:1;;; ;name;str;vchar(256);I;;;F:1;;; ;description;string;vchar(256);N;;;;;; ;project;string;vchar(256);I;;;;;; diff --git a/model/testsuite.csv b/model/testsuite.csv index 037cfff..cef07ed 100644 --- a/model/testsuite.csv +++ b/model/testsuite.csv @@ -1,3 +1,5 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:testsuite;_field;type;format;index;generic;aggregat;key;acceptance;alias;description ;tsid;pk;integer;N;;;T:1;;; ;name;str;vchar(256);I;;;F:1;;; diff --git a/model/tp_testsuite.csv b/model/tp_testsuite.csv index 17409bb..6ab80aa 100644 --- a/model/tp_testsuite.csv +++ b/model/tp_testsuite.csv @@ -1,4 +1,7 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:tp_testsuite;_field;type;format;index;generic;aggregat;key;acceptance;alias;description +;tptsuid;pk;integer;N;;;;;; ;tpid;int;integer;I;;;T:1;;; ;tsid;int;integer;I;;;T:2;;; ;description;string;vchar(256);N;;;;;; diff --git a/model/tr_artifact.csv b/model/tr_artifact.csv index beb65a1..b4776a1 100644 --- a/model/tr_artifact.csv +++ b/model/tr_artifact.csv @@ -1,6 +1,9 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:tr_artifact;_field;type;format;index;generic;aggregat;key;acceptance;alias;description +;trartid;pk;integer;N;;;;;; ;trid;int;integer;I;;;T:1;;; -;afid;int;integer;I;;;T:2;;; +;arid;int;integer;I;;;T:2;;; ;result;str;vchar(256);I;;;;;; ;description;string;vchar(256);N;;;;;; ;reference;str;vchar(256);N;;;;;; diff --git a/model/ts_testcase.csv b/model/ts_testcase.csv index 0a4ad96..2d575a4 100644 --- a/model/ts_testcase.csv +++ b/model/ts_testcase.csv @@ -1,4 +1,7 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:ts_testcase;_field;type;format;index;generic;aggregat;key;acceptance;alias;description +;tstcsid;pk;integer;N;;;;;; ;tsid;int;integer;I;;;T:1;;; ;tcid;int;integer;I;;;T:2;;; ;description;string;vchar(256);N;;;;;; diff --git a/model/ts_usecase.csv b/model/ts_usecase.csv index 0353b12..b5b65f4 100644 --- a/model/ts_usecase.csv +++ b/model/ts_usecase.csv @@ -1,4 +1,7 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:ts_usecase;_field;type;format;index;generic;aggregat;key;acceptance;alias;description +;tsucsid;pk;integer;N;;;;;; ;tsid;int;integer;I;;;T:1;;; ;ucid;int;integer;I;;;T:2;;; ;description;string;vchar(256);N;;;;;; diff --git a/model/usecase.csv b/model/usecase.csv index 856ac89..69cf49c 100644 --- a/model/usecase.csv +++ b/model/usecase.csv @@ -1,3 +1,5 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:usecase;_field;type;format;index;generic;aggregat;key;acceptance;alias;description ;ucid;pk;int;N;;;;;; ;name;str;vchar(256);I;;;;;; diff --git a/model/user.csv b/model/user.csv index 5f8cfec..d38388a 100644 --- a/model/user.csv +++ b/model/user.csv @@ -1,3 +1,5 @@ +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; table:user;_field;type;format;index;generic;aggregat;key;acceptance;alias;description ;id;pk;autoint;N;;;T:1;;; ;username;str;vchar(256);N;;;F:1;;; diff --git a/model/variant.csv b/model/variant.csv index d4de365..0276057 100644 --- a/model/variant.csv +++ b/model/variant.csv @@ -1,4 +1,6 @@ -table:step;_field;type;format;index;generic;aggregat;key;acceptance;alias;description +_type;ctlg;;;;;;;;; +_key;_field;;;;;;;;; +table:variant;_field;type;format;index;generic;aggregat;key;acceptance;alias;description ;vrid;pk;int;N;;;;;; ;name;str;vchar(256);I;;;;;; ;description;string;vchar(256);N;;;;;; diff --git a/test/test_14table.py b/test/test_14table.py new file mode 100644 index 0000000..c16380e --- /dev/null +++ b/test/test_14table.py @@ -0,0 +1,112 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------------------------------------------- +# Author : Ulrich Carmesin +# Source : gitea.ucarmesin.de +# --------------------------------------------------------------------------------------------------------- +import unittest +import inspect +import test.testtools +import basic.constants as B +import test.constants as T +import model.table +import model.entity + +HOME_PATH = test.constants.HOME_PATH +PYTHON_CMD = "python" +TEST_FUNCTIONS = ["test_10getEntityNames", "test_11getEntities", "test_12getEntity", + "test_13writeEntity", "test_14insertEntity", + "test_20getSchema"] +TEST_FUNCTIONS = ["test_20getSchema"] +PROGRAM_NAME = "clean_workspace" + +class MyTestCase(unittest.TestCase): + mymsg = "--------------------------------------------------------------" + + + def test_10getEntityNames(self): + global mymsg + global jobObject + actfunction = str(inspect.currentframe().f_code.co_name) + cnttest = 0 + if actfunction not in TEST_FUNCTIONS: + return + job = test.testtools.getJob() + table = model.table.Table(job, "TESTPROJ") + entityNames = table.read_unique_names(job, "", "", "", {}) + self.assertEqual(type(entityNames), list) + + entityNames = table.read_unique_names(job, B.ATTR_INST_TESTSERVER, "", "", {}) + self.assertEqual(type(entityNames), list) + #entityNames = project.select_unique_names(job, "", "", "", {}) + #self.assertEquals(type(entityNames), list) + + def test_11getEntities(self): + global mymsg + global jobObject + actfunction = str(inspect.currentframe().f_code.co_name) + cnttest = 0 + if actfunction not in TEST_FUNCTIONS: + return + job = test.testtools.getJob() + table = model.table.Table(job, "TESTPROJ") + entityNames = [] + entityNames = table.get_entities(job, storage=model.entity.STORAGE_FILE) + self.assertEqual(type(entityNames), list) + #entityNames = table.get_entities(job, storage=model.entity.STORAGE_DB) + #self.assertEqual(type(entityNames), list) + + def test_12getEntity(self): + global mymsg + global jobObject + actfunction = str(inspect.currentframe().f_code.co_name) + cnttest = 0 + if actfunction not in TEST_FUNCTIONS: + return + job = test.testtools.getJob() + table = model.table.Table(job, "TESTPROJ") + name = "adress" + acttable = table.read_entity(job, name) + self.assertEqual(getattr(acttable, model.table.FIELD_NAME), name) + self.assertRaises(Exception, table.read_entity, job, "xyzxyz") + # + table = model.table.Table(job, B.ATTR_INST_TESTSERVER) + name = B.SUBJECT_APP + acttable = table.read_entity(job, name, project=B.ATTR_INST_TESTSERVER) + self.assertEqual(getattr(acttable, model.table.FIELD_NAME), name) + self.assertRaises(Exception, table.read_entity, job, "xyzxyz") + # + table = model.table.Table(job, B.ATTR_INST_TESTSERVER) + name = "ap_application" + acttable = table.read_entity(job, name, project=B.ATTR_INST_TESTSERVER) + self.assertEqual(getattr(acttable, model.table.FIELD_NAME), name) + self.assertRaises(Exception, table.read_entity, job, "xyzxyz") + + def test_20getSchema(self): + global mymsg + global jobObject + actfunction = str(inspect.currentframe().f_code.co_name) + cnttest = 0 + if actfunction not in TEST_FUNCTIONS: + return + job = test.testtools.getJob() + table = model.table.Table(job, B.ATTR_INST_TESTSERVER) + entityNames = table.read_unique_names(job, B.ATTR_INST_TESTSERVER, "", "", {}) + name = "tc_table" + print(name) + acttable = table.read_entity(job, name, project=B.ATTR_INST_TESTSERVER) + schema = acttable.get_schema(name) + print(schema) + self.assertEqual("CREATE TABLE", schema[:12]) + self.assertIn(name, schema) + for name in entityNames: + print(name) + acttable = table.read_entity(job, name, project=B.ATTR_INST_TESTSERVER) + schema = acttable.get_schema(name) + print(schema) + self.assertEqual("CREATE TABLE", schema[:12]) + self.assertIn("PRIMARY KEY", schema) + self.assertIn(name, schema) + +if __name__ == '__main__': + unittest.main() diff --git a/tools/config_tool.py b/tools/config_tool.py index d9d6816..ce6a732 100644 --- a/tools/config_tool.py +++ b/tools/config_tool.py @@ -88,6 +88,8 @@ def select_config_path(job, modul, name, subname=""): return getEnvironmentPath(job, name) elif modul == P.KEY_USER: return getUserPath(job, name) + elif modul == P.KEY_MODEL: + return getModelPath(job, name) else: pathname = tools.path_tool.compose_path(job, P.P_TCPARFILE) if verify: job.debug(verify, "7 " + pathname) @@ -236,6 +238,14 @@ def getUserPath(job, name): return pathname return None +def getModelPath(job, name): + for ext in CONFIG_FORMAT: + pathname = os.path.join(job.conf[B.TOPIC_PATH][P.ATTR_PATH_PROGRAM], P.ATTR_PATH_MODEL, name + "." + ext) + if os.path.exists(pathname): + return pathname + return None + + def get_plain_filename(job, path): """ the function extracts the plain filename without directory-name and extension diff --git a/tools/data_const.py b/tools/data_const.py index 750863a..9b407fc 100644 --- a/tools/data_const.py +++ b/tools/data_const.py @@ -15,6 +15,9 @@ TYPE_FLOAT = "float" TYPE_DOUBLE = "double" TYPE_DATE = "date" TYPE_TIME = "time" +TYPE_CLOB = "clob" +TYPE_JLOB = "jlob" +TYPE_XLOB = "xlob" TYPE_PK = "pk" TYPE_AUTOINT = "autoint" diff --git a/tools/dbrel_tool.py b/tools/dbrel_tool.py index c333902..6622418 100644 --- a/tools/dbrel_tool.py +++ b/tools/dbrel_tool.py @@ -7,7 +7,8 @@ import tools.db_abstract import mysql.connector import basic.constants as B -import utils.data_const as D +import tools.data_const as D + class DbFcts(tools.db_abstract.DbFcts): """ This interface defines each necessary connection to any kind of database. @@ -92,6 +93,8 @@ class DbFcts(tools.db_abstract.DbFcts): return attr + " text" elif atype == D.TYPE_INT: return attr + " integer" + elif atype == D.TYPE_DATE: + return attr + " datetime" elif atype == D.TYPE_TIME: return attr + " datetime" diff --git a/tools/path_const.py b/tools/path_const.py index 373492a..fead945 100644 --- a/tools/path_const.py +++ b/tools/path_const.py @@ -14,6 +14,7 @@ KEY_REFFILE = "reffile" KEY_TESTCASE = "tc" KEY_TESTSUITE = "ts" KEY_CATALOG = "catalog" +KEY_MODEL = "model" KEY_USER = "user" KEY_DEBUGNAME = "debugname" KEY_LOGNAME = "logname" @@ -82,7 +83,7 @@ ATTR_PATH_PROGRAM = "program" """ This constant defines the program-folder in the workspace """ ATTR_PATH_COMPONENTS = "components" """ This constant defines the program-folder in the workspace """ -ATTR_PATH_MODEL = "model" +ATTR_PATH_MODEL = KEY_MODEL """ This constant defines the folder in model """ ATTR_PATH_ENV = "environment" """ This constant defines the folder in testing-filesystem, used for configs related to environments """