Ulrich
2 years ago
2 changed files with 87 additions and 0 deletions
@ -0,0 +1,31 @@ |
|||
#!/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 basic.entity |
|||
|
|||
class User(basic.entity.Entity): |
|||
username = "" |
|||
password = "" |
|||
|
|||
def __init__(self, job): |
|||
""" |
|||
to be initialized by readSpec |
|||
:param job: |
|||
""" |
|||
self.job = job |
|||
|
|||
def getSchema(self): |
|||
dbtype = self.job.conf.confs[B.TOPIC_NODE_DB][B.ATTR_TYPE] |
|||
dbi = basic.toolHandling.getDbTool(self.job, None, dbtype) |
|||
sql = dbi.getCreateTable("user") |
|||
sql += dbi.getSchemaAttribut("id", "id")+"," |
|||
sql += dbi.getSchemaAttribut("username", D.TYPE_STR)+"," |
|||
sql += dbi.getSchemaAttribut("password", D.TYPE_STR) |
|||
sql += ");\n" |
|||
return sql |
@ -0,0 +1,56 @@ |
|||
# program to copy dummy-file as testcase-results |
|||
# ------------------------------------------------------------------------------------------------------------- |
|||
""" |
|||
|
|||
""" |
|||
import os |
|||
import shutil |
|||
import basic.program |
|||
import utils.path_tool |
|||
import utils.file_tool |
|||
import basic.constants as B |
|||
import utils.tdata_tool |
|||
import basic.componentHandling |
|||
import utils.path_const as P |
|||
import basic.message as message |
|||
|
|||
|
|||
PROGRAM_NAME = "copy_appdummy" |
|||
PROGRAM_DUMMY = "collect_testcase" |
|||
|
|||
def startPyJob(job): |
|||
cm = basic.componentHandling.ComponentManager.getInstance(job) |
|||
cm.initComponents() |
|||
comps = cm.getComponents(PROGRAM_DUMMY) |
|||
job.m.setMsg("# Components initialized with these relevant components " + str(comps)) |
|||
cm = basic.componentHandling.ComponentManager.getInstance(job, "init") |
|||
print("cm " + str(cm)) |
|||
cm.initComponents() |
|||
comps = cm.getComponents(PROGRAM_DUMMY) |
|||
for c in comps: |
|||
comp = cm.getComponent(c) |
|||
for cond in ["pre", "post"]: |
|||
tdatapath = utils.path_tool.composePattern(job, "{td"+cond+"exec}", comp) |
|||
envapppath = utils.path_tool.composePattern(job, "{tc"+cond+"cond}", comp) |
|||
if os.path.exists(tdatapath): |
|||
files = utils.file_tool.getFiles(job.m, job, tdatapath, ".+\.csv", None) |
|||
for f in files: |
|||
# shutil.copy() |
|||
print("cp " + os.path.join(tdatapath, f) + " " + os.path.join(envapppath, f)) |
|||
utils.file_tool.mkPaths(job, os.path.join(envapppath, f), job.m) |
|||
shutil.copy(os.path.join(tdatapath, f), os.path.join(envapppath, f)) |
|||
print(tdatapath) |
|||
|
|||
# Press the green button in the gutter to run the script. |
|||
if __name__ == '__main__': |
|||
print(PROGRAM_NAME) |
|||
x = basic.program.Job(PROGRAM_NAME) |
|||
x.startJob() |
|||
x.m.logDebug(str(vars(x.par)) + "\n" + str(vars(x.conf))) |
|||
if x.m.isRc("fatal"): |
|||
x.stopJob() |
|||
exit(x.m.rc * (-1) + 3) |
|||
startPyJob(x) |
|||
x.stopJob() |
|||
# See PyCharm help at https://www.jetbrains.com/help/pycharm/ |
|||
|
Loading…
Reference in new issue