Ulrich
2 years ago
17 changed files with 844 additions and 55 deletions
@ -0,0 +1,214 @@ |
|||
application: |
|||
_header: |
|||
- apid |
|||
- name |
|||
- description |
|||
- reference |
|||
- attributes |
|||
- inscommit |
|||
- insauthor |
|||
- instime |
|||
- updcommit |
|||
- updauthor |
|||
- updtime |
|||
- actual |
|||
apid: |
|||
field: apid |
|||
type: pk |
|||
name: |
|||
field: name |
|||
index: I |
|||
type: str |
|||
description: |
|||
field: description |
|||
type: string |
|||
reference: |
|||
field: reference |
|||
type: str |
|||
attributes: |
|||
field: attributes |
|||
type: string |
|||
insauthor: |
|||
field: insauthor |
|||
type: str |
|||
inscommit: |
|||
field: inscommit |
|||
type: str |
|||
instime: |
|||
field: instime |
|||
type: time |
|||
updauthor: |
|||
field: updauthor |
|||
type: str |
|||
updcommit: |
|||
field: updcommit |
|||
type: str |
|||
updtime: |
|||
field: updtime |
|||
type: time |
|||
actual: |
|||
field: actual |
|||
index: I |
|||
type: int |
|||
ap_component: |
|||
_header: |
|||
- apcomid |
|||
- apid |
|||
- component |
|||
apcomid: |
|||
field: apcomid |
|||
type: pk |
|||
apid: |
|||
field: apid |
|||
index: I |
|||
type: int |
|||
component: |
|||
field: component |
|||
index: I |
|||
type: str |
|||
ap_project: |
|||
_header: |
|||
- approid |
|||
- apid |
|||
- project |
|||
- description |
|||
- reference |
|||
approid: |
|||
field: apid |
|||
type: pk |
|||
apid: |
|||
field: apid |
|||
index: I |
|||
type: int |
|||
project: |
|||
field: project |
|||
index: I |
|||
type: str |
|||
description: |
|||
field: description |
|||
type: string |
|||
reference: |
|||
field: reference |
|||
type: str |
|||
component: |
|||
_header: |
|||
- coid |
|||
- name |
|||
- description |
|||
- reference |
|||
- attributes |
|||
- inscommit |
|||
- insauthor |
|||
- instime |
|||
- updcommit |
|||
- updauthor |
|||
- updtime |
|||
- actual |
|||
coid: |
|||
field: apid |
|||
type: pk |
|||
name: |
|||
field: name |
|||
index: I |
|||
type: str |
|||
description: |
|||
field: description |
|||
type: string |
|||
reference: |
|||
field: reference |
|||
type: str |
|||
attributes: |
|||
field: attributes |
|||
type: string |
|||
insauthor: |
|||
field: insauthor |
|||
type: str |
|||
inscommit: |
|||
field: inscommit |
|||
type: str |
|||
instime: |
|||
field: instime |
|||
type: time |
|||
updauthor: |
|||
field: updauthor |
|||
type: str |
|||
updcommit: |
|||
field: updcommit |
|||
type: str |
|||
updtime: |
|||
field: updtime |
|||
type: time |
|||
actual: |
|||
field: actual |
|||
index: I |
|||
type: int |
|||
|
|||
connection: |
|||
_header: |
|||
- coid |
|||
- environment |
|||
- component |
|||
- type |
|||
- ip |
|||
- port |
|||
- hostname |
|||
- dompath |
|||
- attributes |
|||
- inscommit |
|||
- insauthor |
|||
- instime |
|||
- updcommit |
|||
- updauthor |
|||
- updtime |
|||
- actual |
|||
cnid: |
|||
field: cnid |
|||
type: pk |
|||
environment: |
|||
field: environment |
|||
index: I |
|||
type: str |
|||
component: |
|||
field: component |
|||
index: I |
|||
type: string |
|||
type: |
|||
field: type |
|||
type: str |
|||
ip: |
|||
field: ip |
|||
type: str |
|||
port: |
|||
field: port |
|||
type: str |
|||
hostname: |
|||
field: hostname |
|||
type: str |
|||
dompath: |
|||
field: dompath |
|||
type: str |
|||
attributes: |
|||
field: attributes |
|||
type: string |
|||
insauthor: |
|||
field: insauthor |
|||
type: str |
|||
inscommit: |
|||
field: inscommit |
|||
type: str |
|||
instime: |
|||
field: instime |
|||
type: time |
|||
updauthor: |
|||
field: updauthor |
|||
type: str |
|||
updcommit: |
|||
field: updcommit |
|||
type: str |
|||
updtime: |
|||
field: updtime |
|||
type: time |
|||
actual: |
|||
field: actual |
|||
index: I |
|||
type: int |
@ -0,0 +1,87 @@ |
|||
import basic.component |
|||
import basic.constants as B |
|||
import utils.config_tool |
|||
import utils.data_const as D |
|||
import utils.file_tool |
|||
|
|||
COMP_NAME = "testserver" |
|||
COMP_TABLES = ["application", "ap_component", "ap_project"] |
|||
|
|||
class Testserver(basic.component.Component): |
|||
def __init__(self, job): |
|||
print('init '+COMP_NAME) |
|||
self.m = job.m |
|||
self.conf = {} |
|||
if B.TOPIC_NODE_DB in job.conf.confs: |
|||
self.conf[B.SUBJECT_CONN] = {} |
|||
self.conf[B.SUBJECT_CONN][B.TOPIC_NODE_DB] = {} |
|||
for attr in B.LIST_DB_ATTR: |
|||
if attr in job.conf.confs[B.TOPIC_NODE_DB]: |
|||
self.conf[B.SUBJECT_CONN][B.TOPIC_NODE_DB][attr] = job.conf.confs[B.TOPIC_NODE_DB][attr] |
|||
if not B.DATA_NODE_DDL in self.conf: |
|||
self.conf[B.DATA_NODE_DDL] = {} |
|||
for table in COMP_TABLES: |
|||
if table in B.LIST_DB_ATTR: |
|||
continue |
|||
ddl = utils.config_tool.getConfig(job, D.DDL_FILENAME, COMP_NAME, table) |
|||
path = "/home/ulrich/workspace/Datest/temp/DATASTRUCTURE.yml" |
|||
utils.file_tool.writeFileDict(job.m, job, path, ddl) |
|||
if B.DATA_NODE_TABLES in ddl and table in ddl[B.DATA_NODE_TABLES]: |
|||
self.conf[B.DATA_NODE_DDL][table] = ddl[B.DATA_NODE_TABLES][table] |
|||
elif table in ddl: |
|||
self.conf[B.DATA_NODE_DDL][table] = ddl[table] |
|||
else: |
|||
self.conf[B.DATA_NODE_DDL][table] = ddl |
|||
|
|||
def createDBTables(self, job): |
|||
if B.TOPIC_NODE_DB in job.conf.confs: |
|||
dbi = basic.toolHandling.getDbTool(job, self, job.conf.confs[B.TOPIC_NODE_DB][B.ATTR_TYPE]) |
|||
else: |
|||
return "No DB in job-config" |
|||
for t in COMP_TABLES: |
|||
sql = self.getDBSchema(job, dbi, t) |
|||
for s in sql.split(";\n"): |
|||
if len(s) < 3: |
|||
continue |
|||
try: |
|||
dbi.execStatement(s+";", job.conf.confs[B.TOPIC_NODE_DB]) |
|||
print("SQL executed: "+s) |
|||
except Exception as e: |
|||
raise Exception("Fehler bei createSchema "+s) |
|||
pass |
|||
|
|||
|
|||
def getDBSchema(self, job, dbi, table): |
|||
sqlTable = "" |
|||
sqlSub = "" |
|||
sqlTable += dbi.getCreateTable(table) |
|||
tableId = "" |
|||
for f in self.conf[B.DATA_NODE_DDL][table]: |
|||
if f[0:1] == "_": |
|||
continue |
|||
fo = self.conf[B.DATA_NODE_DDL][table][f] |
|||
if D.DDL_INDEX in fo and len(fo[D.DDL_INDEX]) > 0: |
|||
a = fo[D.DDL_INDEX].split(":") |
|||
if a[0] == "I": |
|||
sqlSub += dbi.getSchemaIndex(table, fo[D.DDL_FNAME]) + "\n" |
|||
elif a[0] == "S": |
|||
attrList = [] |
|||
attr = {"attr":fo[D.DDL_FNAME], "atype": fo[D.DDL_TYPE]} |
|||
attrList.append(attr) |
|||
for i in range(2, len(a)): |
|||
if i % 2 == 1: |
|||
continue |
|||
if a[i] == "attr": |
|||
attr = {"attr":"attributes", "atype": D.TYPE_TEXT} |
|||
elif i+1 < len(a): |
|||
attr = {"attr": a[i], "atype": a[i+1]} |
|||
attrList.append(attr) |
|||
sqlSub += dbi.getSchemaSubtable(a[1], attrList) + "\n" |
|||
sqlSub += dbi.getSchemaIndex(dbi.getSubTableName(a[1], fo[D.DDL_FNAME]), tableId)+"\n" |
|||
continue |
|||
sqlTable += dbi.getSchemaAttribut(fo[D.DDL_FNAME], fo[D.DDL_TYPE]) + "," |
|||
if fo[D.DDL_TYPE] == D.TYPE_PK: |
|||
tableId = fo[D.DDL_FNAME] |
|||
sql = sqlTable[0:-1]+");\n"+sqlSub |
|||
print(sql) |
|||
return sql |
@ -0,0 +1,264 @@ |
|||
# --------------------------------------------------------------------------------------------------------- |
|||
# Author : Ulrich Carmesin |
|||
# Source : gitea.ucarmesin.de |
|||
# --------------------------------------------------------------------------------------------------------- |
|||
import os |
|||
import utils.db_abstract |
|||
import basic.toolHandling |
|||
import utils.data_const as D |
|||
import basic.constants as B |
|||
import basic.entity |
|||
import utils.path_const as P |
|||
import utils.config_tool |
|||
import utils.file_tool |
|||
import utils.git_tool |
|||
|
|||
TABLE_NAMES = ["application", "ap_project", "ap_component"] |
|||
|
|||
def getProjects(job): |
|||
""" |
|||
get all project which are configured for the workspace |
|||
with all environments where the application of the project are installed |
|||
:param job: |
|||
:return: |
|||
""" |
|||
appl = utils.config_tool.getConfig(job, P.KEY_BASIC, B.SUBJECT_APPS) |
|||
return searchProjects(job, appl) |
|||
|
|||
def searchProjects(job, appl): |
|||
""" |
|||
search all relevant projects from server-configuration |
|||
filtered by parameter --application , --project |
|||
:param job: |
|||
:return: |
|||
""" |
|||
projects = {} |
|||
if B.SUBJECT_PROJECTS in job.conf.confs: |
|||
for k in job.conf.confs[B.SUBJECT_PROJECTS]: |
|||
if k in B.LIST_SUBJECTS: |
|||
continue |
|||
if hasattr(job.par, B.PAR_PROJ) and k != getattr(job.par, B.PAR_PROJ): |
|||
continue |
|||
if hasattr(job.par, B.PAR_APP) \ |
|||
and k not in appl[B.SUBJECT_APPS][getattr(job.par, B.PAR_APP)][B.SUBJECT_PROJECTS]: |
|||
continue |
|||
projects[k] = appl[B.SUBJECT_PROJECTS][k] |
|||
projects[k][B.SUBJECT_ENV] = [] |
|||
else: |
|||
job.conf.confs[B.SUBJECT_PROJECTS] = appl[B.SUBJECT_PROJECTS] |
|||
return projects |
|||
|
|||
def getEnvironments(job, projectList): |
|||
""" |
|||
searches and gets environments in which the applications of the project are declared that these are installed |
|||
filtered by parameter --environment |
|||
:param job: |
|||
:return: |
|||
""" |
|||
projects = {} |
|||
path = job.conf.confs[B.SUBJECT_PATH][B.ATTR_PATH_ENV] |
|||
if os.path.exists(path): |
|||
raise Exception("Umgebungsverzeichnis existiert nicht "+path) |
|||
for envdir in os.listdir(path): |
|||
print ("-- "+envdir) |
|||
if not os.path.isdir(os.path.join(path, envdir)): |
|||
continue |
|||
if envdir[0:1] == "_": |
|||
continue |
|||
if hasattr(job.par, B.PAR_ENV) and envdir != getattr(job.par, B.PAR_ENV): |
|||
continue |
|||
for format in utils.config_tool.CONFIG_FORMAT: |
|||
pathname = os.path.join(job.conf.getPath(P.ATTR_PATH_ENV), |
|||
envdir, P.VAL_CONFIG, P.KEY_TOOL + "_conn." + format) |
|||
if os.path.exists(pathname): |
|||
break |
|||
if os.path.exists(pathname): |
|||
doc = utils.file_tool.readFileDict(job, pathname, job.m) |
|||
print(str(doc)) |
|||
for proj in doc["env"]["general"][B.SUBJECT_PROJECTS]: |
|||
if proj in projectList: |
|||
projects[proj][B.SUBJECT_ENV].append(envdir) |
|||
return projects |
|||
|
|||
def getApplications(job, projectList): |
|||
""" |
|||
get all project which are configured for the workspace |
|||
with all environments where the application of the project are installed |
|||
:param job: |
|||
:return: |
|||
""" |
|||
appl = utils.config_tool.getConfig(job, P.KEY_BASIC, B.SUBJECT_APPS) |
|||
return searchApplications(job, projectList, appl) |
|||
|
|||
def searchApplications(job, projectList, appl): |
|||
appList = {} |
|||
for proj in projectList: |
|||
if hasattr(job.par, B.PAR_PROJ) and proj != getattr(job.par, B.PAR_PROJ): |
|||
continue |
|||
for app in appl[B.SUBJECT_PROJECTS][proj][B.SUBJECT_APPS]: |
|||
if hasattr(job.par, B.PAR_APP) and app != getattr(job.par, B.PAR_APP): |
|||
continue |
|||
appList[app] = appl[B.SUBJECT_APPS][app] |
|||
return appList |
|||
|
|||
def syncApplications(job): |
|||
""" |
|||
synchronize the configuration with the database |
|||
:param job: |
|||
:return: |
|||
""" |
|||
# get git-commit |
|||
apppath = utils.config_tool.getConfigPath(job, P.KEY_BASIC, B.SUBJECT_APPS, "") |
|||
repopath = apppath[len(job.conf.confs[B.SUBJECT_PATH][B.ATTR_PATH_COMPS]) + 1:] |
|||
gitresult = utils.git_tool.gitLog(job, B.ATTR_PATH_COMPS, repopath, 1) |
|||
if B.TOPIC_NODE_DB in job.conf.confs: |
|||
dbi = basic.toolHandling.getDbTool(job, job.testserver, job.conf.confs[B.TOPIC_NODE_DB][B.ATTR_TYPE]) |
|||
else: |
|||
return "No DB in job-config" |
|||
data = dbi.selectRows(TABLE_NAMES[0], job) |
|||
print(str(gitresult)) |
|||
print(str(data[B.DATA_NODE_DATA])) |
|||
if gitresult[0]["date"] == data[B.DATA_NODE_DATA][0]["updtime"]: |
|||
print("gleich") |
|||
if len(gitresult) > 0: |
|||
return |
|||
if len(data[B.DATA_NODE_DATA]) > 0: |
|||
for t in TABLE_NAMES: |
|||
dbi.deleteRows(t, job) |
|||
# insertRows |
|||
# get list of application |
|||
applData = utils.config_tool.getConfig(job, P.KEY_BASIC, B.SUBJECT_APPS) |
|||
|
|||
for app in applData[B.SUBJECT_APPS]: |
|||
ao = Application(job) |
|||
ao.readEntity(job, app) |
|||
rows = ao.getApplicationRows(job) |
|||
apid = dbi.insertRows(TABLE_NAMES[0], rows, job) |
|||
rows = ao.getAppProjectRows(job, apid) |
|||
dbi.insertRows(TABLE_NAMES[1], rows, job) |
|||
rows = ao.getAppComponentRows(job, apid) |
|||
dbi.insertRows(TABLE_NAMES[2], rows, job) |
|||
|
|||
|
|||
class Application(basic.entity.Entity): |
|||
table = "application" |
|||
name = "" |
|||
description = "" |
|||
reference = "" |
|||
component = [] |
|||
project = {} |
|||
|
|||
def __init__(self, job, name=""): |
|||
""" |
|||
to be initialized by readSpec |
|||
:param job: |
|||
""" |
|||
self.job = job |
|||
|
|||
if len(name) > 1: |
|||
self.getEntity(job, name) |
|||
|
|||
def getEntity(self, job, name): |
|||
if B.TOPIC_NODE_DB in job.conf.confs: |
|||
self.selectEntity(job, name) |
|||
#self.readEntity(job, name) |
|||
else: |
|||
self.readEntity(job, name) |
|||
|
|||
def readEntity(self, job, app): |
|||
apppath = utils.config_tool.getConfigPath(job, P.KEY_BASIC, B.SUBJECT_APPS, "") |
|||
repopath = apppath[len(job.conf.confs[B.SUBJECT_PATH][B.ATTR_PATH_COMPS]) + 1:] |
|||
gitresult = utils.git_tool.gitLog(job, B.ATTR_PATH_COMPS, repopath, 1) |
|||
applData = utils.config_tool.getConfig(job, P.KEY_BASIC, B.SUBJECT_APPS) |
|||
# main object |
|||
for f in job.testserver.conf[B.DATA_NODE_DDL][TABLE_NAMES[0]][B.DATA_NODE_HEADER]: |
|||
if f == basic.entity.ENTITY_NAME: |
|||
setattr(self, f, app) |
|||
elif f == basic.entity.ENTITY_ATTRIBUTES: |
|||
setattr(self, f, {}) |
|||
elif f in applData[B.SUBJECT_APPS][app]: |
|||
setattr(self, f, applData[B.SUBJECT_APPS][app][f]) |
|||
elif f in basic.entity.ENTITY_FIELDS: |
|||
setattr(self, f, basic.entity.getEntityValue(job, f, gitresult[0])) |
|||
else: |
|||
setattr(self, f, "xx") |
|||
project = {} |
|||
if applData[B.SUBJECT_APPS][app][B.SUBJECT_PROJECTS] is not None: |
|||
for proj in applData[B.SUBJECT_APPS][app][B.SUBJECT_PROJECTS]: |
|||
project[proj] = {} |
|||
for f in job.testserver.conf[B.DATA_NODE_DDL][TABLE_NAMES[1]][B.DATA_NODE_HEADER]: |
|||
if f == basic.entity.ENTITY_NAME: |
|||
project[proj][f] = proj |
|||
elif f == "project": |
|||
project[proj][f] = proj |
|||
elif f == basic.entity.ENTITY_ATTRIBUTES: |
|||
project[proj][f] = {} |
|||
elif f in applData[B.SUBJECT_PROJECTS][proj]: |
|||
project[proj][f] = applData[B.SUBJECT_PROJECTS][proj][f] |
|||
elif f in basic.entity.ENTITY_FIELDS: |
|||
project[proj][f] = basic.entity.getEntityValue(job, f, gitresult[0]) |
|||
else: |
|||
project[proj][f] = "xx" |
|||
setattr(self, "project", project) |
|||
component = [] |
|||
if applData[B.SUBJECT_APPS][app][B.SUBJECT_COMPS] is not None: |
|||
for comp in applData[B.SUBJECT_APPS][app][B.SUBJECT_COMPS]: |
|||
component.append(comp) |
|||
setattr(self, "component", component) |
|||
|
|||
def getApplicationRows(self, job): |
|||
rows = [] |
|||
row = {} |
|||
for f in job.testserver.conf[B.DATA_NODE_DDL][TABLE_NAMES[0]][B.DATA_NODE_HEADER]: |
|||
row[f] = getattr(self, f) |
|||
rows.append(row) |
|||
return rows |
|||
|
|||
def getAppProjectRows(self, job, apid): |
|||
rows = [] |
|||
for proj in self.project: |
|||
row = {} |
|||
for f in job.testserver.conf[B.DATA_NODE_DDL][TABLE_NAMES[1]][B.DATA_NODE_HEADER]: |
|||
if f == "apid": |
|||
row[f] = apid |
|||
elif f in self.project[proj]: |
|||
row[f] = self.project[proj][f] |
|||
rows.append(row) |
|||
return rows |
|||
|
|||
def getAppComponentRows(self, job, apid): |
|||
rows = [] |
|||
for comp in self.component: |
|||
row = {} |
|||
row["apid"] = apid |
|||
row["component"] = comp |
|||
rows.append(row) |
|||
return rows |
|||
|
|||
def selectEntity(self, job, app): |
|||
dbi = basic.toolHandling.getDbTool(job, job.testserver, job.conf.confs[B.TOPIC_NODE_DB][B.ATTR_TYPE]) |
|||
data = dbi.selectRows(TABLE_NAMES[0], job, "WHERE name = \'"+app+"\' AND actual = "+basic.entity.ENTITY_ACTUAL) |
|||
# main object |
|||
for f in job.testserver.conf[B.DATA_NODE_DDL][TABLE_NAMES[0]][B.DATA_NODE_HEADER]: |
|||
if f == basic.entity.ENTITY_NAME: |
|||
setattr(self, f, app) |
|||
else: |
|||
setattr(self, f, str(data[B.DATA_NODE_DATA][0][f])) |
|||
apid = getattr(self, "apid") |
|||
data = dbi.selectRows(TABLE_NAMES[1], job, "WHERE apid = "+str(apid)) |
|||
project = {} |
|||
for row in data[B.DATA_NODE_DATA]: |
|||
project[row["project"]] = row |
|||
setattr(self, "project", project) |
|||
data = dbi.selectRows(TABLE_NAMES[2], job, "WHERE apid = " + str(apid)) |
|||
component = [] |
|||
for row in data[B.DATA_NODE_DATA]: |
|||
component.append(row["component"]) |
|||
setattr(self, "component", component) |
|||
|
|||
def getSchema(self): |
|||
""" |
|||
ersetzt durch testserver.createDB |
|||
:return: |
|||
""" |
|||
return "" |
@ -0,0 +1,91 @@ |
|||
""" |
|||
unit-test |
|||
""" |
|||
import unittest |
|||
import inspect |
|||
import utils.gen_tool |
|||
import basic.program |
|||
import basic.Testserver |
|||
import test.testtools |
|||
import basic.application |
|||
import basic.constants as B |
|||
import utils.path_const as P |
|||
|
|||
# the list of TEST_FUNCTIONS defines which function will be really tested. |
|||
# if you minimize the list you can check the specific test-function |
|||
TEST_FUNCTIONS = ["test_01createTestserver", "test_02getDBSchema", "test_11createDBTables", "test_11syncApplication"] |
|||
TEST_FUNCTIONS = ["test_02getDBSchema"] |
|||
# with this variable you can switch prints on and off |
|||
verbose = False |
|||
|
|||
|
|||
|
|||
class MyTestCase(unittest.TestCase): |
|||
mymsg = "--------------------------------------------------------------" |
|||
|
|||
def test_01createTestserver(self): |
|||
global mymsg |
|||
actfunction = str(inspect.currentframe().f_code.co_name) |
|||
cnttest = 0 |
|||
if actfunction not in TEST_FUNCTIONS: |
|||
return |
|||
job = test.testtools.getJob() |
|||
testserver = basic.Testserver.Testserver(job) |
|||
self.assertIsNotNone(testserver) |
|||
cnttest += 1 |
|||
if B.TOPIC_NODE_DB in job.conf.confs: |
|||
self.assertIn(B.TOPIC_NODE_DB, testserver.conf[B.SUBJECT_CONN]) |
|||
self.assertIn(B.ATTR_DB_DATABASE, testserver.conf[B.SUBJECT_CONN][B.TOPIC_NODE_DB]) |
|||
self.assertIn(B.DATA_NODE_DDL, testserver.conf) |
|||
self.assertIn("application", testserver.conf[B.DATA_NODE_DDL]) |
|||
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|||
|
|||
def test_02getDBSchema(self): |
|||
global mymsg |
|||
actfunction = str(inspect.currentframe().f_code.co_name) |
|||
cnttest = 0 |
|||
if actfunction not in TEST_FUNCTIONS: |
|||
return |
|||
job = test.testtools.getJob() |
|||
testserver = basic.Testserver.Testserver(job) |
|||
if B.TOPIC_NODE_DB in job.conf.confs: |
|||
dbi = basic.toolHandling.getDbTool(job, self, job.conf.confs[B.TOPIC_NODE_DB][B.ATTR_TYPE]) |
|||
else: |
|||
return "No DB in job-config" |
|||
sql = testserver.getDBSchema(job, dbi, "application") |
|||
print(sql+"##") |
|||
lines = sql.split("\n") |
|||
self.assertEqual(4, len(lines)) |
|||
self.assertIn("CREATE TABLE", lines[0]) |
|||
self.assertIn("CREATE INDEX", lines[1]) |
|||
sql = testserver.getDBSchema(job, dbi, "ap_project") |
|||
print(sql+"##") |
|||
lines = sql.split("\n") |
|||
self.assertEqual(4, len(lines)) |
|||
self.assertIn("CREATE TABLE", lines[0]) |
|||
self.assertIn("CREATE INDEX", lines[1]) |
|||
sql = testserver.getDBSchema(job, dbi, "ap_component") |
|||
print(sql+"##") |
|||
lines = sql.split("\n") |
|||
self.assertEqual(4, len(lines)) |
|||
self.assertIn("CREATE TABLE", lines[0]) |
|||
self.assertIn("CREATE INDEX", lines[1]) |
|||
|
|||
|
|||
def test_11createDBTables(self): |
|||
global mymsg |
|||
actfunction = str(inspect.currentframe().f_code.co_name) |
|||
cnttest = 0 |
|||
if actfunction not in TEST_FUNCTIONS: |
|||
return |
|||
job = test.testtools.getJob() |
|||
testserver = basic.Testserver.Testserver(job) |
|||
testserver.createDBTables(job) |
|||
|
|||
def test_zzz(self): |
|||
if verbose: print(MyTestCase.mymsg) |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
verbose = True |
|||
unittest.main() |
Loading…
Reference in new issue