Data-Test-Executer Framework speziell zum Test von Datenverarbeitungen mit Datengenerierung, Systemvorbereitungen, Einspielungen, ganzheitlicher diversifizierender Vergleich
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.5 KiB

# This is a sample Python script.
import os
import traceback
import sys
import yaml
import basic.program
import basic.constants as B
import basic.message
import tools.path_const as P
import tools.config_tool as config_tool
import tools.file_tool as file_tool
2 years ago
import model.entity
import model.factory
#import model.table
PROGRAM_NAME = "check_configuration"
def startPyJob(job):
try:
job.m.logDebug("--- start " + PROGRAM_NAME + " ------>>>>")
components = job.par.component.split(",")
for c in components:
job.m.logInfo("------------------------------------------\ncheck component "+c)
checkComponent(job, c)
job.m.setMsg("Job " + PROGRAM_NAME + " fertig")
job.m.logDebug("<<<<<<<<----- " + PROGRAM_NAME + " ------")
except Exception as e:
job.m.logDebug("+++++++++++++++++++++++++++++++++++++++++++++")
job.m.setFatal(str(e))
job.m.logDebug("+++++++++++++++++++++++++++++++++++++++++++++")
job.m.logDebug("execpt "+traceback.format_exc())
job.m.logDebug("+++++++++++++++++++++++++++++++++++++++++++++")
def checkComponent(job, componentName):
"""
checks the configurations of the component
:param job:
:param componentName:
:return:
"""
2 years ago
import model.component
configPath = config_tool.getExistingPath(job, [os.path.join(job.conf[B.TOPIC_PATH][B.ATTR_PATH_COMPS], componentName, "CONFIG")])
configTree = file_tool.read_file_dict(job, configPath, job.m)
for x in model.component.LIST_CP_SUBJECTS:
if "conf" not in configTree:
job.m.setError(componentName + ": root conf is not set: ")
break
if x not in configTree["conf"]:
job.m.setError(componentName + ": subject is not set: " + x)
else:
for c in configTree["conf"][x]:
if c == "none":
if len(configTree["conf"][x]) != 1:
job.m.setWarn("none is not the only subject in "+x)
continue
comps = model.component.select_components(job, None, None)
job.m.logInfo("Komponenten pruefen")
for c in configTree["conf"][model.component.CP_SUBJECT_COMPS]:
if c in ["none"]:
continue
if c not in comps:
job.m.setError(componentName + ": component " + c + " does not exist")
job.m.logInfo("- " + componentName + " uses component " + c)
job.m.logInfo("Steps pruefen")
for v in configTree["conf"][model.component.CP_SUBJECT_STEPS]:
if v == "none":
continue
job.m.logInfo("- "+componentName + " uses variant "+v)
job.m.logInfo("Tabellen pruefen")
tables = model.table.select_tables(job, None, None)
for t in configTree["conf"][model.component.CP_SUBJECT_TABLES]:
if t == "none":
continue
if t in tables:
job.m.logInfo("- "+componentName + " uses table " + t)
else:
job.m.setError(componentName + ": table " + t + " ist not defined.")
job.m.logInfo("Artefakte pruefen")
for a in configTree["conf"][model.component.CP_SUBJECT_ARTS]:
if t == "none":
continue
job.m.logInfo("- "+componentName + " uses artifact " + a)
if __name__ == '__main__':
job = basic.program.Job(PROGRAM_NAME)
print ("job "+str(job.__dict__))
job.startJob()
if job.m.isRc("fatal"):
job.stopJob()
# now in theory the program is runnable
startPyJob(job)
job.stopJob()
# See PyCharm help at https://www.jetbrains.com/help/pycharm/